core,clients: use our own string hashing function nm_str_hash()

Replace the usage of g_str_hash() with our own nm_str_hash().

GLib's g_str_hash() uses djb2 hashing function, just like we
do at the moment. The only difference is, that we use a diffrent
seed value.

Note, that we initialize the hash seed with random data (by calling
getrandom() or reading /dev/urandom). That is a change compared to
before.

This change of the hashing function and accessing the random pool
might be undesired for libnm/libnm-core. Hence, the change is not
done there as it possibly changes behavior for public API. Maybe
we should do that later though.

At this point, there isn't much of a change. This patch becomes
interesting, if we decide to use a different hashing algorithm.
This commit is contained in:
Thomas Haller 2017-10-13 16:12:35 +02:00
parent 0e9e35e309
commit 3434261811
43 changed files with 93 additions and 76 deletions

View file

@ -3192,6 +3192,15 @@ clients_cppflags = \
check_ltlibraries += clients/common/libnmc-base.la check_ltlibraries += clients/common/libnmc-base.la
clients_common_libnmc_base_la_SOURCES = \ clients_common_libnmc_base_la_SOURCES = \
shared/nm-utils/nm-enum-utils.c \
shared/nm-utils/nm-enum-utils.h \
shared/nm-utils/nm-hash-utils.c \
shared/nm-utils/nm-hash-utils.h \
shared/nm-utils/nm-random-utils.c \
shared/nm-utils/nm-random-utils.h \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-shared-utils.h \
\
clients/common/nm-secret-agent-simple.c \ clients/common/nm-secret-agent-simple.c \
clients/common/nm-secret-agent-simple.h \ clients/common/nm-secret-agent-simple.h \
clients/common/nm-vpn-helpers.c \ clients/common/nm-vpn-helpers.c \
@ -3240,11 +3249,6 @@ EXTRA_LTLIBRARIES += clients/common/libnmc.la
endif endif
clients_common_libnmc_la_SOURCES = \ clients_common_libnmc_la_SOURCES = \
shared/nm-utils/nm-enum-utils.c \
shared/nm-utils/nm-enum-utils.h \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-shared-utils.h \
\
shared/nm-meta-setting.c \ shared/nm-meta-setting.c \
shared/nm-meta-setting.h \ shared/nm-meta-setting.h \
\ \
@ -3426,8 +3430,6 @@ clients_tui_newt_libnmt_newt_a_CPPFLAGS = \
bin_PROGRAMS += clients/tui/nmtui bin_PROGRAMS += clients/tui/nmtui
clients_tui_nmtui_SOURCES = \ clients_tui_nmtui_SOURCES = \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-shared-utils.h \
clients/tui/nmtui.c \ clients/tui/nmtui.c \
clients/tui/nmtui.h \ clients/tui/nmtui.h \
clients/tui/nmtui-connect.c \ clients/tui/nmtui-connect.c \

View file

@ -31,6 +31,7 @@
#include <readline/readline.h> #include <readline/readline.h>
#include <readline/history.h> #include <readline/history.h>
#include "nm-utils/nm-hash-utils.h"
#include "nm-vpn-helpers.h" #include "nm-vpn-helpers.h"
#include "nm-client-utils.h" #include "nm-client-utils.h"
@ -41,7 +42,7 @@
static char ** static char **
_ip_config_get_routes (NMIPConfig *cfg) _ip_config_get_routes (NMIPConfig *cfg)
{ {
gs_unref_hashtable GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal); gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal);
GPtrArray *ptr_array; GPtrArray *ptr_array;
char **arr; char **arr;
guint i; guint i;

View file

@ -31,6 +31,8 @@
#include <readline/readline.h> #include <readline/readline.h>
#include <readline/history.h> #include <readline/history.h>
#include "nm-utils/nm-hash-utils.h"
#include "nm-client-utils.h" #include "nm-client-utils.h"
#include "nm-vpn-helpers.h" #include "nm-vpn-helpers.h"
#include "nm-meta-setting-access.h" #include "nm-meta-setting-access.h"
@ -2268,7 +2270,7 @@ parse_passwords (const char *passwd_file, GError **error)
char *pwd_spec, *pwd, *prop; char *pwd_spec, *pwd, *prop;
const char *setting; const char *setting;
pwds_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); pwds_hash = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
if (!passwd_file) if (!passwd_file)
return pwds_hash; return pwds_hash;

View file

