1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * Copyright (c) 2010-2011 Juniper Networks, Inc. 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Robert N. M. Watson under 7 * contract to Juniper Networks, Inc. 8 * --- 51 unchanged lines hidden (view full) --- 60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 * SUCH DAMAGE. 63 * 64 * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 65 */ 66 67#include <sys/cdefs.h> |
68__FBSDID("$FreeBSD: head/sys/netinet6/in6_pcb.c 271386 2014-09-10 12:35:42Z ae $"); |
69 70#include "opt_inet.h" 71#include "opt_inet6.h" 72#include "opt_ipsec.h" 73#include "opt_pcbgroup.h" 74#include "opt_rss.h" 75 76#include <sys/param.h> --- 627 unchanged lines hidden (view full) --- 704 INP_HASH_WLOCK_ASSERT(pcbinfo); 705 706 if ((lookupflags & INPLOOKUP_WILDCARD) == 0) { 707 struct inpcbhead *head; 708 /* 709 * Look for an unconnected (wildcard foreign addr) PCB that 710 * matches the local address and port we're looking for. 711 */ |
712 head = &pcbinfo->ipi_hashbase[INP_PCBHASH( 713 INP6_PCBHASHKEY(&in6addr_any), lport, 0, 714 pcbinfo->ipi_hashmask)]; |
715 LIST_FOREACH(inp, head, inp_hash) { 716 /* XXX inp locking */ 717 if ((inp->inp_vflag & INP_IPV6) == 0) 718 continue; 719 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) && 720 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && 721 inp->inp_lport == lport) { 722 /* Found. */ --- 151 unchanged lines hidden (view full) --- 874 else 875 faith = 0; 876 877 /* 878 * First look for an exact match. 879 */ 880 tmpinp = NULL; 881 INP_GROUP_LOCK(pcbgroup); |
882 head = &pcbgroup->ipg_hashbase[INP_PCBHASH( 883 INP6_PCBHASHKEY(faddr), lport, fport, pcbgroup->ipg_hashmask)]; |
884 LIST_FOREACH(inp, head, inp_pcbgrouphash) { 885 /* XXX inp locking */ 886 if ((inp->inp_vflag & INP_IPV6) == 0) 887 continue; 888 if (IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, faddr) && 889 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && 890 inp->inp_fport == fport && 891 inp->inp_lport == lport) { --- 88 unchanged lines hidden (view full) --- 980 981 /* 982 * Order of socket selection - we always prefer jails. 983 * 1. jailed, non-wild. 984 * 2. jailed, wild. 985 * 3. non-jailed, non-wild. 986 * 4. non-jailed, wild. 987 */ |
988 head = &pcbinfo->ipi_wildbase[INP_PCBHASH( 989 INP6_PCBHASHKEY(&in6addr_any), lport, 0, 990 pcbinfo->ipi_wildmask)]; |
991 LIST_FOREACH(inp, head, inp_pcbgroup_wild) { 992 /* XXX inp locking */ 993 if ((inp->inp_vflag & INP_IPV6) == 0) 994 continue; 995 996 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) || 997 inp->inp_lport != lport) { 998 continue; --- 78 unchanged lines hidden (view full) --- 1077 faith = (*faithprefix_p)(laddr); 1078 else 1079 faith = 0; 1080 1081 /* 1082 * First look for an exact match. 1083 */ 1084 tmpinp = NULL; |
1085 head = &pcbinfo->ipi_hashbase[INP_PCBHASH( 1086 INP6_PCBHASHKEY(faddr), lport, fport, pcbinfo->ipi_hashmask)]; |
1087 LIST_FOREACH(inp, head, inp_hash) { 1088 /* XXX inp locking */ 1089 if ((inp->inp_vflag & INP_IPV6) == 0) 1090 continue; 1091 if (IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, faddr) && 1092 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) && 1093 inp->inp_fport == fport && 1094 inp->inp_lport == lport) { --- 21 unchanged lines hidden (view full) --- 1116 1117 /* 1118 * Order of socket selection - we always prefer jails. 1119 * 1. jailed, non-wild. 1120 * 2. jailed, wild. 1121 * 3. non-jailed, non-wild. 1122 * 4. non-jailed, wild. 1123 */ |
1124 head = &pcbinfo->ipi_hashbase[INP_PCBHASH( 1125 INP6_PCBHASHKEY(&in6addr_any), lport, 0, 1126 pcbinfo->ipi_hashmask)]; |
1127 LIST_FOREACH(inp, head, inp_hash) { 1128 /* XXX inp locking */ 1129 if ((inp->inp_vflag & INP_IPV6) == 0) 1130 continue; 1131 1132 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) || 1133 inp->inp_lport != lport) { 1134 continue; --- 174 unchanged lines hidden --- |