From 72de4110dc6ea8c7aff61e6ff2e19228c1272cda Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 20 Aug 2021 09:01:26 -0400 Subject: [PATCH] zebra: Convert to `struct zebra_neigh` as per our internal standard We do not use typedef's to talk about structures as per our standard. Fixing. Signed-off-by: Donald Sharp --- zebra/zebra_evpn.c | 6 +- zebra/zebra_evpn_mac.c | 6 +- zebra/zebra_evpn_neigh.c | 160 ++++++++++++++++++++------------------- zebra/zebra_evpn_neigh.h | 48 ++++++------ zebra/zebra_vxlan.c | 85 +++++++++++---------- 5 files changed, 155 insertions(+), 150 deletions(-) diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index ab9dafa3cf..d5e043eea8 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -458,7 +458,7 @@ int zebra_evpn_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, int zebra_evpn_gw_macip_del(struct interface *ifp, struct zebra_evpn *zevpn, struct ipaddr *ip) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct zebra_mac *mac = NULL; /* If the neigh entry is not present nothing to do*/ @@ -1346,7 +1346,7 @@ static void zebra_evpn_process_sync_macip_add(struct zebra_evpn *zevpn, char ipbuf[INET6_ADDRSTRLEN]; bool sticky; bool remote_gw; - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; sticky = !!CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY); remote_gw = !!CHECK_FLAG(flags, ZEBRA_MACIP_TYPE_GW); @@ -1471,7 +1471,7 @@ void zebra_evpn_rem_macip_del(vni_t vni, const struct ethaddr *macaddr, { struct zebra_evpn *zevpn; struct zebra_mac *mac = NULL; - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct interface *ifp = NULL; struct zebra_if *zif = NULL; struct zebra_ns *zns; diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index 8ce05ed03f..472e53b730 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -383,7 +383,7 @@ static int zebra_evpn_dad_mac_auto_recovery_exp(struct thread *t) struct zebra_mac *mac = NULL; struct zebra_evpn *zevpn = NULL; struct listnode *node = NULL; - zebra_neigh_t *nbr = NULL; + struct zebra_neigh *nbr = NULL; mac = THREAD_ARG(t); @@ -461,7 +461,7 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, bool do_dad, bool *is_dup_detect, bool is_local) { - zebra_neigh_t *nbr; + struct zebra_neigh *nbr; struct listnode *node = NULL; struct timeval elapsed = {0, 0}; bool reset_params = false; @@ -609,7 +609,7 @@ static void zebra_evpn_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, void zebra_evpn_print_mac(struct zebra_mac *mac, void *ctxt, json_object *json) { struct vty *vty; - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct listnode *node = NULL; char buf1[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; diff --git a/zebra/zebra_evpn_neigh.c b/zebra/zebra_evpn_neigh.c index 2301576df7..08ff7011e2 100644 --- a/zebra/zebra_evpn_neigh.c +++ b/zebra/zebra_evpn_neigh.c @@ -48,7 +48,7 @@ DEFINE_MTYPE_STATIC(ZEBRA, NEIGH, "EVI Neighbor"); */ static unsigned int neigh_hash_keymake(const void *p) { - const zebra_neigh_t *n = p; + const struct zebra_neigh *n = p; const struct ipaddr *ip = &n->ip; if (IS_IPADDR_V4(ip)) @@ -63,8 +63,8 @@ static unsigned int neigh_hash_keymake(const void *p) */ static bool neigh_cmp(const void *p1, const void *p2) { - const zebra_neigh_t *n1 = p1; - const zebra_neigh_t *n2 = p2; + const struct zebra_neigh *n1 = p1; + const struct zebra_neigh *n2 = p2; if (n1 == NULL && n2 == NULL) return true; @@ -77,8 +77,8 @@ static bool neigh_cmp(const void *p1, const void *p2) int neigh_list_cmp(void *p1, void *p2) { - const zebra_neigh_t *n1 = p1; - const zebra_neigh_t *n2 = p2; + const struct zebra_neigh *n1 = p1; + const struct zebra_neigh *n2 = p2; return memcmp(&n1->ip, &n2->ip, sizeof(struct ipaddr)); } @@ -94,14 +94,14 @@ uint32_t num_dup_detected_neighs(struct zebra_evpn *zevpn) uint32_t num_neighs = 0; struct hash *hash; struct hash_bucket *hb; - zebra_neigh_t *nbr; + struct zebra_neigh *nbr; hash = zevpn->neigh_table; if (!hash) return num_neighs; for (i = 0; i < hash->size; i++) { for (hb = hash->index[i]; hb; hb = hb->next) { - nbr = (zebra_neigh_t *)hb->data; + nbr = (struct zebra_neigh *)hb->data; if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE)) num_neighs++; } @@ -117,12 +117,12 @@ uint32_t num_dup_detected_neighs(struct zebra_evpn *zevpn) */ void zebra_evpn_find_neigh_addr_width(struct hash_bucket *bucket, void *ctxt) { - zebra_neigh_t *n; + struct zebra_neigh *n; char buf[INET6_ADDRSTRLEN]; struct neigh_walk_ctx *wctx = ctxt; int width; - n = (zebra_neigh_t *)bucket->data; + n = (struct zebra_neigh *)bucket->data; ipaddr2str(&n->ip, buf, sizeof(buf)); width = strlen(buf); @@ -135,7 +135,7 @@ void zebra_evpn_find_neigh_addr_width(struct hash_bucket *bucket, void *ctxt) */ int remote_neigh_count(struct zebra_mac *zmac) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct listnode *node = NULL; int count = 0; @@ -150,8 +150,8 @@ int remote_neigh_count(struct zebra_mac *zmac) /* * Install remote neighbor into the kernel. */ -int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, zebra_neigh_t *n, - bool was_static) +int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, + struct zebra_neigh *n, bool was_static) { struct interface *vlan_if; int flags; @@ -179,10 +179,10 @@ int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, zebra_neigh_t *n, */ void zebra_evpn_install_neigh_hash(struct hash_bucket *bucket, void *ctxt) { - zebra_neigh_t *n; + struct zebra_neigh *n; struct neigh_walk_ctx *wctx = ctxt; - n = (zebra_neigh_t *)bucket->data; + n = (struct zebra_neigh *)bucket->data; if (CHECK_FLAG(n->flags, ZEBRA_NEIGH_REMOTE)) zebra_evpn_rem_neigh_install(wctx->zevpn, n, @@ -194,16 +194,16 @@ void zebra_evpn_install_neigh_hash(struct hash_bucket *bucket, void *ctxt) */ static void *zebra_evpn_neigh_alloc(void *p) { - const zebra_neigh_t *tmp_n = p; - zebra_neigh_t *n; + const struct zebra_neigh *tmp_n = p; + struct zebra_neigh *n; - n = XCALLOC(MTYPE_NEIGH, sizeof(zebra_neigh_t)); + n = XCALLOC(MTYPE_NEIGH, sizeof(struct zebra_neigh)); *n = *tmp_n; return ((void *)n); } -static void zebra_evpn_local_neigh_ref_mac(zebra_neigh_t *n, +static void zebra_evpn_local_neigh_ref_mac(struct zebra_neigh *n, const struct ethaddr *macaddr, struct zebra_mac *mac, bool send_mac_update) @@ -237,7 +237,7 @@ static void zebra_evpn_local_neigh_ref_mac(zebra_neigh_t *n, } /* sync-path that is active on an ES peer */ -static void zebra_evpn_sync_neigh_dp_install(zebra_neigh_t *n, +static void zebra_evpn_sync_neigh_dp_install(struct zebra_neigh *n, bool set_inactive, bool force_clear_static, const char *caller) @@ -337,7 +337,7 @@ int zebra_evpn_neigh_send_del_to_client(vni_t vni, struct ipaddr *ip, vni, macaddr, ip, flags, 0, state, NULL, ZEBRA_MACIP_DEL); } -static void zebra_evpn_neigh_send_add_del_to_client(zebra_neigh_t *n, +static void zebra_evpn_neigh_send_add_del_to_client(struct zebra_neigh *n, bool old_bgp_ready, bool new_bgp_ready) { @@ -355,7 +355,7 @@ static void zebra_evpn_neigh_send_add_del_to_client(zebra_neigh_t *n, * to update the sync-neigh references against the MAC * and inform the dataplane about the static flag changes. */ -void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, +void zebra_evpn_sync_neigh_static_chg(struct zebra_neigh *n, bool old_n_static, bool new_n_static, bool defer_n_dp, bool defer_mac_dp, const char *caller) { @@ -413,7 +413,7 @@ void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, */ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) { - zebra_neigh_t *n; + struct zebra_neigh *n; bool old_bgp_ready; bool new_bgp_ready; bool old_n_static; @@ -452,7 +452,7 @@ static int zebra_evpn_neigh_hold_exp_cb(struct thread *t) return 0; } -static inline void zebra_evpn_neigh_start_hold_timer(zebra_neigh_t *n) +static inline void zebra_evpn_neigh_start_hold_timer(struct zebra_neigh *n) { if (n->hold_timer) return; @@ -464,7 +464,7 @@ static inline void zebra_evpn_neigh_start_hold_timer(zebra_neigh_t *n) zmh_info->neigh_hold_time, &n->hold_timer); } -static void zebra_evpn_local_neigh_deref_mac(zebra_neigh_t *n, +static void zebra_evpn_local_neigh_deref_mac(struct zebra_neigh *n, bool send_mac_update) { struct zebra_mac *mac = n->mac; @@ -496,7 +496,8 @@ static void zebra_evpn_local_neigh_deref_mac(zebra_neigh_t *n, zebra_evpn_deref_ip2mac(zevpn, mac); } -bool zebra_evpn_neigh_is_bgp_seq_ok(struct zebra_evpn *zevpn, zebra_neigh_t *n, +bool zebra_evpn_neigh_is_bgp_seq_ok(struct zebra_evpn *zevpn, + struct zebra_neigh *n, const struct ethaddr *macaddr, uint32_t seq, bool sync) { @@ -542,16 +543,16 @@ bool zebra_evpn_neigh_is_bgp_seq_ok(struct zebra_evpn *zevpn, zebra_neigh_t *n, /* * Add neighbor entry. */ -static zebra_neigh_t *zebra_evpn_neigh_add(struct zebra_evpn *zevpn, - const struct ipaddr *ip, - const struct ethaddr *mac, - struct zebra_mac *zmac, - uint32_t n_flags) +static struct zebra_neigh *zebra_evpn_neigh_add(struct zebra_evpn *zevpn, + const struct ipaddr *ip, + const struct ethaddr *mac, + struct zebra_mac *zmac, + uint32_t n_flags) { - zebra_neigh_t tmp_n; - zebra_neigh_t *n = NULL; + struct zebra_neigh tmp_n; + struct zebra_neigh *n = NULL; - memset(&tmp_n, 0, sizeof(zebra_neigh_t)); + memset(&tmp_n, 0, sizeof(struct zebra_neigh)); memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr)); n = hash_get(zevpn->neigh_table, &tmp_n, zebra_evpn_neigh_alloc); assert(n); @@ -573,9 +574,9 @@ static zebra_neigh_t *zebra_evpn_neigh_add(struct zebra_evpn *zevpn, /* * Delete neighbor entry. */ -int zebra_evpn_neigh_del(struct zebra_evpn *zevpn, zebra_neigh_t *n) +int zebra_evpn_neigh_del(struct zebra_evpn *zevpn, struct zebra_neigh *n) { - zebra_neigh_t *tmp_n; + struct zebra_neigh *tmp_n; if (n->mac) listnode_delete(n->mac->neigh_list, n); @@ -593,7 +594,7 @@ int zebra_evpn_neigh_del(struct zebra_evpn *zevpn, zebra_neigh_t *n) return 0; } -void zebra_evpn_sync_neigh_del(zebra_neigh_t *n) +void zebra_evpn_sync_neigh_del(struct zebra_neigh *n) { bool old_n_static; bool new_n_static; @@ -614,11 +615,10 @@ void zebra_evpn_sync_neigh_del(zebra_neigh_t *n) false /*defer_mac_dp*/, __func__); } -zebra_neigh_t * -zebra_evpn_proc_sync_neigh_update(struct zebra_evpn *zevpn, zebra_neigh_t *n, - uint16_t ipa_len, const struct ipaddr *ipaddr, - uint8_t flags, uint32_t seq, const esi_t *esi, - struct sync_mac_ip_ctx *ctx) +struct zebra_neigh *zebra_evpn_proc_sync_neigh_update( + struct zebra_evpn *zevpn, struct zebra_neigh *n, uint16_t ipa_len, + const struct ipaddr *ipaddr, uint8_t flags, uint32_t seq, + const esi_t *esi, struct sync_mac_ip_ctx *ctx) { struct interface *ifp = NULL; bool is_router; @@ -818,7 +818,7 @@ zebra_evpn_proc_sync_neigh_update(struct zebra_evpn *zevpn, zebra_neigh_t *n, * Uninstall remote neighbor from the kernel. */ static int zebra_evpn_neigh_uninstall(struct zebra_evpn *zevpn, - zebra_neigh_t *n) + struct zebra_neigh *n) { struct interface *vlan_if; @@ -844,7 +844,7 @@ static void zebra_evpn_neigh_del_hash_entry(struct hash_bucket *bucket, void *arg) { struct neigh_walk_ctx *wctx = arg; - zebra_neigh_t *n = bucket->data; + struct zebra_neigh *n = bucket->data; if (((wctx->flags & DEL_LOCAL_NEIGH) && (n->flags & ZEBRA_NEIGH_LOCAL)) || ((wctx->flags & DEL_REMOTE_NEIGH) @@ -897,11 +897,11 @@ void zebra_evpn_neigh_del_all(struct zebra_evpn *zevpn, int uninstall, /* * Look up neighbor hash entry. */ -zebra_neigh_t *zebra_evpn_neigh_lookup(struct zebra_evpn *zevpn, - const struct ipaddr *ip) +struct zebra_neigh *zebra_evpn_neigh_lookup(struct zebra_evpn *zevpn, + const struct ipaddr *ip) { - zebra_neigh_t tmp; - zebra_neigh_t *n; + struct zebra_neigh tmp; + struct zebra_neigh *n; memset(&tmp, 0, sizeof(tmp)); memcpy(&tmp.ip, ip, sizeof(struct ipaddr)); @@ -919,7 +919,7 @@ void zebra_evpn_process_neigh_on_local_mac_change(struct zebra_evpn *zevpn, bool seq_change, bool es_change) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct listnode *node = NULL; struct zebra_vrf *zvrf = NULL; @@ -961,7 +961,7 @@ void zebra_evpn_process_neigh_on_local_mac_change(struct zebra_evpn *zevpn, void zebra_evpn_process_neigh_on_local_mac_del(struct zebra_evpn *zevpn, struct zebra_mac *zmac) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct listnode *node = NULL; if (IS_ZEBRA_DEBUG_VXLAN) @@ -994,7 +994,7 @@ void zebra_evpn_process_neigh_on_local_mac_del(struct zebra_evpn *zevpn, void zebra_evpn_process_neigh_on_remote_mac_add(struct zebra_evpn *zevpn, struct zebra_mac *zmac) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct listnode *node = NULL; if (IS_ZEBRA_DEBUG_VXLAN) @@ -1028,9 +1028,9 @@ void zebra_evpn_process_neigh_on_remote_mac_del(struct zebra_evpn *zevpn, } static inline void zebra_evpn_local_neigh_update_log( - const char *pfx, zebra_neigh_t *n, bool is_router, bool local_inactive, - bool old_bgp_ready, bool new_bgp_ready, bool inform_dataplane, - bool inform_bgp, const char *sfx) + const char *pfx, struct zebra_neigh *n, bool is_router, + bool local_inactive, bool old_bgp_ready, bool new_bgp_ready, + bool inform_dataplane, bool inform_bgp, const char *sfx) { if (!IS_ZEBRA_DEBUG_EVPN_MH_NEIGH) return; @@ -1052,7 +1052,7 @@ static inline void zebra_evpn_local_neigh_update_log( static int zebra_evpn_ip_inherit_dad_from_mac(struct zebra_vrf *zvrf, struct zebra_mac *old_zmac, struct zebra_mac *new_zmac, - zebra_neigh_t *nbr) + struct zebra_neigh *nbr) { bool is_old_mac_dup = false; bool is_new_mac_dup = false; @@ -1095,7 +1095,7 @@ static int zebra_evpn_ip_inherit_dad_from_mac(struct zebra_vrf *zvrf, static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) { struct zebra_vrf *zvrf = NULL; - zebra_neigh_t *nbr = NULL; + struct zebra_neigh *nbr = NULL; struct zebra_evpn *zevpn = NULL; nbr = THREAD_ARG(t); @@ -1139,10 +1139,9 @@ static int zebra_evpn_dad_ip_auto_recovery_exp(struct thread *t) return 0; } -static void -zebra_evpn_dup_addr_detect_for_neigh(struct zebra_vrf *zvrf, zebra_neigh_t *nbr, - struct in_addr vtep_ip, bool do_dad, - bool *is_dup_detect, bool is_local) +static void zebra_evpn_dup_addr_detect_for_neigh( + struct zebra_vrf *zvrf, struct zebra_neigh *nbr, struct in_addr vtep_ip, + bool do_dad, bool *is_dup_detect, bool is_local) { struct timeval elapsed = {0, 0}; @@ -1263,7 +1262,7 @@ int zebra_evpn_local_neigh_update(struct zebra_evpn *zevpn, bool local_inactive, bool dp_static) { struct zebra_vrf *zvrf; - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct zebra_mac *zmac = NULL, *old_zmac = NULL; uint32_t old_mac_seq = 0, mac_new_seq = 0; bool upd_mac_seq = false; @@ -1605,7 +1604,7 @@ int zebra_evpn_remote_neigh_update(struct zebra_evpn *zevpn, const struct ethaddr *macaddr, uint16_t state) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct zebra_mac *zmac = NULL; /* If the neighbor is unknown, there is no further action. */ @@ -1649,7 +1648,7 @@ zebra_evpn_send_neigh_hash_entry_to_client(struct hash_bucket *bucket, void *arg) { struct mac_walk_ctx *wctx = arg; - zebra_neigh_t *zn = bucket->data; + struct zebra_neigh *zn = bucket->data; struct zebra_mac *zmac = NULL; if (CHECK_FLAG(zn->flags, ZEBRA_NEIGH_DEF_GW)) @@ -1682,11 +1681,11 @@ void zebra_evpn_send_neigh_to_client(struct zebra_evpn *zevpn) void zebra_evpn_clear_dup_neigh_hash(struct hash_bucket *bucket, void *ctxt) { struct neigh_walk_ctx *wctx = ctxt; - zebra_neigh_t *nbr; + struct zebra_neigh *nbr; struct zebra_evpn *zevpn; char buf[INET6_ADDRSTRLEN]; - nbr = (zebra_neigh_t *)bucket->data; + nbr = (struct zebra_neigh *)bucket->data; if (!nbr) return; @@ -1720,7 +1719,8 @@ void zebra_evpn_clear_dup_neigh_hash(struct hash_bucket *bucket, void *ctxt) /* * Print a specific neighbor entry. */ -void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json) +void zebra_evpn_print_neigh(struct zebra_neigh *n, void *ctxt, + json_object *json) { struct vty *vty; char buf1[ETHER_ADDR_STRLEN]; @@ -1875,8 +1875,9 @@ void zebra_evpn_print_neigh_hdr(struct vty *vty, struct neigh_walk_ctx *wctx) "Seq #'s"); } -static char *zebra_evpn_print_neigh_flags(zebra_neigh_t *n, char *flags_buf, - uint32_t flags_buf_sz) +static char *zebra_evpn_print_neigh_flags(struct zebra_neigh *n, + char *flags_buf, + uint32_t flags_buf_sz) { snprintf(flags_buf, flags_buf_sz, "%s%s%s", (n->flags & ZEBRA_NEIGH_ES_PEER_ACTIVE) ? @@ -1896,7 +1897,7 @@ void zebra_evpn_print_neigh_hash(struct hash_bucket *bucket, void *ctxt) { struct vty *vty; json_object *json_evpn = NULL, *json_row = NULL; - zebra_neigh_t *n; + struct zebra_neigh *n; char buf1[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; char addr_buf[PREFIX_STRLEN]; @@ -1906,7 +1907,7 @@ void zebra_evpn_print_neigh_hash(struct hash_bucket *bucket, void *ctxt) vty = wctx->vty; json_evpn = wctx->json; - n = (zebra_neigh_t *)bucket->data; + n = (struct zebra_neigh *)bucket->data; if (json_evpn) json_row = json_object_new_object(); @@ -2007,13 +2008,13 @@ void zebra_evpn_print_neigh_hash_detail(struct hash_bucket *bucket, void *ctxt) { struct vty *vty; json_object *json_evpn = NULL, *json_row = NULL; - zebra_neigh_t *n; + struct zebra_neigh *n; char buf[INET6_ADDRSTRLEN]; struct neigh_walk_ctx *wctx = ctxt; vty = wctx->vty; json_evpn = wctx->json; - n = (zebra_neigh_t *)bucket->data; + n = (struct zebra_neigh *)bucket->data; if (!n) return; @@ -2029,9 +2030,9 @@ void zebra_evpn_print_neigh_hash_detail(struct hash_bucket *bucket, void *ctxt) void zebra_evpn_print_dad_neigh_hash(struct hash_bucket *bucket, void *ctxt) { - zebra_neigh_t *nbr; + struct zebra_neigh *nbr; - nbr = (zebra_neigh_t *)bucket->data; + nbr = (struct zebra_neigh *)bucket->data; if (!nbr) return; @@ -2042,9 +2043,9 @@ void zebra_evpn_print_dad_neigh_hash(struct hash_bucket *bucket, void *ctxt) void zebra_evpn_print_dad_neigh_hash_detail(struct hash_bucket *bucket, void *ctxt) { - zebra_neigh_t *nbr; + struct zebra_neigh *nbr; - nbr = (zebra_neigh_t *)bucket->data; + nbr = (struct zebra_neigh *)bucket->data; if (!nbr) return; @@ -2059,7 +2060,7 @@ void zebra_evpn_neigh_remote_macip_add(struct zebra_evpn *zevpn, struct in_addr vtep_ip, uint8_t flags, uint32_t seq) { - zebra_neigh_t *n; + struct zebra_neigh *n; int update_neigh = 0; struct zebra_mac *old_mac = NULL; bool old_static = false; @@ -2191,7 +2192,7 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, struct ipaddr *ip, struct zebra_mac *mac) { - zebra_neigh_t *n; + struct zebra_neigh *n; assert(mac); @@ -2248,7 +2249,8 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, } void zebra_evpn_neigh_remote_uninstall(struct zebra_evpn *zevpn, - struct zebra_vrf *zvrf, zebra_neigh_t *n, + struct zebra_vrf *zvrf, + struct zebra_neigh *n, struct zebra_mac *mac, const struct ipaddr *ipaddr) { @@ -2285,7 +2287,7 @@ void zebra_evpn_neigh_remote_uninstall(struct zebra_evpn *zevpn, int zebra_evpn_neigh_del_ip(struct zebra_evpn *zevpn, const struct ipaddr *ip) { - zebra_neigh_t *n; + struct zebra_neigh *n; struct zebra_mac *zmac; bool old_bgp_ready; bool new_bgp_ready; diff --git a/zebra/zebra_evpn_neigh.h b/zebra/zebra_evpn_neigh.h index 2af24fddb7..c779109e0a 100644 --- a/zebra/zebra_evpn_neigh.h +++ b/zebra/zebra_evpn_neigh.h @@ -29,8 +29,6 @@ extern "C" { #endif -typedef struct zebra_neigh_t_ zebra_neigh_t; - #define IS_ZEBRA_NEIGH_ACTIVE(n) (n->state == ZEBRA_NEIGH_ACTIVE) #define IS_ZEBRA_NEIGH_INACTIVE(n) (n->state == ZEBRA_NEIGH_INACTIVE) @@ -50,7 +48,7 @@ typedef struct zebra_neigh_t_ zebra_neigh_t; * it is sufficient for zebra to maintain against the VNI. The correct * VNI will be obtained as zebra maintains the mapping (of VLAN to VNI). */ -struct zebra_neigh_t_ { +struct zebra_neigh { /* IP address. */ struct ipaddr ip; @@ -144,12 +142,12 @@ struct neigh_walk_ctx { }; /**************************** SYNC neigh handling **************************/ -static inline bool zebra_evpn_neigh_is_static(zebra_neigh_t *neigh) +static inline bool zebra_evpn_neigh_is_static(struct zebra_neigh *neigh) { return !!(neigh->flags & ZEBRA_NEIGH_ALL_PEER_FLAGS); } -static inline bool zebra_evpn_neigh_is_ready_for_bgp(zebra_neigh_t *n) +static inline bool zebra_evpn_neigh_is_ready_for_bgp(struct zebra_neigh *n) { bool mac_ready; bool neigh_ready; @@ -165,7 +163,7 @@ static inline bool zebra_evpn_neigh_is_ready_for_bgp(zebra_neigh_t *n) return mac_ready && neigh_ready; } -static inline void zebra_evpn_neigh_stop_hold_timer(zebra_neigh_t *n) +static inline void zebra_evpn_neigh_stop_hold_timer(struct zebra_neigh *n) { if (!n->hold_timer) return; @@ -176,11 +174,11 @@ static inline void zebra_evpn_neigh_stop_hold_timer(zebra_neigh_t *n) THREAD_OFF(n->hold_timer); } -void zebra_evpn_sync_neigh_static_chg(zebra_neigh_t *n, bool old_n_static, +void zebra_evpn_sync_neigh_static_chg(struct zebra_neigh *n, bool old_n_static, bool new_n_static, bool defer_n_dp, bool defer_mac_dp, const char *caller); -static inline bool zebra_evpn_neigh_clear_sync_info(zebra_neigh_t *n) +static inline bool zebra_evpn_neigh_clear_sync_info(struct zebra_neigh *n) { bool old_n_static = false; bool new_n_static = false; @@ -214,8 +212,8 @@ struct hash *zebra_neigh_db_create(const char *desc); uint32_t num_dup_detected_neighs(struct zebra_evpn *zevpn); void zebra_evpn_find_neigh_addr_width(struct hash_bucket *bucket, void *ctxt); int remote_neigh_count(struct zebra_mac *zmac); -int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, zebra_neigh_t *n, - bool was_static); +int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, + struct zebra_neigh *n, bool was_static); void zebra_evpn_install_neigh_hash(struct hash_bucket *bucket, void *ctxt); int zebra_evpn_neigh_send_add_to_client(vni_t vni, const struct ipaddr *ip, const struct ethaddr *macaddr, @@ -224,23 +222,23 @@ int zebra_evpn_neigh_send_add_to_client(vni_t vni, const struct ipaddr *ip, int zebra_evpn_neigh_send_del_to_client(vni_t vni, struct ipaddr *ip, struct ethaddr *macaddr, uint32_t flags, int state, bool force); -bool zebra_evpn_neigh_is_bgp_seq_ok(struct zebra_evpn *zevpn, zebra_neigh_t *n, +bool zebra_evpn_neigh_is_bgp_seq_ok(struct zebra_evpn *zevpn, + struct zebra_neigh *n, const struct ethaddr *macaddr, uint32_t seq, bool sync); -int zebra_evpn_neigh_del(struct zebra_evpn *zevpn, zebra_neigh_t *n); -void zebra_evpn_sync_neigh_del(zebra_neigh_t *n); -zebra_neigh_t * -zebra_evpn_proc_sync_neigh_update(struct zebra_evpn *zevpn, zebra_neigh_t *n, - uint16_t ipa_len, const struct ipaddr *ipaddr, - uint8_t flags, uint32_t seq, const esi_t *esi, - struct sync_mac_ip_ctx *ctx); +int zebra_evpn_neigh_del(struct zebra_evpn *zevpn, struct zebra_neigh *n); +void zebra_evpn_sync_neigh_del(struct zebra_neigh *n); +struct zebra_neigh *zebra_evpn_proc_sync_neigh_update( + struct zebra_evpn *zevpn, struct zebra_neigh *n, uint16_t ipa_len, + const struct ipaddr *ipaddr, uint8_t flags, uint32_t seq, + const esi_t *esi, struct sync_mac_ip_ctx *ctx); void zebra_evpn_neigh_del_all(struct zebra_evpn *zevpn, int uninstall, int upd_client, uint32_t flags); -zebra_neigh_t *zebra_evpn_neigh_lookup(struct zebra_evpn *zevpn, - const struct ipaddr *ip); +struct zebra_neigh *zebra_evpn_neigh_lookup(struct zebra_evpn *zevpn, + const struct ipaddr *ip); -int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, zebra_neigh_t *n, - bool was_static); +int zebra_evpn_rem_neigh_install(struct zebra_evpn *zevpn, + struct zebra_neigh *n, bool was_static); void zebra_evpn_process_neigh_on_remote_mac_add(struct zebra_evpn *zevpn, struct zebra_mac *zmac); void zebra_evpn_process_neigh_on_local_mac_del(struct zebra_evpn *zevpn, @@ -263,7 +261,8 @@ int zebra_evpn_remote_neigh_update(struct zebra_evpn *zevpn, uint16_t state); void zebra_evpn_send_neigh_to_client(struct zebra_evpn *zevpn); void zebra_evpn_clear_dup_neigh_hash(struct hash_bucket *bucket, void *ctxt); -void zebra_evpn_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json); +void zebra_evpn_print_neigh(struct zebra_neigh *n, void *ctxt, + json_object *json); void zebra_evpn_print_neigh_hash(struct hash_bucket *bucket, void *ctxt); void zebra_evpn_print_neigh_hdr(struct vty *vty, struct neigh_walk_ctx *wctx); void zebra_evpn_print_neigh_hash_detail(struct hash_bucket *bucket, void *ctxt); @@ -280,7 +279,8 @@ int zebra_evpn_neigh_gw_macip_add(struct interface *ifp, struct zebra_evpn *zevpn, struct ipaddr *ip, struct zebra_mac *mac); void zebra_evpn_neigh_remote_uninstall(struct zebra_evpn *zevpn, - struct zebra_vrf *zvrf, zebra_neigh_t *n, + struct zebra_vrf *zvrf, + struct zebra_neigh *n, struct zebra_mac *mac, const struct ipaddr *ipaddr); int zebra_evpn_neigh_del_ip(struct zebra_evpn *zevpn, const struct ipaddr *ip); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 3a686daf8e..aede4098b4 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -71,22 +71,23 @@ DEFINE_HOOK(zebra_rmac_update, /* static function declarations */ static void zevpn_print_neigh_hash_all_evpn(struct hash_bucket *bucket, void **args); -static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty, +static void zl3vni_print_nh(struct zebra_neigh *n, struct vty *vty, json_object *json); static void zl3vni_print_rmac(struct zebra_mac *zrmac, struct vty *vty, json_object *json); static void zevpn_print_mac_hash_all_evpn(struct hash_bucket *bucket, void *ctxt); /* l3-vni next-hop neigh related APIs */ -static zebra_neigh_t *zl3vni_nh_lookup(struct zebra_l3vni *zl3vni, - const struct ipaddr *ip); +static struct zebra_neigh *zl3vni_nh_lookup(struct zebra_l3vni *zl3vni, + const struct ipaddr *ip); static void *zl3vni_nh_alloc(void *p); -static zebra_neigh_t *zl3vni_nh_add(struct zebra_l3vni *zl3vni, - const struct ipaddr *vtep_ip, - const struct ethaddr *rmac); -static int zl3vni_nh_del(struct zebra_l3vni *zl3vni, zebra_neigh_t *n); -static int zl3vni_nh_install(struct zebra_l3vni *zl3vni, zebra_neigh_t *n); -static int zl3vni_nh_uninstall(struct zebra_l3vni *zl3vni, zebra_neigh_t *n); +static struct zebra_neigh *zl3vni_nh_add(struct zebra_l3vni *zl3vni, + const struct ipaddr *vtep_ip, + const struct ethaddr *rmac); +static int zl3vni_nh_del(struct zebra_l3vni *zl3vni, struct zebra_neigh *n); +static int zl3vni_nh_install(struct zebra_l3vni *zl3vni, struct zebra_neigh *n); +static int zl3vni_nh_uninstall(struct zebra_l3vni *zl3vni, + struct zebra_neigh *n); /* l3-vni rmac related APIs */ static void zl3vni_print_rmac_hash(struct hash_bucket *, void *); @@ -326,7 +327,7 @@ static void zevpn_print_neigh_hash_all_evpn_detail(struct hash_bucket *bucket, } /* print a specific next hop for an l3vni */ -static void zl3vni_print_nh(zebra_neigh_t *n, struct vty *vty, +static void zl3vni_print_nh(struct zebra_neigh *n, struct vty *vty, json_object *json) { char buf1[ETHER_ADDR_STRLEN]; @@ -546,7 +547,7 @@ static void zl3vni_print_nh_hash(struct hash_bucket *bucket, void *ctx) struct vty *vty = NULL; struct json_object *json_evpn = NULL; struct json_object *json_nh = NULL; - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; char buf1[ETHER_ADDR_STRLEN]; char buf2[INET6_ADDRSTRLEN]; @@ -555,7 +556,7 @@ static void zl3vni_print_nh_hash(struct hash_bucket *bucket, void *ctx) json_evpn = wctx->json; if (json_evpn) json_nh = json_object_new_object(); - n = (zebra_neigh_t *)bucket->data; + n = (struct zebra_neigh *)bucket->data; if (!json_evpn) { vty_out(vty, "%-15s %-17s\n", @@ -1368,11 +1369,11 @@ static void zl3vni_remote_rmac_del(struct zebra_l3vni *zl3vni, /* * Look up nh hash entry on a l3-vni. */ -static zebra_neigh_t *zl3vni_nh_lookup(struct zebra_l3vni *zl3vni, - const struct ipaddr *ip) +static struct zebra_neigh *zl3vni_nh_lookup(struct zebra_l3vni *zl3vni, + const struct ipaddr *ip) { - zebra_neigh_t tmp; - zebra_neigh_t *n; + struct zebra_neigh tmp; + struct zebra_neigh *n; memset(&tmp, 0, sizeof(tmp)); memcpy(&tmp.ip, ip, sizeof(struct ipaddr)); @@ -1387,10 +1388,10 @@ static zebra_neigh_t *zl3vni_nh_lookup(struct zebra_l3vni *zl3vni, */ static void *zl3vni_nh_alloc(void *p) { - const zebra_neigh_t *tmp_n = p; - zebra_neigh_t *n; + const struct zebra_neigh *tmp_n = p; + struct zebra_neigh *n; - n = XCALLOC(MTYPE_L3NEIGH, sizeof(zebra_neigh_t)); + n = XCALLOC(MTYPE_L3NEIGH, sizeof(struct zebra_neigh)); *n = *tmp_n; return ((void *)n); @@ -1399,14 +1400,14 @@ static void *zl3vni_nh_alloc(void *p) /* * Add neighbor entry. */ -static zebra_neigh_t *zl3vni_nh_add(struct zebra_l3vni *zl3vni, - const struct ipaddr *ip, - const struct ethaddr *mac) +static struct zebra_neigh *zl3vni_nh_add(struct zebra_l3vni *zl3vni, + const struct ipaddr *ip, + const struct ethaddr *mac) { - zebra_neigh_t tmp_n; - zebra_neigh_t *n = NULL; + struct zebra_neigh tmp_n; + struct zebra_neigh *n = NULL; - memset(&tmp_n, 0, sizeof(zebra_neigh_t)); + memset(&tmp_n, 0, sizeof(struct zebra_neigh)); memcpy(&tmp_n.ip, ip, sizeof(struct ipaddr)); n = hash_get(zl3vni->nh_table, &tmp_n, zl3vni_nh_alloc); assert(n); @@ -1423,9 +1424,9 @@ static zebra_neigh_t *zl3vni_nh_add(struct zebra_l3vni *zl3vni, /* * Delete neighbor entry. */ -static int zl3vni_nh_del(struct zebra_l3vni *zl3vni, zebra_neigh_t *n) +static int zl3vni_nh_del(struct zebra_l3vni *zl3vni, struct zebra_neigh *n) { - zebra_neigh_t *tmp_n; + struct zebra_neigh *tmp_n; struct host_rb_entry *hle; while (!RB_EMPTY(host_rb_tree_entry, &n->host_rb)) { @@ -1444,7 +1445,7 @@ static int zl3vni_nh_del(struct zebra_l3vni *zl3vni, zebra_neigh_t *n) /* * Install remote nh as neigh into the kernel. */ -static int zl3vni_nh_install(struct zebra_l3vni *zl3vni, zebra_neigh_t *n) +static int zl3vni_nh_install(struct zebra_l3vni *zl3vni, struct zebra_neigh *n) { uint8_t flags; int ret = 0; @@ -1469,7 +1470,8 @@ static int zl3vni_nh_install(struct zebra_l3vni *zl3vni, zebra_neigh_t *n) /* * Uninstall remote nh from the kernel. */ -static int zl3vni_nh_uninstall(struct zebra_l3vni *zl3vni, zebra_neigh_t *n) +static int zl3vni_nh_uninstall(struct zebra_l3vni *zl3vni, + struct zebra_neigh *n) { if (!(n->flags & ZEBRA_NEIGH_REMOTE) || !(n->flags & ZEBRA_NEIGH_REMOTE_NH)) @@ -1489,7 +1491,7 @@ static int zl3vni_remote_nh_add(struct zebra_l3vni *zl3vni, const struct ethaddr *rmac, const struct prefix *host_prefix) { - zebra_neigh_t *nh = NULL; + struct zebra_neigh *nh = NULL; /* Create the next hop entry, or update its mac, if necessary. */ nh = zl3vni_nh_lookup(zl3vni, vtep_ip); @@ -1522,7 +1524,8 @@ static int zl3vni_remote_nh_add(struct zebra_l3vni *zl3vni, } /* handle nh neigh delete */ -static void zl3vni_remote_nh_del(struct zebra_l3vni *zl3vni, zebra_neigh_t *nh, +static void zl3vni_remote_nh_del(struct zebra_l3vni *zl3vni, + struct zebra_neigh *nh, struct prefix *host_prefix) { rb_delete_host(&nh->host_rb, host_prefix); @@ -1543,7 +1546,7 @@ static int zl3vni_local_nh_add_update(struct zebra_l3vni *zl3vni, struct ipaddr *ip, uint16_t state) { #ifdef GNU_LINUX - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; n = zl3vni_nh_lookup(zl3vni, ip); if (!n) @@ -1561,7 +1564,7 @@ static int zl3vni_local_nh_add_update(struct zebra_l3vni *zl3vni, /* handle neigh delete from kernel */ static int zl3vni_local_nh_del(struct zebra_l3vni *zl3vni, struct ipaddr *ip) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; n = zl3vni_nh_lookup(zl3vni, ip); if (!n) @@ -2153,10 +2156,10 @@ static void zl3vni_del_rmac_hash_entry(struct hash_bucket *bucket, void *ctx) /* delete and uninstall nh hash entry */ static void zl3vni_del_nh_hash_entry(struct hash_bucket *bucket, void *ctx) { - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; struct zebra_l3vni *zl3vni = NULL; - n = (zebra_neigh_t *)bucket->data; + n = (struct zebra_neigh *)bucket->data; zl3vni = (struct zebra_l3vni *)ctx; zl3vni_nh_uninstall(zl3vni, n); zl3vni_nh_del(zl3vni, n); @@ -2238,7 +2241,7 @@ void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id, struct prefix *host_prefix) { struct zebra_l3vni *zl3vni = NULL; - zebra_neigh_t *nh = NULL; + struct zebra_neigh *nh = NULL; struct zebra_mac *zrmac = NULL; zl3vni = zl3vni_from_vrf(vrf_id); @@ -2381,7 +2384,7 @@ void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni, struct ipaddr *ip, bool use_json) { struct zebra_l3vni *zl3vni = NULL; - zebra_neigh_t *n = NULL; + struct zebra_neigh *n = NULL; json_object *json = NULL; if (!is_evpn_enabled()) { @@ -2692,7 +2695,7 @@ void zebra_vxlan_print_specific_neigh_vni(struct vty *vty, struct ipaddr *ip, bool use_json) { struct zebra_evpn *zevpn; - zebra_neigh_t *n; + struct zebra_neigh *n; json_object *json = NULL; if (!is_evpn_enabled()) @@ -3097,7 +3100,7 @@ int zebra_vxlan_clear_dup_detect_vni_mac(struct zebra_vrf *zvrf, vni_t vni, struct zebra_evpn *zevpn; struct zebra_mac *mac; struct listnode *node = NULL; - zebra_neigh_t *nbr = NULL; + struct zebra_neigh *nbr = NULL; if (!is_evpn_enabled()) return 0; @@ -3183,7 +3186,7 @@ int zebra_vxlan_clear_dup_detect_vni_ip(struct zebra_vrf *zvrf, vni_t vni, size_t errmsg_len) { struct zebra_evpn *zevpn; - zebra_neigh_t *nbr; + struct zebra_neigh *nbr; struct zebra_mac *mac; char buf[INET6_ADDRSTRLEN]; char buf2[ETHER_ADDR_STRLEN]; @@ -3251,7 +3254,7 @@ static void zevpn_clear_dup_mac_hash(struct hash_bucket *bucket, void *ctxt) struct zebra_mac *mac; struct zebra_evpn *zevpn; struct listnode *node = NULL; - zebra_neigh_t *nbr = NULL; + struct zebra_neigh *nbr = NULL; mac = (struct zebra_mac *)bucket->data; if (!mac)