@ -36,6 +36,8 @@
#include "nm-client-utils.h" #include "nm-client-utils.h"
#include "nm-utils/nm-hash-utils.h"
#include "polkit-agent.h" #include "polkit-agent.h"
#include "utils.h" #include "utils.h"
#include "common.h" #include "common.h"
@ -124,7 +126,7 @@ complete_fields (const char *option, const char *prefix)
GHashTable *h; GHashTable *h;
const char *option_with_value[2] = { option, prefix }; const char *option_with_value[2] = { option, prefix };
h = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); h = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
complete_field (h, metagen_ip4_config); complete_field (h, metagen_ip4_config);
complete_field (h, nmc_fields_dhcp4_config); complete_field (h, nmc_fields_dhcp4_config);

View file

@ -25,6 +25,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "nm-common-macros.h" #include "nm-common-macros.h"
#include "nm-utils/nm-hash-utils.h"
#include "nm-utils/nm-enum-utils.h" #include "nm-utils/nm-enum-utils.h"
#include "NetworkManager.h" #include "NetworkManager.h"
@ -188,7 +189,7 @@ _parse_ip_route (int family,
} }
if (!attrs) if (!attrs)
attrs = g_hash_table_new (g_str_hash, g_str_equal); attrs = g_hash_table_new (nm_str_hash, g_str_equal);
g_hash_table_iter_init (&iter, tmp_attrs); g_hash_table_iter_init (&iter, tmp_attrs);
while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) { while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) {
@ -3011,7 +3012,7 @@ _get_fcn_ip_config_routes (ARGS_GET_FCN)
for (i = 0; i < num_routes; i++) { for (i = 0; i < num_routes; i++) {
gs_free char *attr_str = NULL; gs_free char *attr_str = NULL;
gs_strfreev char **attr_names = NULL; gs_strfreev char **attr_names = NULL;
gs_unref_hashtable GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal); gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal);
int j; int j;
route = nm_setting_ip_config_get_route (s_ip, i); route = nm_setting_ip_config_get_route (s_ip, i);

View file

@ -33,6 +33,8 @@
#include <string.h> #include <string.h>
#include "nm-utils/nm-hash-utils.h"
#include "NetworkManager.h" #include "NetworkManager.h"
#include "nm-vpn-service-plugin.h" #include "nm-vpn-service-plugin.h"
@ -86,7 +88,7 @@ nm_secret_agent_simple_init (NMSecretAgentSimple *agent)
{ {
NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (agent); NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (agent);
priv->requests = g_hash_table_new_full (g_str_hash, g_str_equal, priv->requests = g_hash_table_new_full (nm_str_hash, g_str_equal,
g_free, nm_secret_agent_simple_request_free); g_free, nm_secret_agent_simple_request_free);
} }
@ -694,7 +696,7 @@ nm_secret_agent_simple_response (NMSecretAgentSimple *self,
g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}")); g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}"));
settings = g_hash_table_new (g_str_hash, g_str_equal); settings = g_hash_table_new (nm_str_hash, g_str_equal);
for (i = 0; i < secrets->len; i++) { for (i = 0; i < secrets->len; i++) {
NMSecretAgentSimpleSecretReal *secret = secrets->pdata[i]; NMSecretAgentSimpleSecretReal *secret = secrets->pdata[i];

View file

@ -21,6 +21,8 @@
#include "NetworkManager.h" #include "NetworkManager.h"
#include "nm-utils/nm-hash-utils.h"
#include "nm-meta-setting-access.h" #include "nm-meta-setting-access.h"
#include "nm-utils/nm-test-utils.h" #include "nm-utils/nm-test-utils.h"
@ -77,7 +79,7 @@ test_client_meta_check (void)
g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties)); g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties));
if (info->properties_num) { if (info->properties_num) {
gs_unref_hashtable GHashTable *property_names = g_hash_table_new (g_str_hash, g_str_equal); gs_unref_hashtable GHashTable *property_names = g_hash_table_new (nm_str_hash, g_str_equal);
g_assert (info->properties); g_assert (info->properties);
for (p = 0; p < info->properties_num; p++) { for (p = 0; p < info->properties_num; p++) {

View file

@ -30,6 +30,8 @@
#include "NetworkManager.h" #include "NetworkManager.h"
#include "nm-utils/nm-hash-utils.h"
#include "nmtui.h" #include "nmtui.h"
#include "nmt-connect-connection-list.h" #include "nmt-connect-connection-list.h"
@ -274,7 +276,7 @@ add_connections_for_aps (NmtConnectDevice *nmtdev,
if (!aps->len) if (!aps->len)
return; return;
seen_ssids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); seen_ssids = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
for (i = 0; i < aps->len; i++) { for (i = 0; i < aps->len; i++) {
ap = aps->pdata[i]; ap = aps->pdata[i];
@ -362,7 +364,7 @@ append_nmt_devices_for_virtual_devices (GSList *nmt_devices,
NmtConnectConnection *nmtconn; NmtConnectConnection *nmtconn;
int sort_order; int sort_order;
devices_by_name = g_hash_table_new (g_str_hash, g_str_equal); devices_by_name = g_hash_table_new (nm_str_hash, g_str_equal);
for (i = 0; i < connections->len; i++) { for (i = 0; i < connections->len; i++) {
conn = connections->pdata[i]; conn = connections->pdata[i];

View file

@ -299,7 +299,7 @@ nm_utils_complete_generic (NMPlatform *platform,
} }
/* Normalize */ /* Normalize */
parameters = g_hash_table_new (g_str_hash, g_str_equal); parameters = g_hash_table_new (nm_str_hash, g_str_equal);
g_hash_table_insert (parameters, NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD, g_hash_table_insert (parameters, NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD,
default_enable_ipv6 ? NM_SETTING_IP6_CONFIG_METHOD_AUTO : NM_SETTING_IP6_CONFIG_METHOD_IGNORE); default_enable_ipv6 ? NM_SETTING_IP6_CONFIG_METHOD_AUTO : NM_SETTING_IP6_CONFIG_METHOD_IGNORE);
nm_connection_normalize (connection, parameters, NULL, NULL); nm_connection_normalize (connection, parameters, NULL, NULL);

View file

@ -25,6 +25,7 @@
#include <string.h> #include <string.h>
#include "nm-dbus-interface.h" #include "nm-dbus-interface.h"
#include "nm-utils/nm-hash-utils.h"
#include "nm-bluez-device.h" #include "nm-bluez-device.h"
#include "nm-bluez-common.h" #include "nm-bluez-common.h"
#include "nm-core-internal.h" #include "nm-core-internal.h"
@ -340,7 +341,7 @@ nm_bluez4_adapter_init (NMBluez4Adapter *self)
{ {
NMBluez4AdapterPrivate *priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self); NMBluez4AdapterPrivate *priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self);
priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, priv->devices = g_hash_table_new_full (nm_str_hash, g_str_equal,
NULL, NULL); NULL, NULL);
} }

View file

@ -514,7 +514,7 @@ nm_bluez5_manager_init (NMBluez5Manager *self)
bluez_connect (self); bluez_connect (self);
priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, priv->devices = g_hash_table_new_full (nm_str_hash, g_str_equal,
NULL, g_object_unref); NULL, g_object_unref);
c_list_init (&priv->network_servers); c_list_init (&priv->network_servers);

View file

@ -294,7 +294,7 @@ nm_device_ethernet_init (NMDeviceEthernet *self)
priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate); priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate);
self->_priv = priv; self->_priv = priv;
priv->s390_options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); priv->s390_options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
} }
static NMDeviceCapabilities static NMDeviceCapabilities

