kern/99558: FreeBSD 6.1 can't send packets to INADDR_BROADCAST

Andrey V. Elsukov bu7cher at yandex.ru
Thu Jun 29 05:55:27 UTC 2006


Bruce M Simpson wrote:
> Please read the manual page ip(4) for information on the IP_ONESBCAST
> option. The INADDR_BROADCAST destination is by its nature non specific
> and link local therefore you need to use the IP_ONESBCAST option to
> cause undirected broadcasts to be sent on a particular interface.
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=99558

Ok. I've tested 5.4-STABLE.
Without IP_ONESBCAST:
09:24:50.293393 IP 10.0.0.4.5000 > 10.0.7.255.5000: UDP, length: 4
0x0000:  ffff ffff ffff 0007 e909 d5b3 0800 4500  ..............E.
0x0010:  0020 24d7 0000 4011 39f4 0a00 0004 0a00  ..$... at .9.......
0x0020:  07ff 1388 1388 000c 1c20 7465 7374       ..........test

With IP_ONESBCAST:
09:28:08.275418 IP 10.0.0.4.54715 > 255.255.255.255.5000: UDP,length:4
0x0000:  ffff ffff ffff 0007 e909 d5b3 0800 4500  ..............E.
0x0010:  0020 8987 0000 4011 e742 0a00 0004 ffff  ...... at ..B......
0x0020:  ffff d5bb 1388 000c 0a21 7465 7374       .........!test

In result we have difference only in IP destination address.
I want to pay attention that a Ethernet destination address is a
ethernet broadcast!

Now for 6.1-STABLE. Without IP_ONESBCAST:
10:43:15.384080 IP 172.21.81.19.58298 > 255.255.255.255.5000: UDP, 
length 4
0x0000:  0011 936b 3c91 0080 4819 86df 0800 4500  ...k<...H.....E.
0x0010:  0020 a670 0000 4011 d734 ac15 5113 ffff  ...p.. at ..4..Q...
0x0020:  ffff e3ba 1388 000c 2391 7465 7374 0000  ........#.test..
0x0030:  0000 0000 0000 0000 0000 0000            ............

With IP_ONESBCAST:
10:44:20.320314 IP 172.21.81.19.53276 > 255.255.255.255.5000: UDP, 
length 4
0x0000:  0011 936b 3c91 0080 4819 86df 0800 4500  ...k<...H.....E.
0x0010:  0020 a998 0000 4011 d40c ac15 5113 ffff  ...... at .....Q...
0x0020:  ffff d01c 1388 000c 372f 7465 7374 0000  ........7/test..
0x0030:  0000 0000 0000 0000 0000 0000            ............

In result we have an identical datagrams with *incorrect* ethernet
destination addresses. When my system don't have default route, he
can not send broadcast. I've got error message "sendto(): Network is
unreachable"!

-- 
WBR, Andrey V. Elsukov


More information about the freebsd-bugs mailing list