diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-10-20 17:43:26 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-10-20 18:03:00 +0200 |
commit | c26951eb0f98de0151699563cd0302f2ed714c01 (patch) | |
tree | 4110c0e0529e4344863941e0883efebbd265130e /src/expr.c | |
parent | 41363369c3df93cb2e8856c51629223f4d89d1e6 (diff) |
src: add notrack expression
Register this simple expression with no attributes. Make sure libnftnl
doesn't crash when no build and parse indirections are defined, as it
is the case for this expression.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -213,13 +213,15 @@ bool nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2) } EXPORT_SYMBOL(nftnl_expr_cmp); -void -nftnl_expr_build_payload(struct nlmsghdr *nlh, struct nftnl_expr *expr) +void nftnl_expr_build_payload(struct nlmsghdr *nlh, struct nftnl_expr *expr) { struct nlattr *nest; mnl_attr_put_strz(nlh, NFTA_EXPR_NAME, expr->ops->name); + if (!expr->ops->build) + return; + nest = mnl_attr_nest_start(nlh, NFTA_EXPR_DATA); expr->ops->build(nlh, expr); mnl_attr_nest_end(nlh, nest); @@ -261,6 +263,7 @@ struct nftnl_expr *nftnl_expr_parse(struct nlattr *attr) goto err1; if (tb[NFTA_EXPR_DATA] && + expr->ops->parse && expr->ops->parse(expr, tb[NFTA_EXPR_DATA]) < 0) goto err2; |