View file

@ -351,7 +351,7 @@ nm_device_factory_manager_load_factories (NMDeviceFactoryManagerFactoryFunc call
g_return_if_fail (factories_by_setting == NULL); g_return_if_fail (factories_by_setting == NULL);
factories_by_link = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref); factories_by_link = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref);
factories_by_setting = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) factories_list_unref); factories_by_setting = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, (GDestroyNotify) factories_list_unref);
#define _ADD_INTERNAL(get_type_fcn) \ #define _ADD_INTERNAL(get_type_fcn) \
G_STMT_START { \ G_STMT_START { \

View file

@ -8939,7 +8939,7 @@ _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name,
#if NM_MORE_ASSERTS > 10 #if NM_MORE_ASSERTS > 10
/* Assert that the keys are unique. */ /* Assert that the keys are unique. */
{ {
gs_unref_hashtable GHashTable *check_dups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); gs_unref_hashtable GHashTable *check_dups = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL);
for (i = 0; argv[i]; i++) { for (i = 0; argv[i]; i++) {
if (!nm_g_hash_table_add (check_dups, (char *) argv[i])) if (!nm_g_hash_table_add (check_dups, (char *) argv[i]))
@ -13989,7 +13989,7 @@ nm_device_init (NMDevice *self)
priv->unmanaged_flags = NM_UNMANAGED_PLATFORM_INIT; priv->unmanaged_flags = NM_UNMANAGED_PLATFORM_INIT;
priv->unmanaged_mask = priv->unmanaged_flags; priv->unmanaged_mask = priv->unmanaged_flags;
priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
priv->ip6_saved_properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); priv->ip6_saved_properties = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_free);
priv->sys_iface_state = NM_DEVICE_SYS_IFACE_STATE_EXTERNAL; priv->sys_iface_state = NM_DEVICE_SYS_IFACE_STATE_EXTERNAL;
priv->v4_commit_first_time = TRUE; priv->v4_commit_first_time = TRUE;

View file

@ -3360,7 +3360,7 @@ nm_device_wifi_init (NMDeviceWifi *self)
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
priv->mode = NM_802_11_MODE_INFRA; priv->mode = NM_802_11_MODE_INFRA;
priv->aps = g_hash_table_new (g_str_hash, g_str_equal); priv->aps = g_hash_table_new (nm_str_hash, g_str_equal);
} }
static void static void

