From: "Josef Miegl" <josef@miegl.cz>
To: "Eyal Birger" <eyal.birger@gmail.com>
Cc: "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
Subject: Re: [PATCH v2 1/1] net: geneve: accept every ethertype
Date: Mon, 27 Feb 2023 10:02:23 +0000 [thread overview]
Message-ID: <0abab84afdaa4817522b7ee2bd2879f9@miegl.cz> (raw)
In-Reply-To: <CAHsH6GvCecnq6Cte=ktRB+BxdZMo4Mi0z-hBDD3kFkENeWUfdQ@mail.gmail.com>
February 27, 2023 10:31 AM, "Eyal Birger" <eyal.birger@gmail.com> wrote:
> On Mon, Feb 27, 2023 at 10:14 AM Josef Miegl <josef@miegl.cz> wrote:
>
>> This patch removes a restriction that prohibited receiving encapsulated
>> ethertypes other than IPv4, IPv6 and Ethernet.
>>
>> With IFLA_GENEVE_INNER_PROTO_INHERIT flag set, GENEVE interface can now
>> receive ethertypes such as MPLS.
>>
>> Signed-off-by: Josef Miegl <josef@miegl.cz>
>> ---
>> drivers/net/geneve.c | 15 ++++-----------
>> 1 file changed, 4 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
>> index 89ff7f8e8c7e..7973659a891f 100644
>> --- a/drivers/net/geneve.c
>> +++ b/drivers/net/geneve.c
>> @@ -353,7 +353,6 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
>> struct genevehdr *geneveh;
>> struct geneve_dev *geneve;
>> struct geneve_sock *gs;
>> - __be16 inner_proto;
>
> nit: why remove the variable? - it's still used in two places and this
> change just makes the patch longer.
I thought making the code shorter would be a better option, usage in two
places doesn't justify a dedicated variable in my mind.
>> int opts_len;
>>
>> /* Need UDP and Geneve header to be present */
>> @@ -365,13 +364,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;
>> @@ -381,14 +373,15 @@ static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
>> goto drop;
>>
>> if (unlikely((!geneve->cfg.inner_proto_inherit &&
>> - inner_proto != htons(ETH_P_TEB)))) {
>> + geneveh->proto_type != htons(ETH_P_TEB)))) {
>> geneve->dev->stats.rx_dropped++;
>> goto drop;
>> }
>>
>> opts_len = geneveh->opt_len * 4;
>> - if (iptunnel_pull_header(skb, GENEVE_BASE_HLEN + opts_len, inner_proto,
>> - !net_eq(geneve->net, dev_net(geneve->dev)))) {
>> + if (iptunnel_pull_header(skb, GENEVE_BASE_HLEN + opts_len,
>> + geneveh->proto_type, !net_eq(geneve->net,
>> + dev_net(geneve->dev)))) {
>> geneve->dev->stats.rx_dropped++;
>> goto drop;
>> }
>> --
>> 2.37.1
next prev parent reply other threads:[~2023-02-27 10:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-27 7:41 [PATCH v2 0/1] net: geneve: accept every ethertype Josef Miegl
2023-02-27 7:41 ` [PATCH v2 1/1] " Josef Miegl
2023-02-27 9:31 ` Eyal Birger
2023-02-27 10:02 ` Josef Miegl [this message]
2023-02-27 9:30 ` [PATCH v2 0/1] " Eyal Birger
2023-02-27 9:57 ` Josef Miegl
2023-02-27 10:05 ` Eyal Birger
2023-02-27 19:57 ` Jakub Kicinski
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=0abab84afdaa4817522b7ee2bd2879f9@miegl.cz \
--to=josef@miegl.cz \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eyal.birger@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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