weird behaviour of bind() with sin_family=0

Luigi Rizzo rizzo at icir.org
Sun Apr 20 07:39:38 PDT 2003


Hi,
i have some code (which works on FreeBSD) which was supposed to
do a bind() of a UDP socket on address 0.0.0.0/5678
When running it under cygwin, i got a bind() error which made
me notice that i forgot to set sin_family = PF_INET, 
resulting in a value of 0 (which corresponds to AF_UNSPEC)
in that field. Cygwin complains
at runtime with "unsupported protocol family", whereas
FreeBSD succeeds in binding to the UDP socket.

Is this to be considered a feature or a bug ?
And, any idea on why it works like this ?

	cheers
	luigi


More information about the freebsd-stable mailing list