From d2f856fb95d5945282858bdc7fa3585b9a59aa81 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 27 Jun 2017 19:02:47 +0200 Subject: [PATCH] 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. --- src/platform/nmp-object.c | 17 +++++++---------- 1 file 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