From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Wei Han <lailitty@foxmail.com>
Cc: kadlec@netfilter.org, fw@strlen.de, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netfilter: xt_esp: add support for ESP match in NAT Traversal
Date: Mon, 27 Jun 2022 19:22:05 +0200 [thread overview]
Message-ID: <YrnnPV8rPz+s845b@salvia> (raw)
In-Reply-To: <tencent_2B372B7CD9C70750319022510DAD3C081108@qq.com>
On Fri, Jun 24, 2022 at 08:05:30PM +0800, Wei Han wrote:
> On Thu, Jun 23, 2022 at 09:36:41PM +0200, Pablo Neira Ayuso wrote:
[...]
> > > + } else {
> > > + return false;
> > > + }
> > > + } else if (proto == IPPROTO_ESP) {
> > > + //not NAT-T
> > > + eh = skb_header_pointer(skb, par->thoff, sizeof(_esp), &_esp);
> > > + if (!eh) {
> > > + /* We've been asked to examine this packet, and we
> > > + * can't. Hence, no choice but to drop.
> > > + */
> > > + pr_debug("Dropping evil ESP tinygram.\n");
> > > + par->hotdrop = true;
> > > + return false;
> > > + }
> >
> > This is loose, the user does not have a way to restrict to either
> > ESP over UDP or native ESP. I don't think this is going to look nice
> > from iptables syntax perspective to restrict either one or another
> > mode.
> >
> This match original purpose is check the ESP packet's SPI value, so I
> think the user maybe not need to pay attention that the packet is
> ESP over UDP or native ESP just get SPI and check it, this patch is
> only want to add support for get SPI in ESP over UDP.And the iptables rules like:
> "iptables -A INPUT -m esp --espspi 0x12345678 -j ACCEPT"
This rule would be now allowing UDP traffic to go through, even if the
user does not need it. An explicit policy entry to allow NAT-T would
be preferred.
There is another issue, although I suppose there is a standard UDP
port for this, user might decide to select a different one, in that
case, this would break. And I don't see an easy way to allow user to
select the UDP port in the iptables case.
prev parent reply other threads:[~2022-06-27 17:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 12:42 [PATCH] netfilter: xt_esp: add support for ESP match in NAT Traversal Wei Han
2022-06-23 19:36 ` Pablo Neira Ayuso
2022-06-24 12:05 ` Wei Han
2022-06-27 17:22 ` Pablo Neira Ayuso [this message]
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=YrnnPV8rPz+s845b@salvia \
--to=pablo@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=lailitty@foxmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
/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).