Simon Josefsson wrote: > +#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
If the goal is that sizeof (struct sockaddr_storage) == _SS_SIZE, then the formula is incorrect. It should be (_SS_SIZE - (max (sizeof (sa_family_t), alignof (__ss_aligntype)) + sizeof (__ss_aligntype))) > +#define _SS_SIZE 128 Is this enough for all platforms? Let's see... - On platforms like FreeBSD 5.2, MacOS X 10.3, NetBSD 3.0, AIX 5.1, OSF/1 5.1, Haiku, mingw, 'struct sockaddr_storage' is defined with size 128, hence this bound will also be valid for earlier releases of these OSes. - IRIX 6.5 has no 'struct sockaddr_storage' but all 'struct sockaddr_*' variants are less than 64 bytes in size. - On OpenBSD 3.8 and HP-UX 11.23, 'struct sockaddr_storage' is defined with a size 256, but actually all 'struct sockaddr_*' variants are less than 64 bytes in size. - But on Solaris 10, 'struct sockaddr_storage' is defined with a size 256, and 'struct sockaddr_dl' actually has size 252. So I would make _SS_SIZE larger, to 256, at least on Solaris. Bruno