This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Re: FreeBSD-Stack not responding (Update)
On Wed, 2002-07-31 at 07:46, Christoph Csebits wrote:
> Hi again,
>
> On Wed, Jul 31, 2002 at 12:32:45PM +0200, Andrew Lunn wrote:
> > Put some break points into places like ether_input, ip_input,
> > tcp_input etc and see where the packet gets dropped.
>
> there is a problem with the function in_cksum( ) in
> bsd_tcpip/current/src/sys/netinet/in_cksum.c
>
> it says a packet has a wrong
> checksum if (len % 4 != 2). ethereal
> shows the checksum is correct.
>
> If the function returns always 0 (hardcoded)
> this gives me a "working" IP stack :-/
>
> DHCP isnt working anyway, /var/syslog says
>
> DHCPDISCOVER from 00:01:bb:00:0b:78
> DHCPDISCOVER from 00:01:bb:00:0b:78
> already acking lease 10.16.2.240
> DHCPDISCOVER from 00:01:bb:00:0b:78
> already acking lease 10.16.2.240
> DHCPDISCOVER from 00:01:bb:00:0b:78
> already acking lease 10.16.2.240
> DHCPDISCOVER from 00:01:bb:00:0b:78
> already acking lease 10.16.2.240
> DHCPDISCOVER from 00:01:bb:00:0b:78
> already acking lease 10.16.2.240
> DHCPOFFER on 10.16.2.240 to 00:01:bb:00:0b:78 via eth0
> 7 bad udp checksums in 13 packets
> 5 bad udp checksums in 5 packets
> 5 bad udp checksums in 5 packets
>
> looks like checksum calculating ( in both direction )
> is not working for me.
Yup, this was broken :-( [Don't forget that the FreeBSD stack is
still officially only *alpha*]
This patch should help:
Index: net/bsd_tcpip/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/bsd_tcpip/current/ChangeLog,v
retrieving revision 1.7
diff -u -5 -p -r1.7 ChangeLog
--- net/bsd_tcpip/current/ChangeLog 26 Jul 2002 15:04:01 -0000 1.7
+++ net/bsd_tcpip/current/ChangeLog 31 Jul 2002 14:01:59 -0000
@@ -1,5 +1,9 @@
+2002-07-31 Gary Thomas <gary@chez-thomas.org>
+
+ * src/sys/netinet/in_cksum.c: Fix problem on big endian machines.
+
2002-07-26 Gary Thomas <gary@chez-thomas.org>
2002-07-26 Ken Cox <jkc@redhat.com>
* src/ecos/support.c (ovbcopy): ovbcopy() must handle the case
where the src and dst regions are overlayed. memcpy() does not
Index: net/bsd_tcpip/current/src/sys/netinet/in_cksum.c
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/bsd_tcpip/current/src/sys/netinet/in_cksum.c,v
retrieving revision 1.1
diff -u -5 -p -r1.1 in_cksum.c
--- net/bsd_tcpip/current/src/sys/netinet/in_cksum.c 20 May 2002 22:25:02 -0000 1.1
+++ net/bsd_tcpip/current/src/sys/netinet/in_cksum.c 31 Jul 2002 13:59:08 -0000
@@ -86,15 +86,23 @@
sum = l_util.s[0] + l_util.s[1]; \
ADDCARRY(sum); \
}
static const u_int32_t in_masks[] = {
+#if BYTE_ORDER == BIG_ENDIAN
+ /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/
+ 0x00000000, 0xFF000000, 0xFFFF0000, 0xFFFFFF00, /* offset 0 */
+ 0x00000000, 0x00FF0000, 0x00FFFF00, 0x00FFFFFF, /* offset 1 */
+ 0x00000000, 0x0000FF00, 0x0000FFFF, 0x0000FFFF, /* offset 2 */
+ 0x00000000, 0x000000FF, 0x000000FF, 0x000000FF, /* offset 3 */
+#else
/*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/
0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */
0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */
0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */
0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */
+#endif
};
union l_util {
u_int16_t s[2];
u_int32_t l;
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss