summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2009-06-01 15:49:42 +0000
committerbz <bz@FreeBSD.org>2009-06-01 15:49:42 +0000
commitc62e99f85d6b43e872928cb1f83b13335b7b5d51 (patch)
tree743a83cdd0c6416f952293952e112bd315518157 /sys/netinet6
parentc731979fffc05b5f4ec31fd935fe3bed200a0b42 (diff)
downloadFreeBSD-src-c62e99f85d6b43e872928cb1f83b13335b7b5d51.zip
FreeBSD-src-c62e99f85d6b43e872928cb1f83b13335b7b5d51.tar.gz
Convert the two dimensional array to be malloced and introduce
an accessor function to get the correct rnh pointer back. Update netstat to get the correct pointer using kvm_read() as well. This not only fixes the ABI problem depending on the kernel option but also permits the tunable to overwrite the kernel option at boot time up to MAXFIBS, enlarging the number of FIBs without having to recompile. So people could just use GENERIC now. Reviewed by: julian, rwatson, zec X-MFC: not possible
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_ifattach.c9
-rw-r--r--sys/netinet6/in6_rmx.c26
-rw-r--r--sys/netinet6/nd6_rtr.c11
3 files changed, 29 insertions, 17 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 1137ad7..1666bec 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -777,11 +777,11 @@ statinit:
void
in6_ifdetach(struct ifnet *ifp)
{
- INIT_VNET_NET(ifp->if_vnet);
INIT_VNET_INET(ifp->if_vnet);
INIT_VNET_INET6(ifp->if_vnet);
struct in6_ifaddr *ia, *oia;
struct ifaddr *ifa, *next;
+ struct radix_node_head *rnh;
struct rtentry *rt;
short rtflags;
struct sockaddr_in6 sin6;
@@ -874,15 +874,16 @@ in6_ifdetach(struct ifnet *ifp)
/* XXX: should not fail */
return;
/* XXX grab lock first to avoid LOR */
- if (V_rt_tables[0][AF_INET6] != NULL) {
- RADIX_NODE_HEAD_LOCK(V_rt_tables[0][AF_INET6]);
+ rnh = rt_tables_get_rnh(0, AF_INET6);
+ if (rnh != NULL) {
+ RADIX_NODE_HEAD_LOCK(rnh);
rt = rtalloc1((struct sockaddr *)&sin6, 0, RTF_RNH_LOCKED);
if (rt) {
if (rt->rt_ifp == ifp)
rtexpunge(rt);
RTFREE_LOCKED(rt);
}
- RADIX_NODE_HEAD_UNLOCK(V_rt_tables[0][AF_INET6]);
+ RADIX_NODE_HEAD_UNLOCK(rnh);
}
}
diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
index 70909b1..3a423ed 100644
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -289,13 +289,17 @@ static void
in6_rtqtimo(void *rock)
{
CURVNET_SET_QUIET((struct vnet *) rock);
- INIT_VNET_NET(curvnet);
INIT_VNET_INET6(curvnet);
- struct radix_node_head *rnh = V_rt_tables[0][AF_INET6];
+ struct radix_node_head *rnh;
struct rtqk_arg arg;
struct timeval atv;
static time_t last_adjusted_timeout = 0;
+ rnh = rt_tables_get_rnh(0, AF_INET6);
+ if (rnh == NULL) {
+ CURVNET_RESTORE();
+ return;
+ }
arg.found = arg.killed = 0;
arg.rnh = rnh;
arg.nextstop = time_uptime + V_rtq_timeout6;
@@ -377,12 +381,16 @@ static void
in6_mtutimo(void *rock)
{
CURVNET_SET_QUIET((struct vnet *) rock);
- INIT_VNET_NET(curvnet);
INIT_VNET_INET6(curvnet);
- struct radix_node_head *rnh = V_rt_tables[0][AF_INET6];
+ struct radix_node_head *rnh;
struct mtuex_arg arg;
struct timeval atv;
+ rnh = rt_tables_get_rnh(0, AF_INET6);
+ if (rnh == NULL) {
+ CURVNET_RESTORE();
+ return;
+ }
arg.rnh = rnh;
arg.nextstop = time_uptime + MTUTIMO_DEFAULT;
RADIX_NODE_HEAD_LOCK(rnh);
@@ -405,9 +413,12 @@ void
in6_rtqdrain(void)
{
INIT_VNET_NET(curvnet);
- struct radix_node_head *rnh = V_rt_tables[0][AF_INET6];
+ struct radix_node_head *rnh;
struct rtqk_arg arg;
+ rnh = rt_tables_get_rnh(0, AF_INET6);
+ if (rnh == NULL)
+ panic("%s: rnh == NULL", __func__);
arg.found = arg.killed = 0;
arg.rnh = rnh;
arg.nextstop = 0;
@@ -429,9 +440,6 @@ in6_rtqdrain(void)
int
in6_inithead(void **head, int off)
{
-#ifdef INVARIANTS
- INIT_VNET_NET(curvnet);
-#endif
INIT_VNET_INET6(curvnet);
struct radix_node_head *rnh;
@@ -447,7 +455,7 @@ in6_inithead(void **head, int off)
V_rtq_timeout6 = RTQ_TIMEOUT;
rnh = *head;
- KASSERT(rnh == V_rt_tables[0][AF_INET6], ("rnh?"));
+ KASSERT(rnh == rt_tables_get_rnh(0, AF_INET6), ("rnh?"));
rnh->rnh_addaddr = in6_addroute;
rnh->rnh_matchaddr = in6_matroute;
callout_init(&V_rtq_timer6, CALLOUT_MPSAFE);
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 41a100d..eab8951 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1549,7 +1549,6 @@ pfxlist_onlink_check()
int
nd6_prefix_onlink(struct nd_prefix *pr)
{
- INIT_VNET_NET(curvnet);
INIT_VNET_INET6(curvnet);
struct ifaddr *ifa;
struct ifnet *ifp = pr->ndpr_ifp;
@@ -1632,7 +1631,8 @@ nd6_prefix_onlink(struct nd_prefix *pr)
ifa->ifa_addr, (struct sockaddr *)&mask6, rtflags, &rt);
if (error == 0) {
if (rt != NULL) /* this should be non NULL, though */ {
- rnh = V_rt_tables[rt->rt_fibnum][AF_INET6];
+ rnh = rt_tables_get_rnh(rt->rt_fibnum, AF_INET6);
+ /* XXX what if rhn == NULL? */
RADIX_NODE_HEAD_LOCK(rnh);
RT_LOCK(rt);
if (!rt_setgate(rt, rt_key(rt), (struct sockaddr *)&null_sdl)) {
@@ -2058,8 +2058,7 @@ in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6)
void
rt6_flush(struct in6_addr *gateway, struct ifnet *ifp)
{
- INIT_VNET_NET(curvnet);
- struct radix_node_head *rnh = V_rt_tables[0][AF_INET6];
+ struct radix_node_head *rnh;
int s = splnet();
/* We'll care only link-local addresses */
@@ -2068,6 +2067,10 @@ rt6_flush(struct in6_addr *gateway, struct ifnet *ifp)
return;
}
+ rnh = rt_tables_get_rnh(0, AF_INET6);
+ if (rnh == NULL)
+ return;
+
RADIX_NODE_HEAD_LOCK(rnh);
rnh->rnh_walktree(rnh, rt6_deleteroute, (void *)gateway);
RADIX_NODE_HEAD_UNLOCK(rnh);
OpenPOWER on IntegriCloud