From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft] expression: provide clone operation for set element ops
Date: Thu, 1 Oct 2015 00:46:46 +0200 [thread overview]
Message-ID: <1443653206-25841-1-git-send-email-fw@strlen.de> (raw)
define addrs={ 1.2.3.4 }
table ip filter {
chain input {
type filter hook input priority 0;
ip saddr $addrs accept
}
}
segfaults. Using saddr { 1.2.3.4 } instead of $addrs works.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/expression.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/expression.c b/src/expression.c
index 3edc550..70f18e2 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -48,6 +48,7 @@ struct expr *expr_clone(const struct expr *expr)
expr->byteorder, expr->len);
new->flags = expr->flags;
new->op = expr->op;
+ assert(expr->ops->clone);
expr->ops->clone(new, expr);
return new;
}
@@ -907,9 +908,19 @@ static void set_elem_expr_destroy(struct expr *expr)
expr_free(expr->key);
}
+static void set_elem_expr_clone(struct expr *new, const struct expr *expr)
+{
+ new->key = expr_clone(expr->key);
+ new->expiration = expr->expiration;
+ new->timeout = expr->timeout;
+ if (expr->comment)
+ new->comment = xstrdup(expr->comment);
+}
+
static const struct expr_ops set_elem_expr_ops = {
.type = EXPR_SET_ELEM,
.name = "set element",
+ .clone = set_elem_expr_clone,
.print = set_elem_expr_print,
.destroy = set_elem_expr_destroy,
};
--
2.0.5
next reply other threads:[~2015-09-30 22:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 22:46 Florian Westphal [this message]
2015-10-06 8:58 ` [PATCH nft] expression: provide clone operation for set element ops Arturo Borrero Gonzalez
2015-10-06 9:53 ` Pablo Neira Ayuso
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=1443653206-25841-1-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).