From: Simon Horman <simon.horman@corigine.com>
To: Josef Miegl <josef@miegl.cz>
Cc: Eyal Birger <eyal.birger@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Pravin B Shelar <pshelar@ovn.org>
Subject: Re: [PATCH net-next] net: geneve: accept every ethertype
Date: Mon, 13 Mar 2023 17:48:23 +0100 [thread overview]
Message-ID: <ZA9T14Ks66HOlwH+@corigine.com> (raw)
In-Reply-To: <20230312163726.55257-1-josef@miegl.cz>
+Pravin
On Sun, Mar 12, 2023 at 05:37:26PM +0100, Josef Miegl wrote:
> The Geneve encapsulation, as defined in RFC 8926, has a Protocol Type
> field, which states the Ethertype of the payload appearing after the
> Geneve header.
>
> Commit 435fe1c0c1f7 ("net: geneve: support IPv4/IPv6 as inner protocol")
> introduced a new IFLA_GENEVE_INNER_PROTO_INHERIT flag that allowed the
> use of other Ethertypes than Ethernet. However, it imposed a restriction
> that prohibits receiving payloads other than IPv4, IPv6 and Ethernet.
>
> This patch removes this restriction, making it possible to receive any
> Ethertype as a payload, if the IFLA_GENEVE_INNER_PROTO_INHERIT flag is
> set.
>
> This is especially useful if one wants to encapsulate MPLS, because with
> this patch the control-plane traffic (IP, IS-IS) and the data-plane
> traffic (MPLS) can be encapsulated without an Ethernet frame, making
> lightweight overlay networks a possibility.
Hi Josef,
I could be mistaken. But I believe that the thinking at the time,
was based on the idea that it was better to only allow protocols that
were known to work. And allow more as time goes on.
Perhaps we have moved away from that thinking (I have no strong feeling
either way). Or perhaps this is safe because of some other guard. But if
not perhaps it is better to add the MPLS ethertype(s) to the if clause
rather than remove it. This would be after any patches that enhance the
stack to actually support this (I'm thinking of [1], though I haven't
looked at it closely).
[1] [PATCH net-next] net: geneve: set IFF_POINTOPOINT with IFLA_GENEVE_INNER_PROTO_INHERIT
Link: https://lore.kernel.org/netdev/20230312164557.55354-1-josef@miegl.cz/
> Signed-off-by: Josef Miegl <josef@miegl.cz>
> ---
> drivers/net/geneve.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> index 89ff7f8e8c7e..32684e94eb4f 100644
> --- a/drivers/net/geneve.c
> +++ b/drivers/net/geneve.c
> @@ -365,13 +365,6 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
> if (unlikely(geneveh->ver != GENEVE_VER))
> goto drop;
>
> - inner_proto = geneveh->proto_type;
> -
> - if (unlikely((inner_proto != htons(ETH_P_TEB) &&
> - inner_proto != htons(ETH_P_IP) &&
> - inner_proto != htons(ETH_P_IPV6))))
> - goto drop;
> -
> gs = rcu_dereference_sk_user_data(sk);
> if (!gs)
> goto drop;
> @@ -380,6 +373,8 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
> if (!geneve)
> goto drop;
>
> + inner_proto = geneveh->proto_type;
> +
> if (unlikely((!geneve->cfg.inner_proto_inherit &&
> inner_proto != htons(ETH_P_TEB)))) {
> geneve->dev->stats.rx_dropped++;
> --
> 2.37.1
>
next prev parent reply other threads:[~2023-03-13 16:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-12 16:37 [PATCH net-next] net: geneve: accept every ethertype Josef Miegl
2023-03-13 16:48 ` Simon Horman [this message]
2023-03-13 17:14 ` Josef Miegl
2023-03-13 18:35 ` Simon Horman
2023-03-14 9:55 ` Eyal Birger
2023-03-14 15:08 ` Simon Horman
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=ZA9T14Ks66HOlwH+@corigine.com \
--to=simon.horman@corigine.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eyal.birger@gmail.com \
--cc=josef@miegl.cz \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pshelar@ovn.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).