diff options
author | Florian Westphal <fw@strlen.de> | 2013-05-31 17:35:41 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2013-06-02 19:03:37 +0200 |
commit | 044fcf5f4c1e94e0c57876b2a98fc4a7975498d0 (patch) | |
tree | 81c226097e6e8f0cb641c47a32c9ab577789a4b8 /src/conntrack | |
parent | e6f31bf4346007b4bf64a81ba1843da03663789d (diff) |
conntrack, expect: fix _cmp api with STRICT checking
Normal comparision succeeds when the _common_ attribute subset
have same values.
When STRICT matching is specified, the comparision should succeed only when
both objects have same attribute subset and attribute values match.
However, STRICT comparision often fails as an attribute missing in both
objects is erronously considered an error.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/conntrack')
-rw-r--r-- | src/conntrack/compare.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/conntrack/compare.c b/src/conntrack/compare.c index e282a24..97c25cb 100644 --- a/src/conntrack/compare.c +++ b/src/conntrack/compare.c @@ -17,8 +17,12 @@ static int __cmp(int attr, const struct nf_conntrack *ct2, unsigned int flags)) { - if (test_bit(attr, ct1->head.set) && test_bit(attr, ct2->head.set)) { + int a = test_bit(attr, ct1->head.set); + int b = test_bit(attr, ct2->head.set); + if (a && b) { return cmp(ct1, ct2, flags); + } else if (!a && !b) { + return 1; } else if (flags & NFCT_CMP_MASK && test_bit(attr, ct1->head.set)) { return 0; |