NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/43510: kernel reply TCP-RST for bad checksum TCP-SYN packet



On 06/25/10 13:10, ryo%iij.ad.jp@localhost wrote:
>> Synopsis:       kernel reply TCP-RST for bad checksum TCP-SYN packet

Try the attached patch, it should fix the issue. I will not commit it
yet, I need to ask people with more TCP knowledge if it's OK.

From RFC793 section 1.5: Damage is handled by adding a checksum to each
segment transmitted, checking it at the receiver, and discarding damaged
segments.

-- 
Mihai
Index: tcp_input.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_input.c,v
retrieving revision 1.305
diff -u -p -r1.305 tcp_input.c
--- tcp_input.c 26 May 2010 17:38:29 -0000      1.305
+++ tcp_input.c 25 Jun 2010 17:20:22 -0000
@@ -1185,6 +1185,12 @@ tcp_input(struct mbuf *m, ...)
        tiflags = th->th_flags;
 
        /*
+        * Checksum extended TCP header and data.
+        */
+       if (tcp_input_checksum(af, m, th, toff, off, tlen))
+               goto badcsum;
+
+       /*
         * Locate pcb for segment.
         */
 findpcb:
@@ -1322,12 +1328,6 @@ findpcb:
        KASSERT(so->so_lock == softnet_lock);
        KASSERT(solocked(so));
 
-       /*
-        * Checksum extended TCP header and data.
-        */
-       if (tcp_input_checksum(af, m, th, toff, off, tlen))
-               goto badcsum;
-
        tcp_fields_to_host(th);
 
        /* Unscale the window into a 32-bit value. */


Home | Main Index | Thread Index | Old Index