View file

@ -840,7 +840,7 @@ nm_modem_manager_init (NMModemManager *self)
{ {
NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self); NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self);
priv->modems = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); priv->modems = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref);
priv->main_cancellable = g_cancellable_new (); priv->main_cancellable = g_cancellable_new ();

View file

@ -1147,7 +1147,7 @@ create_connect_properties (NMConnection *connection)
const char *str; const char *str;
setting = nm_connection_get_setting_gsm (connection); setting = nm_connection_get_setting_gsm (connection);
properties = g_hash_table_new (g_str_hash, g_str_equal); properties = g_hash_table_new (nm_str_hash, g_str_equal);
str = nm_setting_gsm_get_apn (setting); str = nm_setting_gsm_get_apn (setting);
if (str) if (str)

View file

@ -772,7 +772,7 @@ nm_dhcp_client_handle_event (gpointer unused,
GVariant *value; GVariant *value;
/* Copy options */ /* Copy options */
str_options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); str_options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
g_variant_iter_init (&iter, options); g_variant_iter_init (&iter, options);
while (g_variant_iter_next (&iter, "{&sv}", &name, &value)) { while (g_variant_iter_next (&iter, "{&sv}", &name, &value)) {
maybe_add_option (self, str_options, name, value); maybe_add_option (self, str_options, name, value);

View file

@ -739,7 +739,7 @@ nm_dhcp_dhclient_read_lease_ip_configs (NMDedupMultiIndex *multi_idx,
g_hash_table_destroy (hash); g_hash_table_destroy (hash);
} }
hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); hash = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
} else if (hash && strlen (*line)) } else if (hash && strlen (*line))
add_lease_option (hash, *line); add_lease_option (hash, *line);
} }

View file

@ -525,7 +525,7 @@ bound4_handle (NMDhcpSystemd *self)
_LOGD ("lease available"); _LOGD ("lease available");
options = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); options = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_free);
ip4_config = lease_to_ip4_config (nm_dhcp_client_get_multi_idx (NM_DHCP_CLIENT (self)), ip4_config = lease_to_ip4_config (nm_dhcp_client_get_multi_idx (NM_DHCP_CLIENT (self)),
iface, iface,
nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)), nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)),
@ -853,7 +853,7 @@ bound6_handle (NMDhcpSystemd *self)
_LOGD ("lease available"); _LOGD ("lease available");
options = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); options = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_free);
ip6_config = lease_to_ip6_config (nm_dhcp_client_get_multi_idx (NM_DHCP_CLIENT (self)), ip6_config = lease_to_ip6_config (nm_dhcp_client_get_multi_idx (NM_DHCP_CLIENT (self)),
iface, iface,
nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)), nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)),

View file

@ -57,7 +57,7 @@ fill_table (const Option *test_options, GHashTable *table)
const Option *opt; const Option *opt;
if (!table) if (!table)
table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); table = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL);
for (opt = test_options; opt->name; opt++) for (opt = test_options; opt->name; opt++)
g_hash_table_insert (table, (gpointer) opt->name, (gpointer) opt->value); g_hash_table_insert (table, (gpointer) opt->name, (gpointer) opt->value);
return table; return table;

View file

@ -24,6 +24,7 @@
#include <string.h> #include <string.h>
#include "nm-utils/nm-hash-utils.h"
#include "nm-setting-connection.h" #include "nm-setting-connection.h"
#include "nm-auth-subject.h" #include "nm-auth-subject.h"
#include "nm-auth-manager.h" #include "nm-auth-manager.h"
@ -131,7 +132,7 @@ nm_auth_chain_new_subject (NMAuthSubject *subject,
self = g_slice_new0 (NMAuthChain); self = g_slice_new0 (NMAuthChain);
self->refcount = 1; self->refcount = 1;
self->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, chain_data_free); self->data = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, chain_data_free);
self->done_func = done_func; self->done_func = done_func;
self->user_data = user_data; self->user_data = user_data;
self->context = context ? g_object_ref (context) : NULL; self->context = context ? g_object_ref (context) : NULL;

View file

