From 34b054ba6d8ff278f52d77328475f542138ce958 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Sat, 19 Aug 2017 11:38:47 -0300 Subject: [PATCH] *: remove leftovers from "router zebra" Signed-off-by: Renato Westphal --- babeld/babel_zebra.c | 28 ----------- bgpd/bgp_zebra.c | 16 ------ isisd/isis_zebra.c | 16 ------ lib/zclient.c | 19 -------- lib/zclient.h | 4 -- ospf6d/ospf6_zebra.c | 113 +------------------------------------------ ospfd/ospf_zebra.c | 32 ------------ ripd/rip_zebra.c | 53 -------------------- ripngd/ripng_zebra.c | 56 --------------------- 9 files changed, 1 insertion(+), 336 deletions(-) diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c index 2ec5c3d7c3..37f441c30f 100644 --- a/babeld/babel_zebra.c +++ b/babeld/babel_zebra.c @@ -37,7 +37,6 @@ void babelz_zebra_init(void); /* we must use a pointer because of zclient.c's functions (new, free). */ struct zclient *zclient; -static int zebra_config_write (struct vty *vty); /* Debug types */ static struct { @@ -55,15 +54,6 @@ static struct { {0, 0, NULL} }; -/* Zebra node structure. */ -struct cmd_node zebra_node = -{ - ZEBRA_NODE, - "%s(config-router)# ", - 1 /* vtysh? yes */ -}; - - /* Zebra route add and delete treatment (ipv6). */ static int babel_zebra_read_ipv6 (int command, struct zclient *zclient, @@ -347,7 +337,6 @@ void babelz_zebra_init(void) zclient->redistribute_route_ipv6_add = babel_zebra_read_ipv6; zclient->redistribute_route_ipv6_del = babel_zebra_read_ipv6; - install_node (&zebra_node, zebra_config_write); install_element(BABEL_NODE, &babel_redistribute_type_cmd); install_element(ENABLE_NODE, &debug_babel_cmd); install_element(ENABLE_NODE, &no_debug_babel_cmd); @@ -357,23 +346,6 @@ void babelz_zebra_init(void) install_element(VIEW_NODE, &show_debugging_babel_cmd); } -static int -zebra_config_write (struct vty *vty) -{ - if (! zclient->enable) - { - vty_out (vty, "no router zebra\n"); - return 1; - } - else if (! vrf_bitmap_check (zclient->redist[AFI_IP][ZEBRA_ROUTE_BABEL], VRF_DEFAULT)) - { - vty_out (vty, "router zebra\n"); - vty_out (vty, " no redistribute babel\n"); - return 1; - } - return 0; -} - void babel_zebra_close_connexion(void) { diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 2fc75ea5a2..193775165c 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1169,14 +1169,6 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, if (!bgp_install_info_to_zebra(bgp)) return; - if ((p->family == AF_INET - && !vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_BGP], - bgp->vrf_id)) - || (p->family == AF_INET6 - && !vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_BGP], - bgp->vrf_id))) - return; - if (bgp->main_zebra_update_hold) return; @@ -1590,14 +1582,6 @@ void bgp_zebra_withdraw(struct prefix *p, struct bgp_info *info, safi_t safi) if (!bgp_install_info_to_zebra(peer->bgp)) return; - if ((p->family == AF_INET - && !vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_BGP], - peer->bgp->vrf_id)) - || (p->family == AF_INET6 - && !vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_BGP], - peer->bgp->vrf_id))) - return; - flags = 0; if (peer->sort == BGP_PEER_IBGP) { diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 5fc3a24c30..2eecda91bf 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -258,10 +258,6 @@ static void isis_zebra_route_add_ipv4(struct prefix *prefix, if (CHECK_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) return; - if (!vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_ISIS], - VRF_DEFAULT)) - return; - message = 0; flags = 0; @@ -324,10 +320,6 @@ static void isis_zebra_route_del_ipv4(struct prefix *prefix, UNSET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); - if (!vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_ISIS], - VRF_DEFAULT)) - return; - api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_ISIS; api.instance = 0; @@ -505,14 +497,6 @@ void isis_zebra_route_update(struct prefix *prefix, if (zclient->sock < 0) return; - if ((prefix->family == AF_INET - && !vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_ISIS], - VRF_DEFAULT)) - || (prefix->family == AF_INET6 - && !vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_ISIS], - VRF_DEFAULT))) - return; - if (CHECK_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ACTIVE)) { if (prefix->family == AF_INET) isis_zebra_route_add_ipv4(prefix, route_info); diff --git a/lib/zclient.c b/lib/zclient.c index 24cb699196..f8bbdd85c9 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -352,10 +352,6 @@ void zclient_send_reg_requests(struct zclient *zclient, vrf_id_t vrf_id) int i; afi_t afi; - /* zclient is disabled. */ - if (!zclient->enable) - return; - /* If not connected to the zebra yet. */ if (zclient->sock < 0) return; @@ -418,10 +414,6 @@ void zclient_send_dereg_requests(struct zclient *zclient, vrf_id_t vrf_id) int i; afi_t afi; - /* zclient is disabled. */ - if (!zclient->enable) - return; - /* If not connected to the zebra yet. */ if (zclient->sock < 0) return; @@ -485,10 +477,6 @@ void zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id, { struct stream *s; - /* zclient is disabled. */ - if (!zclient->enable) - return; - /* If not connected to the zebra yet. */ if (zclient->sock < 0) return; @@ -516,10 +504,6 @@ int zclient_start(struct zclient *zclient) if (zclient_debug) zlog_info("zclient_start is called"); - /* zclient is disabled. */ - if (!zclient->enable) - return 0; - /* If already connected to the zebra. */ if (zclient->sock >= 0) return 0; @@ -564,9 +548,6 @@ void zclient_init(struct zclient *zclient, int redist_default, u_short instance) { int afi, i; - /* Enable zebra client connection by default. */ - zclient->enable = 1; - /* Set -1 to the default socket value. */ zclient->sock = -1; diff --git a/lib/zclient.h b/lib/zclient.h index 0218c1b732..ddd9655443 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -137,10 +137,6 @@ struct zclient { /* Socket to zebra daemon. */ int sock; - /* Flag of communication to zebra is enabled or not. Default is on. - This flag is disabled by `no router zebra' statement. */ - int enable; - /* Connection failure count. */ int fail; diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index dc97f1ff4b..1c266da888 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -317,7 +317,7 @@ DEFUN (show_zebra, } vty_out(vty, "Zebra Infomation\n"); - vty_out(vty, " enable: %d fail: %d\n", zclient->enable, zclient->fail); + vty_out(vty, " fail: %d\n", zclient->fail); vty_out(vty, " redistribute default: %d\n", vrf_bitmap_check(zclient->default_information, VRF_DEFAULT)); vty_out(vty, " redistribute:"); @@ -329,27 +329,6 @@ DEFUN (show_zebra, return CMD_SUCCESS; } -/* Zebra configuration write function. */ -static int config_write_ospf6_zebra(struct vty *vty) -{ - if (!zclient->enable) { - vty_out(vty, "no router zebra\n"); - vty_out(vty, "!\n"); - } else if (!vrf_bitmap_check( - zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT)) { - vty_out(vty, "router zebra\n"); - vty_out(vty, " no redistribute ospf6\n"); - vty_out(vty, "!\n"); - } - return 0; -} - -/* Zebra node structure. */ -static struct cmd_node zebra_node = { - ZEBRA_NODE, "%s(config-zebra)# ", -}; - #define ADD 0 #define REM 1 static void ospf6_zebra_route_update(int type, struct ospf6_route *request) @@ -471,23 +450,11 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request) void ospf6_zebra_route_update_add(struct ospf6_route *request) { - if (!vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT)) { - ospf6->route_table->hook_add = NULL; - ospf6->route_table->hook_remove = NULL; - return; - } ospf6_zebra_route_update(ADD, request); } void ospf6_zebra_route_update_remove(struct ospf6_route *request) { - if (!vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT)) { - ospf6->route_table->hook_add = NULL; - ospf6->route_table->hook_remove = NULL; - return; - } ospf6_zebra_route_update(REM, request); } @@ -497,10 +464,6 @@ void ospf6_zebra_add_discard(struct ospf6_route *request) char buf[INET6_ADDRSTRLEN]; struct prefix_ipv6 *dest; - if (!vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT)) - return; - if (!CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) { api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_OSPF6; @@ -542,10 +505,6 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request) char buf[INET6_ADDRSTRLEN]; struct prefix_ipv6 *dest; - if (!vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT)) - return; - if (CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) { api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_OSPF6; @@ -580,65 +539,6 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request) } } -DEFUN (redistribute_ospf6, - redistribute_ospf6_cmd, - "redistribute ospf6", - "Redistribute control\n" - "OSPF6 route\n") -{ - struct ospf6_route *route; - - if (vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT)) - return CMD_SUCCESS; - - vrf_bitmap_set(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT); - - if (ospf6 == NULL) - return CMD_SUCCESS; - - /* send ospf6 route to zebra route table */ - for (route = ospf6_route_head(ospf6->route_table); route; - route = ospf6_route_next(route)) - ospf6_zebra_route_update_add(route); - - ospf6->route_table->hook_add = ospf6_zebra_route_update_add; - ospf6->route_table->hook_remove = ospf6_zebra_route_update_remove; - - return CMD_SUCCESS; -} - -DEFUN (no_redistribute_ospf6, - no_redistribute_ospf6_cmd, - "no redistribute ospf6", - NO_STR - "Redistribute control\n" - "OSPF6 route\n") -{ - struct ospf6_route *route; - - if (!vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT)) - return CMD_SUCCESS; - - vrf_bitmap_unset(zclient->redist[AFI_IP6][ZEBRA_ROUTE_OSPF6], - VRF_DEFAULT); - - if (ospf6 == NULL) - return CMD_SUCCESS; - - ospf6->route_table->hook_add = NULL; - ospf6->route_table->hook_remove = NULL; - - /* withdraw ospf6 route from zebra route table */ - for (route = ospf6_route_head(ospf6->route_table); route; - route = ospf6_route_next(route)) - ospf6_zebra_route_update_remove(route); - - return CMD_SUCCESS; -} - static struct ospf6_distance *ospf6_distance_new(void) { return XCALLOC(MTYPE_OSPF6_DISTANCE, sizeof(struct ospf6_distance)); @@ -794,19 +694,8 @@ void ospf6_zebra_init(struct thread_master *master) zclient->redistribute_route_ipv6_add = ospf6_zebra_read_ipv6; zclient->redistribute_route_ipv6_del = ospf6_zebra_read_ipv6; - /* redistribute connected route by default */ - /* ospf6_zebra_redistribute (ZEBRA_ROUTE_CONNECT); */ - - /* Install zebra node. */ - install_node(&zebra_node, config_write_ospf6_zebra); - /* Install command element for zebra node. */ install_element(VIEW_NODE, &show_ospf6_zebra_cmd); - install_default(ZEBRA_NODE); - install_element(ZEBRA_NODE, &redistribute_ospf6_cmd); - install_element(ZEBRA_NODE, &no_redistribute_ospf6_cmd); - - return; } /* Debug */ diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index f9668f2495..6d9d56d92d 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -342,14 +342,6 @@ void ospf_zebra_add(struct prefix_ipv4 *p, struct ospf_route * or) struct listnode *node; struct ospf *ospf = ospf_lookup(); - if (!(ospf->instance - && redist_check_instance( - &zclient->mi_redist[AFI_IP][ZEBRA_ROUTE_OSPF], - ospf->instance)) - && !vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_OSPF], - VRF_DEFAULT)) - return; - message = 0; flags = 0; @@ -465,14 +457,6 @@ void ospf_zebra_delete(struct prefix_ipv4 *p, struct ospf_route * or) struct listnode *node; struct ospf *ospf = ospf_lookup(); - if (!(ospf->instance - && redist_check_instance( - &zclient->mi_redist[AFI_IP][ZEBRA_ROUTE_OSPF], - ospf->instance)) - && !vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_OSPF], - VRF_DEFAULT)) - return; - message = 0; flags = 0; /* Distance value. */ @@ -543,14 +527,6 @@ void ospf_zebra_add_discard(struct prefix_ipv4 *p) struct zapi_ipv4 api; struct ospf *ospf = ospf_lookup(); - if (!(ospf->instance - && redist_check_instance( - &zclient->mi_redist[AFI_IP][ZEBRA_ROUTE_OSPF], - ospf->instance)) - && !vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_OSPF], - VRF_DEFAULT)) - return; - api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_OSPF; api.instance = ospf->instance; @@ -574,14 +550,6 @@ void ospf_zebra_delete_discard(struct prefix_ipv4 *p) struct zapi_ipv4 api; struct ospf *ospf = ospf_lookup(); - if (!(ospf->instance - && redist_check_instance( - &zclient->mi_redist[AFI_IP][ZEBRA_ROUTE_OSPF], - ospf->instance)) - && !vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_OSPF], - VRF_DEFAULT)) - return; - api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_OSPF; api.instance = ospf->instance; diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index 8a166745ec..f9d2d33f19 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -48,10 +48,6 @@ static void rip_zebra_ipv4_send(struct route_node *rp, u_char cmd) struct rip_info *rinfo = NULL; int count = 0; - if (!vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP], - VRF_DEFAULT)) - return; - api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_RIP; api.instance = 0; @@ -295,27 +291,6 @@ void rip_redistribute_clean(void) } } -DEFUN (rip_redistribute_rip, - rip_redistribute_rip_cmd, - "redistribute rip", - "Redistribute information from another routing protocol\n" - "Routing Information Protocol (RIP)\n") -{ - vrf_bitmap_set(zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP], VRF_DEFAULT); - return CMD_SUCCESS; -} - -DEFUN (no_rip_redistribute_rip, - no_rip_redistribute_rip_cmd, - "no redistribute rip", - NO_STR - "Redistribute information from another routing protocol\n" - "Routing Information Protocol (RIP)\n") -{ - vrf_bitmap_unset(zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP], VRF_DEFAULT); - return CMD_SUCCESS; -} - DEFUN (rip_redistribute_type, rip_redistribute_type_cmd, "redistribute " FRR_REDIST_STR_RIPD, @@ -601,21 +576,6 @@ DEFUN (no_rip_default_information_originate, return CMD_SUCCESS; } -/* RIP configuration write function. */ -static int config_write_zebra(struct vty *vty) -{ - if (!zclient->enable) { - vty_out(vty, "no router zebra\n"); - return 1; - } else if (!vrf_bitmap_check(zclient->redist[AFI_IP][ZEBRA_ROUTE_RIP], - VRF_DEFAULT)) { - vty_out(vty, "router zebra\n"); - vty_out(vty, " no redistribute rip\n"); - return 1; - } - return 0; -} - int config_write_rip_redistribute(struct vty *vty, int config_mode) { int i; @@ -656,11 +616,6 @@ int config_write_rip_redistribute(struct vty *vty, int config_mode) return 0; } -/* Zebra node structure. */ -static struct cmd_node zebra_node = { - ZEBRA_NODE, "%s(config-router)# ", -}; - static void rip_zebra_connected(struct zclient *zclient) { zclient_send_reg_requests(zclient, VRF_DEFAULT); @@ -681,14 +636,6 @@ void rip_zclient_init(struct thread_master *master) zclient->redistribute_route_ipv4_add = rip_zebra_read_ipv4; zclient->redistribute_route_ipv4_del = rip_zebra_read_ipv4; - /* Install zebra node. */ - install_node(&zebra_node, config_write_zebra); - - /* Install command elements to zebra node. */ - install_default(ZEBRA_NODE); - install_element(ZEBRA_NODE, &rip_redistribute_rip_cmd); - install_element(ZEBRA_NODE, &no_rip_redistribute_rip_cmd); - /* Install command elements to rip node. */ install_element(RIP_NODE, &rip_redistribute_type_cmd); install_element(RIP_NODE, &rip_redistribute_type_routemap_cmd); diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 875ec4f225..3845028264 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -49,10 +49,6 @@ static void ripng_zebra_ipv6_send(struct route_node *rp, u_char cmd) struct ripng_info *rinfo = NULL; int count = 0; - if (!vrf_bitmap_check(zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG], - VRF_DEFAULT)) - return; - api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_RIPNG; api.instance = 0; @@ -292,29 +288,6 @@ void ripng_redistribute_clean() } } -DEFUN (ripng_redistribute_ripng, - ripng_redistribute_ripng_cmd, - "redistribute ripng", - "Redistribute information from another routing protocol\n" - "RIPng route\n") -{ - vrf_bitmap_set(zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG], - VRF_DEFAULT); - return CMD_SUCCESS; -} - -DEFUN (no_ripng_redistribute_ripng, - no_ripng_redistribute_ripng_cmd, - "no redistribute ripng", - NO_STR - "Redistribute information from another routing protocol\n" - "RIPng route\n") -{ - vrf_bitmap_unset(zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG], - VRF_DEFAULT); - return CMD_SUCCESS; -} - DEFUN (ripng_redistribute_type, ripng_redistribute_type_cmd, "redistribute " FRR_REDIST_STR_RIPNGD, @@ -484,27 +457,6 @@ void ripng_redistribute_write(struct vty *vty, int config_mode) } } -/* RIPng configuration write function. */ -static int zebra_config_write(struct vty *vty) -{ - if (!zclient->enable) { - vty_out(vty, "no router zebra\n"); - return 1; - } else if (!vrf_bitmap_check( - zclient->redist[AFI_IP6][ZEBRA_ROUTE_RIPNG], - VRF_DEFAULT)) { - vty_out(vty, "router zebra\n"); - vty_out(vty, " no redistribute ripng\n"); - return 1; - } - return 0; -} - -/* Zebra node structure. */ -static struct cmd_node zebra_node = { - ZEBRA_NODE, "%s(config-router)# ", -}; - static void ripng_zebra_connected(struct zclient *zclient) { zclient_send_reg_requests(zclient, VRF_DEFAULT); @@ -527,14 +479,6 @@ void zebra_init(struct thread_master *master) zclient->redistribute_route_ipv6_add = ripng_zebra_read_ipv6; zclient->redistribute_route_ipv6_del = ripng_zebra_read_ipv6; - /* Install zebra node. */ - install_node(&zebra_node, zebra_config_write); - - /* Install command element for zebra node. */ - install_default(ZEBRA_NODE); - install_element(ZEBRA_NODE, &ripng_redistribute_ripng_cmd); - install_element(ZEBRA_NODE, &no_ripng_redistribute_ripng_cmd); - /* Install command elements to ripng node */ install_element(RIPNG_NODE, &ripng_redistribute_type_cmd); install_element(RIPNG_NODE, &ripng_redistribute_type_routemap_cmd); -- 2.39.5