]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
Fix rule attribute comparison
authorPatrick McHardy <kaber@trash.net>
Wed, 7 Apr 2010 17:21:47 +0000 (19:21 +0200)
committerThomas Graf <tgraf@suug.ch>
Mon, 19 Apr 2010 10:43:18 +0000 (12:43 +0200)
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>
lib/object.c

index 46d8141442bf3dacc7345ec4d18e7f324376aa51..d881ac997e974f48ea0e3c666f1473d81363cd34 100644 (file)
@@ -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 */