summaryrefslogtreecommitdiff
path: root/staticd
diff options
context:
space:
mode:
Diffstat (limited to 'staticd')
-rw-r--r--staticd/static_routes.c30
-rw-r--r--staticd/static_routes.h1
-rw-r--r--staticd/static_zebra.c6
3 files changed, 37 insertions, 0 deletions
diff --git a/staticd/static_routes.c b/staticd/static_routes.c
index 82eabd8d56..d549df70fe 100644
--- a/staticd/static_routes.c
+++ b/staticd/static_routes.c
@@ -368,6 +368,36 @@ static void static_ifindex_update_nh(struct interface *ifp, bool up,
static_install_path(pn);
}
+void static_install_nexthops_on_startup(void)
+{
+ struct route_table *stable;
+ struct route_node *rn;
+ struct static_nexthop *nh;
+ struct static_path *pn;
+ struct static_vrf *svrf;
+ struct static_route_info *si;
+ afi_t afi;
+ safi_t safi;
+
+ RB_FOREACH (svrf, svrf_name_head, &svrfs) {
+ FOREACH_AFI_SAFI (afi, safi) {
+ stable = static_vrf_static_table(afi, safi, svrf);
+ if (!stable)
+ continue;
+ for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) {
+ si = static_route_info_from_rnode(rn);
+ if (!si)
+ continue;
+ frr_each (static_path_list, &si->path_list, pn) {
+ frr_each (static_nexthop_list, &pn->nexthop_list, nh) {
+ static_zebra_nht_register(nh, true);
+ }
+ }
+ }
+ }
+ }
+}
+
static void static_ifindex_update_af(struct interface *ifp, bool up, afi_t afi,
safi_t safi)
{
diff --git a/staticd/static_routes.h b/staticd/static_routes.h
index 2e2e4986c3..7f4936e0b9 100644
--- a/staticd/static_routes.h
+++ b/staticd/static_routes.h
@@ -264,6 +264,7 @@ extern void static_bfd_initialize(struct zclient *zc, struct event_loop *tm);
extern void static_bfd_show(struct vty *vty, bool isjson);
+extern void static_install_nexthops_on_startup(void);
#ifdef __cplusplus
}
#endif
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index a6521cccc6..3ed525f386 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -181,6 +181,12 @@ static void zebra_connected(struct zclient *zclient)
vrf = vrf_lookup_by_id(VRF_DEFAULT);
assert(vrf);
static_fixup_vrf_ids(vrf);
+
+ /*
+ * It's possible that staticd connected after config was read
+ * in.
+ */
+ static_install_nexthops_on_startup();
}
/* API to check whether the configured nexthop address is