summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2011-05-13 14:31:16 +0000
committeroga <oga@openbsd.org>2011-05-13 14:31:16 +0000
commitdda46e081c914a53cca99225de98dcc0d41f936f (patch)
tree9f9378fa5ad43027f94b90608eae22f35d13b6c1 /sys/netinet/tcp_input.c
parentreplace handrolled NELEM() with nitems() (diff)
downloadwireguard-openbsd-dda46e081c914a53cca99225de98dcc0d41f936f.tar.xz
wireguard-openbsd-dda46e081c914a53cca99225de98dcc0d41f936f.zip
Revert the pf->socket linking diff.
at least krw@, pirofti@ and todd@ have been seeing panics (todd and krw with xxxterm not sure about pirofti) involving pool corruption while using this commit. krw and todd confirm that this backout fixes the problem. ok blambert@ krw@, todd@ henning@ and kettenis@ Double link between pf states and sockets. Henning has already implemented half of it. The additional part is: - The pf state lookup for outgoing packets is optimized by using mbuf->inp->state. - For incomming tcp, udp, raw, raw6 packets the socket lookup always is optimized by using mbuf->state->inp. - All protocols establish the link for incomming packets. - All protocols set the inp in the mbuf for outgoing packets. This allows the linkage beginning with the first packet for outgoing connections. - In case of divert states, delete the state when the socket closes. Otherwise new connections could match on old states instead of being diverted to the listen socket. ok henning@
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 3eabda7633a..2cb29ea6c53 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.249 2011/05/04 08:20:05 blambert Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.250 2011/05/13 14:31:16 oga Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -895,8 +895,7 @@ findpcb:
#endif
#if NPF > 0
- if (m->m_pkthdr.pf.statekey && !inp->inp_pf_sk &&
- !((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp) {
+ if (m->m_pkthdr.pf.statekey) {
((struct pf_state_key *)m->m_pkthdr.pf.statekey)->inp = inp;
inp->inp_pf_sk = m->m_pkthdr.pf.statekey;
}
@@ -1339,19 +1338,6 @@ trimthenstep6:
((opti.ts_present &&
TSTMP_LT(tp->ts_recent, opti.ts_val)) ||
SEQ_GT(th->th_seq, tp->rcv_nxt))) {
-#if NPF > 0
- /*
- * The socket will be recreated but the new state
- * has already been linked to the socket. Remove the
- * link between old socket and new state. Otherwise
- * closing the socket would remove the state.
- */
- if (inp->inp_pf_sk) {
- ((struct pf_state_key *)inp->inp_pf_sk)->inp =
- NULL;
- inp->inp_pf_sk = NULL;
- }
-#endif
/*
* Advance the iss by at least 32768, but
* clear the msb in order to make sure