aboutsummaryrefslogtreecommitdiff
path: root/sys/net/route/route_tables.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net/route/route_tables.c')
-rw-r--r--sys/net/route/route_tables.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c
index e2bbd5ea16a2..e3743d55404d 100644
--- a/sys/net/route/route_tables.c
+++ b/sys/net/route/route_tables.c
@@ -171,7 +171,7 @@ static void
grow_rtables(uint32_t num_tables)
{
struct domain *dom;
- struct rib_head **prnh;
+ struct rib_head **prnh, *rh;
struct rib_head **new_rt_tables, **old_rt_tables;
int family;
@@ -188,6 +188,10 @@ grow_rtables(uint32_t num_tables)
"by default. Consider tuning %s if needed\n",
"net.add_addr_allfibs");
+#ifdef FIB_ALGO
+ fib_grow_rtables(num_tables);
+#endif
+
/*
* Current rt_tables layout:
* fib0[af0, af1, af2, .., AF_MAX]fib1[af0, af1, af2, .., Af_MAX]..
@@ -206,10 +210,18 @@ grow_rtables(uint32_t num_tables)
prnh = &new_rt_tables[i * (AF_MAX + 1) + family];
if (*prnh != NULL)
continue;
- *prnh = dom->dom_rtattach(i);
- if (*prnh == NULL)
- log(LOG_ERR, "unable to create routing tables for domain %d\n",
- dom->dom_family);
+ rh = dom->dom_rtattach(i);
+ if (rh == NULL)
+ log(LOG_ERR, "unable to create routing table for %d.%d\n",
+ dom->dom_family, i);
+#ifdef FIB_ALGO
+ if (fib_select_algo_initial(rh) != 0) {
+ log(LOG_ERR, "unable to select algo for table %d.%d\n",
+ dom->dom_family, i);
+ // TODO: detach table
+ }
+#endif
+ *prnh = rh;
}
}
@@ -246,7 +258,9 @@ vnet_rtables_init(const void *unused __unused)
V_rt_numfibs = 1;
vnet_rtzone_init();
-
+#ifdef FIB_ALGO
+ vnet_fib_init();
+#endif
RTABLES_LOCK_INIT();
RTABLES_LOCK();
@@ -288,6 +302,9 @@ rtables_destroy(const void *unused __unused)
free(V_rt_tables, M_RTABLE);
vnet_rtzone_destroy();
+#ifdef FIB_ALGO
+ vnet_fib_destroy();
+#endif
}
VNET_SYSUNINIT(rtables_destroy, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST,
rtables_destroy, 0);