summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-12-03 14:05:29 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-12-03 14:05:29 +0000
commitd3f72f555df1d0f3b3cf927894fe87abac7d2c4c (patch)
treeac50a6a79a26d9fcf2730a0c7707051766e97a08 /sys/netinet/udp_usrreq.c
parent079c7059196309f173011b95567393ba1aadb3aa (diff)
To avoid that the stack manipules the pf statekeys directly, introduce
pf_inp_...() lookup, link and unlink functions as an interface. Locking can be added to them later. Remove the first linking at the beginning of tcp_input() and udp_input() as it is not necessary. It will be done later anyway. That code was a relict, from the time before I had added the second linking. Input from mikeb@ and sashan@; OK sashan@
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c25
1 files changed, 5 insertions, 20 deletions
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