From: Florian Westphal <fw@strlen.de>
To: Eric Leblond <eric@regit.org>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] parser: support reject unreach|reset
Date: Mon, 3 Mar 2014 23:03:51 +0100 [thread overview]
Message-ID: <20140303220351.GI9965@breakpoint.cc> (raw)
In-Reply-To: <1393882892.19488.14.camel@ice-age2.regit.org>
Eric Leblond <eric@regit.org> wrote:
> On Mon, 2014-03-03 at 22:12 +0100, Florian Westphal wrote:
> > reject did not allow to use tcp reset instead of icmp unreach.
>
> I'm currently working on a patchset to support this and also setting the
> ICMP code. But I'm fighting on the ICMP code filtering.
Good to hear this, very nice!
In that case its probably best if this patch is tossed to not
interfere with your work.
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> > ---
> > After this patch its possibe to do something like
> >
> > rule filter output reject reset
>
> I found syntax a bit short ;) If we add ICMP code support
> and follow the logic:
>
> rule filter output reject administratively-prohibited
>
> My plan was to do something like:
>
> rule filter output reject with tcp reset
> rule filter output reject with icmp|code administratively-prohibited
>
> >
> > Which makes kernel generate bogus tcp resets in repsonse
> > to non-tcp packets.
> >
> > In iptables this is avoided by making checkentry fail if -p tcp is not
> > specified when tcp-reset is requested.
> >
> > How should this be handled in nft?
>
> Good point. It looks a bit like what Patrick did mention in "Re:
> [nftables RFC PATCH 0/1] implementing icmp code filterin"
>
> "We do something similar in ct_expr_update_type() for ct expressions."
>
> Idea is to update the entry and in this case to output an error if we
> don't have tcp. But I'm not sure we can access to the other expressions
> (and henve to the TCP or not info) in that point.
Thanks for the pointer, this seems to work:
static int stmt_evaluate_reject(struct eval_ctx *ctx, struct stmt *stmt)
{
if (stmt->reject.type == NFT_REJECT_TCP_RST) {
const struct proto_desc *desc;
desc = ctx->pctx.protocol[PROTO_BASE_TRANSPORT_HDR].desc;
if (desc != &proto_tcp)
return stmt_error(ctx, stmt, "reset option can only be used with tcp");
}
stmt->flags |= STMT_F_TERMINAL;
return 0;
}
next prev parent reply other threads:[~2014-03-03 22:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-03 21:12 [PATCH nft] parser: support reject unreach|reset Florian Westphal
2014-03-03 21:41 ` Eric Leblond
2014-03-03 22:03 ` Florian Westphal [this message]
2014-03-04 9:08 ` Patrick McHardy
2014-03-04 9:01 ` Patrick McHardy
2014-03-04 8:50 ` Patrick McHardy
2014-03-04 9:03 ` Florian Westphal
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=20140303220351.GI9965@breakpoint.cc \
--to=fw@strlen.de \
--cc=eric@regit.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).