Is there a blanket requirement somewhere in POSIX which says that whenever a structure may have members in addition to the required ones, these members must be initialized (and specifically to zero) when the application creates such a structure and passes it to a library function?
(If so, why are they repeating that requirement for struct sockaddr_in6?)
In any case, does the issue reproduce on FreeBSD? If I google for this bind problem, it only appears to be reported against Mac OS X, and no other Unix, historic or current.
https://groups.google.com/forum/#!topic/comp.std.c/zl15FkixB...
If a standard structure may have additional members, those do not have to be initialized by the program, unless the requirement is explicit somewhere. For example, we do not have to initialize members of "struct tm" other than the standard ones when calling asctime; there is no wording which absolves asctime of behaving as required if those members are not initialized.
The same reasoning applies to the POSIX bind function and the members of struct sockaddr_in. (But not struct sockaddr_in6, for which initialization requirements are specified).
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/net...
> The <netinet/in.h> header shall define the sockaddr_in structure that includes at least the following members: [...]
The "at least" is the keyword. Additional members in the struct are allowed by POSIX. You have to expect and handle them according to the standard.