From: Guillaume Nault <gnault@redhat.com>
To: David Ahern <dsahern@gmail.com>
Cc: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
David Ahern <dsahern@kernel.org>,
Simon Horman <simon.horman@netronome.com>,
Martin Varghese <martin.varghese@nokia.com>,
Eli Cohen <elic@nvidia.com>, Jiri Benc <jbenc@redhat.com>,
Tom Herbert <tom@herbertland.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Harald Welte <laforge@gnumonks.org>,
Andreas Schultz <aschultz@tpip.net>,
Jonas Bonn <jonas@norrbonn.se>
Subject: Re: [PATCH net-next 0/6] net: reset MAC header consistently across L3 virtual devices
Date: Mon, 28 Jun 2021 17:04:36 +0200 [thread overview]
Message-ID: <20210628150436.GA3495@pc-23.home> (raw)
In-Reply-To: <2547b53c-9c22-67ec-99fb-e7e2b403f9f1@gmail.com>
On Sun, Jun 27, 2021 at 09:56:53AM -0600, David Ahern wrote:
> On 6/26/21 2:53 PM, Guillaume Nault wrote:
> > On Sat, Jun 26, 2021 at 11:50:19AM -0600, David Ahern wrote:
> >> On 6/25/21 7:32 AM, Guillaume Nault wrote:
> >>> Some virtual L3 devices, like vxlan-gpe and gre (in collect_md mode),
> >>> reset the MAC header pointer after they parsed the outer headers. This
> >>> accurately reflects the fact that the decapsulated packet is pure L3
> >>> packet, as that makes the MAC header 0 bytes long (the MAC and network
> >>> header pointers are equal).
> >>>
> >>> However, many L3 devices only adjust the network header after
> >>> decapsulation and leave the MAC header pointer to its original value.
> >>> This can confuse other parts of the networking stack, like TC, which
> >>> then considers the outer headers as one big MAC header.
> >>>
> >>> This patch series makes the following L3 tunnels behave like VXLAN-GPE:
> >>> bareudp, ipip, sit, gre, ip6gre, ip6tnl, gtp.
> >>>
> >>> The case of gre is a bit special. It already resets the MAC header
> >>> pointer in collect_md mode, so only the classical mode needs to be
> >>> adjusted. However, gre also has a special case that expects the MAC
> >>> header pointer to keep pointing to the outer header even after
> >>> decapsulation. Therefore, patch 4 keeps an exception for this case.
> >>>
> >>> Ideally, we'd centralise the call to skb_reset_mac_header() in
> >>> ip_tunnel_rcv(), to avoid manual calls in ipip (patch 2),
> >>> sit (patch 3) and gre (patch 4). That's unfortunately not feasible
> >>> currently, because of the gre special case discussed above that
> >>> precludes us from resetting the MAC header unconditionally.
> >>
> >> What about adding a flag to ip_tunnel indicating if it can be done (or
> >> should not be done since doing it is the most common)?
> >
> > That's feasible. I didn't do it here because I wanted to keep the
> > patch series focused on L3 tunnels. Modifying ip_tunnel_rcv()'s
> > prototype would also require updating erspan_rcv(), which isn't L3
> > (erspan carries Ethernet frames). I was feeling such consolidation
> > would be best done in a follow up patch series.
>
> I was thinking a flag in 'struct ip_tunnel'. It's the private data for
> those netdevices, so a per-instance setting. I haven't walked through
> the details to know if it would work.
I didn't think about that. Good idea, that looks perfectly doable. But
I'd still prefer to centralise the skb_reset_mac_header() call in a
dedicated patch set. I we did it here, we'd have to not reset the mac
header by default, to guarantee that unrelated tunnels wouldn't be
affected.
However, I think that the default behaviour should be to reset the mac
header and that only special cases, like the one in ip_gre, should
explicitely turn that off. Therefore, we'd need a follow up patch
anyway, to change the way this "reset_mac" flag would be set.
IMHO, the current approach has the advantage of clearly separating the
new feature from the refactoring. But if you feel strongly about using
a flag in struct ip_tunnel, I can rework this series.
next prev parent reply other threads:[~2021-06-28 15:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-25 13:32 [PATCH net-next 0/6] net: reset MAC header consistently across L3 virtual devices Guillaume Nault
2021-06-25 13:33 ` [PATCH net-next 1/6] bareudp: allow redirecting bareudp packets to eth devices Guillaume Nault
2021-06-25 13:33 ` [PATCH net-next 2/6] ipip: allow redirecting ipip and mplsip " Guillaume Nault
2021-06-25 13:33 ` [PATCH net-next 3/6] sit: allow redirecting ip6ip, " Guillaume Nault
2021-06-25 13:33 ` [PATCH net-next 4/6] gre: let mac_header point to outer header only when necessary Guillaume Nault
2021-06-25 13:33 ` [PATCH net-next 5/6] ip6_tunnel: allow redirecting ip6gre and ipxip6 packets to eth devices Guillaume Nault
2021-06-25 13:33 ` [PATCH net-next 6/6] gtp: reset mac_header after decap Guillaume Nault
2021-06-26 17:50 ` [PATCH net-next 0/6] net: reset MAC header consistently across L3 virtual devices David Ahern
2021-06-26 20:53 ` Guillaume Nault
2021-06-27 15:56 ` David Ahern
2021-06-28 15:04 ` Guillaume Nault [this message]
2021-06-28 18:46 ` David Ahern
2021-06-28 20:40 ` Guillaume Nault
2021-06-28 20:10 ` patchwork-bot+netdevbpf
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=20210628150436.GA3495@pc-23.home \
--to=gnault@redhat.com \
--cc=aschultz@tpip.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=dsahern@kernel.org \
--cc=elic@nvidia.com \
--cc=jbenc@redhat.com \
--cc=jonas@norrbonn.se \
--cc=kuba@kernel.org \
--cc=laforge@gnumonks.org \
--cc=martin.varghese@nokia.com \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=simon.horman@netronome.com \
--cc=tom@herbertland.com \
--cc=yoshfuji@linux-ipv6.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).