diff options
Diffstat (limited to 'src/platform/nmp-object.c')
-rw-r--r-- | src/platform/nmp-object.c | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c index b6a51e58bc..f36e55b099 100644 --- a/src/platform/nmp-object.c +++ b/src/platform/nmp-object.c @@ -1020,16 +1020,10 @@ _vt_cmd_plobj_id_copy (ip6_address, NMPlatformIP6Address, { dst->address = src->address; }); _vt_cmd_plobj_id_copy (ip4_route, NMPlatformIP4Route, { - dst->ifindex = src->ifindex; - dst->plen = src->plen; - dst->metric = src->metric; - dst->network = src->network; + *dst = *src; }); _vt_cmd_plobj_id_copy (ip6_route, NMPlatformIP6Route, { - dst->ifindex = src->ifindex; - dst->plen = src->plen; - dst->metric = src->metric; - dst->network = src->network; + *dst = *src; }); /* Uses internally nmp_object_copy(), hence it also violates the const @@ -1091,20 +1085,9 @@ _vt_cmd_plobj_id_equal (ip6_address, NMPlatformIP6Address, /* for IPv6 addresses, the prefix length is not part of the primary identifier. */ && IN6_ARE_ADDR_EQUAL (&obj1->address, &obj2->address)); _vt_cmd_plobj_id_equal (ip4_route, NMPlatformIP4Route, - obj1->ifindex == obj2->ifindex - && obj1->plen == obj2->plen - && obj1->metric == obj2->metric - && nm_utils_ip4_address_clear_host_address (obj1->network, obj1->plen) == nm_utils_ip4_address_clear_host_address (obj2->network, obj2->plen)); + nm_platform_ip4_route_cmp_full (obj1, obj2, TRUE) == 0); _vt_cmd_plobj_id_equal (ip6_route, NMPlatformIP6Route, - obj1->ifindex == obj2->ifindex - && obj1->plen == obj2->plen - && obj1->metric == obj2->metric - && ({ - struct in6_addr n1, n2; - - IN6_ARE_ADDR_EQUAL(nm_utils_ip6_address_clear_host_address (&n1, &obj1->network, obj1->plen), - nm_utils_ip6_address_clear_host_address (&n2, &obj2->network, obj2->plen)); - })); + nm_platform_ip6_route_cmp_full (obj1, obj2, TRUE) == 0); guint nmp_object_id_hash (const NMPObject *obj) @@ -1154,21 +1137,11 @@ _vt_cmd_plobj_id_hash (ip6_address, NMPlatformIP6Address, { }) _vt_cmd_plobj_id_hash (ip4_route, NMPlatformIP4Route, { hash = (guint) 2569857221u; - hash = hash + ((guint) obj->ifindex); - hash = NM_HASH_COMBINE (hash, obj->plen); - hash = NM_HASH_COMBINE (hash, obj->metric); - hash = NM_HASH_COMBINE (hash, nm_utils_ip4_address_clear_host_address (obj->network, obj->plen)); + hash = NM_HASH_COMBINE (hash, nm_platform_ip4_route_hash (obj)); }) _vt_cmd_plobj_id_hash (ip6_route, NMPlatformIP6Route, { hash = (guint) 3999787007u; - hash = hash + ((guint) obj->ifindex); - hash = NM_HASH_COMBINE (hash, obj->plen); - hash = NM_HASH_COMBINE (hash, obj->metric); - hash = NM_HASH_COMBINE (hash, - ({ - struct in6_addr n1; - nm_utils_in6_addr_hash (nm_utils_ip6_address_clear_host_address (&n1, &obj->network, obj->plen)); - })); + hash = NM_HASH_COMBINE (hash, nm_platform_ip6_route_hash (obj)); }) gboolean |