diff options
author | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2005-01-15 09:09:28 +0000 |
---|---|---|
committer | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2005-01-15 09:09:28 +0000 |
commit | 18a6395263a86a45606a916a5fa4be9ae77e9f11 (patch) | |
tree | de5203ca27241659c8f6efc6b7930e5b8b1f4f9c /sys/netinet/in.c | |
parent | 126fa55724c3f9752c0a81bed9525ce32db3c65d (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/in.c')
-rw-r--r-- | sys/netinet/in.c | 13 |
1 files changed, 7 insertions, 6 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); } |