Skip to content

Commit

Permalink
Merge pull request #17433 from donaldsharp/zebra_debug_assert
Browse files Browse the repository at this point in the history
Zebra debug assert
  • Loading branch information
Jafaral authored Nov 15, 2024
2 parents 345ab24 + 8a71bf9 commit 076879a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 60 deletions.
5 changes: 3 additions & 2 deletions zebra/zebra_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,9 @@ int zebra_evpn_vtep_install(struct zebra_evpn *zevpn, struct zebra_vtep *zvtep)
int zebra_evpn_vtep_uninstall(struct zebra_evpn *zevpn, struct in_addr *vtep_ip)
{
if (!zevpn->vxlan_if) {
zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
zevpn->vni, zevpn);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("VNI %u hash %p couldn't be uninstalled - no intf",
zevpn->vni, zevpn);
return -1;
}

Expand Down
119 changes: 61 additions & 58 deletions zebra/zebra_vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ static int host_rb_entry_compare(const struct host_rb_entry *hle1,

return 0;
} else {
zlog_debug("%s: Unexpected family type: %d", __func__,
hle1->p.family);
assert(!"Received unexpected family type, dev escape");
return 0;
}
}
Expand Down Expand Up @@ -1015,9 +1014,9 @@ static int zevpn_build_vni_hash_table(struct zebra_if *zif,
} else {
zevpn = zebra_evpn_add(vni);
if (!zevpn) {
zlog_debug(
"Failed to add EVPN hash, IF %s(%u) L2-VNI %u",
ifp->name, ifp->ifindex, vni);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Failed to add EVPN hash, IF %s(%u) L2-VNI %u",
ifp->name, ifp->ifindex, vni);
return 0;
}

