Stefan Winter wrote:
A colleague of mine played around with netcat and FR and straced both. There is one difference in the socket() call:
netcat, IPv4, UDP: socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
Ah. SO_REUSEADDR means "allow multiple programs to listen on the same address"
The difference being: socket(..., IPPROTO_UDP <-> IPPROTO_IP) (the setsockopt looks harmless, but not sure).
I don't think that's it.
Why that would be a difference is not clear to me. A wild guess is that SOCK_DGRAM+IPPROTO_IP binds to all datagram-based IP payload protocols, which may be more than UDP, and that one of those non-UDP bindings clashes when trying to bind, even to an IPv6 address. Weird.
If netcat is listening on IP sockets, there are less issues with conflicts. Alan DeKok.