diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-04 08:43:40 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-04 08:43:40 +0000 |
commit | 9afff0521bd3161bdbce6695ee2c75154d7858d1 (patch) | |
tree | cdb4de2031848165d23d257d661869003247ecc6 /sys/net/route.c | |
parent | 3329517806969b15b0dbe4ca265bbe649c3aef4a (diff) |
Make every subsystem using a radix tree call rn_init() and pass the
length of the key as argument.
This way every consumer of the radix tree has a chance to explicitly
initialize the shared data structures and no longer rely on another
subsystem to do the initialization.
As a bonus ``dom_maxrtkey'' is no longer used an die.
ART kernels should now be fully usable because pf(4) and IPSEC properly
initialized the radix tree.
ok chris@, reyk@
Diffstat (limited to 'sys/net/route.c')
-rw-r--r-- | sys/net/route.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 05a2cfe955f..64e1df22c6d 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.229 2015/09/03 09:50:26 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.230 2015/09/04 08:43:39 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -198,11 +198,25 @@ void route_init(void) { struct domain *dom; + unsigned int keylen; int i; pool_init(&rtentry_pool, sizeof(struct rtentry), 0, 0, 0, "rtentry", NULL); - rtable_init(); /* initialize all zeroes, all ones, mask table */ + + /* + * Compute the maximum supported key length in case the routing + * table backend needs it. + */ + keylen = sizeof(struct sockaddr_in); +#ifdef INET6 + keylen = max(keylen, (sizeof(struct sockaddr_in6))); +#endif +#ifdef MPLS + keylen = max(keylen, (sizeof(struct sockaddr_mpls))); +#endif + + rtable_init(keylen); bzero(af2rtafidx, sizeof(af2rtafidx)); rtafidx_max = 1; /* must have NULL at index 0, so start at 1 */ |