diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-08-22 09:48:32 +0200 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-11-04 18:10:09 +0100 |
commit | ccf813e13eba7b5c71cc3090582f50f25ba7b721 (patch) | |
tree | 2316f2d00a2c6fa8dc5c4195386cf9554cc49726 /lib/includes | |
parent | 6b7f4c3f9d9d26a5aa71be8f5976956aff387e8f (diff) |
[HICN-262] Fix binary api to prevent byteswapping of ip addresses in vapi
Change-Id: If3f9a7db1e1310fdc08d1003b28e5e1d4006b61e
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'lib/includes')
-rw-r--r-- | lib/includes/hicn/compat.h | 12 | ||||
-rw-r--r-- | lib/includes/hicn/util/ip_address.h | 17 |
2 files changed, 16 insertions, 13 deletions
diff --git a/lib/includes/hicn/compat.h b/lib/includes/hicn/compat.h index b31d01a0d..2796983c6 100644 --- a/lib/includes/hicn/compat.h +++ b/lib/includes/hicn/compat.h @@ -234,7 +234,7 @@ int hicn_packet_get_payload (hicn_format_t format, */ int hicn_packet_get_locator (hicn_format_t format, const hicn_header_t * packet, - ip_prefix_t * prefix, bool is_interest); + ip_address_t * prefix, bool is_interest); /** * @brief Sets the locator of an interest / data packet @@ -246,7 +246,7 @@ int hicn_packet_get_locator (hicn_format_t format, * @return hICN error code */ int hicn_packet_set_locator (hicn_format_t format, hicn_header_t * packet, - const ip_prefix_t * prefix, + const ip_address_t * prefix, bool is_interest); /** @@ -396,9 +396,9 @@ int hicn_interest_set_name (hicn_format_t format, hicn_header_t * interest, const hicn_name_t * name); int hicn_interest_get_locator (hicn_format_t format, const hicn_header_t * interest, - ip_prefix_t * prefix); + ip_address_t * prefix); int hicn_interest_set_locator (hicn_format_t format, hicn_header_t * interest, - const ip_prefix_t * prefix); + const ip_address_t * prefix); int hicn_interest_compare (const hicn_header_t * interest_1, const hicn_header_t * interest_2); int hicn_interest_set_lifetime (hicn_header_t * interest, u32 lifetime); @@ -425,9 +425,9 @@ int hicn_data_get_name (hicn_format_t format, const hicn_header_t * data, int hicn_data_set_name (hicn_format_t format, hicn_header_t * data, const hicn_name_t * name); int hicn_data_get_locator (hicn_format_t format, const hicn_header_t * data, - ip_prefix_t * prefix); + ip_address_t * prefix); int hicn_data_set_locator (hicn_format_t format, hicn_header_t * data, - const ip_prefix_t * prefix); + const ip_address_t * prefix); int hicn_data_compare (const hicn_header_t * data_1, const hicn_header_t * data_2); int hicn_data_get_expiry_time (const hicn_header_t * data, u32 * expiry_time); 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); |