From 951e5f5bf87df01c603c9cbe69f401bfdfbbd579 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 27 Apr 2017 13:58:38 +0200 Subject: core: make dad_counter argument guint32 type The dad_counter is hashed into the resulting address. Since we want the hashing to be independent of the architecture, we always hash 32 bit of dad_counter. Make the dad_counter argument of type guint32 for consistency. In practice this has no effect because: - for all our (current!) architectues, guint is the same as guint32. - all callers of nm_utils_ipv6_addr_set_stable_privacy() keep their dad-counter argument as guint8, so they never even pass numbers larger then 255. - nm_utils_ipv6_addr_set_stable_privacy() limits dad_counter further against RFC7217_IDGEN_RETRIES. --- src/devices/nm-device.c | 2 +- src/nm-core-utils.c | 8 ++++---- src/nm-core-utils.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index d49e36b34b..46bc50f9a2 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1358,7 +1358,7 @@ nm_device_get_ip_iface_identifier (NMDevice *self, NMUtilsIPv6IfaceId *iid, gboo if (!ignore_token) { s_ip6 = (NMSettingIP6Config *) - nm_device_get_applied_setting (self, NM_TYPE_SETTING_IP6_CONFIG); + nm_device_get_applied_setting (self, NM_TYPE_SETTING_IP6_CONFIG); g_return_val_if_fail (s_ip6, FALSE); token = nm_setting_ip6_config_get_token (s_ip6); } diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 01bb9c1d44..567f06c25c 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -3329,7 +3329,7 @@ nm_utils_ipv6_interface_identifier_get_from_addr (NMUtilsIPv6IfaceId *iid, */ gboolean nm_utils_ipv6_interface_identifier_get_from_token (NMUtilsIPv6IfaceId *iid, - const char *token) + const char *token) { struct in6_addr i6_token; @@ -3578,7 +3578,7 @@ _set_stable_privacy (NMUtilsStableType stable_type, struct in6_addr *addr, const char *ifname, const char *network_id, - guint dad_counter, + guint32 dad_counter, guint8 *secret_key, gsize key_len, GError **error) @@ -3653,7 +3653,7 @@ nm_utils_ipv6_addr_set_stable_privacy_impl (NMUtilsStableType stable_type, struct in6_addr *addr, const char *ifname, const char *network_id, - guint dad_counter, + guint32 dad_counter, guint8 *secret_key, gsize key_len, GError **error) @@ -3675,7 +3675,7 @@ nm_utils_ipv6_addr_set_stable_privacy (NMUtilsStableType stable_type, struct in6_addr *addr, const char *ifname, const char *network_id, - guint dad_counter, + guint32 dad_counter, GError **error) { gs_free guint8 *secret_key = NULL; diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index e39b5f65f8..fdcbbdb1ad 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -367,7 +367,7 @@ gboolean nm_utils_ipv6_addr_set_stable_privacy_impl (NMUtilsStableType stable_ty struct in6_addr *addr, const char *ifname, const char *network_id, - guint dad_counter, + guint32 dad_counter, guint8 *secret_key, gsize key_len, GError **error); @@ -376,7 +376,7 @@ gboolean nm_utils_ipv6_addr_set_stable_privacy (NMUtilsStableType id_type, struct in6_addr *addr, const char *ifname, const char *network_id, - guint dad_counter, + guint32 dad_counter, GError **error); char *nm_utils_hw_addr_gen_random_eth (const char *current_mac_address, -- cgit v1.2.1