From: Yanchuan Nian <ycnian@gmail.com>
To: pablo@netfilter.org
Cc: kaber@trash.net, netfilter-devel@vger.kernel.org,
Yanchuan Nian <ycnian@gmail.com>
Subject: [nft PATCH] Kill the correct protocol expression during payload parsing
Date: Sat, 30 Aug 2014 13:17:15 +0800 [thread overview]
Message-ID: <1409375835-28041-1-git-send-email-ycnian@gmail.com> (raw)
The protocol expression that should be killed when payload parsing
isn't the first one but the last one. Look at the result of this command:
nft> add rule ip filter input ip protocol != tcp tcp sport 80 drop
nft> list table ip filter
table ip filter {
chain input {
type filter hook input priority 0;
ip protocol tcp tcp sport http drop
}
}
nft>
With this patch, the result is:
nft> add rule ip filter input ip protocol != tcp tcp sport 80 drop
nft> list table ip filter
table ip filter {
chain input {
type filter hook input priority 0;
ip protocol != tcp tcp sport http drop
}
}
nft>
Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
---
src/netlink_delinearize.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index 195d432..322c7cc 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -671,12 +671,11 @@ static void payload_match_postprocess(struct rule_pp_ctx *ctx,
nstmt = expr_stmt_alloc(&stmt->location, nexpr);
list_add_tail(&nstmt->list, &stmt->list);
- /* Remember the first payload protocol expression to
+ /* Remember the last payload protocol expression to
* kill it later on if made redundant by a higher layer
* payload expression.
*/
- if (ctx->pbase == PROTO_BASE_INVALID &&
- left->flags & EXPR_F_PROTOCOL)
+ if (left->flags & EXPR_F_PROTOCOL)
payload_dependency_store(ctx, nstmt,
left->payload.base);
else
--
1.9.3
next reply other threads:[~2014-08-30 5:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-30 5:17 Yanchuan Nian [this message]
2014-08-30 10:52 ` [nft PATCH] Kill the correct protocol expression during payload parsing Patrick McHardy
2014-09-01 1:49 ` Yanchuan Nian
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=1409375835-28041-1-git-send-email-ycnian@gmail.com \
--to=ycnian@gmail.com \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).