summaryrefslogtreecommitdiff
path: root/zebra/zebra_vxlan.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vxlan.c')
-rw-r--r--zebra/zebra_vxlan.c69
1 files changed, 42 insertions, 27 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 4cd70381c7..00fc230851 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -2213,8 +2213,7 @@ static int zvni_neigh_del(zebra_vni_t *zvni, zebra_neigh_t *n)
/* Free the VNI hash entry and allocated memory. */
tmp_n = hash_release(zvni->neigh_table, n);
- if (tmp_n)
- XFREE(MTYPE_NEIGH, tmp_n);
+ XFREE(MTYPE_NEIGH, tmp_n);
return 0;
}
@@ -2987,8 +2986,12 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni,
}
zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
- if (!zvrf)
+ if (!zvrf) {
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("\tUnable to find vrf for: %d",
+ zvni->vxlan_if->vrf_id);
return -1;
+ }
/* Check if the neighbor exists. */
n = zvni_neigh_lookup(zvni, ip);
@@ -3018,6 +3021,9 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni,
cur_is_router = !!CHECK_FLAG(n->flags,
ZEBRA_NEIGH_ROUTER_FLAG);
if (!mac_different && is_router == cur_is_router) {
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug(
+ "\tIgnoring entry mac is the same and is_router == cur_is_router");
n->ifindex = ifp->ifindex;
return 0;
}
@@ -3046,6 +3052,11 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni,
return zvni_neigh_send_add_to_client(
zvni->vni, ip, macaddr,
n->flags, n->loc_seq);
+ else {
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug(
+ "\tNeighbor active and frozen");
+ }
return 0;
}
@@ -3186,6 +3197,10 @@ static int zvni_local_neigh_update(zebra_vni_t *zvni,
if (!neigh_on_hold)
return zvni_neigh_send_add_to_client(zvni->vni, ip, macaddr,
n->flags, n->loc_seq);
+ else {
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("\tNeighbor on hold not sending");
+ }
return 0;
}
@@ -3309,8 +3324,7 @@ static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac)
/* Free the VNI hash entry and allocated memory. */
tmp_mac = hash_release(zvni->mac_table, mac);
- if (tmp_mac)
- XFREE(MTYPE_MAC, tmp_mac);
+ XFREE(MTYPE_MAC, tmp_mac);
return 0;
}
@@ -3862,8 +3876,7 @@ static int zvni_del(zebra_vni_t *zvni)
/* Free the VNI hash entry and allocated memory. */
tmp_zvni = hash_release(zvrf->vni_table, zvni);
- if (tmp_zvni)
- XFREE(MTYPE_ZVNI, tmp_zvni);
+ XFREE(MTYPE_ZVNI, tmp_zvni);
return 0;
}
@@ -4299,8 +4312,7 @@ static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
}
tmp_rmac = hash_release(zl3vni->rmac_table, zrmac);
- if (tmp_rmac)
- XFREE(MTYPE_MAC, tmp_rmac);
+ XFREE(MTYPE_MAC, tmp_rmac);
return 0;
}
@@ -4476,8 +4488,7 @@ static int zl3vni_nh_del(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
}
tmp_n = hash_release(zl3vni->nh_table, n);
- if (tmp_n)
- XFREE(MTYPE_NEIGH, tmp_n);
+ XFREE(MTYPE_NEIGH, tmp_n);
return 0;
}
@@ -4709,8 +4720,7 @@ static int zl3vni_del(zebra_l3vni_t *zl3vni)
/* Free the VNI hash entry and allocated memory. */
tmp_zl3vni = hash_release(zrouter.l3vni_table, zl3vni);
- if (tmp_zl3vni)
- XFREE(MTYPE_ZL3VNI, tmp_zl3vni);
+ XFREE(MTYPE_ZL3VNI, tmp_zl3vni);
return 0;
}
@@ -7585,7 +7595,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
if (!zvni) {
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
- "Add/Update %sMAC %s intf %s(%u) VID %u, could not find VNI",
+ "\tAdd/Update %sMAC %s intf %s(%u) VID %u, could not find VNI",
sticky ? "sticky " : "",
prefix_mac2str(macaddr, buf, sizeof(buf)),
ifp->name, ifp->ifindex, vid);
@@ -7593,15 +7603,20 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
}
if (!zvni->vxlan_if) {
- zlog_debug(
- "VNI %u hash %p doesn't have intf upon local MAC ADD",
- zvni->vni, zvni);
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug(
+ "\tVNI %u hash %p doesn't have intf upon local MAC ADD",
+ zvni->vni, zvni);
return -1;
}
zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
- if (!zvrf)
+ if (!zvrf) {
+ if (IS_ZEBRA_DEBUG_VXLAN)
+ zlog_debug("\tNo Vrf found for vrf_id: %d",
+ zvni->vxlan_if->vrf_id);
return -1;
+ }
/* Check if we need to create or update or it is a NO-OP. */
mac = zvni_mac_lookup(zvni, macaddr);
@@ -7651,7 +7666,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp,
&& mac->fwd_info.local.vid == vid) {
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
- "Add/Update %sMAC %s intf %s(%u) VID %u -> VNI %u, "
+ "\tAdd/Update %sMAC %s intf %s(%u) VID %u -> VNI %u, "
"entry exists and has not changed ",
sticky ? "sticky " : "",
prefix_mac2str(macaddr, buf,
@@ -9163,16 +9178,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*/
- nbr = zvni_neigh_lookup(zvni, &nbr->ip);
- if (!nbr)
+ zvrf = vrf_info_lookup(nbr->zvni->vrf_id);
+ if (!zvrf)
return 0;
zvni = zvni_lookup(nbr->zvni->vni);
if (!zvni)
return 0;
- zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
- if (!zvrf)
+ nbr = zvni_neigh_lookup(zvni, &nbr->ip);
+ if (!nbr)
return 0;
if (IS_ZEBRA_DEBUG_VXLAN)
@@ -9213,16 +9228,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*/
- mac = zvni_mac_lookup(zvni, &mac->macaddr);
- if (!mac)
+ zvrf = vrf_info_lookup(mac->zvni->vrf_id);
+ if (!zvrf)
return 0;
zvni = zvni_lookup(mac->zvni->vni);
if (!zvni)
return 0;
- zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
- if (!zvrf)
+ mac = zvni_mac_lookup(zvni, &mac->macaddr);
+ if (!mac)
return 0;
if (IS_ZEBRA_DEBUG_VXLAN)