tis 2008-04-01 klockan 22:59 +1300 skrev Amos Jeffries: > I started out that way (assuming ss_len was absent but sin_len was > present) but a header analysis proved the assumption wrong. sin_len also > proves very absent from Debian Linux 2.6.25 headers.
Somehow I doubt that linux would change the socket ABI between 2.6.24 and 2.6.25 breaking all applications.. Additinally the relevant header is not really from the kernel but glibc.. > OS that I know of and have tested the headers for all define a > SOCKADDR_COMMON() macro for these types which neatly ensures they all > have the same initial format within a given kernel. But not necessarily > the same as other kernels. Linux only has the family in the common part, with length being a family specific member so you need to look in the actual definition of sockaddr_in and sockaddr_in6 to find it. family ---- length data FreeBSD has a both length and family in the common area length family --- data > AFAICT they are formally required to do so for sockaddr_in6. But not for > sockaddr_in or sockaddr_storage. sockaddr_in must have a sin_length for BSD socket implementations, which is the common implementation seen in most OS:es... sockaddr_storage does not have much requirements other than it being able to store all supported sockaddr formats and there at minimum being a ss_family member telling the address format.. Regards Henrik
