net: ip: Verify that in_addr/in6_addr struct sizes are correct

Make sure that in_addr/in6_addr structure size match the respective
binary IP address size with BUILD_ASSERT.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2021-10-04 13:16:19 +02:00 committed by Anas Nashif
commit 0da228c57c
3 changed files with 10 additions and 0 deletions

View file

@ -144,6 +144,9 @@ struct in6_addr {
};
};
/* Binary size of the IPv6 address */
#define NET_IPV6_ADDR_SIZE 16
/** IPv4 address struct */
struct in_addr {
union {
@ -154,6 +157,9 @@ struct in_addr {
};
};
/* Binary size of the IPv4 address */
#define NET_IPV4_ADDR_SIZE 4
/** Socket address family type */
typedef unsigned short int sa_family_t;