diff options
Diffstat (limited to 'zebra/zebra_vxlan.c')
| -rw-r--r-- | zebra/zebra_vxlan.c | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 20dc64b0bc..86a7812780 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -412,7 +412,7 @@ static void zebra_vxlan_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, * this MAC update. */ if (zvrf->dad_freeze) - *is_dup_detect = false; + *is_dup_detect = true; return; } @@ -464,11 +464,6 @@ static void zebra_vxlan_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, if (is_local) mac->dad_count++; - zlog_debug("%s: MAC DAD %s dad_count %u ", - __PRETTY_FUNCTION__, - prefix_mac2str(&mac->macaddr, buf, sizeof(buf)), - mac->dad_count); - if (mac->dad_count >= zvrf->dad_max_moves) { flog_warn(EC_ZEBRA_DUP_MAC_DETECTED, "VNI %u: MAC %s detected as duplicate during %s VTEP %s", @@ -521,11 +516,11 @@ static void zebra_vxlan_dup_addr_detect_for_mac(struct zebra_vrf *zvrf, &mac->dad_mac_auto_recovery_timer); } - /* Do not inform to client (BGPd), + /* In case of local update, do not inform to client (BGPd), * upd_neigh for neigh sequence change. */ if (zvrf->dad_freeze) - *is_dup_detect = false; + *is_dup_detect = true; } } @@ -692,10 +687,11 @@ static void zvni_print_neigh(zebra_neigh_t *n, void *ctxt, json_object *json) struct zebra_vrf *zvrf = NULL; struct timeval detect_start_time = {0, 0}; - zvrf = zebra_vrf_lookup_by_id(n->zvni->vrf_id); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); if (!zvrf) return; + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); ipaddr2str(&n->ip, buf2, sizeof(buf2)); prefix_mac2str(&n->emac, buf1, sizeof(buf1)); type_str = CHECK_FLAG(n->flags, ZEBRA_NEIGH_LOCAL) ? @@ -1140,7 +1136,7 @@ static void zvni_print_mac(zebra_mac_t *mac, void *ctxt, json_object *json) struct zebra_vrf *zvrf; struct timeval detect_start_time = {0, 0}; - zvrf = zebra_vrf_lookup_by_id(mac->zvni->vrf_id); + zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); vty = (struct vty *)ctxt; prefix_mac2str(&mac->macaddr, buf1, sizeof(buf1)); @@ -2301,7 +2297,7 @@ static void zvni_process_neigh_on_local_mac_change(zebra_vni_t *zvni, struct zebra_vrf *zvrf = NULL; char buf[ETHER_ADDR_STRLEN]; - zvrf = vrf_info_lookup(zvni->vrf_id); + zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id); if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug("Processing neighbors on local MAC %s %s, VNI %u", @@ -2896,7 +2892,7 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni, } } - zvrf = vrf_info_lookup(zvni->vrf_id); + zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id); if (!zvrf) return -1; @@ -5176,11 +5172,11 @@ static void process_remote_macip_add(vni_t vni, do_dad, &is_dup_detect, false); - zvni_process_neigh_on_remote_mac_add(zvni, mac); - - /* Install the entry. */ - if (!is_dup_detect) + if (!is_dup_detect) { + zvni_process_neigh_on_remote_mac_add(zvni, mac); + /* Install the entry. */ zvni_mac_install(zvni, mac); + } } /* Update seq number. */ @@ -6386,7 +6382,8 @@ int zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty, * to BGP. Similarly remote macip update, neigh needs to be * installed locally. */ - if (nbr->dad_count) { + if (zvrf->dad_freeze && + CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE)) { if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_LOCAL)) ZEBRA_NEIGH_SET_INACTIVE(nbr); else if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_REMOTE)) @@ -6406,6 +6403,10 @@ int zebra_vxlan_clear_dup_detect_vni_mac(struct vty *vty, mac->dad_dup_detect_time = 0; THREAD_OFF(mac->dad_mac_auto_recovery_timer); + /* warn-only action return */ + if (!zvrf->dad_freeze) + return CMD_SUCCESS; + /* Local: Notify Peer VTEPs, Remote: Install the entry */ if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL)) { /* Inform to BGP */ @@ -6907,8 +6908,8 @@ void zebra_vxlan_dup_addr_detection(ZAPI_HANDLER_ARGS) if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "%s: duplicate detect %s max_moves %u timeout %u freeze %s freeze_time %u", - __PRETTY_FUNCTION__, + "VRF %s duplicate detect %s max_moves %u timeout %u freeze %s freeze_time %u", + vrf_id_to_name(zvrf->vrf->vrf_id), zvrf->dup_addr_detect ? "enable" : "disable", zvrf->dad_max_moves, zvrf->dad_time, @@ -7412,6 +7413,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, bool mac_sticky = false; bool inform_client = false; bool upd_neigh = false; + bool is_dup_detect = false; struct in_addr vtep_ip = {.s_addr = 0}; /* We are interested in MACs only on ports or (port, VLAN) that @@ -7559,8 +7561,12 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, zebra_vxlan_dup_addr_detect_for_mac(zvrf, mac, vtep_ip, do_dad, - &inform_client, + &is_dup_detect, true); + if (is_dup_detect) { + inform_client = false; + upd_neigh = false; + } } } @@ -8899,16 +8905,16 @@ static int zebra_vxlan_dad_ip_auto_recovery_exp(struct thread *t) nbr = THREAD_ARG(t); /* since this is asynchronous we need sanity checks*/ - zvrf = vrf_info_lookup(nbr->zvni->vrf_id); - if (!zvrf) + nbr = zvni_neigh_lookup(zvni, &nbr->ip); + if (!nbr) return 0; zvni = zvni_lookup(nbr->zvni->vni); if (!zvni) return 0; - nbr = zvni_neigh_lookup(zvni, &nbr->ip); - if (!nbr) + zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id); + if (!zvrf) return 0; if (IS_ZEBRA_DEBUG_VXLAN) @@ -8949,16 +8955,16 @@ static int zebra_vxlan_dad_mac_auto_recovery_exp(struct thread *t) mac = THREAD_ARG(t); /* since this is asynchronous we need sanity checks*/ - zvrf = vrf_info_lookup(mac->zvni->vrf_id); - if (!zvrf) + mac = zvni_mac_lookup(zvni, &mac->macaddr); + if (!mac) return 0; zvni = zvni_lookup(mac->zvni->vni); if (!zvni) return 0; - mac = zvni_mac_lookup(zvni, &mac->macaddr); - if (!mac) + zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id); + if (!zvrf) return 0; if (IS_ZEBRA_DEBUG_VXLAN) @@ -8971,7 +8977,7 @@ static int zebra_vxlan_dad_mac_auto_recovery_exp(struct thread *t) /* Remove all IPs as duplicate associcated with this MAC */ for (ALL_LIST_ELEMENTS_RO(mac->neigh_list, node, nbr)) { - if (nbr->dad_count) { + if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_DUPLICATE)) { if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_LOCAL)) ZEBRA_NEIGH_SET_INACTIVE(nbr); else if (CHECK_FLAG(nbr->flags, ZEBRA_NEIGH_REMOTE)) |
