From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH] dynset prefix support
Date: Tue, 23 Aug 2016 17:11:17 +0200 [thread overview]
Message-ID: <1471965079-1036-1-git-send-email-pablo@netfilter.org> (raw)
table ip filter {
chain input {
type filter hook input priority 0;
flow table xyz { ip saddr & 255.255.255.0 counter packets 0 bytes 0}
}
}
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/evaluate.c | 14 +++++++++-----
src/parser_bison.y | 6 ++++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/evaluate.c b/src/evaluate.c
index 8116735..d9984e5 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -656,12 +656,16 @@ static int expr_evaluate_prefix(struct eval_ctx *ctx, struct expr **expr)
if (expr_evaluate(ctx, &prefix->prefix) < 0)
return -1;
base = prefix->prefix;
- assert(expr_is_constant(base));
- prefix->dtype = base->dtype;
- prefix->byteorder = base->byteorder;
- prefix->len = base->len;
- prefix->flags |= EXPR_F_CONSTANT;
+ if (expr_is_constant(base)) {
+ prefix->dtype = base->dtype;
+ prefix->byteorder = base->byteorder;
+ prefix->len = base->len;
+ prefix->flags |= EXPR_F_CONSTANT;
+ } else {
+ *expr = base;
+ }
+
return 0;
}
diff --git a/src/parser_bison.y b/src/parser_bison.y
index e16b8a3..f06df6f 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1950,6 +1950,12 @@ concat_expr : basic_expr
}
compound_expr_add($$, $3);
}
+ | basic_expr SLASH NUM
+ {
+ $$ = prefix_expr_alloc(&@$, $1, $3);
+ }
+ ;
+
;
prefix_rhs_expr : basic_rhs_expr SLASH NUM
--
2.1.4
reply other threads:[~2016-08-23 15:11 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=1471965079-1036-1-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--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).