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.
This commit is contained in:
Julian Elischer 2008-07-27 01:29:28 +00:00
parent 693e312235
commit 66e8505f4c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180840

View file

@ -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;