summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2009-06-01 15:49:42 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2009-06-01 15:49:42 +0000
commitc2c2a7c11ee7cdc9d33dc3cdabff4a25dbcbca13 (patch)
tree743a83cdd0c6416f952293952e112bd315518157 /sys/netinet6
parentb01c90a31af487bfb796c57b6f199eae730939fd (diff)
Notes
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 1137ad7532f0..1666becb4a9c 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 70909b1fb0d2..3a423ed0ff2d 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 41a100dd93ea..eab8951ef56f 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);