diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c index bd202e76c6b6..472a3434ebad 100644 --- a/sys/netinet6/in6_mcast.c +++ b/sys/netinet6/in6_mcast.c @@ -372,9 +372,16 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr *group, IN6_MULTI_LIST_LOCK(); IF_ADDR_WLOCK(ifp); NET_EPOCH_ENTER_ET(et); - inm = in6m_lookup_locked(ifp, group); + /* Does ifp support IPv6? */ + if (ifp->if_afdata[AF_INET6] == NULL) + error = ENODEV; + else + inm = in6m_lookup_locked(ifp, group); NET_EPOCH_EXIT_ET(et); + if (error != 0) + goto out_locked; + if (inm != NULL) { /* * If we already joined this group, just bump the