diff options
author | Thomas Haller <thaller@redhat.com> | 2018-05-25 11:10:13 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-05-26 20:11:04 +0200 |
commit | 1c5e7902775b895a9c57abfeec5a63da98d628e9 (patch) | |
tree | 45245eda8c7b36c02a8e19b9641a09bae8fed477 /src | |
parent | f11bb3d93d3557847018871cacf918ea24664ddf (diff) | |
download | NetworkManager-1c5e7902775b895a9c57abfeec5a63da98d628e9.tar.gz |
core: let NM_IS_IP_CONFIG() check for expected addr-family
Still unused...
Diffstat (limited to 'src')
-rw-r--r-- | src/dns/nm-dns-manager.c | 6 | ||||
-rw-r--r-- | src/nm-ip4-config.h | 12 | ||||
-rw-r--r-- | src/nm-policy.c | 4 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index 669371378d..f5500ee794 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -232,7 +232,7 @@ _ASSERT_ip_config_data (const NMDnsIPConfigData *ip_data) { nm_assert (ip_data); _ASSERT_config_data (ip_data->data); - nm_assert (NM_IS_IP_CONFIG (ip_data->ip_config)); + nm_assert (NM_IS_IP_CONFIG (ip_data->ip_config, AF_UNSPEC)); nm_assert (c_list_contains (&ip_data->data->data_lst_head, &ip_data->data_lst)); nm_assert (ip_data->data->ifindex == nm_ip_config_get_ifindex (ip_data->ip_config)); } @@ -245,7 +245,7 @@ _ip_config_data_new (NMDnsConfigData *data, NMDnsIPConfigData *ip_data; _ASSERT_config_data (data); - nm_assert (NM_IS_IP_CONFIG (ip_config)); + nm_assert (NM_IS_IP_CONFIG (ip_config, AF_UNSPEC)); nm_assert (ip_config_type != NM_DNS_IP_CONFIG_TYPE_REMOVED); ip_data = g_slice_new0 (NMDnsIPConfigData); @@ -1562,7 +1562,7 @@ nm_dns_manager_set_ip_config (NMDnsManager *self, NMDnsIPConfigData **p_best; g_return_val_if_fail (NM_IS_DNS_MANAGER (self), FALSE); - g_return_val_if_fail (NM_IS_IP_CONFIG (ip_config), FALSE); + g_return_val_if_fail (NM_IS_IP_CONFIG (ip_config, AF_UNSPEC), FALSE); ifindex = nm_ip_config_get_ifindex (ip_config); g_return_val_if_fail (ifindex > 0, FALSE); diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h index e2f40fd345..78aca14e43 100644 --- a/src/nm-ip4-config.h +++ b/src/nm-ip4-config.h @@ -295,9 +295,15 @@ gboolean _nm_ip_config_check_and_add_domain (GPtrArray *array, const char *domai #include "nm-ip6-config.h" static inline gboolean -NM_IS_IP_CONFIG (gconstpointer config) +NM_IS_IP_CONFIG (gconstpointer config, int addr_family) { - return NM_IS_IP4_CONFIG (config) || NM_IS_IP6_CONFIG (config); + if (addr_family == AF_UNSPEC) + return NM_IS_IP4_CONFIG (config) || NM_IS_IP6_CONFIG (config); + if (addr_family == AF_INET) + return NM_IS_IP4_CONFIG (config); + if (addr_family == AF_INET6) + return NM_IS_IP6_CONFIG (config); + g_return_val_if_reached (FALSE); } #if _NM_CC_SUPPORT_GENERIC @@ -334,7 +340,7 @@ NM_IS_IP_CONFIG (gconstpointer config) NMIP6Config * : (NM_IS_IP6_CONFIG (_config))); \ }) #else -#define _NM_IS_IP_CONFIG(typeexpr, config) NM_IS_IP_CONFIG(config) +#define _NM_IS_IP_CONFIG(typeexpr, config) NM_IS_IP_CONFIG(config, AF_UNSPEC) #endif #define NM_IP_CONFIG_CAST(config) \ diff --git a/src/nm-policy.c b/src/nm-policy.c index 61cc001f0b..a90dd97bf6 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1910,8 +1910,8 @@ device_ip_config_changed (NMDevice *device, int addr_family; nm_assert (new_config || old_config); - nm_assert (!new_config || NM_IS_IP_CONFIG (new_config)); - nm_assert (!old_config || NM_IS_IP_CONFIG (old_config)); + nm_assert (!new_config || NM_IS_IP_CONFIG (new_config, AF_UNSPEC)); + nm_assert (!old_config || NM_IS_IP_CONFIG (old_config, AF_UNSPEC)); if (new_config) { addr_family = nm_ip_config_get_addr_family (new_config); |