From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 2/4] netlink_delinearize: fix bogus offset w exthdr expressions
Date: Wed, 9 Mar 2016 00:09:46 +0100 [thread overview]
Message-ID: <1457478588-12592-2-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1457478588-12592-1-git-send-email-fw@strlen.de>
Need to fetch the offset from the exthdr template.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/netlink_linearize.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 07f70e0..49b4676 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -320,19 +320,24 @@ static void netlink_gen_range(struct netlink_linearize_ctx *ctx,
static void payload_shift_value(const struct expr *left, struct expr *right)
{
+ unsigned int offset;
+
if (right->ops->type != EXPR_VALUE)
return;
switch (left->ops->type) {
case EXPR_PAYLOAD:
+ offset = left->payload.offset;
+ break;
case EXPR_EXTHDR:
+ offset = left->exthdr.tmpl->offset;
break;
default:
return;
}
mpz_lshift_ui(right->value,
- payload_shift_calc(left, left->payload.offset));
+ payload_shift_calc(left, offset));
}
static struct expr *netlink_gen_prefix(struct netlink_linearize_ctx *ctx,
--
2.4.10
next prev parent reply other threads:[~2016-03-08 23:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 23:09 [PATCH nft 1/4] tests: frag: enable more tests Florian Westphal
2016-03-08 23:09 ` Florian Westphal [this message]
2016-03-08 23:09 ` [PATCH nft 3/4] nft-test: don't zap remainder of rule after handling a set Florian Westphal
2016-03-08 23:09 ` [PATCH nft 4/4] netlink_delinarize: shift constant for ranges too Florian Westphal
2016-03-10 11:10 ` [PATCH nft 1/4] tests: frag: enable more tests 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=1457478588-12592-2-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).