diff options
author | Donald Sharp <sharpd@nvidia.com> | 2020-11-15 00:50:37 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2020-11-15 00:53:03 +0100 |
commit | f18ba3cd18210fceac80fc1bf21fcb116d4d4397 (patch) | |
tree | 7ec928e01f625f4114d3c522e6168b9518e8302f /staticd | |
parent | bgpd: If using filters free up name on peer deletion (diff) | |
download | frr-f18ba3cd18210fceac80fc1bf21fcb116d4d4397.tar.xz frr-f18ba3cd18210fceac80fc1bf21fcb116d4d4397.zip |
bgpd, lib, staticd, tests: Convert to using FOREACH_AFI_SAFI
Move the FOREACH_AFI_SAFI macro from bgpd.h to zebra.h( GLOBAL's YOUALL )
Then convert all the places that have the two level for loop to
iterate over all afi/safis
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'staticd')
-rw-r--r-- | staticd/static_routes.c | 49 | ||||
-rw-r--r-- | staticd/static_vrf.c | 14 |
2 files changed, 26 insertions, 37 deletions
diff --git a/staticd/static_routes.c b/staticd/static_routes.c index 94299e098..05355c48f 100644 --- a/staticd/static_routes.c +++ b/staticd/static_routes.c @@ -546,19 +546,15 @@ void static_fixup_vrf_ids(struct static_vrf *enable_svrf) svrf = vrf->info; /* Install any static routes configured for this VRF. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - stable = svrf->stable[afi][safi]; - if (!stable) - continue; + FOREACH_AFI_SAFI (afi, safi) { + stable = svrf->stable[afi][safi]; + if (!stable) + continue; - static_fixup_vrf(enable_svrf, stable, - afi, safi); + static_fixup_vrf(enable_svrf, stable, afi, safi); - if (enable_svrf == svrf) - static_enable_vrf(svrf, stable, - afi, safi); - } + if (enable_svrf == svrf) + static_enable_vrf(svrf, stable, afi, safi); } } } @@ -649,20 +645,17 @@ void static_cleanup_vrf_ids(struct static_vrf *disable_svrf) svrf = vrf->info; /* Uninstall any static routes configured for this VRF. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - struct route_table *stable; + FOREACH_AFI_SAFI (afi, safi) { + struct route_table *stable; - stable = svrf->stable[afi][safi]; - if (!stable) - continue; + stable = svrf->stable[afi][safi]; + if (!stable) + continue; - static_cleanup_vrf(disable_svrf, stable, - afi, safi); + static_cleanup_vrf(disable_svrf, stable, afi, safi); - if (disable_svrf == svrf) - static_disable_vrf(stable, afi, safi); - } + if (disable_svrf == svrf) + static_disable_vrf(stable, afi, safi); } } } @@ -725,14 +718,12 @@ void static_install_intf_nh(struct interface *ifp) continue; /* Install any static routes configured for this interface. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - stable = svrf->stable[afi][safi]; - if (!stable) - continue; + FOREACH_AFI_SAFI (afi, safi) { + stable = svrf->stable[afi][safi]; + if (!stable) + continue; - static_fixup_intf_nh(stable, ifp, afi, safi); - } + static_fixup_intf_nh(stable, ifp, afi, safi); } } } diff --git a/staticd/static_vrf.c b/staticd/static_vrf.c index 5ae342571..83894e926 100644 --- a/staticd/static_vrf.c +++ b/staticd/static_vrf.c @@ -238,14 +238,12 @@ int static_vrf_has_config(struct static_vrf *svrf) * NOTE: This is a don't care for the default VRF, but we go through * the motions to keep things consistent. */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) { - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - table = svrf->stable[afi][safi]; - if (!table) - continue; - if (route_table_count(table)) - return 1; - } + FOREACH_AFI_SAFI (afi, safi) { + table = svrf->stable[afi][safi]; + if (!table) + continue; + if (route_table_count(table)) + return 1; } return 0; |