From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: nevola@gmail.com
Subject: [PATCH libnftnl] expr: numgen: add missing nftnl_expr_ng_cmp()
Date: Tue, 30 Aug 2016 16:17:10 +0200 [thread overview]
Message-ID: <1472566630-15744-1-git-send-email-pablo@netfilter.org> (raw)
This patch adds the missing comparator interface, most likely due to
race between the patchset that has added this and the introduction of
numgen.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/expr/numgen.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/expr/numgen.c b/src/expr/numgen.c
index e8fa9a1..0669eda 100644
--- a/src/expr/numgen.c
+++ b/src/expr/numgen.c
@@ -238,10 +238,28 @@ nftnl_expr_ng_snprintf(char *buf, size_t len, uint32_t type,
return -1;
}
+static bool nftnl_expr_ng_cmp(const struct nftnl_expr *e1,
+ const struct nftnl_expr *e2)
+{
+ struct nftnl_expr_ng *n1 = nftnl_expr_data(e1);
+ struct nftnl_expr_ng *n2 = nftnl_expr_data(e2);
+ bool eq = true;
+
+ if (e1->flags & (1 << NFTNL_EXPR_NG_DREG))
+ eq &= (n1->dreg == n2->dreg);
+ if (e1->flags & (1 << NFTNL_EXPR_NG_UNTIL))
+ eq &= (n1->until == n2->until);
+ if (e1->flags & (1 << NFTNL_EXPR_NG_TYPE))
+ eq &= (n1->type == n2->type);
+
+ return eq;
+}
+
struct expr_ops expr_ops_ng = {
.name = "numgen",
.alloc_len = sizeof(struct nftnl_expr_ng),
.max_attr = NFTA_NG_MAX,
+ .cmp = nftnl_expr_ng_cmp,
.set = nftnl_expr_ng_set,
.get = nftnl_expr_ng_get,
.parse = nftnl_expr_ng_parse,
--
2.1.4
reply other threads:[~2016-08-30 14:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472566630-15744-1-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=nevola@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.