From ccf813e13eba7b5c71cc3090582f50f25ba7b721 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Thu, 22 Aug 2019 09:48:32 +0200 Subject: [HICN-262] Fix binary api to prevent byteswapping of ip addresses in vapi Change-Id: If3f9a7db1e1310fdc08d1003b28e5e1d4006b61e Signed-off-by: Alberto Compagno --- lib/includes/hicn/util/ip_address.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/includes/hicn/util/ip_address.h') diff --git a/lib/includes/hicn/util/ip_address.h b/lib/includes/hicn/util/ip_address.h index 542e6e4c6..e39d08585 100644 --- a/lib/includes/hicn/util/ip_address.h +++ b/lib/includes/hicn/util/ip_address.h @@ -65,12 +65,15 @@ #define DUMMY_PORT 1234 typedef union { - union { - struct in_addr as_inaddr; - u8 as_u8[4]; - u16 as_u16[2]; - u32 as_u32; - } v4; + struct { + u32 pad[3]; + union { + struct in_addr as_inaddr; + u8 as_u8[4]; + u16 as_u16[2]; + u32 as_u32; + } v4; + }; union { struct in6_addr as_in6addr; u8 as_u8[16]; @@ -121,7 +124,7 @@ extern const ip_address_t IP_ADDRESS_EMPTY; /* IP address */ int ip_address_get_family (const char * ip_address); -int ip_address_len (const ip_address_t * ip_address, int family); +int ip_address_len (int family); int ip_address_ntop (const ip_address_t * ip_address, char *dst, const size_t len, int family); int ip_address_pton (const char *ip_address_str, ip_address_t * ip_address); -- cgit 1.2.3-korg