summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2005-01-15 09:09:28 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2005-01-15 09:09:28 +0000
commit18a6395263a86a45606a916a5fa4be9ae77e9f11 (patch)
treede5203ca27241659c8f6efc6b7930e5b8b1f4f9c /sys/netinet
parent126fa55724c3f9752c0a81bed9525ce32db3c65d (diff)
From NetBSD:
- Keep track of allhost multicast address record we joined into each in_ifaddr and delete it when an address is purged. - Don't simply try to delete a multicast address record listed in the ia_multiaddrs. It results a dangling pointer. Let whoever holds a reference to it to delete it. mcbride@ markus@ ok
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in.c13
-rw-r--r--sys/netinet/in_var.h4
2 files changed, 10 insertions, 7 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 34779753cf6..c01104200a8 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.38 2004/11/18 23:14:49 dhartmei Exp $ */
+/* $OpenBSD: in.c,v 1.39 2005/01/15 09:09:27 pascoe Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -427,7 +427,6 @@ in_control(so, cmd, data, ifp)
return (error);
case SIOCDIFADDR: {
- struct in_multi *inm;
error = 0;
cleanup:
@@ -441,8 +440,10 @@ cleanup:
in_ifscrub(ifp, ia);
TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list);
TAILQ_REMOVE(&in_ifaddr, ia, ia_list);
- while ((inm = LIST_FIRST(&ia->ia_multiaddrs)) != NULL)
- in_delmulti(inm);
+ if (ia->ia_allhosts != NULL) {
+ in_delmulti(ia->ia_allhosts);
+ ia->ia_allhosts = NULL;
+ }
IFAFREE((&ia->ia_ifa));
dohooks(ifp->if_addrhooks, 0);
splx(s);
@@ -743,11 +744,11 @@ in_ifinit(ifp, ia, sin, scrub)
* If the interface supports multicast, join the "all hosts"
* multicast group on that interface.
*/
- if (ifp->if_flags & IFF_MULTICAST) {
+ if ((ifp->if_flags & IFF_MULTICAST) && ia->ia_allhosts == NULL) {
struct in_addr addr;
addr.s_addr = INADDR_ALLHOSTS_GROUP;
- in_addmulti(&addr, ifp);
+ ia->ia_allhosts = in_addmulti(&addr, ifp);
}
return (error);
}
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index 8817d53c7ce..95aa7c27f9c 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_var.h,v 1.7 2003/12/10 07:22:43 itojun Exp $ */
+/* $OpenBSD: in_var.h,v 1.8 2005/01/15 09:09:27 pascoe Exp $ */
/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
/*
@@ -59,6 +59,8 @@ struct in_ifaddr {
#define ia_broadaddr ia_dstaddr
struct sockaddr_in ia_sockmask; /* reserve space for general netmask */
LIST_HEAD(, in_multi) ia_multiaddrs; /* list of multicast addresses */
+ struct in_multi *ia_allhosts; /* multicast address record for
+ the allhosts multicast group */
};
struct in_aliasreq {