summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2007-09-18 18:46:00 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2007-09-18 18:46:00 +0000
commit73ab101f302f601f84bacdb4b550ba93e28812c1 (patch)
tree72589a53e70930b6f84cb8926a9654dc0e20e74b /sys/net
parent2279ba3eeae8ee58c4ede9188769224ff80a60c1 (diff)
allow state reuse for tcp if both sides are in FIN_WAIT_2 and a new SYN
arrives; ok dhartmei, henning, feedback aaron
Diffstat (limited to 'sys/net')
-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;