diff options
author | Donald Sharp <donaldsharp72@gmail.com> | 2022-04-05 15:49:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-05 15:49:00 +0200 |
commit | 2c38c8ad35591849912a82db2f99f27001f55c01 (patch) | |
tree | c9f98d14dc3ef53049c97665265586ae29043a5e /zebra/zebra_vxlan.c | |
parent | Merge pull request #10940 from opensourcerouting/pim-5549-clarify (diff) | |
parent | zebra: remove unnecessary check for parsing macfdb (diff) | |
download | frr-2c38c8ad35591849912a82db2f99f27001f55c01.tar.xz frr-2c38c8ad35591849912a82db2f99f27001f55c01.zip |
Merge pull request #10928 from anlancs/zebra-cleanup-1
zebra: use "assert" instead of unnecessary check
Diffstat (limited to 'zebra/zebra_vxlan.c')
-rw-r--r-- | zebra/zebra_vxlan.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 004c89bfa..fc7eb8c87 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1754,6 +1754,8 @@ static int zl3vni_map_to_vxlan_if_ns(struct ns *ns, if (!zvrf) return NS_WALK_STOP; + assert(_pifp); + /* loop through all vxlan-interface */ for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { @@ -1784,8 +1786,7 @@ static int zl3vni_map_to_vxlan_if_ns(struct ns *ns, zl3vni->local_vtep_ip = vxl->vtep_ip; - if (_pifp) - *_pifp = (void *)ifp; + *_pifp = (void *)ifp; return NS_WALK_STOP; } @@ -1856,7 +1857,6 @@ struct zebra_l3vni *zl3vni_from_vrf(vrf_id_t vrf_id) static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni) { - int found = 0; struct zebra_ns *zns = ns->info; struct zebra_l3vni **p_zl3vni = (struct zebra_l3vni **)_p_zl3vni; struct zebra_from_svi_param *in_param = @@ -1866,8 +1866,7 @@ static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni) struct zebra_if *zif = NULL; struct zebra_l2info_vxlan *vxl = NULL; - if (!in_param) - return NS_WALK_STOP; + assert(in_param && p_zl3vni); /* loop through all vxlan-interface */ for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { @@ -1886,17 +1885,12 @@ static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni) if (!in_param->bridge_vlan_aware || vxl->access_vlan == in_param->vid) { - found = 1; - break; + *p_zl3vni = zl3vni_lookup(vxl->vni); + return NS_WALK_STOP; } } - if (!found) - return NS_WALK_CONTINUE; - - if (p_zl3vni) - *p_zl3vni = zl3vni_lookup(vxl->vni); - return NS_WALK_STOP; + return NS_WALK_CONTINUE; } /* |