summaryrefslogtreecommitdiff
path: root/lib/object.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-04-07 19:21:47 +0200
committerThomas Graf <tgraf@suug.ch>2010-04-19 12:43:18 +0200
commit3c28aa5dca309286ad9136c6d4742969b5dfde1d (patch)
tree9aabe10e35f75de10dd72620047bc24abf73fcf3 /lib/object.c
parent0e4f54d288b8d1d06ee40122d6bf3ed971870d47 (diff)
downloadlibnl-3c28aa5dca309286ad9136c6d4742969b5dfde1d.tar.gz
Fix rule attribute comparison
Rules don't have unique identifiers, so all attributes are compared by initializing the ID mask to ~0. This doesn't work however since nl_object_identical verifies whether the ID attributes are actually present before comparing the objects, which is never the case. Work around by using the intersection of present attributes when comparing two rule objects. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'lib/object.c')
-rw-r--r--lib/object.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/object.c b/lib/object.c
index 46d8141..d881ac9 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -265,6 +265,8 @@ int nl_object_identical(struct nl_object *a, struct nl_object *b)
return 0;
req_attrs = ops->oo_id_attrs;
+ if (req_attrs == ~0)
+ req_attrs = a->ce_mask & b->ce_mask;
/* Both objects must provide all required attributes to uniquely
* identify an object */