= n >>>>> 'struct >>>>>>> in6_addr' >>>>>>> 95 | ipv6->sin6_addr.s6_addr32[3] =3D 0; >>>>>>> | ~~~~~~~~~~~~~~~ ^ >>>>>>> but yet, we kinda define them, but only for the kernel and boot l= oader: >>>>>>> /* >>>>>>> * IPv6 address >>>>>>> */ >>>>>>> struct in6_addr { >>>>>>> union { >>>>>>> uint8_t __u6_addr8[16]; >>>>>>> uint16_t __u6_addr16[8]; >>>>>>> uint32_t __u6_addr32[4]; >>>>>>> } __u6_addr; /* 128-bit IP6 address */ >>>>>>> }; >>>>>>> >>>>>>> #define s6_addr __u6_addr.__u6_addr8 >>>>>>> #if defined(_KERNEL) || defined(_STANDALONE) /* XXX nonstandard *= / >>>>>>> #define s6_addr8 __u6_addr.__u6_addr8 >>>>>>> #define s6_addr16 __u6_addr.__u6_addr16 >>>>>>> #define s6_addr32 __u6_addr.__u6_addr32 >>>>>>> #endif >>>>>>> >>>>>>> I'm wondering if anybody why it's like that? git blame suggests w= e >>>>> imported >>>>>>> that from kame, with >>>>>>> only tweaks by people that are now deceased*.* >>>>>>> >>>>>>> Why not just expose them? >>>>>> >>>>>> Looks like only s6_addr is specified in the RFCs (2553 and 3493). = Oddly, >>>>>> though, the RFCs give an example implementation using that union w= ith >>>>>> different element names (like _S6_u8), and show the one #define. >>>>>> Similarly, POSIX specifies only s6_addr, but it allows other membe= rs >>>>>> of the structure, so I don't see a problem with exposing them all = even >>>>>> in a POSIX environment. >>>>>> >>>>>> I would have no objection to exposing all four definitions, especi= ally >>>>>> if Linux apps use them. >>>>> >>>>> I put the change, along with an explanatory comment, in >>>>> https://reviews.freebsd.org/D44979. Comments welcome. >>>>> >>>> >>>> Thanks! I was testing a similar change, but I like yours better... t= hough >>>> maybe >>>> we should just make it visible when __BSD_VISIBLE is true.... I'll h= ave to >>>> look >>>> closely at what Linux does here... I think they have it always visib= le, or >>>> at least >>>> musl does that (glibc is harder to track down due to the many layers= of >>>> indirection). >>> >>> I thought briefly about __BSD_VISIBLE, but wasn't sure it was necessa= ry. >>> Let me know what you find out. I think it should work either way; in= =2Eh >>> includes cdefs.h, so it's guaranteed to have been included. >> >> If the -ms-extensions option is used with gcc or clang, this ugliness = can >> go away as you can have nested anonymous unions or -structs and their = fields >> can be referenced as if they're directly in the parent struct/union. >> >> [IIRC this was present in Plan9 C from very early on. Also in C11 or l= ater] >> >> True. In fact c11 and newer doesn't need anything on the command line = here. If it were only in the kernel then I'd chamge it like thay while I = was here... but lots of code in ports will specify c99 + POSIX 2001 and t= o compile there your only hope is this construct.... > > Such defines were typically within #if defined(KERNEL) .. #endif > so non-kld ports shouldn't be referring to them, right?! I don't know if that is typical, but in this case the point is to make it= visible to user level. We don't expect base/ports to do that currently, but imported programs will. Mike