UDP checksum broken, -head and releng_8
Daniel Eischen
deischen at freebsd.org
Fri Jan 7 10:06:23 UTC 2011
When sending multicast packets to a socket that is _not_
bound to the multicast address, this generates bad UDP
checksums. This use to work and was broke sometime between
the middle of October and late December as far as I can
tell.
A test program is here:
http://people.freebsd.org/~deischen/test_net.c
It will use multicast with the -b option, so run it with
something like this:
test_net -b 225.168.2.50 -p 5000 -m 64
And on another box, use tcpdump to see the bad checksums,
as in:
tcpdump -x -s0 -vvv host 225.168.2.50 and port 5000
This is a real problem for us because our applications
cannot read the multicast data (both the Solaris and
VxWork stacks refuse to deliver the packets with bad
checksums).
As a data point, if the sending socket is bound to
the multicast address, then the checksums are calculated
correctly. It is only if the socket is bound to a
different address (the host IP and ephemeral port),
that the checksum is invalid. To see this, you can
change line 827 in test_net.c from this:
if ((ss = init_mcast_socket(p, mcast_addr, if_addr, 1, 0)) < 0)
to
if ((ss = init_mcast_socket(p, mcast_addr, if_addr, 1, 1)) < 0)
Here's a snippet from a tcpdump showing the problem:
04:46:13.640846 IP (tos 0x0, ttl 1, id 42777, offset 0, flags [none],
proto UDP (17), length 92) 192.168.3.85.60133 > 225.168.2.50.5000: [bad
udp cksum 3c02!] UDP, length 64
0x0000: 4500 005c a719 0000 0111 6aa0 c0a8 0355
0x0010: e1a8 0232 eae5 1388 0048 1cc6 0000 0038
0x0020: 0000 0018 0000 0000 0000 0000 0000 0000
0x0030: 0000 0000 0000 0000 0000 0000 0000 0000
0x0040: 0000 0000 0000 0000 0000 0000 0000 0000
0x0050: 0000 0000 0000 0000 0000 0000
04:46:13.741800 IP (tos 0x0, ttl 1, id 42778, offset 0, flags [none],
proto UDP (17), length 92) 192.168.3.85.60133 > 225.168.2.50.5000: [bad
udp cksum 3c02!] UDP, length 64
0x0000: 4500 005c a71a 0000 0111 6a9f c0a8 0355
0x0010: e1a8 0232 eae5 1388 0048 c76f 0000 0038
0x0020: 0000 0019 5555 5555 5555 5555 5555 5555
0x0030: 5555 5555 5555 5555 5555 5555 5555 5555
0x0040: 5555 5555 5555 5555 5555 5555 5555 5555
0x0050: 5555 5555 5555 5555 5555 5555
--
DE
More information about the freebsd-current
mailing list