@ -283,7 +283,7 @@ nm_checkpoint_manager_new (NMManager *manager)
* of NMManager shall surpass the lifetime of the NMCheckpointManager * of NMManager shall surpass the lifetime of the NMCheckpointManager
* instance. */ * instance. */
self->_manager = manager; self->_manager = manager;
self->checkpoints = g_hash_table_new_full (g_str_hash, g_str_equal, self->checkpoints = g_hash_table_new_full (nm_str_hash, g_str_equal,
NULL, checkpoint_destroy); NULL, checkpoint_destroy);
return self; return self;

View file

@ -506,7 +506,7 @@ nm_checkpoint_new (NMManager *manager, GPtrArray *devices, guint32 rollback_time
priv->flags = flags; priv->flags = flags;
if (NM_FLAGS_HAS (flags, NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS)) { if (NM_FLAGS_HAS (flags, NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS)) {
priv->connection_uuids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->connection_uuids = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
for (con = nm_settings_get_connections (nm_settings_get (), NULL); *con; con++) { for (con = nm_settings_get_connections (nm_settings_get (), NULL); *con; con++) {
g_hash_table_add (priv->connection_uuids, g_hash_table_add (priv->connection_uuids,
g_strdup (nm_settings_connection_get_uuid (*con))); g_strdup (nm_settings_connection_get_uuid (*con)));

View file

@ -875,7 +875,7 @@ load_global_dns (GKeyFile *keyfile, gboolean internal)
return NULL; return NULL;
conf = g_malloc0 (sizeof (NMGlobalDnsConfig)); conf = g_malloc0 (sizeof (NMGlobalDnsConfig));
conf->domains = g_hash_table_new_full (g_str_hash, g_str_equal, conf->domains = g_hash_table_new_full (nm_str_hash, g_str_equal,
g_free, (GDestroyNotify) global_dns_domain_free); g_free, (GDestroyNotify) global_dns_domain_free);
strv = g_key_file_get_string_list (keyfile, group, "searches", NULL, NULL); strv = g_key_file_get_string_list (keyfile, group, "searches", NULL, NULL);
@ -1077,7 +1077,7 @@ nm_global_dns_config_from_dbus (const GValue *value, GError **error)
} }
dns_config = g_malloc0 (sizeof (NMGlobalDnsConfig)); dns_config = g_malloc0 (sizeof (NMGlobalDnsConfig));
dns_config->domains = g_hash_table_new_full (g_str_hash, g_str_equal, dns_config->domains = g_hash_table_new_full (nm_str_hash, g_str_equal,
g_free, (GDestroyNotify) global_dns_domain_free); g_free, (GDestroyNotify) global_dns_domain_free);
g_variant_iter_init (&iter, variant); g_variant_iter_init (&iter, variant);

View file

@ -272,7 +272,7 @@ nm_exported_object_class_add_interface (NMExportedObjectClass *object_class,
classinfo = g_slice_new (NMExportedObjectClassInfo); classinfo = g_slice_new (NMExportedObjectClassInfo);
classinfo->skeleton_types = NULL; classinfo->skeleton_types = NULL;
classinfo->methods = g_array_new (FALSE, FALSE, sizeof (NMExportedObjectDBusMethodImpl)); classinfo->methods = g_array_new (FALSE, FALSE, sizeof (NMExportedObjectDBusMethodImpl));
classinfo->properties = g_hash_table_new (g_str_hash, g_str_equal); classinfo->properties = g_hash_table_new (nm_str_hash, g_str_equal);
g_type_set_qdata (G_TYPE_FROM_CLASS (object_class), g_type_set_qdata (G_TYPE_FROM_CLASS (object_class),
nm_exported_object_class_info_quark (), classinfo); nm_exported_object_class_info_quark (), classinfo);
} }
@ -579,7 +579,7 @@ _create_export_path (NMExportedObjectClass *klass)
p = strchr (class_export_path, '%'); p = strchr (class_export_path, '%');
if (p) { if (p) {
if (G_UNLIKELY (!prefix_counters)) if (G_UNLIKELY (!prefix_counters))
prefix_counters = g_hash_table_new (g_str_hash, g_str_equal); prefix_counters = g_hash_table_new (nm_str_hash, g_str_equal);
nm_assert (p[1] == 'l'); nm_assert (p[1] == 'l');
nm_assert (p[2] == 'l'); nm_assert (p[2] == 'l');

View file

@ -1358,7 +1358,7 @@ nm_fake_platform_init (NMFakePlatform *fake_platform)
{ {
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (fake_platform); NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (fake_platform);
priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); priv->options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
priv->links = g_array_new (TRUE, TRUE, sizeof (NMFakePlatformLink)); priv->links = g_array_new (TRUE, TRUE, sizeof (NMFakePlatformLink));
} }

View file

@ -3062,7 +3062,7 @@ _log_dbg_sysctl_get_impl (NMPlatform *platform, const char *pathid, const char *
if (!priv->sysctl_get_prev_values) { if (!priv->sysctl_get_prev_values) {
_nm_logging_clear_platform_logging_cache = _nm_logging_clear_platform_logging_cache_impl; _nm_logging_clear_platform_logging_cache = _nm_logging_clear_platform_logging_cache_impl;
sysctl_clear_cache_list = g_slist_prepend (sysctl_clear_cache_list, platform); sysctl_clear_cache_list = g_slist_prepend (sysctl_clear_cache_list, platform);
priv->sysctl_get_prev_values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); priv->sysctl_get_prev_values = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
} else } else
prev_value = g_hash_table_lookup (priv->sysctl_get_prev_values, pathid); prev_value = g_hash_table_lookup (priv->sysctl_get_prev_values, pathid);

View file

@ -321,9 +321,9 @@ _dedup_multi_idx_type_init (DedupMultiIdxType *idx_type, NMPCacheIdType cache_id
/*****************************************************************************/ /*****************************************************************************/
static void static void
_vlan_xgress_qos_mappings_hash (NMHashState *h, _vlan_xgress_qos_mappings_hash_update (guint n_map,
guint n_map, const NMVlanQosMapping *map,
const NMVlanQosMapping *map) NMHashState *h)
{ {
guint i; guint i;
@ -817,12 +817,12 @@ _vt_cmd_obj_hash_lnk_vlan (const NMPObject *obj)
nm_hash_init (&h, 914932607u); nm_hash_init (&h, 914932607u);
nm_hash_update_uint (&h, nm_platform_lnk_vlan_hash (&obj->lnk_vlan)); nm_hash_update_uint (&h, nm_platform_lnk_vlan_hash (&obj->lnk_vlan));
_vlan_xgress_qos_mappings_hash (&h, _vlan_xgress_qos_mappings_hash_update (obj->_lnk_vlan.n_ingress_qos_map,
obj->_lnk_vlan.n_ingress_qos_map, obj->_lnk_vlan.ingress_qos_map,
obj->_lnk_vlan.ingress_qos_map); &h);
_vlan_xgress_qos_mappings_hash (&h, _vlan_xgress_qos_mappings_hash_update (obj->_lnk_vlan.n_egress_qos_map,
obj->_lnk_vlan.n_egress_qos_map, obj->_lnk_vlan.egress_qos_map,
obj->_lnk_vlan.egress_qos_map); &h);
return nm_hash_complete (&h); return nm_hash_complete (&h);
} }

View file

@ -1559,7 +1559,7 @@ nm_agent_manager_init (NMAgentManager *self)
NMAgentManagerPrivate *priv = NM_AGENT_MANAGER_GET_PRIVATE (self); NMAgentManagerPrivate *priv = NM_AGENT_MANAGER_GET_PRIVATE (self);
c_list_init (&priv->requests); c_list_init (&priv->requests);
priv->agents = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); priv->agents = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref);
} }
static void static void

