summaryrefslogtreecommitdiffstats
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2008-07-27 01:29:28 +0000
committerjulian <julian@FreeBSD.org>2008-07-27 01:29:28 +0000
commit4c1af4639a28804c24bdde2b0a1d10168d42e1ca (patch)
treeef19c5fb987ce6d45abea9b9d7e9aed082a14d65 /sys/net/route.c
parent1fc2ef0208b69ae667b75ed3995790d478b8c93d (diff)
downloadFreeBSD-src-4c1af4639a28804c24bdde2b0a1d10168d42e1ca.zip
FreeBSD-src-4c1af4639a28804c24bdde2b0a1d10168d42e1ca.tar.gz
Add the ability to add new addresses for interfacesto just one FIB
(Other more specific related options will follow) This allows one to set multiple p2p links to the same place and select which to use by having each in different FIBS.
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 40f3ccb..08a70c5 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -84,9 +84,25 @@
u_int rt_numfibs = RT_NUMFIBS;
SYSCTL_INT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, "");
-/* Eventually this will be a tunable */
+/*
+ * Allow the boot code to allow LESS than RT_MAXFIBS to be used.
+ * We can't do more because storage is statically allocated for now.
+ * (for compatibility reasons.. this will change).
+ */
TUNABLE_INT("net.fibs", &rt_numfibs);
+/*
+ * By default add routes to all fibs for new interfaces.
+ * Once this is set to 0 then only allocate routes on interface
+ * changes for the FIB of the caller when adding a new set of addresses
+ * to an interface. XXX this is a shotgun aproach to a problem that needs
+ * a more fine grained solution.. that will come.
+ */
+u_int rt_add_addr_allfibs = 1;
+SYSCTL_INT(_net, OID_AUTO, add_addr_allfibs, CTLFLAG_RW,
+ &rt_add_addr_allfibs, 0, "");
+TUNABLE_INT("net.add_addr_allfibs", &rt_add_addr_allfibs);
+
static struct rtstat rtstat;
/* by default only the first 'row' of tables will be accessed. */
@@ -1453,8 +1469,12 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum)
if ( dst->sa_family != AF_INET)
fibnum = 0;
if (fibnum == -1) {
- startfib = 0;
- endfib = rt_numfibs - 1;
+ if (rt_add_addr_allfibs == 0 && cmd == (int)RTM_ADD) {
+ startfib = endfib = curthread->td_proc->p_fibnum;
+ } else {
+ startfib = 0;
+ endfib = rt_numfibs - 1;
+ }
} else {
KASSERT((fibnum < rt_numfibs), ("rtinit1: bad fibnum"));
startfib = fibnum;
OpenPOWER on IntegriCloud