summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2007-09-18 18:45:59 +0000
committermarkus <markus@openbsd.org>2007-09-18 18:45:59 +0000
commit6b9bd24e86b7435487e7a3713482c84fadaa1703 (patch)
tree7ca6e8854cfd7d4255bbcffaeb82afe6e8faf8e1
parentFix typo (`Advancded'). (diff)
downloadwireguard-openbsd-6b9bd24e86b7435487e7a3713482c84fadaa1703.tar.xz
wireguard-openbsd-6b9bd24e86b7435487e7a3713482c84fadaa1703.zip
allow state reuse for tcp if both sides are in FIN_WAIT_2 and a new SYN
arrives; ok dhartmei, henning, feedback aaron
-rw-r--r--sys/net/pf.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index fdb813d8bc3..66aa25cd515 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.558 2007/09/07 20:34:10 bluhm Exp $ */
+/* $OpenBSD: pf.c,v 1.559 2007/09/18 18:45:59 markus Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -3732,6 +3732,22 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
}
}
+ if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) &&
+ dst->state >= TCPS_FIN_WAIT_2 &&
+ src->state >= TCPS_FIN_WAIT_2) {
+ if (pf_status.debug >= PF_DEBUG_MISC) {
+ printf("pf: state reuse ");
+ pf_print_state(*state);
+ pf_print_flags(th->th_flags);
+ printf("\n");
+ }
+ /* XXX make sure it's the same direction ?? */
+ (*state)->src.state = (*state)->dst.state = TCPS_CLOSED;
+ pf_unlink_state(*state);
+ *state = NULL;
+ return (PF_DROP);
+ }
+
if (src->wscale && dst->wscale && !(th->th_flags & TH_SYN)) {
sws = src->wscale & PF_WSCALE_MASK;
dws = dst->wscale & PF_WSCALE_MASK;