summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-04-23 15:06:16 +0000
committerrwatson <rwatson@FreeBSD.org>2006-04-23 15:06:16 +0000
commit00366b63e338baa890f4da88ce2dbd32bbafa7b8 (patch)
tree268f011dc5e5edfc9869c10cea4131a82291fadb /sys/netinet6
parent281dc6494fa6a185632ea615b685424e90ab7df4 (diff)
downloadFreeBSD-src-00366b63e338baa890f4da88ce2dbd32bbafa7b8.zip
FreeBSD-src-00366b63e338baa890f4da88ce2dbd32bbafa7b8.tar.gz
Modify in6_pcbpurgeif0() to accept a pcbinfo structure rather than a pcb
list head structure; this improves congruence to IPv4, and also allows in6_pcbpurgeif0() to lock the pcbinfo. Modify in6_pcbpurgeif0() to lock the pcbinfo before iterating the pcb list, use queue(9)'s LIST_FOREACH() for the iteration, and to lock individual inpcb's while manipulating them. MFC after: 3 months
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_ifattach.c6
-rw-r--r--sys/netinet6/in6_pcb.c10
-rw-r--r--sys/netinet6/in6_pcb.h2
3 files changed, 10 insertions, 8 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 6b7d022..4d822f2 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -794,10 +794,8 @@ in6_ifdetach(ifp)
/* leave from all multicast groups joined */
- if (udbinfo.listhead != NULL)
- in6_pcbpurgeif0(LIST_FIRST(udbinfo.listhead), ifp);
- if (ripcbinfo.listhead != NULL)
- in6_pcbpurgeif0(LIST_FIRST(ripcbinfo.listhead), ifp);
+ in6_pcbpurgeif0(&udbinfo, ifp);
+ in6_pcbpurgeif0(&ripcbinfo, ifp);
for (in6m = LIST_FIRST(&in6_multihead); in6m; in6m = in6m_next) {
in6m_next = LIST_NEXT(in6m, in6m_entry);
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index d331da3..16b4810 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -799,15 +799,17 @@ in6_pcblookup_local(pcbinfo, laddr, lport_arg, wild_okay)
}
void
-in6_pcbpurgeif0(head, ifp)
- struct in6pcb *head;
+in6_pcbpurgeif0(pcbinfo, ifp)
+ struct inpcbinfo *pcbinfo;
struct ifnet *ifp;
{
struct in6pcb *in6p;
struct ip6_moptions *im6o;
struct in6_multi_mship *imm, *nimm;
- for (in6p = head; in6p != NULL; in6p = LIST_NEXT(in6p, inp_list)) {
+ INP_INFO_RLOCK(pcbinfo);
+ LIST_FOREACH(in6p, pcbinfo->listhead, inp_list) {
+ INP_LOCK(in6p);
im6o = in6p->in6p_moptions;
if ((in6p->inp_vflag & INP_IPV6) &&
im6o) {
@@ -834,7 +836,9 @@ in6_pcbpurgeif0(head, ifp)
}
}
}
+ INP_UNLOCK(in6p);
}
+ INP_INFO_RUNLOCK(pcbinfo);
}
/*
diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h
index 52e566a..a1f4190 100644
--- a/sys/netinet6/in6_pcb.h
+++ b/sys/netinet6/in6_pcb.h
@@ -70,7 +70,7 @@
#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
-void in6_pcbpurgeif0 __P((struct in6pcb *, struct ifnet *));
+void in6_pcbpurgeif0 __P((struct inpcbinfo *, struct ifnet *));
void in6_losing __P((struct inpcb *));
int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *));
int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *));
OpenPOWER on IntegriCloud