On Dec 8, 2008, at Dec 8, 2008, 6:28 PM, Steinar H. Gunderson wrote:
On Mon, Dec 08, 2008 at 05:55:40PM -0500, Steve Dickson wrote:
Yes... one does pass pointers of struct sockaddr to the majority
of the network system call such as bind().. but conventionally
I've seen a lot of declare struct sockaddr as memory then typecasting
that memory into a struct sockaddr_in pointer...
That's just wrong. Don't do that :-) (Where have you seen this, by
the way?)
The server-side sysctl code defines a data structure shared between
nfs-utils and the kernel which has some fields defined as type "struct
sockaddr". That code works because "struct sockaddr_in" and "struct
sockaddr" happen to be the same size.
But it is incorrect. Since those are legacy interfaces and only need
to handle IPv4 addresses, they are not worth fixing at this point.
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html