IPv6 APIs rework

Robin Jarry rjarry at redhat.com
Thu Jul 18 23:40:36 CEST 2024


Stephen Hemminger, Jul 18, 2024 at 23:15:
> If you look at the standard netinet/in.h the storage of IPv6 addresses
> is in in6_addr. DPDK has always wanted to do its own thing...
>
> The in6_addr is a union with no explicit alignment.
>
> struct in6_addr
>   {
>     union
>       {
>         uint8_t __u6_addr8[16];
>         uint16_t __u6_addr16[8];
>         uint32_t __u6_addr32[4];
>       } __in6_u;
>
> Better to not have explicit alignment and not have 64 bit value.

The main reason why I didn't use the standard POSIX type is that it has 
an alignment of 4 which means it cannot always be mapped directly to 
packets in memory depending on the encapsulating protocol.

Also, ip->__in6_u.__u6_addr8 is really ugly as a field name, even if 
the "helper" macros (ip->s6_addr8) make them a bit better :)

What do you have against adding a 64 bit value in the union?



More information about the dev mailing list