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 @@ -2242,6 +2242,10 @@ KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT(faddr.s_addr != INADDR_ANY, + ("%s: invalid foreign address", __func__)); + KASSERT(laddr.s_addr != INADDR_ANY, + ("%s: invalid local address", __func__)); INP_HASH_LOCK_ASSERT(pcbinfo); /* diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -980,6 +980,10 @@ KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, ("%s: invalid lookup flags %d", __func__, lookupflags)); + KASSERT(!IN6_IS_ADDR_UNSPECIFIED(faddr), + ("%s: invalid foreign address", __func__)); + KASSERT(!IN6_IS_ADDR_UNSPECIFIED(laddr), + ("%s: invalid local address", __func__)); INP_HASH_LOCK_ASSERT(pcbinfo);