Subject: resetting a TCP connection during 3way handshake
To: None <tech-net@netbsd.org>
From: None <itojun@iijlab.net>
List: tech-net
Date: 04/25/2004 03:24:28
in syn_cache_get() we have received ACK and about to make a fully
established TCP connection. when we send RST, we need to follow
RFC793 page 36 last paragraph, hence the diff.
if you see "dropwithreset" label in tcp_input(), you see the change
is right - when ACK bit is set it respond like this.
itojun
Index: tcp_input.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_input.c,v
retrieving revision 1.196
diff -u -r1.196 tcp_input.c
--- tcp_input.c 22 Apr 2004 15:05:33 -0000 1.196
+++ tcp_input.c 24 Apr 2004 16:54:49 -0000
@@ -3436,8 +3436,7 @@
return (so);
resetandabort:
- (void) tcp_respond(NULL, m, m, th,
- th->th_seq + tlen, (tcp_seq)0, TH_RST|TH_ACK);
+ (void)tcp_respond(NULL, m, m, th, (tcp_seq)0, th->th_ack, TH_RST);
abort:
if (so != NULL)
(void) soabort(so);