svn commit: r195755 - head/sys/netinet6
Bruce M Simpson
bms at FreeBSD.org
Sat Jul 18 17:38:19 UTC 2009
Author: bms
Date: Sat Jul 18 17:38:18 2009
New Revision: 195755
URL: http://svn.freebsd.org/changeset/base/195755
Log:
Fix a problem, whereby misbehaving IPv6 applications, which don't include
a valid zone ID or interface identifier in a v6 multicast leave, would
trigger a fairly paranoid KASSERT().
Observed with Boost++ regression tests on ref8.freebsd.org.
Approved by: re (kib)
Modified:
head/sys/netinet6/in6_mcast.c
Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c Sat Jul 18 16:33:27 2009 (r195754)
+++ head/sys/netinet6/in6_mcast.c Sat Jul 18 17:38:18 2009 (r195755)
@@ -2160,14 +2160,24 @@ in6p_leave_group(struct inpcb *inp, stru
if (error)
return (EADDRNOTAVAIL);
/*
+ * Some badly behaved applications don't pass an ifindex
+ * or a scope ID, which is an API violation. In this case,
+ * perform a lookup as per a v6 join.
+ *
* XXX For now, stomp on zone ID for the corner case.
* This is not the 'KAME way', but we need to see the ifp
* directly until such time as this implementation is
* refactored, assuming the scope IDs are the way to go.
*/
ifindex = ntohs(gsa->sin6.sin6_addr.s6_addr16[1]);
- KASSERT(ifindex != 0, ("%s: bad zone ID", __func__));
- ifp = ifnet_byindex(ifindex);
+ if (ifindex == 0) {
+ CTR2(KTR_MLD, "%s: warning: no ifindex, looking up "
+ "ifp for group %s.", __func__,
+ ip6_sprintf(ip6tbuf, &gsa->sin6.sin6_addr));
+ ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6);
+ } else {
+ ifp = ifnet_byindex(ifindex);
+ }
if (ifp == NULL)
return (EADDRNOTAVAIL);
}
More information about the svn-src-head
mailing list