summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorkstailey <kstailey@cvs.openbsd.org>1997-06-09 15:50:58 +0000
committerkstailey <kstailey@cvs.openbsd.org>1997-06-09 15:50:58 +0000
commit64674e06cc631c16970802239076f5bef9b3f753 (patch)
treef059d5119b0925508c2b2b8909875ba5b298b2a5 /sys
parent545113c2c635dad9c8bd3b326cfa49ea706d5482 (diff)
fix a problem with TCP RST packets which only include a non-zero SEQ # in the
RST packet. Darren Reed; Guido van Rooij.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_state.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/netinet/ip_state.c b/sys/netinet/ip_state.c
index 71af2c23176..a2f23142917 100644
--- a/sys/netinet/ip_state.c
+++ b/sys/netinet/ip_state.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_state.c,v 1.7 1997/02/11 22:23:28 kstailey Exp $ */
+/* $OpenBSD: ip_state.c,v 1.8 1997/06/09 15:50:57 kstailey Exp $ */
/*
* (C)opyright 1995 by Darren Reed.
*
@@ -246,7 +246,13 @@ fr_tcpstate(is, fin, ip, tcp, sport
*/
seq = ntohl(tcp->th_seq);
ack = ntohl(tcp->th_ack);
- if (sport == is->is_sport) {
+
+ source = (sport == is->is_sport);
+
+ if (!(tcp->th_flags & TH_ACK)) /* Pretend an ack was sent */
+ ack = source ? is->is_ack : is->is_seq;
+
+ if (source) {
seqskew = seq - is->is_seq;
ackskew = ack - is->is_ack;
} else {
@@ -272,7 +278,7 @@ fr_tcpstate(is, fin, ip, tcp, sport
* window size of the connection, store these values and match
* the packet.
*/
- if ((source = (sport == is->is_sport))) {
+ if (source) {
swin = is->is_swin;
dwin = is->is_dwin;
} else {