summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2008-05-06 09:44:26 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2008-05-06 09:44:26 +0000
commit1359c0b6e98cffad6a64b8146e15ff8b8fc44fac (patch)
tree752cba742a0cadfbbcf1cce1788f7fc2c2a8b66a /sys/net
parentac5c2eeab237a0c4b895e2b848b73f99d90de2a8 (diff)
Kill state if we get SYN for a state that has been closed from both sides.
ok henning@
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 a51badfdb6f..2c57df02131 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.569 2008/05/06 03:45:21 mpf Exp $ */
+/* $OpenBSD: pf.c,v 1.570 2008/05/06 09:44:25 markus Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -3812,6 +3812,22 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
return (PF_DROP);
}
+ 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;