sin_family not checked for UDP sockets?

Mark Gritter (mark@erdos.Stanford.EDU)
Mon, 8 Mar 1999 01:14:37 -0800 (PST)

I was looking at the Linux sockets code, and noticed that address family
(sockaddr_in.sin_family) doesn't get checked on a bind() to a datagram
socket. Only the address length is verified. (I'm looking at inet_bind(),
in net/ipv4/af_inet.c)

I wrote a test program and verified that the call to bind() with a bogus
address family succeeds, instead of setting errno to EINVAL as documented.
This occurs in 2.2 kernels, and appears identical in 2.0.36.

Is there some reason to avoid doing this check? Or is this just a bug?
Or should the IP(4) man page get fixed?

Mark Gritter

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to