View file

@ -2776,7 +2776,7 @@ nm_settings_connection_init (NMSettingsConnection *self)
priv->agent_mgr = g_object_ref (nm_agent_manager_get ()); priv->agent_mgr = g_object_ref (nm_agent_manager_get ());
priv->seen_bssids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->seen_bssids = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
priv->autoconnect_retries = AUTOCONNECT_RETRIES_UNSET; priv->autoconnect_retries = AUTOCONNECT_RETRIES_UNSET;

View file

@ -1885,7 +1885,7 @@ nm_settings_init (NMSettings *self)
{ {
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_object_unref);
/* Hold a reference to the agent manager so it stays alive; the only /* Hold a reference to the agent manager so it stays alive; the only
* other holders are NMSettingsConnection objects which are often * other holders are NMSettingsConnection objects which are often

View file

@ -152,7 +152,7 @@ nms_ibft_plugin_init (NMSIbftPlugin *self)
{ {
NMSIbftPluginPrivate *priv = NMS_IBFT_PLUGIN_GET_PRIVATE (self); NMSIbftPluginPrivate *priv = NMS_IBFT_PLUGIN_GET_PRIVATE (self);
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref);
} }
static void static void

View file

@ -461,7 +461,7 @@ _paths_from_connections (GHashTable *connections)
{ {
GHashTableIter iter; GHashTableIter iter;
NMIfcfgConnection *connection; NMIfcfgConnection *connection;
GHashTable *paths = g_hash_table_new (g_str_hash, g_str_equal); GHashTable *paths = g_hash_table_new (nm_str_hash, g_str_equal);
g_hash_table_iter_init (&iter, connections); g_hash_table_iter_init (&iter, connections);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &connection)) { while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &connection)) {
@ -991,7 +991,7 @@ settings_plugin_ifcfg_init (SettingsPluginIfcfg *plugin)
{ {
SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE ((SettingsPluginIfcfg *) plugin); SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE ((SettingsPluginIfcfg *) plugin);
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref);
} }
static void static void

View file

@ -882,7 +882,7 @@ svGetKeys (shvarFile *s)
/* we don't clone the keys. The keys are only valid /* we don't clone the keys. The keys are only valid
* until @s gets modified. */ * until @s gets modified. */
if (!keys) if (!keys)
keys = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); keys = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL);
g_hash_table_add (keys, (gpointer) line->key); g_hash_table_add (keys, (gpointer) line->key);
} }
} }