Expand Down Expand Up @@ -1354,9 +1353,9 @@ static int zl3vni_remote_rmac_add(struct zebra_l3vni *zl3vni,
/* Create the RMAC entry, or update its vtep, if necessary. */
zrmac = zl3vni_rmac_add(zl3vni, rmac);
if (!zrmac) {
zlog_debug(
"Failed to add RMAC %pEA L3VNI %u Remote VTEP %pIA",
rmac, zl3vni->vni, vtep_ip);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Failed to add RMAC %pEA L3VNI %u Remote VTEP %pIA",
rmac, zl3vni->vni, vtep_ip);
return -1;
}
memset(&zrmac->fwd_info, 0, sizeof(zrmac->fwd_info));
Expand Down Expand Up @@ -1678,9 +1677,9 @@ static int zl3vni_remote_nh_add(struct zebra_l3vni *zl3vni,
if (!nh) {
nh = zl3vni_nh_add(zl3vni, vtep_ip, rmac);
if (!nh) {
zlog_debug(
"Failed to add NH %pIA as Neigh (RMAC %pEA L3-VNI %u prefix %pFX)",
vtep_ip, rmac, zl3vni->vni, host_prefix);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Failed to add NH %pIA as Neigh (RMAC %pEA L3-VNI %u prefix %pFX)",
vtep_ip, rmac, zl3vni->vni, host_prefix);
return -1;
}

Expand Down Expand Up @@ -1736,9 +1735,9 @@ static int svd_remote_nh_add(struct zebra_l3vni *zl3vni,
if (!nh) {
nh = svd_nh_add(vtep_ip, rmac);
if (!nh) {
zlog_debug(
"Failed to add NH %pIA as SVD Neigh (RMAC %pEA prefix %pFX)",
vtep_ip, rmac, host_prefix);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Failed to add NH %pIA as SVD Neigh (RMAC %pEA prefix %pFX)",
vtep_ip, rmac, host_prefix);
return -1;
}

Expand Down Expand Up @@ -1784,7 +1783,8 @@ static int svd_remote_nh_del(struct zebra_l3vni *zl3vni,

nh = svd_nh_lookup(vtep_ip);
if (!nh) {
zlog_debug("Failed to del NH %pIA as SVD Neigh", vtep_ip);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Failed to del NH %pIA as SVD Neigh", vtep_ip);

return -1;
}
Expand Down Expand Up @@ -4082,9 +4082,9 @@ int zebra_vxlan_handle_kernel_neigh_del(struct interface *ifp,
}

if (!zevpn->vxlan_if) {
zlog_debug(
"VNI %u hash %p doesn't have intf upon local neighbor DEL",
zevpn->vni, zevpn);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("VNI %u hash %p doesn't have intf upon local neighbor DEL",
zevpn->vni, zevpn);
return -1;
}

Expand Down Expand Up @@ -4258,7 +4258,8 @@ void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS)
char esi_buf[ESI_STR_LEN];

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("EVPN not enabled, ignoring remote MACIP ADD");
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("EVPN not enabled, ignoring remote MACIP ADD");
return;
}

Expand Down Expand Up @@ -4530,9 +4531,9 @@ int zebra_vxlan_local_mac_del(struct interface *ifp, struct interface *br_if,
if (!zevpn)
return 0;
if (!zevpn->vxlan_if) {
zlog_debug(
"VNI %u hash %p doesn't have intf upon local MAC DEL",
zevpn->vni, zevpn);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("VNI %u hash %p doesn't have intf upon local MAC DEL",
zevpn->vni, zevpn);
return -1;
}

Expand Down Expand Up @@ -4600,15 +4601,15 @@ void zebra_vxlan_remote_vtep_del_zapi(ZAPI_HANDLER_ARGS)
struct in_addr vtep_ip;

if (!is_evpn_enabled()) {
zlog_debug(
"%s: EVPN is not enabled yet we have received a VTEP DEL msg",
__func__);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("%s: EVPN is not enabled yet we have received a VTEP DEL msg",
__func__);
return;
}

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("Recv VTEP DEL zapi for non-EVPN VRF %u",
zvrf_id(zvrf));
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Recv VTEP DEL zapi for non-EVPN VRF %u", zvrf_id(zvrf));
return;
}

Expand Down Expand Up @@ -4653,8 +4654,8 @@ void zebra_vxlan_remote_vtep_del(vrf_id_t vrf_id, vni_t vni,
struct zebra_vrf *zvrf;

if (!is_evpn_enabled()) {
zlog_debug("%s: Can't process vtep del: EVPN is not enabled",
__func__);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("%s: Can't process vtep del: EVPN is not enabled", __func__);
return;
}

Expand All @@ -4663,8 +4664,8 @@ void zebra_vxlan_remote_vtep_del(vrf_id_t vrf_id, vni_t vni,
return;

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("Can't process VTEP DEL for non-EVPN VRF %u",
zvrf_id(zvrf));
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Can't process VTEP DEL for non-EVPN VRF %u", zvrf_id(zvrf));
return;
}

Expand All @@ -4680,9 +4681,9 @@ void zebra_vxlan_remote_vtep_del(vrf_id_t vrf_id, vni_t vni,

ifp = zevpn->vxlan_if;
if (!ifp) {
zlog_debug(
"VNI %u hash %p doesn't have intf upon remote VTEP DEL",
zevpn->vni, zevpn);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("VNI %u hash %p doesn't have intf upon remote VTEP DEL",
zevpn->vni, zevpn);
return;
}
zif = ifp->info;
Expand Down Expand Up @@ -4717,8 +4718,8 @@ void zebra_vxlan_remote_vtep_add(vrf_id_t vrf_id, vni_t vni,
struct zebra_vrf *zvrf;

if (!is_evpn_enabled()) {
zlog_debug("%s: EVPN not enabled: can't process a VTEP ADD",
__func__);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("%s: EVPN not enabled: can't process a VTEP ADD", __func__);
return;
}

Expand All @@ -4727,8 +4728,8 @@ void zebra_vxlan_remote_vtep_add(vrf_id_t vrf_id, vni_t vni,
return;

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("Can't process VTEP ADD for non-EVPN VRF %u",
zvrf_id(zvrf));
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Can't process VTEP ADD for non-EVPN VRF %u", zvrf_id(zvrf));
return;
}

Expand Down Expand Up @@ -4795,15 +4796,15 @@ void zebra_vxlan_remote_vtep_add_zapi(ZAPI_HANDLER_ARGS)
int flood_control;

if (!is_evpn_enabled()) {
zlog_debug(
"%s: EVPN not enabled yet we received a VTEP ADD zapi msg",
__func__);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("%s: EVPN not enabled yet we received a VTEP ADD zapi msg",
__func__);
return;
}

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("Recv VTEP ADD zapi for non-EVPN VRF %u",
zvrf_id(zvrf));
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Recv VTEP ADD zapi for non-EVPN VRF %u", zvrf_id(zvrf));
return;
}

Expand Down Expand Up @@ -4871,8 +4872,9 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, const struct prefix *p,
svi_if = if_lookup_by_index_per_ns(zebra_ns_lookup(NS_DEFAULT),
ifp_zif->link_ifindex);
if (!svi_if) {
zlog_debug("MACVLAN %s(%u) without link information",
ifp->name, ifp->ifindex);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("MACVLAN %s(%u) without link information", ifp->name,
ifp->ifindex);
return -1;
}

Expand Down Expand Up @@ -4920,8 +4922,9 @@ int zebra_vxlan_add_del_gw_macip(struct interface *ifp, const struct prefix *p,
return 0;

if (!zevpn->vxlan_if) {
zlog_debug("VNI %u hash %p doesn't have intf upon MACVLAN up",
zevpn->vni, zevpn);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("VNI %u hash %p doesn't have intf upon MACVLAN up", zevpn->vni,
zevpn);
return -1;
}

Expand Down Expand Up @@ -5038,9 +5041,9 @@ int zebra_vxlan_svi_up(struct interface *ifp, struct interface *link_if)
return 0;

if (!zevpn->vxlan_if) {
zlog_debug(
"VNI %u hash %p doesn't have intf upon SVI up",
zevpn->vni, zevpn);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("VNI %u hash %p doesn't have intf upon SVI up",
zevpn->vni, zevpn);
return -1;
}

Expand Down Expand Up @@ -5350,8 +5353,8 @@ void zebra_vxlan_advertise_svi_macip(ZAPI_HANDLER_ARGS)
struct interface *ifp = NULL;

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("EVPN SVI-MACIP Adv for non-EVPN VRF %u",
zvrf_id(zvrf));
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("EVPN SVI-MACIP Adv for non-EVPN VRF %u", zvrf_id(zvrf));
return;
}

Expand Down Expand Up @@ -5458,8 +5461,8 @@ void zebra_vxlan_advertise_subnet(ZAPI_HANDLER_ARGS)
struct zebra_vxlan_vni *zl2_info_vni = NULL;

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("EVPN GW-MACIP Adv for non-EVPN VRF %u",
zvrf_id(zvrf));
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("EVPN GW-MACIP Adv for non-EVPN VRF %u", zvrf_id(zvrf));
return;
}

Expand Down Expand Up @@ -5523,8 +5526,8 @@ void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS)
struct interface *ifp = NULL;

if (!EVPN_ENABLED(zvrf)) {
zlog_debug("EVPN GW-MACIP Adv for non-EVPN VRF %u",
zvrf_id(zvrf));
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("EVPN GW-MACIP Adv for non-EVPN VRF %u", zvrf_id(zvrf));
return;
}

Expand Down Expand Up @@ -6296,8 +6299,8 @@ void zebra_vlan_dplane_result(struct zebra_dplane_ctx *ctx)

ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), ifindex);
if (!ifp) {
zlog_debug("Cannot find bridge-vlan IF (%u) for vlan update",
ifindex);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Cannot find bridge-vlan IF (%u) for vlan update", ifindex);
return;
}

Expand Down

0 comments on commit 076879a

Please sign in to comment.