NetBSD-Bugs archive

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

port-mips/43882: On special condition,you get incorrect TCP checksum.



>Number:         43882
>Category:       port-mips
>Synopsis:       On special condition,you get incorrect TCP checksum.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-mips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 15 06:35:00 +0000 2010
>Originator:     Fumiyuki.Yoshida
>Release:        Netbsd2.0.2(This problem remains on current)
>Organization:
Ricoh
>Environment:
>Description:
You get incorrect TCP checksum on following condition.
(1)mbufs size is 2byte.
(2)align is not 32-bit-align.

For example,mbufs data is 0x1234,we get 0x4600.(Correct sum is 0x1234)

>How-To-Repeat:

>Fix:
Apply following patch to sys/arch/mips/mips/in_cksum.c
(Diff to 1.13(latest))

86d85
<
88,115c87
<               if (n < 3){
<               /*
<                * This code is for following condition.
<                * (1)mbufs size is 2byte.
<                * (2)align is not 32-bit-align.
<                *
<                * On this condition,we should get checksum by
<                * step1. 8-bit shift upper 1byte.
<                * step2. add step1's value and lower 1byte.
<                *
<                * For example mbufs data is 0x1234,
<                * step1. 0x12 << 8 --> 0x1200
<                * step2. 0x1200 + 0x34 --> 0x1234
<                */
<                       if (n == 2){
<                               sum = *(buf.c);
< #if BYTE_ORDER == BIG_ENDIAN
<                               sum = sum << 8;
<                               buf.c++;
<                               sum += *(buf.c);
< #else
<                               buf.c++;
<                               sum += *(buf.c) << 8;
< #endif
<                               buf.c++;
<                               n -= 2;
<                       }
<
---
>               if (n < 3)
117c89
<               }
---
>



Home | Main Index | Thread Index | Old Index