From 4f27140331ca36798e5a6169ca556be6afe8face Mon Sep 17 00:00:00 2001 From: Michael Jung Date: Mon, 29 Jul 2019 08:25:35 -0600 Subject: [PATCH] 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." --- include/netinet/in.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/netinet/in.h b/include/netinet/in.h index 1afd5d12068..813db3d4469 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -222,7 +222,7 @@ struct sockaddr_in sa_family_t sin_family; /* Address family: AF_INET */ in_port_t sin_port; /* Port in network byte order */ struct in_addr sin_addr; /* Internet address */ - uint8_t __pad[8]; + uint8_t sin_zero[8]; }; /* Used with certain IPv4 socket options */