diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-01-18 18:27:13 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-01-18 18:27:13 +0000 |
commit | 8e2a8f5323887c4ea350ff6fde22d7c02dbb5b09 (patch) | |
tree | 83918386cc5f020b50b460538a07d3a296e95b1d /sys/net/rtable.c | |
parent | 1f0673e8309d3a4c43d6de1aebb4e122998706b6 (diff) |
Pass the address length to art_alloc() and remove the hack abusing the
offset of the address in the sockaddr to initialize the stride lengths.
Diffstat (limited to 'sys/net/rtable.c')
-rw-r--r-- | sys/net/rtable.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/net/rtable.c b/sys/net/rtable.c index d473349d13e..81a94e518aa 100644 --- a/sys/net/rtable.c +++ b/sys/net/rtable.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtable.c,v 1.37 2016/01/18 15:38:52 mpi Exp $ */ +/* $OpenBSD: rtable.c,v 1.38 2016/01/18 18:27:12 mpi Exp $ */ /* * Copyright (c) 2014-2015 Martin Pieuchot @@ -75,7 +75,7 @@ void rtmap_dtor(void *, void *); struct srp_gc rtmap_gc = SRP_GC_INITIALIZER(rtmap_dtor, NULL); void rtable_init_backend(unsigned int); -void *rtable_alloc(unsigned int, sa_family_t, unsigned int); +void *rtable_alloc(unsigned int, unsigned int, unsigned int); void *rtable_get(unsigned int, sa_family_t); void @@ -184,7 +184,7 @@ rtable_add(unsigned int id) struct rtmap *map; struct dommp *dmm; sa_family_t af; - unsigned int off; + unsigned int off, alen; int i; KERNEL_ASSERT_LOCKED(); @@ -201,11 +201,12 @@ rtable_add(unsigned int id) af = dp->dom_family; off = dp->dom_rtoffset; + alen = dp->dom_maxplen; if (id >= rtmap_limit) rtmap_grow(id + 1, af); - tbl = rtable_alloc(id, af, off); + tbl = rtable_alloc(id, alen, off); if (tbl == NULL) return (ENOMEM); @@ -298,7 +299,7 @@ rtable_init_backend(unsigned int keylen) } void * -rtable_alloc(unsigned int rtableid, sa_family_t af, unsigned int off) +rtable_alloc(unsigned int rtableid, unsigned int alen, unsigned int off) { struct radix_node_head *rnh = NULL; @@ -521,9 +522,9 @@ rtable_init_backend(unsigned int keylen) } void * -rtable_alloc(unsigned int rtableid, sa_family_t af, unsigned int off) +rtable_alloc(unsigned int rtableid, unsigned int alen, unsigned int off) { - return (art_alloc(rtableid, off)); + return (art_alloc(rtableid, alen, off)); } struct rtentry * |