summaryrefslogtreecommitdiffstats
path: root/staticd
diff options
context:
space:
mode:
Diffstat (limited to 'staticd')
-rw-r--r--staticd/static_routes.c49
-rw-r--r--staticd/static_vrf.c14
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;