diff options
-rw-r--r-- | zebra/main.c | 6 | ||||
-rw-r--r-- | zebra/redistribute.c | 25 | ||||
-rw-r--r-- | zebra/router-id.c | 8 | ||||
-rw-r--r-- | zebra/zapi_msg.c | 13 | ||||
-rw-r--r-- | zebra/zebra_ptm.c | 6 | ||||
-rw-r--r-- | zebra/zebra_ptm_redistribute.c | 6 | ||||
-rw-r--r-- | zebra/zebra_router.h | 3 | ||||
-rw-r--r-- | zebra/zebra_vrf.c | 4 | ||||
-rw-r--r-- | zebra/zserv.c | 12 | ||||
-rw-r--r-- | zebra/zserv.h | 2 |
10 files changed, 44 insertions, 41 deletions
diff --git a/zebra/main.c b/zebra/main.c index 16a5ad53c..339bb6a91 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -156,10 +156,10 @@ static void sigint(void) zebra_dplane_pre_finish(); - for (ALL_LIST_ELEMENTS(zebrad.client_list, ln, nn, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, ln, nn, client)) zserv_close_client(client); - list_delete_all_node(zebrad.client_list); + list_delete_all_node(zrouter.client_list); zebra_ptm_finish(); if (retain_mode) @@ -179,7 +179,7 @@ static void sigint(void) prefix_list_reset(); route_map_finish(); - list_delete(&zebrad.client_list); + list_delete(&zrouter.client_list); /* Indicate that all new dplane work has been enqueued. When that * work is complete, the dataplane will enqueue an event diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 2c5350fce..a98ed96b9 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -33,7 +33,7 @@ #include "srcdest_table.h" #include "zebra/rib.h" -#include "zebra/zserv.h" +#include "zebra/zebra_router.h" #include "zebra/zebra_ns.h" #include "zebra/zebra_vrf.h" #include "zebra/zebra_routemap.h" @@ -173,7 +173,7 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p, return; } - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { send_redistribute = 0; if (is_default_prefix(p) @@ -246,7 +246,7 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p, return; } - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { if ((is_default_prefix(p) && vrf_bitmap_check(client->redist_default[afi], re->vrf_id)) @@ -405,7 +405,8 @@ void zebra_interface_up_update(struct interface *ifp) ifp->name, ifp->vrf_id); if (ifp->ptm_status || !ifp->ptm_enable) { - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, + client)) if (vrf_bitmap_check(client->ifinfo, ifp->vrf_id)) { zsend_interface_update(ZEBRA_INTERFACE_UP, client, ifp); @@ -424,7 +425,7 @@ void zebra_interface_down_update(struct interface *ifp) zlog_debug("MESSAGE: ZEBRA_INTERFACE_DOWN %s(%u)", ifp->name, ifp->vrf_id); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { zsend_interface_update(ZEBRA_INTERFACE_DOWN, client, ifp); } } @@ -439,7 +440,7 @@ void zebra_interface_add_update(struct interface *ifp) zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADD %s(%u)", ifp->name, ifp->vrf_id); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) if (vrf_bitmap_check(client->ifinfo, ifp->vrf_id)) { client->ifadd_cnt++; zsend_interface_add(client, ifp); @@ -456,7 +457,7 @@ void zebra_interface_delete_update(struct interface *ifp) zlog_debug("MESSAGE: ZEBRA_INTERFACE_DELETE %s(%u)", ifp->name, ifp->vrf_id); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { client->ifdel_cnt++; zsend_interface_delete(client, ifp); } @@ -488,7 +489,7 @@ void zebra_interface_address_add_update(struct interface *ifp, router_id_add_address(ifc); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) { client->connected_rt_add_cnt++; zsend_interface_address(ZEBRA_INTERFACE_ADDRESS_ADD, @@ -517,7 +518,7 @@ void zebra_interface_address_delete_update(struct interface *ifp, router_id_del_address(ifc); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) if (CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL)) { client->connected_rt_del_cnt++; zsend_interface_address(ZEBRA_INTERFACE_ADDRESS_DELETE, @@ -538,7 +539,7 @@ void zebra_interface_vrf_update_del(struct interface *ifp, vrf_id_t new_vrf_id) "MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL %s VRF Id %u -> %u", ifp->name, ifp->vrf_id, new_vrf_id); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Need to delete if the client is not interested in the new * VRF. */ zsend_interface_update(ZEBRA_INTERFACE_DOWN, client, ifp); @@ -561,7 +562,7 @@ void zebra_interface_vrf_update_add(struct interface *ifp, vrf_id_t old_vrf_id) "MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD %s VRF Id %u -> %u", ifp->name, old_vrf_id, ifp->vrf_id); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { /* Need to add if the client is interested in the new VRF. */ client->ifadd_cnt++; zsend_interface_add(client, ifp); @@ -812,7 +813,7 @@ void zebra_interface_parameters_update(struct interface *ifp) zlog_debug("MESSAGE: ZEBRA_INTERFACE_LINK_PARAMS %s(%u)", ifp->name, ifp->vrf_id); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) if (vrf_bitmap_check(client->ifinfo, ifp->vrf_id)) zsend_interface_link_params(client, ifp); } diff --git a/zebra/router-id.c b/zebra/router-id.c index c500f79a6..2775383eb 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -38,7 +38,7 @@ #include "rib.h" #include "vrf.h" -#include "zebra/zserv.h" +#include "zebra/zebra_router.h" #include "zebra/zapi_msg.h" #include "zebra/zebra_vrf.h" #include "zebra/router-id.h" @@ -114,7 +114,7 @@ static void router_id_set(struct prefix *p, vrf_id_t vrf_id) router_id_get(&p2, vrf_id); - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) zsend_router_id_update(client, &p2, vrf_id); } @@ -145,7 +145,7 @@ void router_id_add_address(struct connected *ifc) if (prefix_same(&before, &after)) return; - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) zsend_router_id_update(client, &after, zvrf_id(zvrf)); } @@ -177,7 +177,7 @@ void router_id_del_address(struct connected *ifc) if (prefix_same(&before, &after)) return; - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) zsend_router_id_update(client, &after, zvrf_id(zvrf)); } diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 951a411f2..e560c2b5a 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -42,6 +42,7 @@ #include "lib/libfrr.h" #include "lib/sockopt.h" +#include "zebra/zebra_router.h" #include "zebra/rib.h" #include "zebra/zebra_memory.h" #include "zebra/zebra_ns.h" @@ -365,7 +366,7 @@ static void zebra_interface_nbr_address_add_update(struct interface *ifp, p->prefixlen, ifc->ifp->name); } - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) zsend_interface_nbr_address(ZEBRA_INTERFACE_NBR_ADDRESS_ADD, client, ifp, ifc); } @@ -389,7 +390,7 @@ static void zebra_interface_nbr_address_delete_update(struct interface *ifp, p->prefixlen, ifc->ifp->name); } - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) zsend_interface_nbr_address(ZEBRA_INTERFACE_NBR_ADDRESS_DELETE, client, ifp, ifc); } @@ -768,7 +769,7 @@ void zsend_rule_notify_owner(struct zebra_pbr_rule *rule, zlog_debug("%s: Notifying %u", __PRETTY_FUNCTION__, rule->rule.unique); - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) { if (rule->sock == client->sock) break; } @@ -804,7 +805,7 @@ void zsend_ipset_notify_owner(struct zebra_pbr_ipset *ipset, zlog_debug("%s: Notifying %u", __PRETTY_FUNCTION__, ipset->unique); - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) { if (ipset->sock == client->sock) break; } @@ -834,7 +835,7 @@ void zsend_ipset_entry_notify_owner(struct zebra_pbr_ipset_entry *ipset, zlog_debug("%s: Notifying %u", __PRETTY_FUNCTION__, ipset->unique); - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) { if (ipset->sock == client->sock) break; } @@ -864,7 +865,7 @@ void zsend_iptable_notify_owner(struct zebra_pbr_iptable *iptable, zlog_debug("%s: Notifying %u", __PRETTY_FUNCTION__, iptable->unique); - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) { if (iptable->sock == client->sock) break; } diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 333485073..1e942d643 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -41,7 +41,7 @@ #include "zebra/zebra_errors.h" #include "zebra/zebra_ptm.h" #include "zebra/zebra_ptm_redistribute.h" -#include "zebra/zserv.h" +#include "zebra/zebra_router.h" #include "zebra_vrf.h" /* @@ -1276,7 +1276,7 @@ static void zebra_ptm_send_bfdd(struct stream *msg) } /* Send message to all running BFDd daemons. */ - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) { if (client->proto != ZEBRA_ROUTE_BFD) continue; @@ -1308,7 +1308,7 @@ static void zebra_ptm_send_clients(struct stream *msg) } /* Send message to all running client daemons. */ - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) { if (!IS_BFD_ENABLED_PROTOCOL(client->proto)) continue; diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c index 3acbe3bf2..0c24c732a 100644 --- a/zebra/zebra_ptm_redistribute.c +++ b/zebra/zebra_ptm_redistribute.c @@ -22,7 +22,7 @@ #include "prefix.h" #include "vty.h" #include "stream.h" -#include "zebra/zserv.h" +#include "zebra/zebra_router.h" #include "zebra/zapi_msg.h" #include "zebra/zebra_ptm.h" #include "zebra/zebra_ptm_redistribute.h" @@ -76,7 +76,7 @@ void zebra_interface_bfd_update(struct interface *ifp, struct prefix *dp, struct listnode *node, *nnode; struct zserv *client; - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { if (!IS_BFD_ENABLED_PROTOCOL(client->proto)) continue; @@ -106,7 +106,7 @@ void zebra_bfd_peer_replay_req(void) struct listnode *node, *nnode; struct zserv *client; - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { if (!IS_BFD_ENABLED_PROTOCOL(client->proto)) continue; diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h index 244b8c37a..155841cc9 100644 --- a/zebra/zebra_router.h +++ b/zebra/zebra_router.h @@ -48,6 +48,9 @@ struct zebra_router { /* Thread master */ struct thread_master *master; + /* Lists of clients who have connected to us */ + struct list *client_list; + struct zebra_router_table_head tables; /* L3-VNI hash table (for EVPN). Only in default instance */ diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index f1458cb13..9812bd448 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -58,7 +58,7 @@ static void zebra_vrf_add_update(struct zebra_vrf *zvrf) if (IS_ZEBRA_DEBUG_EVENT) zlog_debug("MESSAGE: ZEBRA_VRF_ADD %s", zvrf_name(zvrf)); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) zsend_vrf_add(client, zvrf); } @@ -70,7 +70,7 @@ static void zebra_vrf_delete_update(struct zebra_vrf *zvrf) if (IS_ZEBRA_DEBUG_EVENT) zlog_debug("MESSAGE: ZEBRA_VRF_DELETE %s", zvrf_name(zvrf)); - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) zsend_vrf_delete(client, zvrf); } diff --git a/zebra/zserv.c b/zebra/zserv.c index 6e450f07b..05dea8d2a 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -647,7 +647,7 @@ void zserv_close_client(struct zserv *client) client->pthread = NULL; /* remove from client list */ - listnode_delete(zebrad.client_list, client); + listnode_delete(zrouter.client_list, client); /* delete client */ zserv_client_free(client); @@ -714,7 +714,7 @@ static struct zserv *zserv_client_create(int sock) client->is_synchronous = 0; /* Add this client to linked list. */ - listnode_add(zebrad.client_list, client); + listnode_add(zrouter.client_list, client); struct frr_pthread_attr zclient_pthr_attrs = { .start = frr_pthread_attr_default.start, @@ -1003,7 +1003,7 @@ struct zserv *zserv_find_client(uint8_t proto, unsigned short instance) struct listnode *node, *nnode; struct zserv *client; - for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) { + for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) { if (client->proto == proto && client->instance == instance) return client; } @@ -1022,7 +1022,7 @@ DEFUN (show_zebra_client, struct listnode *node; struct zserv *client; - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) zebra_show_client_detail(vty, client); return CMD_SUCCESS; @@ -1045,7 +1045,7 @@ DEFUN (show_zebra_client_summary, vty_out(vty, "--------------------------------------------------------------------------------\n"); - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) + for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) zebra_show_client_brief(vty, client); vty_out(vty, "Routes column shows (added+updated)/deleted\n"); @@ -1068,7 +1068,7 @@ void zserv_read_file(char *input) void zserv_init(void) { /* Client list init. */ - zebrad.client_list = list_new(); + zrouter.client_list = list_new(); /* Misc init. */ zebrad.sock = -1; diff --git a/zebra/zserv.h b/zebra/zserv.h index a712e7fb9..77ac40e1a 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -175,8 +175,6 @@ DECLARE_KOOH(zserv_client_close, (struct zserv *client), (client)); /* Zebra instance */ struct zebra_t { - struct list *client_list; - /* Socket */ int sock; |