From: Matthias May <matthias.may@westermo.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <yoshfuji@linux-ipv6.org>,
<dsahern@kernel.org>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <linux-kernel@vger.kernel.org>,
Matthias May <matthias.may@westermo.com>
Subject: [PATCH 3/4 net-next] ip6_gre: use actual protocol to select xmit
Date: Mon, 11 Jul 2022 11:17:21 +0200 [thread overview]
Message-ID: <20220711091722.14485-4-matthias.may@westermo.com> (raw)
In-Reply-To: <20220711091722.14485-1-matthias.may@westermo.com>
When the payload is a VLAN encapsulated IPv6/IPv6 frame, we can
skip the 802.1q/802.1ad ethertypes and jump to the actual protocol.
This way we treat IPv4/IPv6 frames as IP instead of as "other".
Signed-off-by: Matthias May <matthias.may@westermo.com>
---
net/ipv6/ip6_gre.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 5fe0db88bea8..cd0202016da0 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -916,6 +916,7 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
{
struct ip6_tnl *t = netdev_priv(dev);
struct net_device_stats *stats = &t->dev->stats;
+ __be16 payload_protocol;
int ret;
if (!pskb_inet_may_pull(skb))
@@ -924,7 +925,8 @@ static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
if (!ip6_tnl_xmit_ctl(t, &t->parms.laddr, &t->parms.raddr))
goto tx_err;
- switch (skb->protocol) {
+ payload_protocol = skb_protocol(skb, true);
+ switch (payload_protocol) {
case htons(ETH_P_IP):
ret = ip6gre_xmit_ipv4(skb, dev);
break;
--
2.35.1
next prev parent reply other threads:[~2022-07-11 9:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 9:17 [PATCH 0/4 net-next] Allow to inherit from VLAN encapsulated IP Matthias May
2022-07-11 9:17 ` [PATCH 1/4 v3 net-next] ip_tunnel: allow " Matthias May
2022-07-11 9:17 ` [PATCH 2/4 net-next] ip6_gre: set DSCP for non-IP Matthias May
2022-07-11 9:17 ` Matthias May [this message]
2022-07-11 9:17 ` [PATCH 4/4 net-next] ip6_tunnel: allow to inherit from VLAN encapsulated IP Matthias May
2022-07-13 11:20 ` [PATCH 0/4 net-next] Allow " 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=20220711091722.14485-4-matthias.may@westermo.com \
--to=matthias.may@westermo.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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