View file

@ -58,7 +58,7 @@ add_new_connection_config (const gchar * type, const gchar * name)
/* Return existing connection */ /* Return existing connection */
if ((new_conn = g_hash_table_lookup (conn_table, name)) != NULL) if ((new_conn = g_hash_table_lookup (conn_table, name)) != NULL)
return new_conn; return new_conn;
new_conn = g_hash_table_new (g_str_hash, g_str_equal); new_conn = g_hash_table_new (nm_str_hash, g_str_equal);
new_name = g_strdup (name); new_name = g_strdup (name);
g_hash_table_insert (new_conn, g_strdup ("name"), new_name); g_hash_table_insert (new_conn, g_strdup ("name"), new_name);
g_hash_table_insert (new_conn, g_strdup ("type"), g_strdup (type)); g_hash_table_insert (new_conn, g_strdup ("type"), g_strdup (type));
@ -302,8 +302,8 @@ ifnet_init (gchar * config_file)
net_parser_data_changed = FALSE; net_parser_data_changed = FALSE;
conn_table = g_hash_table_new (g_str_hash, g_str_equal); conn_table = g_hash_table_new (nm_str_hash, g_str_equal);
global_settings_table = g_hash_table_new (g_str_hash, g_str_equal); global_settings_table = g_hash_table_new (nm_str_hash, g_str_equal);
functions_list = NULL; functions_list = NULL;
if (g_file_test (config_file, G_FILE_TEST_IS_REGULAR)) if (g_file_test (config_file, G_FILE_TEST_IS_REGULAR))

View file

@ -226,7 +226,7 @@ reload_connections (NMSettingsPlugin *config)
NM_CONFIG_KEYFILE_GROUP_IFNET, NM_CONFIG_KEYFILE_KEY_IFNET_AUTO_REFRESH, NM_CONFIG_KEYFILE_GROUP_IFNET, NM_CONFIG_KEYFILE_KEY_IFNET_AUTO_REFRESH,
FALSE); FALSE);
new_connections = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); new_connections = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_object_unref);
/* Reread on-disk data and refresh in-memory connections from it */ /* Reread on-disk data and refresh in-memory connections from it */
conn_names = ifnet_get_connection_names (); conn_names = ifnet_get_connection_names ();
@ -444,7 +444,7 @@ init (NMSettingsPlugin *config)
nm_log_info (LOGD_SETTINGS, "Initializing!"); nm_log_info (LOGD_SETTINGS, "Initializing!");
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref);
priv->unmanaged_well_known = !is_managed_plugin (); priv->unmanaged_well_known = !is_managed_plugin ();
nm_log_info (LOGD_SETTINGS, "management mode: %s", nm_log_info (LOGD_SETTINGS, "management mode: %s",
priv->unmanaged_well_known ? "unmanaged" : "managed"); priv->unmanaged_well_known ? "unmanaged" : "managed");

View file

