summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-06-27 19:02:47 +0200
committerThomas Haller <thaller@redhat.com>2017-07-05 18:37:39 +0200
commitd2f856fb95d5945282858bdc7fa3585b9a59aa81 (patch)
treea3e3c3becaae43dc8fec94aefb4159538fd2bc4b
parentbb009630a1ebf6de2b82e8afb986c90be3806318 (diff)
downloadNetworkManager-d2f856fb95d5945282858bdc7fa3585b9a59aa81.tar.gz
platform: fix nmp_object_hash() to include object type
NMPlatformLnkMacvtap is a typedef of NMPlatformLnkMacvlan, hence, their plobj implementation is idential. nmp_object_equal() already correctly compares the object type, so we should hash it too.
-rw-r--r--src/platform/nmp-object.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c
index 48fb81ffad..b698b838a1 100644
--- a/src/platform/nmp-object.c
+++ b/src/platform/nmp-object.c
@@ -860,6 +860,7 @@ guint
nmp_object_hash (const NMPObject *obj)
{
const NMPClass *klass;
+ guint h;
if (!obj)
return 0;
@@ -869,16 +870,12 @@ nmp_object_hash (const NMPObject *obj)
klass = NMP_OBJECT_GET_CLASS (obj);
if (klass->cmd_obj_hash)
- return klass->cmd_obj_hash (obj);
- if (klass->cmd_plobj_hash)
- return klass->cmd_plobj_hash (&obj->object);
- return GPOINTER_TO_UINT (obj);
-}
-
-static guint
-_vt_cmd_obj_hash_not_implemented (const NMPObject *obj)
-{
- g_return_val_if_reached (0);
+ h = klass->cmd_obj_hash (obj);
+ else if (klass->cmd_plobj_hash)
+ h = klass->cmd_plobj_hash (&obj->object);
+ else
+ return GPOINTER_TO_UINT (obj);
+ return NM_HASH_COMBINE (h, klass->obj_type);
}
static guint