Deleted Added
full compact
in6_pcb.c (268562) in6_pcb.c (271386)
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>
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 268562 2014-07-12 05:46:33Z adrian $");
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 */
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(INADDR_ANY, lport,
713 0, pcbinfo->ipi_hashmask)];
712 head = &pcbinfo->ipi_hashbase[INP_PCBHASH(
713 INP6_PCBHASHKEY(&in6addr_any), lport, 0,
714 pcbinfo->ipi_hashmask)];
714 LIST_FOREACH(inp, head, inp_hash) {
715 /* XXX inp locking */
716 if ((inp->inp_vflag & INP_IPV6) == 0)
717 continue;
718 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) &&
719 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) &&
720 inp->inp_lport == lport) {
721 /* Found. */

--- 151 unchanged lines hidden (view full) ---

873 else
874 faith = 0;
875
876 /*
877 * First look for an exact match.
878 */
879 tmpinp = NULL;
880 INP_GROUP_LOCK(pcbgroup);
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);
881 head = &pcbgroup->ipg_hashbase[
882 INP_PCBHASH(faddr->s6_addr32[3] /* XXX */, lport, fport,
883 pcbgroup->ipg_hashmask)];
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 */
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(INADDR_ANY, lport,
989 0, pcbinfo->ipi_wildmask)];
988 head = &pcbinfo->ipi_wildbase[INP_PCBHASH(
989 INP6_PCBHASHKEY(&in6addr_any), lport, 0,
990 pcbinfo->ipi_wildmask)];
990 LIST_FOREACH(inp, head, inp_pcbgroup_wild) {
991 /* XXX inp locking */
992 if ((inp->inp_vflag & INP_IPV6) == 0)
993 continue;
994
995 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) ||
996 inp->inp_lport != lport) {
997 continue;

--- 78 unchanged lines hidden (view full) ---

1076 faith = (*faithprefix_p)(laddr);
1077 else
1078 faith = 0;
1079
1080 /*
1081 * First look for an exact match.
1082 */
1083 tmpinp = NULL;
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;
1084 head = &pcbinfo->ipi_hashbase[
1085 INP_PCBHASH(faddr->s6_addr32[3] /* XXX */, lport, fport,
1086 pcbinfo->ipi_hashmask)];
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 */
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(INADDR_ANY, lport,
1125 0, pcbinfo->ipi_hashmask)];
1124 head = &pcbinfo->ipi_hashbase[INP_PCBHASH(
1125 INP6_PCBHASHKEY(&in6addr_any), lport, 0,
1126 pcbinfo->ipi_hashmask)];
1126 LIST_FOREACH(inp, head, inp_hash) {
1127 /* XXX inp locking */
1128 if ((inp->inp_vflag & INP_IPV6) == 0)
1129 continue;
1130
1131 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) ||
1132 inp->inp_lport != lport) {
1133 continue;

--- 174 unchanged lines hidden ---
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 ---