From 54c174250c381580b0477e6eade2c03c4109ed64 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Mon, 13 Aug 2018 17:07:22 -0700 Subject: [PATCH] zebra: mark router flag for neigh update The neigh update can come prior to mac add update. In this case, the mac will be auto created for the vni. set router flag to local neigh update for mac with auto flag. The neigh update will be informed to bgpd once local mac is learnt. Unset router flag if the neigh update comes without the router flag for an existing neigh entry. Signed-off-by: Chirag Shah --- zebra/zebra_vxlan.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 04f9be8ade..a4f5f7b954 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -2060,6 +2060,12 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni, n->ifindex = ifp->ifindex; } + /*Mark Router flag (R-bit) */ + if (router_flag) + SET_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG); + else + UNSET_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG); + /* Before we program this in BGP, we need to check if MAC is locally * learnt as well */ @@ -2074,10 +2080,6 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni, return 0; } - /*Set router flag (R-bit) */ - if (router_flag) - SET_FLAG(n->flags, ZEBRA_NEIGH_ROUTER_FLAG); - /* Inform BGP. */ if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug("Neigh %s (MAC %s) is now ACTIVE on L2-VNI %u with flags 0x%x", @@ -4965,10 +4967,11 @@ int zebra_vxlan_handle_kernel_neigh_update(struct interface *ifp, if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( - "Add/Update neighbor %s MAC %s intf %s(%u) state 0x%x %s-> L2-VNI %u", + "Add/Update neighbor %s MAC %s intf %s(%u) state 0x%x %s %s-> L2-VNI %u", ipaddr2str(ip, buf2, sizeof(buf2)), prefix_mac2str(macaddr, buf, sizeof(buf)), ifp->name, ifp->ifindex, state, ext_learned ? "ext-learned " : "", + router_flag ? "router " : "", zvni->vni); /* Is this about a local neighbor or a remote one? */