From 137ce8dd46d313f15ee93ddbb5428d702aa61ed8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 06:24:34 +0200 Subject: Merging upstream version 10.0. Signed-off-by: Daniel Baumann --- eigrpd/eigrp_cli.c | 211 ++++++++++++++++++++++++++++++++++++---------- eigrpd/eigrp_const.h | 3 - eigrpd/eigrp_interface.c | 6 +- eigrpd/eigrp_main.c | 18 ++-- eigrpd/eigrp_network.c | 4 +- eigrpd/eigrp_northbound.c | 90 ++++++++++++++++---- eigrpd/eigrp_routemap.c | 48 +---------- eigrpd/eigrp_zebra.c | 4 +- 8 files changed, 259 insertions(+), 125 deletions(-) (limited to 'eigrpd') diff --git a/eigrpd/eigrp_cli.c b/eigrpd/eigrp_cli.c index 213834a..eaede73 100644 --- a/eigrpd/eigrp_cli.c +++ b/eigrpd/eigrp_cli.c @@ -69,8 +69,8 @@ DEFPY_YANG( void eigrp_cli_show_header(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { - const char *asn = yang_dnode_get_string(dnode, "./asn"); - const char *vrf = yang_dnode_get_string(dnode, "./vrf"); + const char *asn = yang_dnode_get_string(dnode, "asn"); + const char *vrf = yang_dnode_get_string(dnode, "vrf"); vty_out(vty, "router eigrp %s", asn); if (strcmp(vrf, VRF_DEFAULT_NAME)) @@ -131,12 +131,14 @@ DEFPY_YANG( "Suppress routing updates on an interface\n" "Interface to suppress on\n") { + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), "./passive-interface[.='%s']", ifname); + if (no) - nb_cli_enqueue_change(vty, "./passive-interface", - NB_OP_DESTROY, ifname); + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); else - nb_cli_enqueue_change(vty, "./passive-interface", - NB_OP_CREATE, ifname); + nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); return nb_cli_apply_changes(vty, NULL); } @@ -323,18 +325,18 @@ void eigrp_cli_show_metrics(struct vty *vty, const struct lyd_node *dnode, { const char *k1, *k2, *k3, *k4, *k5, *k6; - k1 = yang_dnode_exists(dnode, "./K1") ? - yang_dnode_get_string(dnode, "./K1") : "0"; - k2 = yang_dnode_exists(dnode, "./K2") ? - yang_dnode_get_string(dnode, "./K2") : "0"; - k3 = yang_dnode_exists(dnode, "./K3") ? - yang_dnode_get_string(dnode, "./K3") : "0"; - k4 = yang_dnode_exists(dnode, "./K4") ? - yang_dnode_get_string(dnode, "./K4") : "0"; - k5 = yang_dnode_exists(dnode, "./K5") ? - yang_dnode_get_string(dnode, "./K5") : "0"; - k6 = yang_dnode_exists(dnode, "./K6") ? - yang_dnode_get_string(dnode, "./K6") : "0"; + k1 = yang_dnode_exists(dnode, "K1") ? + yang_dnode_get_string(dnode, "K1") : "0"; + k2 = yang_dnode_exists(dnode, "K2") ? + yang_dnode_get_string(dnode, "K2") : "0"; + k3 = yang_dnode_exists(dnode, "K3") ? + yang_dnode_get_string(dnode, "K3") : "0"; + k4 = yang_dnode_exists(dnode, "K4") ? + yang_dnode_get_string(dnode, "K4") : "0"; + k5 = yang_dnode_exists(dnode, "K5") ? + yang_dnode_get_string(dnode, "K5") : "0"; + k6 = yang_dnode_exists(dnode, "K6") ? + yang_dnode_get_string(dnode, "K6") : "0"; vty_out(vty, " metric weights %s %s %s %s %s", k1, k2, k3, k4, k5); @@ -354,12 +356,14 @@ DEFPY_YANG( "Enable routing on an IP network\n" "EIGRP network prefix\n") { + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), "./network[.='%s']", prefix_str); + if (no) - nb_cli_enqueue_change(vty, "./network", NB_OP_DESTROY, - prefix_str); + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); else - nb_cli_enqueue_change(vty, "./network", NB_OP_CREATE, - prefix_str); + nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); return nb_cli_apply_changes(vty, NULL); } @@ -383,12 +387,14 @@ DEFPY_YANG( "Specify a neighbor router\n" "Neighbor address\n") { + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), "./neighbor[.='%s']", addr_str); + if (no) - nb_cli_enqueue_change(vty, "./neighbor", NB_OP_DESTROY, - addr_str); + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); else - nb_cli_enqueue_change(vty, "./neighbor", NB_OP_CREATE, - addr_str); + nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); return nb_cli_apply_changes(vty, NULL); } @@ -401,6 +407,117 @@ void eigrp_cli_show_neighbor(struct vty *vty, const struct lyd_node *dnode, vty_out(vty, " neighbor %s\n", prefix); } +/* + * XPath: /frr-eigrpd:eigrpd/instance/distribute-list + */ +DEFPY_YANG (eigrp_distribute_list, + eigrp_distribute_list_cmd, + "distribute-list ACCESSLIST4_NAME$name $dir [WORD$ifname]", + "Filter networks in routing updates\n" + "Access-list name\n" + "Filter incoming routing updates\n" + "Filter outgoing routing updates\n" + "Interface name\n") +{ + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), + "./distribute-list[interface='%s']/%s/access-list", + ifname ? ifname : "", dir); + /* nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); */ + nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, name); + return nb_cli_apply_changes(vty, NULL); +} + +DEFPY_YANG (eigrp_distribute_list_prefix, + eigrp_distribute_list_prefix_cmd, + "distribute-list prefix PREFIXLIST4_NAME$name $dir [WORD$ifname]", + "Filter networks in routing updates\n" + "Specify a prefix list\n" + "Prefix-list name\n" + "Filter incoming routing updates\n" + "Filter outgoing routing updates\n" + "Interface name\n") +{ + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), + "./distribute-list[interface='%s']/%s/prefix-list", + ifname ? ifname : "", dir); + /* nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); */ + nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, name); + return nb_cli_apply_changes(vty, NULL); +} + +DEFPY_YANG (eigrp_no_distribute_list, + eigrp_no_distribute_list_cmd, + "no distribute-list [ACCESSLIST4_NAME$name] $dir [WORD$ifname]", + NO_STR + "Filter networks in routing updates\n" + "Access-list name\n" + "Filter incoming routing updates\n" + "Filter outgoing routing updates\n" + "Interface name\n") +{ + const struct lyd_node *value_node; + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), + "./distribute-list[interface='%s']/%s/access-list", + ifname ? ifname : "", dir); + /* + * See if the user has specified specific list so check it exists. + * + * NOTE: Other FRR CLI commands do not do this sort of verification and + * there may be an official decision not to. + */ + if (name) { + value_node = yang_dnode_getf(vty->candidate_config->dnode, "%s/%s", + VTY_CURR_XPATH, xpath); + if (!value_node || strcmp(name, lyd_get_value(value_node))) { + vty_out(vty, "distribute list doesn't exist\n"); + return CMD_WARNING_CONFIG_FAILED; + } + } + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); +} + +DEFPY_YANG (eigrp_no_distribute_list_prefix, + eigrp_no_distribute_list_prefix_cmd, + "no distribute-list prefix [PREFIXLIST4_NAME$name] $dir [WORD$ifname]", + NO_STR + "Filter networks in routing updates\n" + "Specify a prefix list\n" + "Prefix-list name\n" + "Filter incoming routing updates\n" + "Filter outgoing routing updates\n" + "Interface name\n") +{ + const struct lyd_node *value_node; + char xpath[XPATH_MAXLEN]; + + snprintf(xpath, sizeof(xpath), + "./distribute-list[interface='%s']/%s/prefix-list", + ifname ? ifname : "", dir); + /* + * See if the user has specified specific list so check it exists. + * + * NOTE: Other FRR CLI commands do not do this sort of verification and + * there may be an official decision not to. + */ + if (name) { + value_node = yang_dnode_getf(vty->candidate_config->dnode, "%s/%s", + VTY_CURR_XPATH, xpath); + if (!value_node || strcmp(name, lyd_get_value(value_node))) { + vty_out(vty, "distribute list doesn't exist\n"); + return CMD_WARNING_CONFIG_FAILED; + } + } + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); +} + /* * XPath: /frr-eigrpd:eigrpd/instance/redistribute * XPath: /frr-eigrpd:eigrpd/instance/redistribute/route-map @@ -456,19 +573,19 @@ DEFPY_YANG( void eigrp_cli_show_redistribute(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { - const char *proto = yang_dnode_get_string(dnode, "./protocol"); + const char *proto = yang_dnode_get_string(dnode, "protocol"); const char *bw, *delay, *load, *mtu, *rlbt; - bw = yang_dnode_exists(dnode, "./metrics/bandwidth") ? - yang_dnode_get_string(dnode, "./metrics/bandwidth") : NULL; - delay = yang_dnode_exists(dnode, "./metrics/delay") ? - yang_dnode_get_string(dnode, "./metrics/delay") : NULL; - rlbt = yang_dnode_exists(dnode, "./metrics/reliability") ? - yang_dnode_get_string(dnode, "./metrics/reliability") : NULL; - load = yang_dnode_exists(dnode, "./metrics/load") ? - yang_dnode_get_string(dnode, "./metrics/load") : NULL; - mtu = yang_dnode_exists(dnode, "./metrics/mtu") ? - yang_dnode_get_string(dnode, "./metrics/mtu") : NULL; + bw = yang_dnode_exists(dnode, "metrics/bandwidth") ? + yang_dnode_get_string(dnode, "metrics/bandwidth") : NULL; + delay = yang_dnode_exists(dnode, "metrics/delay") ? + yang_dnode_get_string(dnode, "metrics/delay") : NULL; + rlbt = yang_dnode_exists(dnode, "metrics/reliability") ? + yang_dnode_get_string(dnode, "metrics/reliability") : NULL; + load = yang_dnode_exists(dnode, "metrics/load") ? + yang_dnode_get_string(dnode, "metrics/load") : NULL; + mtu = yang_dnode_exists(dnode, "metrics/mtu") ? + yang_dnode_get_string(dnode, "metrics/mtu") : NULL; vty_out(vty, " redistribute %s", proto); if (bw || rlbt || delay || load || mtu) @@ -658,8 +775,9 @@ DEFPY_YANG( as_str); nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); - snprintf(xpath_auth, sizeof(xpath_auth), "%s/summarize-addresses", xpath); - nb_cli_enqueue_change(vty, xpath_auth, NB_OP_CREATE, prefix_str); + snprintf(xpath_auth, sizeof(xpath_auth), + "%s/summarize-addresses[.='%s']", xpath, prefix_str); + nb_cli_enqueue_change(vty, xpath_auth, NB_OP_CREATE, NULL); return nb_cli_apply_changes(vty, NULL); } @@ -681,8 +799,9 @@ DEFPY_YANG( as_str); nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); - snprintf(xpath_auth, sizeof(xpath_auth), "%s/summarize-addresses", xpath); - nb_cli_enqueue_change(vty, xpath_auth, NB_OP_DESTROY, prefix_str); + snprintf(xpath_auth, sizeof(xpath_auth), + "%s/summarize-addresses[.='%s']", xpath, prefix_str); + nb_cli_enqueue_change(vty, xpath_auth, NB_OP_DESTROY, NULL); return nb_cli_apply_changes(vty, NULL); } @@ -693,7 +812,7 @@ void eigrp_cli_show_summarize_address(struct vty *vty, { const struct lyd_node *instance = yang_dnode_get_parent(dnode, "instance"); - uint16_t asn = yang_dnode_get_uint16(instance, "./asn"); + uint16_t asn = yang_dnode_get_uint16(instance, "asn"); const char *summarize_address = yang_dnode_get_string(dnode, NULL); vty_out(vty, " ip summary-address eigrp %d %s\n", asn, @@ -759,7 +878,7 @@ void eigrp_cli_show_authentication(struct vty *vty, { const struct lyd_node *instance = yang_dnode_get_parent(dnode, "instance"); - uint16_t asn = yang_dnode_get_uint16(instance, "./asn"); + uint16_t asn = yang_dnode_get_uint16(instance, "asn"); const char *crypt = yang_dnode_get_string(dnode, NULL); vty_out(vty, " ip authentication mode eigrp %d %s\n", asn, crypt); @@ -819,7 +938,7 @@ void eigrp_cli_show_keychain(struct vty *vty, const struct lyd_node *dnode, { const struct lyd_node *instance = yang_dnode_get_parent(dnode, "instance"); - uint16_t asn = yang_dnode_get_uint16(instance, "./asn"); + uint16_t asn = yang_dnode_get_uint16(instance, "asn"); const char *keychain = yang_dnode_get_string(dnode, NULL); vty_out(vty, " ip authentication key-chain eigrp %d %s\n", asn, @@ -875,6 +994,10 @@ eigrp_cli_init(void) install_element(EIGRP_NODE, &no_eigrp_metric_weights_cmd); install_element(EIGRP_NODE, &eigrp_network_cmd); install_element(EIGRP_NODE, &eigrp_neighbor_cmd); + install_element(EIGRP_NODE, &eigrp_distribute_list_cmd); + install_element(EIGRP_NODE, &eigrp_distribute_list_prefix_cmd); + install_element(EIGRP_NODE, &eigrp_no_distribute_list_cmd); + install_element(EIGRP_NODE, &eigrp_no_distribute_list_prefix_cmd); install_element(EIGRP_NODE, &eigrp_redistribute_source_metric_cmd); vrf_cmd_init(NULL); diff --git a/eigrpd/eigrp_const.h b/eigrpd/eigrp_const.h index 607719d..05fbae3 100644 --- a/eigrpd/eigrp_const.h +++ b/eigrpd/eigrp_const.h @@ -61,9 +61,6 @@ /* IP TTL for EIGRP protocol. */ #define EIGRP_IP_TTL 1 -/* VTY port number. */ -#define EIGRP_VTY_PORT 2613 - /* Default configuration file name for eigrp. */ #define EIGRP_DEFAULT_CONFIG "eigrpd.conf" diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index 7bb1617..fb8f47e 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -202,8 +202,10 @@ struct list *eigrp_iflist; void eigrp_if_init(void) { - if_zapi_callbacks(eigrp_ifp_create, eigrp_ifp_up, - eigrp_ifp_down, eigrp_ifp_destroy); + hook_register_prio(if_real, 0, eigrp_ifp_create); + hook_register_prio(if_up, 0, eigrp_ifp_up); + hook_register_prio(if_down, 0, eigrp_ifp_down); + hook_register_prio(if_unreal, 0, eigrp_ifp_destroy); /* Initialize Zebra interface data structure. */ // hook_register_prio(if_add, 0, eigrp_if_new); hook_register_prio(if_del, 0, eigrp_if_delete_hook); diff --git a/eigrpd/eigrp_main.c b/eigrpd/eigrp_main.c index 6d7443b..552ba7c 100644 --- a/eigrpd/eigrp_main.c +++ b/eigrpd/eigrp_main.c @@ -96,6 +96,8 @@ static void sigint(void) zlog_notice("Terminating on signal"); eigrp_terminate(); + keychain_terminate(); + exit(0); } @@ -132,16 +134,20 @@ static const struct frr_yang_module_info *const eigrpd_yang_modules[] = { &frr_vrf_info, }; -FRR_DAEMON_INFO(eigrpd, EIGRP, .vty_port = EIGRP_VTY_PORT, +/* clang-format off */ +FRR_DAEMON_INFO(eigrpd, EIGRP, + .vty_port = EIGRP_VTY_PORT, + .proghelp = "Implementation of the EIGRP routing protocol.", - .proghelp = "Implementation of the EIGRP routing protocol.", + .signals = eigrp_signals, + .n_signals = array_size(eigrp_signals), - .signals = eigrp_signals, - .n_signals = array_size(eigrp_signals), + .privs = &eigrpd_privs, - .privs = &eigrpd_privs, .yang_modules = eigrpd_yang_modules, - .n_yang_modules = array_size(eigrpd_yang_modules), + .yang_modules = eigrpd_yang_modules, + .n_yang_modules = array_size(eigrpd_yang_modules), ); +/* clang-format on */ /* EIGRPd main routine. */ int main(int argc, char **argv, char **envp) diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c index ef567fe..5ca5a18 100644 --- a/eigrpd/eigrp_network.c +++ b/eigrpd/eigrp_network.c @@ -233,13 +233,11 @@ static void eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p, struct interface *ifp) { struct eigrp_interface *ei; - struct listnode *cnode; struct connected *co; /* if interface prefix is match specified prefix, then create socket and join multicast group. */ - for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, co)) { - + frr_each (if_connected, ifp->connected, co) { if (CHECK_FLAG(co->flags, ZEBRA_IFA_SECONDARY)) continue; diff --git a/eigrpd/eigrp_northbound.c b/eigrpd/eigrp_northbound.c index f50abb7..4aeb635 100644 --- a/eigrpd/eigrp_northbound.c +++ b/eigrpd/eigrp_northbound.c @@ -14,6 +14,7 @@ #include "lib/table.h" #include "lib/vrf.h" #include "lib/zclient.h" +#include "lib/distribute.h" #include "eigrp_structs.h" #include "eigrpd.h" @@ -28,18 +29,18 @@ static void redistribute_get_metrics(const struct lyd_node *dnode, { memset(em, 0, sizeof(*em)); - if (yang_dnode_exists(dnode, "./bandwidth")) - em->bandwidth = yang_dnode_get_uint32(dnode, "./bandwidth"); - if (yang_dnode_exists(dnode, "./delay")) - em->delay = yang_dnode_get_uint32(dnode, "./delay"); + if (yang_dnode_exists(dnode, "bandwidth")) + em->bandwidth = yang_dnode_get_uint32(dnode, "bandwidth"); + if (yang_dnode_exists(dnode, "delay")) + em->delay = yang_dnode_get_uint32(dnode, "delay"); #if 0 /* TODO: How does MTU work? */ - if (yang_dnode_exists(dnode, "./mtu")) - em->mtu[0] = yang_dnode_get_uint32(dnode, "./mtu"); + if (yang_dnode_exists(dnode, "mtu")) + em->mtu[0] = yang_dnode_get_uint32(dnode, "mtu"); #endif - if (yang_dnode_exists(dnode, "./load")) - em->load = yang_dnode_get_uint32(dnode, "./load"); - if (yang_dnode_exists(dnode, "./reliability")) - em->reliability = yang_dnode_get_uint32(dnode, "./reliability"); + if (yang_dnode_exists(dnode, "load")) + em->load = yang_dnode_get_uint32(dnode, "load"); + if (yang_dnode_exists(dnode, "reliability")) + em->reliability = yang_dnode_get_uint32(dnode, "reliability"); } static struct eigrp_interface *eigrp_interface_lookup(const struct eigrp *eigrp, @@ -73,7 +74,7 @@ static int eigrpd_instance_create(struct nb_cb_create_args *args) /* NOTHING */ break; case NB_EV_PREPARE: - vrf = yang_dnode_get_string(args->dnode, "./vrf"); + vrf = yang_dnode_get_string(args->dnode, "vrf"); pVrf = vrf_lookup_by_name(vrf); if (pVrf) @@ -81,7 +82,7 @@ static int eigrpd_instance_create(struct nb_cb_create_args *args) else vrfid = VRF_DEFAULT; - eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"), + eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"), vrfid); args->resource->ptr = eigrp; break; @@ -701,6 +702,22 @@ static int eigrpd_instance_neighbor_destroy(struct nb_cb_destroy_args *args) return NB_OK; } +/* + * XPath: /frr-eigrpd:eigrpd/instance/distribute-list + */ +static int eigrpd_instance_distribute_list_create(struct nb_cb_create_args *args) +{ + struct eigrp *eigrp; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + eigrp = nb_running_get_entry(args->dnode, NULL, true); + group_distribute_list_create_helper(args, eigrp->distribute_ctx); + + return NB_OK; +} + /* * XPath: /frr-eigrpd:eigrpd/instance/redistribute */ @@ -715,7 +732,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args) switch (args->event) { case NB_EV_VALIDATE: - proto = yang_dnode_get_enum(args->dnode, "./protocol"); + proto = yang_dnode_get_enum(args->dnode, "protocol"); vrfname = yang_dnode_get_string(args->dnode, "../vrf"); pVrf = vrf_lookup_by_name(vrfname); @@ -733,7 +750,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args) break; case NB_EV_APPLY: eigrp = nb_running_get_entry(args->dnode, NULL, true); - proto = yang_dnode_get_enum(args->dnode, "./protocol"); + proto = yang_dnode_get_enum(args->dnode, "protocol"); redistribute_get_metrics(args->dnode, &metrics); eigrp_redistribute_set(eigrp, proto, metrics); break; @@ -755,7 +772,7 @@ static int eigrpd_instance_redistribute_destroy(struct nb_cb_destroy_args *args) break; case NB_EV_APPLY: eigrp = nb_running_get_entry(args->dnode, NULL, true); - proto = yang_dnode_get_enum(args->dnode, "./protocol"); + proto = yang_dnode_get_enum(args->dnode, "protocol"); eigrp_redistribute_unset(eigrp, proto); break; } @@ -1120,7 +1137,7 @@ static int lib_interface_eigrp_instance_create(struct nb_cb_create_args *args) break; } - eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"), + eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"), ifp->vrf->vrf_id); eif = eigrp_interface_lookup(eigrp, ifp->name); if (eif == NULL) @@ -1132,7 +1149,7 @@ static int lib_interface_eigrp_instance_create(struct nb_cb_create_args *args) break; case NB_EV_APPLY: ifp = nb_running_get_entry(args->dnode, NULL, true); - eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"), + eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"), ifp->vrf->vrf_id); eif = eigrp_interface_lookup(eigrp, ifp->name); if (eif == NULL) @@ -1402,6 +1419,45 @@ const struct frr_yang_module_info frr_eigrpd_info = { .cli_show = eigrp_cli_show_neighbor, } }, + { + .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list", + .cbs = { + .create = eigrpd_instance_distribute_list_create, + .destroy = group_distribute_list_destroy, + } + }, + { + .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/in/access-list", + .cbs = { + .modify = group_distribute_list_ipv4_modify, + .destroy = group_distribute_list_ipv4_destroy, + .cli_show = group_distribute_list_ipv4_cli_show, + } + }, + { + .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/out/access-list", + .cbs = { + .modify = group_distribute_list_ipv4_modify, + .destroy = group_distribute_list_ipv4_destroy, + .cli_show = group_distribute_list_ipv4_cli_show, + } + }, + { + .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/in/prefix-list", + .cbs = { + .modify = group_distribute_list_ipv4_modify, + .destroy = group_distribute_list_ipv4_destroy, + .cli_show = group_distribute_list_ipv4_cli_show, + } + }, + { + .xpath = "/frr-eigrpd:eigrpd/instance/distribute-list/out/prefix-list", + .cbs = { + .modify = group_distribute_list_ipv4_modify, + .destroy = group_distribute_list_ipv4_destroy, + .cli_show = group_distribute_list_ipv4_cli_show, + } + }, { .xpath = "/frr-eigrpd:eigrpd/instance/redistribute", .cbs = { diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c index 84f27d0..420cb6c 100644 --- a/eigrpd/eigrp_routemap.c +++ b/eigrpd/eigrp_routemap.c @@ -1107,60 +1107,14 @@ ALIAS(no_set_tag, no_set_tag_val_cmd, "no set tag (0-65535)", NO_STR SET_STR "Tag value for routing protocol\n" "Tag value\n") -DEFUN (eigrp_distribute_list, - eigrp_distribute_list_cmd, - "distribute-list [prefix] ACCESSLIST_NAME [WORD]", - "Filter networks in routing updates\n" - "Specify a prefix\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") -{ - const char *ifname = NULL; - int prefix = (argv[1]->type == WORD_TKN) ? 1 : 0; - - if (argv[argc - 1]->type == VARIABLE_TKN) - ifname = argv[argc - 1]->arg; - - return distribute_list_parser(prefix, true, argv[2 + prefix]->text, - argv[1 + prefix]->arg, ifname); -} - -DEFUN (eigrp_no_distribute_list, - eigrp_no_distribute_list_cmd, - "no distribute-list [prefix] ACCESSLIST_NAME [WORD]", - NO_STR - "Filter networks in routing updates\n" - "Specify a prefix\n" - "Access-list name\n" - "Filter incoming routing updates\n" - "Filter outgoing routing updates\n" - "Interface name\n") -{ - const char *ifname = NULL; - int prefix = (argv[2]->type == WORD_TKN) ? 1 : 0; - - if (argv[argc - 1]->type == VARIABLE_TKN) - ifname = argv[argc - 1]->arg; - - return distribute_list_no_parser(vty, prefix, true, - argv[3 + prefix]->text, - argv[2 + prefix]->arg, ifname); -} - - /* Route-map init */ -void eigrp_route_map_init() +void eigrp_route_map_init(void) { route_map_init(); route_map_init_vty(); route_map_add_hook(eigrp_route_map_update); route_map_delete_hook(eigrp_route_map_update); - install_element(EIGRP_NODE, &eigrp_distribute_list_cmd); - install_element(EIGRP_NODE, &eigrp_no_distribute_list_cmd); - /*route_map_install_match (&route_match_metric_cmd); route_map_install_match (&route_match_interface_cmd);*/ /*route_map_install_match (&route_match_ip_next_hop_cmd); diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index a5cecb9..a0eff68 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -98,9 +98,7 @@ static zclient_handler *const eigrp_handlers[] = { void eigrp_zebra_init(void) { - struct zclient_options opt = {.receive_notify = false}; - - zclient = zclient_new(master, &opt, eigrp_handlers, + zclient = zclient_new(master, &zclient_options_default, eigrp_handlers, array_size(eigrp_handlers)); zclient_init(zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs); -- cgit v1.2.3