summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce M Simpson <bms@FreeBSD.org>2009-07-18 17:38:18 +0000
committerBruce M Simpson <bms@FreeBSD.org>2009-07-18 17:38:18 +0000
commitb36c89e55f33a02f1f3ff4954144401610baca81 (patch)
tree069fac91e669ff94c10c5c3d59c50f40d65fc813
parentf7ce26cda0a1e15b259044e8c6b182ebfae05fb2 (diff)
Notes
-rw-r--r--sys/netinet6/in6_mcast.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index f7607deca2d7..67686a43524a 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -2160,14 +2160,24 @@ in6p_leave_group(struct inpcb *inp, struct sockopt *sopt)
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);
}