From: Phil Sutter <phil@nwl.cc>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: linux-crypto@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: XFRM interface and NF_INET_LOCAL_OUT hook
Date: Mon, 7 Dec 2020 13:35:11 +0100 [thread overview]
Message-ID: <20201207123511.GN4647@orbyte.nwl.cc> (raw)
In-Reply-To: <20201202131847.GB85961@gauss3.secunet.de>
Hi Steffen,
On Wed, Dec 02, 2020 at 02:18:47PM +0100, Steffen Klassert wrote:
> On Fri, Nov 27, 2020 at 03:10:48PM +0100, Phil Sutter wrote:
[...]
> > diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
> > index aa4cdcf69d471..24af61c95b4d4 100644
> > --- a/net/xfrm/xfrm_interface.c
> > +++ b/net/xfrm/xfrm_interface.c
> > @@ -317,7 +317,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
> > skb_dst_set(skb, dst);
> > skb->dev = tdev;
> >
> > - err = dst_output(xi->net, skb->sk, skb);
> > + err = NF_HOOK(skb_dst(skb)->ops->family, NF_INET_LOCAL_OUT, xi->net,
> > + skb->sk, skb, NULL, skb_dst(skb)->dev, dst_output);
> > if (net_xmit_eval(err) == 0) {
> > struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
>
> I don't mind that change, but we have to be carefull on namespace transition.
> xi->net is the namespace 'behind' the xfrm interface. I guess this is the
> namespace where you want to do the match because that is the namespace
> that has the policies and states for the xfrm interface. So I think that
> change is correct, I just wanted to point that out explicitely.
Thanks for the heads-up, I didn't consider this at all! But indeed I
think it makes sense. I can move the xfrm interface into a netns after
setting things up, then inside that netns netfilter only sees the plain
"inner" packets and no associated ipsec context. This is correct as the
netns doesn't have any knowledge of the policies pesent in initial
netns.
I'll submit the patch formally.
Thanks, Phil
next prev parent reply other threads:[~2020-12-07 12:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 11:23 XFRM interface and NF_INET_LOCAL_OUT hook Phil Sutter
2020-11-26 9:40 ` Steffen Klassert
2020-11-26 13:12 ` Phil Sutter
2020-11-27 9:55 ` Steffen Klassert
2020-11-27 14:10 ` Phil Sutter
2020-12-02 13:18 ` Steffen Klassert
2020-12-07 12:35 ` Phil Sutter [this message]
2020-12-07 12:38 ` Nicolas Dichtel
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=20201207123511.GN4647@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=linux-crypto@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=steffen.klassert@secunet.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).