include/netinet/in.h: Rename __pad member to sin_zero in struct sockaddr_in.

Libwebsockets initializes the 'sin_zero' member of sockaddr_in objects to zeros.
Apparently, judging from mailing list entries, there are platforms on which incliinclunot
doing this causes undefined behaviour.

On NuttX compiling respective code is broken, as the corresponding member
variable is called '__pad'.  Neither in the 'nuttx' nor in the 'apps'
respository did I find any reference to this identifier.  Thus, I believe its a
safe bet to just rename it.

UNIX Network Programming states in this regard:

"The POSIX specification requires only three members in the structure: sin_family,
sin_addr, and sin_port. It is acceptable for a POSIX-compliant implementation to
define additional structure members, and this is normal for an Internet socket
address structure. Almost all implementations add the sin_zero member so that all
socket address structures are at least 16 bytes in size."
This commit is contained in:
Michael Jung 2019-07-29 08:25:35 -06:00 committed by Gregory Nutt
parent 7a151016c2
commit 4f27140331

View file

@ -222,7 +222,7 @@ struct sockaddr_in
sa_family_t sin_family; /* Address family: AF_INET */ sa_family_t sin_family; /* Address family: AF_INET */
in_port_t sin_port; /* Port in network byte order */ in_port_t sin_port; /* Port in network byte order */
struct in_addr sin_addr; /* Internet address */ struct in_addr sin_addr; /* Internet address */
uint8_t __pad[8]; uint8_t sin_zero[8];
}; };
/* Used with certain IPv4 socket options */ /* Used with certain IPv4 socket options */