Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet6/mld6.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet6/mld6.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.61.2.5 retrieving revision 1.82 diff -u -p -r1.61.2.5 -r1.82 --- src/sys/netinet6/mld6.c 2016/10/05 20:56:09 1.61.2.5 +++ src/sys/netinet6/mld6.c 2017/02/22 07:46:00 1.82 @@ -1,4 +1,4 @@ -/* $NetBSD: mld6.c,v 1.61.2.5 2016/10/05 20:56:09 skrll Exp $ */ +/* $NetBSD: mld6.c,v 1.82 2017/02/22 07:46:00 ozaki-r Exp $ */ /* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */ /* @@ -102,10 +102,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.61.2.5 2016/10/05 20:56:09 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.82 2017/02/22 07:46:00 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" +#include "opt_net_mpsafe.h" #endif #include @@ -113,7 +114,6 @@ __KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.6 #include #include #include -#include #include #include #include @@ -229,6 +229,7 @@ mld_timeo(void *arg) { struct in6_multi *in6m = arg; + /* XXX NOMPSAFE still need softnet_lock */ mutex_enter(softnet_lock); KERNEL_LOCK(1, NULL); @@ -344,6 +345,8 @@ mld_input(struct mbuf *m, int off) int s; ifp = m_get_rcvif(m, &s); + if (__predict_false(ifp == NULL)) + goto out; IP6_EXTHDR_GET(mldh, struct mld_hdr *, m, off, sizeof(*mldh)); if (mldh == NULL) { ICMP6_STATINC(ICMP6_STAT_TOOSHORT); @@ -373,9 +376,12 @@ mld_input(struct mbuf *m, int off) * though RFC3590 says "SHOULD log" if the source of a query * is the unspecified address. */ + char ip6bufs[INET6_ADDRSTRLEN]; + char ip6bufm[INET6_ADDRSTRLEN]; log(LOG_INFO, "mld_input: src %s is not link-local (grp=%s)\n", - ip6_sprintf(&ip6->ip6_src), ip6_sprintf(&mldh->mld_addr)); + IN6_PRINT(ip6bufs,&ip6->ip6_src), + IN6_PRINT(ip6bufm, &mldh->mld_addr)); #endif goto out; } @@ -394,7 +400,7 @@ mld_input(struct mbuf *m, int off) * * In Non-Listener state, we simply don't have a membership record. * In Delaying Listener state, our timer is running (in6m->in6m_timer) - * In Idle Listener state, our timer is not running + * In Idle Listener state, our timer is not running * (in6m->in6m_timer==IN6M_TIMER_UNDEF) * * The flag is in6m->in6m_state, it is set to MLD_OTHERLISTENER if @@ -487,7 +493,7 @@ mld_input(struct mbuf *m, int off) * If we belong to the group being reported, stop * our timer for that group. */ - IN6_LOOKUP_MULTI(mld_addr, ifp, in6m); + in6m = in6_lookup_multi(&mld_addr, ifp); if (in6m) { mld_stoptimer(in6m); /* transit to idle state */ in6m->in6m_state = MLD_OTHERLISTENER; /* clear flag */ @@ -512,7 +518,7 @@ out_nodrop: } static void -mld_sendpkt(struct in6_multi *in6m, int type, +mld_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) { struct mbuf *mh; @@ -646,7 +652,7 @@ mld_allocbuf(struct mbuf **mh, int len, * Add an address to the list of IP6 multicast addresses for a given interface. */ struct in6_multi * -in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp, +in6_addmulti(struct in6_addr *maddr6, struct ifnet *ifp, int *errorp, int timer) { struct in6_ifaddr *ia; @@ -659,7 +665,7 @@ in6_addmulti(struct in6_addr *maddr6, st /* * See if address already in list. */ - IN6_LOOKUP_MULTI(*maddr6, ifp, in6m); + in6m = in6_lookup_multi(maddr6, ifp); if (in6m != NULL) { /* * Found it; just increment the refrence count. @@ -789,7 +795,10 @@ in6_delmulti(struct in6_multi *in6m) /* Tell mld_timeo we're halting the timer */ in6m->in6m_timer = IN6M_TIMER_UNDEF; - callout_halt(&in6m->in6m_timer_ch, softnet_lock); + if (mutex_owned(softnet_lock)) + callout_halt(&in6m->in6m_timer_ch, softnet_lock); + else + callout_halt(&in6m->in6m_timer_ch, NULL); callout_destroy(&in6m->in6m_timer_ch); free(in6m, M_IPMADDR); @@ -799,7 +808,7 @@ in6_delmulti(struct in6_multi *in6m) struct in6_multi_mship * -in6_joingroup(struct ifnet *ifp, struct in6_addr *addr, +in6_joingroup(struct ifnet *ifp, struct in6_addr *addr, int *errorp, int timer) { struct in6_multi_mship *imm; @@ -1094,7 +1103,8 @@ done: return error; } -SYSCTL_SETUP(sysctl_in6_mklude_setup, "sysctl net.inet6.multicast_kludge subtree setup") +void +in6_sysctl_multicast_setup(struct sysctllog **clog) { sysctl_createv(clog, 0, NULL, NULL,