]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
rule: Fix comparison between rules if number of expressions differ
authorCarlos Falgueras García <carlosfg@riseup.net>
Thu, 18 Aug 2016 15:12:36 +0000 (17:12 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 18 Aug 2016 16:16:25 +0000 (18:16 +0200)
Before this patch, comparison between rules with distinct number of
expressions indicate that they are equals, however, they are not.
Example:

r1[e1, e2] == r2[e1, e2, e3]

Fix this by checking that the number of expression is the same.

Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Carlos Falgueras García <carlosfg@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/rule.c

index ae7c478dda0967115f15e249885688e1347064f3..5d0097ce60e743776bf96f010c6a8124820fb9eb 100644 (file)
@@ -1102,6 +1102,7 @@ bool nftnl_rule_cmp(const struct nftnl_rule *r1, const struct nftnl_rule *r2)
                e1 = nftnl_expr_iter_next(&it1);
                e2 = nftnl_expr_iter_next(&it2);
        }
+       eq &= (!e1 && !e2);
 
        return eq;
 }