netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft] expression: provide clone operation for set element ops
@ 2015-09-30 22:46 Florian Westphal
  2015-10-06  8:58 ` Arturo Borrero Gonzalez
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2015-09-30 22:46 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH nft] expression: provide clone operation for set element ops
  2015-09-30 22:46 [PATCH nft] expression: provide clone operation for set element ops Florian Westphal
@ 2015-10-06  8:58 ` Arturo Borrero Gonzalez
  2015-10-06  9:53   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Arturo Borrero Gonzalez @ 2015-10-06  8:58 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Netfilter Development Mailing list

On 1 October 2015 at 00:46, Florian Westphal <fw@strlen.de> wrote:
> 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(+)
>

Tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>

-- 
Arturo Borrero González
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH nft] expression: provide clone operation for set element ops
  2015-10-06  8:58 ` Arturo Borrero Gonzalez
@ 2015-10-06  9:53   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2015-10-06  9:53 UTC (permalink / raw)
  To: Arturo Borrero Gonzalez
  Cc: Florian Westphal, Netfilter Development Mailing list

On Tue, Oct 06, 2015 at 10:58:59AM +0200, Arturo Borrero Gonzalez wrote:
> On 1 October 2015 at 00:46, Florian Westphal <fw@strlen.de> wrote:
> > 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(+)
> >
> 
> Tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>

Testing helps us a lot to speed up submission process. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-06  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 22:46 [PATCH nft] expression: provide clone operation for set element ops Florian Westphal
2015-10-06  8:58 ` Arturo Borrero Gonzalez
2015-10-06  9:53   ` Pablo Neira Ayuso

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).