@ -26,6 +26,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "nm-utils/nm-hash-utils.h"
#include "settings/nm-settings-plugin.h" #include "settings/nm-settings-plugin.h"
#include "nms-ifnet-net-parser.h" #include "nms-ifnet-net-parser.h"
@ -270,8 +271,8 @@ wpa_parser_init (const char *wpa_supplicant_conf)
gboolean complete = FALSE; gboolean complete = FALSE;
wpa_parser_data_changed = FALSE; wpa_parser_data_changed = FALSE;
wsec_table = g_hash_table_new (g_str_hash, g_str_equal); wsec_table = g_hash_table_new (nm_str_hash, g_str_equal);
wsec_global_table = g_hash_table_new (g_str_hash, g_str_equal); wsec_global_table = g_hash_table_new (nm_str_hash, g_str_equal);
if (g_file_test (wpa_supplicant_conf, G_FILE_TEST_IS_REGULAR)) if (g_file_test (wpa_supplicant_conf, G_FILE_TEST_IS_REGULAR))
channel = channel =
@ -292,7 +293,7 @@ wpa_parser_init (const char *wpa_supplicant_conf)
continue; continue;
} else { } else {
GHashTable *network = GHashTable *network =
g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_new (nm_str_hash, g_str_equal);
do { do {
gchar *quote_start, *quote_end = NULL, *comment; gchar *quote_start, *quote_end = NULL, *comment;
@ -512,7 +513,7 @@ wpa_add_security (const char *ssid)
return TRUE; return TRUE;
else { else {
GHashTable *security = GHashTable *security =
g_hash_table_new (g_str_hash, g_str_equal); g_hash_table_new (nm_str_hash, g_str_equal);
gchar *ssid_i; gchar *ssid_i;
nm_log_info (LOGD_SETTINGS, "Adding security for %s", ssid); nm_log_info (LOGD_SETTINGS, "Adding security for %s", ssid);

View file

@ -338,16 +338,16 @@ init (NMSettingsPlugin *config)
const char *block_name; const char *block_name;
NMIfupdownConnection *connection; NMIfupdownConnection *connection;
auto_ifaces = g_hash_table_new (g_str_hash, g_str_equal); auto_ifaces = g_hash_table_new (nm_str_hash, g_str_equal);
if(!priv->connections) if(!priv->connections)
priv->connections = g_hash_table_new (g_str_hash, g_str_equal); priv->connections = g_hash_table_new (nm_str_hash, g_str_equal);
if(!priv->kernel_ifaces) if(!priv->kernel_ifaces)
priv->kernel_ifaces = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, _udev_device_unref); priv->kernel_ifaces = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, _udev_device_unref);
if(!priv->eni_ifaces) if(!priv->eni_ifaces)
priv->eni_ifaces = g_hash_table_new (g_str_hash, g_str_equal); priv->eni_ifaces = g_hash_table_new (nm_str_hash, g_str_equal);
nm_log_info (LOGD_SETTINGS, "init!"); nm_log_info (LOGD_SETTINGS, "init!");

View file

@ -378,7 +378,7 @@ _paths_from_connections (GHashTable *connections)
{ {
GHashTableIter iter; GHashTableIter iter;
NMSKeyfileConnection *connection; NMSKeyfileConnection *connection;
GHashTable *paths = g_hash_table_new (g_str_hash, g_str_equal); GHashTable *paths = g_hash_table_new (nm_str_hash, g_str_equal);
g_hash_table_iter_init (&iter, connections); g_hash_table_iter_init (&iter, connections);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &connection)) { while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &connection)) {
@ -588,7 +588,7 @@ nms_keyfile_plugin_init (NMSKeyfilePlugin *plugin)
NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE (plugin); NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE (plugin);
priv->config = g_object_ref (nm_config_get ()); priv->config = g_object_ref (nm_config_get ());
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref);
} }
static void static void

View file

@ -88,11 +88,11 @@ nm_supplicant_config_init (NMSupplicantConfig * self)
{ {
NMSupplicantConfigPrivate *priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); NMSupplicantConfigPrivate *priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self);
priv->config = g_hash_table_new_full (g_str_hash, g_str_equal, priv->config = g_hash_table_new_full (nm_str_hash, g_str_equal,
(GDestroyNotify) g_free, (GDestroyNotify) g_free,
(GDestroyNotify) config_option_free); (GDestroyNotify) config_option_free);
priv->blobs = g_hash_table_new_full (g_str_hash, g_str_equal, priv->blobs = g_hash_table_new_full (nm_str_hash, g_str_equal,
(GDestroyNotify) g_free, (GDestroyNotify) g_free,
(GDestroyNotify) blob_free); (GDestroyNotify) blob_free);

View file

@ -1912,7 +1912,7 @@ nm_supplicant_interface_init (NMSupplicantInterface * self)
NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);
priv->state = NM_SUPPLICANT_INTERFACE_STATE_INIT; priv->state = NM_SUPPLICANT_INTERFACE_STATE_INIT;
priv->bss_proxies = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, bss_data_destroy); priv->bss_proxies = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, bss_data_destroy);
} }
NMSupplicantInterface * NMSupplicantInterface *

View file

@ -255,7 +255,7 @@ nm_vpn_manager_init (NMVpnManager *self)
try_add_plugin (self, info->data); try_add_plugin (self, info->data);
g_slist_free_full (infos, g_object_unref); g_slist_free_full (infos, g_object_unref);
priv->active_services = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); priv->active_services = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
} }
static void static void