diff --git a/lib/birdlib.h b/lib/birdlib.h index 0779655e..9bbffe02 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -11,6 +11,7 @@ #include "lib/alloca.h" #include +#include /* Ugly structure offset handling macros */ diff --git a/lib/net.c b/lib/net.c index e83cdce7..64cf9e04 100644 --- a/lib/net.c +++ b/lib/net.c @@ -75,6 +75,21 @@ STATIC_ASSERT(sizeof(net_addr_ip6_sadr) == 40); STATIC_ASSERT(sizeof(net_addr_mpls) == 8); STATIC_ASSERT(sizeof(net_addr_aspa) == 8); +/* Ensure that all net_addr structures have the same alignment */ +STATIC_ASSERT(alignof(net_addr_ip4) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_ip6) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_vpn4) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_vpn6) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_roa4) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_roa6) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_flow4) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_flow6) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_flow4) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_flow6) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_ip6_sadr) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_mpls) == alignof(net_addr)); +STATIC_ASSERT(alignof(net_addr_aspa) == alignof(net_addr)); + int rd_format(const vpn_rd rd_, char *buf, int buflen) diff --git a/lib/net.h b/lib/net.h index fe5c0d8c..a1fd0291 100644 --- a/lib/net.h +++ b/lib/net.h @@ -51,7 +51,7 @@ typedef struct net_addr { u8 pxlen; u16 length; u8 data[20]; - u64 align[0]; + u32 align[0]; } net_addr; typedef struct net_addr_ip4 {