summaryrefslogtreecommitdiffstats
path: root/lib/utils.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-04-17 15:24:21 (GMT)
committerThomas Haller <thaller@redhat.com>2020-04-17 15:54:06 (GMT)
commit36b08942c5c69f435e39578d815238e6ac001299 (patch)
treea22920954317ad77867d006b8d74765c2256537c /lib/utils.c
parent5020077d271a918b989d5d46d664992a88c7c69b (diff)
downloadlibnl-36b08942c5c69f435e39578d815238e6ac001299.zip
libnl-36b08942c5c69f435e39578d815238e6ac001299.tar.gz
libnl-36b08942c5c69f435e39578d815238e6ac001299.tar.bz2
lib: allow to compare incomplete objects in nl_object_identical()
nl_object_identical() gets the ID attributes and then checks whether these attributes are identical for both objects, by calling the compare implementation. If an object doesn't have all ID attributes set, previously there was no way that this object would compare identical to anything. That seems not right. For example, kernel has for many objects a rather fuzzy understanding of what constitutes the ID attributes of an object. For routes and routing rules for example, most attributes are part of their ID, but also most of them are commonly missing and unset (note that libnl3's understanding of about equality for routes is not correct and does not correspond to kernels understanding. That is a known bug). Anyway, such incomplete objects, if we have them at hand, we still shall give them a chance to be evaluated as identical. Of course, and object that has a certain ID attribute set must not compare identical to an object that has the attribute missing. But if both objects miss the attribute, they shall still be able to compare identical. While at it, use uint64_t for the attribute mask. That corresponds to the object's ce_mask and the API of oo_compare(). Note that if the object's ops would return id-attributes as 0xFFFFFFFF, it previously would choose the intersection of the present attributes. That is not correct either. If the ops don't specify any attributes, then all present attributes shall be compared, not those that are present in both.
Diffstat (limited to 'lib/utils.c')
-rw-r--r--lib/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/utils.c b/lib/utils.c
index 050eb33..1448931 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1217,7 +1217,7 @@ int nl_has_capability (int capability)
NL_CAPABILITY_VERSION_3_4_0,
NL_CAPABILITY_ROUTE_FIX_VLAN_SET_EGRESS_MAP,
NL_CAPABILITY_VERSION_3_5_0,
- 0,
+ NL_CAPABILITY_NL_OBJECT_IDENTICAL_PARTIAL,
0),
/* IMPORTANT: these capability numbers are intended to be universal and stable
* for libnl3. Don't allocate new numbers on your own that differ from upstream