diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -783,7 +783,7 @@ } #ifdef INET - laddr.s_addr = INADDR_ANY; + laddr.s_addr = INADDR_ANY; /* will be used by ipv6 branch later too */ if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) { if (lsa != NULL) laddr = ((struct sockaddr_in *)lsa)->sin_addr; @@ -834,16 +834,24 @@ #endif } else { #ifdef INET6 - if ((inp->inp_vflag & INP_IPV6) != 0) + if ((inp->inp_vflag & INP_IPV6) != 0) { tmpinp = in6_pcblookup_local(pcbinfo, - &inp->in6p_laddr, lport, lookupflags, cred); + &inp->in6p_laddr, lport, lookupflags, NULL); +#ifdef INET + if (tmpinp == NULL && + (inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 + && IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) + tmpinp = in_pcblookup_local(pcbinfo, + laddr, lport, lookupflags, NULL); +#endif + } #endif #if defined(INET) && defined(INET6) else #endif #ifdef INET tmpinp = in_pcblookup_local(pcbinfo, laddr, - lport, lookupflags, cred); + lport, lookupflags, NULL); #endif } } while (tmpinp != NULL);