summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c5
-rw-r--r--sys/netinet/tcp_input.c27
-rw-r--r--sys/netinet/udp_usrreq.c25
3 files changed, 11 insertions, 46 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 18541164858..df22dcd91e8 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.191 2015/12/03 09:49:15 bluhm Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.192 2015/12/03 14:05:28 bluhm Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -530,8 +530,7 @@ in_pcbdetach(struct inpcb *inp)
if (inp->inp_pf_sk) {
pf_remove_divert_state(inp->inp_pf_sk);
/* pf_remove_divert_state() may have detached the state */
- if (inp->inp_pf_sk)
- inp->inp_pf_sk->inp = NULL;
+ pf_inp_unlink(inp);
}
#endif
s = splnet();
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index af16aae17d1..e82ccaf1bd0 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.310 2015/11/29 15:09:32 mpi Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.311 2015/12/03 14:05:28 bluhm Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -580,11 +580,7 @@ tcp_input(struct mbuf *m, ...)
* Locate pcb for segment.
*/
#if NPF > 0
- if (m->m_pkthdr.pf.statekey) {
- inp = m->m_pkthdr.pf.statekey->inp;
- if (inp && inp->inp_pf_sk)
- KASSERT(m->m_pkthdr.pf.statekey == inp->inp_pf_sk);
- }
+ inp = pf_inp_lookup(m);
#endif
findpcb:
if (inp == NULL) {
@@ -602,12 +598,6 @@ findpcb:
m->m_pkthdr.ph_rtableid);
break;
}
-#if NPF > 0
- if (m->m_pkthdr.pf.statekey && inp) {
- m->m_pkthdr.pf.statekey->inp = inp;
- inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
- }
-#endif
}
if (inp == NULL) {
int inpl_reverse = 0;
@@ -880,13 +870,7 @@ findpcb:
#endif
#if NPF > 0
- if (m->m_pkthdr.pf.statekey && !m->m_pkthdr.pf.statekey->inp &&
- !inp->inp_pf_sk) {
- m->m_pkthdr.pf.statekey->inp = inp;
- inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
- }
- /* The statekey has finished finding the inp, it is no longer needed. */
- m->m_pkthdr.pf.statekey = NULL;
+ pf_inp_link(m, inp);
#endif
#ifdef IPSEC
@@ -1294,10 +1278,7 @@ trimthenstep6:
* has already been linked to the socket. Remove the
* link between old socket and new state.
*/
- if (inp->inp_pf_sk) {
- inp->inp_pf_sk->inp = NULL;
- inp->inp_pf_sk = NULL;
- }
+ pf_inp_unlink(inp);
#endif
/*
* Advance the iss by at least 32768, but
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 365f2f23b8d..c365068341b 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.207 2015/09/11 07:42:35 claudio Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.208 2015/12/03 14:05:28 bluhm Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -527,12 +527,8 @@ udp_input(struct mbuf *m, ...)
/*
* Locate pcb for datagram.
*/
-#if 0
- if (m->m_pkthdr.pf.statekey) {
- inp = m->m_pkthdr.pf.statekey->inp;
- if (inp && inp->inp_pf_sk)
- KASSERT(m->m_pkthdr.pf.statekey == inp->inp_pf_sk);
- }
+#if NPF > 0 && 0 /* currently disabled */
+ inp = pf_inp_lookup(m);
#endif
if (inp == NULL) {
#ifdef INET6
@@ -544,12 +540,6 @@ udp_input(struct mbuf *m, ...)
#endif /* INET6 */
inp = in_pcbhashlookup(&udbtable, ip->ip_src, uh->uh_sport,
ip->ip_dst, uh->uh_dport, m->m_pkthdr.ph_rtableid);
-#if NPF > 0
- if (m->m_pkthdr.pf.statekey && inp) {
- m->m_pkthdr.pf.statekey->inp = inp;
- inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
- }
-#endif
}
if (inp == 0) {
int inpl_reverse = 0;
@@ -591,13 +581,8 @@ udp_input(struct mbuf *m, ...)
KASSERT(sotoinpcb(inp->inp_socket) == inp);
#if NPF > 0
- if (m->m_pkthdr.pf.statekey && !m->m_pkthdr.pf.statekey->inp &&
- !inp->inp_pf_sk && (inp->inp_socket->so_state & SS_ISCONNECTED)) {
- m->m_pkthdr.pf.statekey->inp = inp;
- inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
- }
- /* The statekey has finished finding the inp, it is no longer needed. */
- m->m_pkthdr.pf.statekey = NULL;
+ if (inp->inp_socket->so_state & SS_ISCONNECTED)
+ pf_inp_link(m, inp);
#endif
#ifdef IPSEC