Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/in6_pcb.c
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include "opt_ipsec.h" | #include "opt_ipsec.h" | ||||
#include "opt_route.h" | #include "opt_route.h" | ||||
#include "opt_rss.h" | #include "opt_rss.h" | ||||
#include <sys/hash.h> | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#include <sys/protosw.h> | #include <sys/protosw.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/socketvar.h> | #include <sys/socketvar.h> | ||||
▲ Show 20 Lines • Show All 696 Lines • ▼ Show 20 Lines | in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr, | ||||
INP_HASH_LOCK_ASSERT(pcbinfo); | INP_HASH_LOCK_ASSERT(pcbinfo); | ||||
if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { | if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { | ||||
struct inpcbhead *head; | struct inpcbhead *head; | ||||
/* | /* | ||||
* Look for an unconnected (wildcard foreign addr) PCB that | * Look for an unconnected (wildcard foreign addr) PCB that | ||||
* matches the local address and port we're looking for. | * matches the local address and port we're looking for. | ||||
*/ | */ | ||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH( | head = &pcbinfo->ipi_hashbase[INP_PCBHASH_WILD(lport, | ||||
INP6_PCBHASHKEY(&in6addr_any), lport, 0, | |||||
pcbinfo->ipi_hashmask)]; | pcbinfo->ipi_hashmask)]; | ||||
CK_LIST_FOREACH(inp, head, inp_hash) { | CK_LIST_FOREACH(inp, head, inp_hash) { | ||||
/* XXX inp locking */ | /* XXX inp locking */ | ||||
if ((inp->inp_vflag & INP_IPV6) == 0) | if ((inp->inp_vflag & INP_IPV6) == 0) | ||||
continue; | continue; | ||||
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && | if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && | ||||
IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && | IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && | ||||
inp->inp_lport == lport) { | inp->inp_lport == lport) { | ||||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | in6_pcblookup_lbgroup(const struct inpcbinfo *pcbinfo, | ||||
CK_LIST_FOREACH(grp, hdr, il_list) { | CK_LIST_FOREACH(grp, hdr, il_list) { | ||||
#ifdef INET | #ifdef INET | ||||
if (!(grp->il_vflag & INP_IPV6)) | if (!(grp->il_vflag & INP_IPV6)) | ||||
continue; | continue; | ||||
#endif | #endif | ||||
if (grp->il_lport != lport) | if (grp->il_lport != lport) | ||||
continue; | continue; | ||||
idx = INP_PCBLBGROUP_PKTHASH(INP6_PCBHASHKEY(faddr), lport, | idx = INP6_PCBLBGROUP_PKTHASH(faddr, lport, fport) % | ||||
fport) % grp->il_inpcnt; | grp->il_inpcnt; | ||||
if (IN6_ARE_ADDR_EQUAL(&grp->il6_laddr, laddr)) { | if (IN6_ARE_ADDR_EQUAL(&grp->il6_laddr, laddr)) { | ||||
if (numa_domain == M_NODOM || | if (numa_domain == M_NODOM || | ||||
grp->il_numa_domain == numa_domain) { | grp->il_numa_domain == numa_domain) { | ||||
return (grp->il_inp[idx]); | return (grp->il_inp[idx]); | ||||
} | } | ||||
else | else | ||||
numa_wild = grp->il_inp[idx]; | numa_wild = grp->il_inp[idx]; | ||||
} | } | ||||
Show All 25 Lines | KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0, | ||||
("%s: invalid lookup flags %d", __func__, lookupflags)); | ("%s: invalid lookup flags %d", __func__, lookupflags)); | ||||
INP_HASH_LOCK_ASSERT(pcbinfo); | INP_HASH_LOCK_ASSERT(pcbinfo); | ||||
/* | /* | ||||
* First look for an exact match. | * First look for an exact match. | ||||
*/ | */ | ||||
tmpinp = NULL; | tmpinp = NULL; | ||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH( | head = &pcbinfo->ipi_hashbase[INP6_PCBHASH(faddr, lport, fport, | ||||
INP6_PCBHASHKEY(faddr), lport, fport, pcbinfo->ipi_hashmask)]; | pcbinfo->ipi_hashmask)]; | ||||
CK_LIST_FOREACH(inp, head, inp_hash) { | CK_LIST_FOREACH(inp, head, inp_hash) { | ||||
/* XXX inp locking */ | /* XXX inp locking */ | ||||
if ((inp->inp_vflag & INP_IPV6) == 0) | if ((inp->inp_vflag & INP_IPV6) == 0) | ||||
continue; | continue; | ||||
if (IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, faddr) && | if (IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, faddr) && | ||||
IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && | IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && | ||||
inp->inp_fport == fport && | inp->inp_fport == fport && | ||||
inp->inp_lport == lport) { | inp->inp_lport == lport) { | ||||
Show All 31 Lines | if ((lookupflags & INPLOOKUP_WILDCARD) != 0) { | ||||
/* | /* | ||||
* Order of socket selection - we always prefer jails. | * Order of socket selection - we always prefer jails. | ||||
* 1. jailed, non-wild. | * 1. jailed, non-wild. | ||||
* 2. jailed, wild. | * 2. jailed, wild. | ||||
* 3. non-jailed, non-wild. | * 3. non-jailed, non-wild. | ||||
* 4. non-jailed, wild. | * 4. non-jailed, wild. | ||||
*/ | */ | ||||
head = &pcbinfo->ipi_hashbase[INP_PCBHASH( | head = &pcbinfo->ipi_hashbase[INP_PCBHASH_WILD(lport, | ||||
INP6_PCBHASHKEY(&in6addr_any), lport, 0, | |||||
pcbinfo->ipi_hashmask)]; | pcbinfo->ipi_hashmask)]; | ||||
CK_LIST_FOREACH(inp, head, inp_hash) { | CK_LIST_FOREACH(inp, head, inp_hash) { | ||||
/* XXX inp locking */ | /* XXX inp locking */ | ||||
if ((inp->inp_vflag & INP_IPV6) == 0) | if ((inp->inp_vflag & INP_IPV6) == 0) | ||||
continue; | continue; | ||||
if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) || | if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) || | ||||
inp->inp_lport != lport) { | inp->inp_lport != lport) { | ||||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |