On Tue, 9 Jul 2002, Juan Francisco Rodriguez Hervella wrote:

> Hello:
> 
> I'm seeing that "struct sockaddr_in" has a field like this:
> 
> char sin_zero[8];
> 
> Why ?
> Could anyone explain me what's used for ?
> 
> Could it be bad if I'd add the same field to
> "sockaddr_in6" ?
> 
> PS: I'm trying to implement divert sockets for
> IPv6 using the KAME implementation of "ip6fw".
> 
> Thanks.
> 
> JFRH.
> 

  The minimum size of a sockaddr's address portion (as defined in
sys/socket.h) is 14 bytes (max is SOCK_MAXADDRLEN = 255); combined with
the size of the sa_len and sa_family fields you get a minimum length of 16
bytes for the entire structure.  The sin_zero field of sockaddr_in is to
pad the structure out to this minimum length.  Given that a sockaddr_in6
is already larger than the minimum required, there really isn't any point
in adding the padding field to it.

  Kelly

--
Kelly Yancey -- kbyanc@{posi.net,FreeBSD.org}


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to