[TEST ATTACHED] Inconsistencies with IP_ONESBCAST and/or
Bruce M Simpson
bms at incunabulum.net
Wed Jan 31 16:57:04 UTC 2007
In preparation for tightening up our handling of INADDR_BROADCAST sends,
I ran some brief tests today on the network stack with the attached test
I found some inconsistencies when run against 6.2-RELEASE;
1. IP_ONESBCAST breaks if SO_DONTROUTE is specified.
One thing appears to be consistent about the failure mode: bad UDP
dc(4) is being used on the destination end of the test network, so
checksum offloading should not be an issue.
I am also seeing the wrong destination address being used in most cases.
This is intermittent regardless of whether the socket is bound or unbound.
2. IP_SENDSRCADDR has some other inconsistencies.
a. The option is always rejected if the socket is not bound.
I find this behaviour suspect; the whole point of the option is to
specify, for SOCK_DGRAM and SOCK_RAW, the source address of a packet.
b. 0.0.0.0 is always accepted.
A regular interface lookup is used based on destination if this is
specified. This appears suspect to me because such an option is redundant.
In theory a developer should be able to write code which uses
SO_DONTROUTE and IP_SENDSRCADDR to bypass the routing table lookup when
sending to 255.255.255.255.
Currently this doesn't appear to be the case, though IP_SENDSRCADDR is a
separate issue from IP_ONESBCAST.
More information about the freebsd-net