netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@netronome.com>
To: Davide Caratti <dcaratti@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	John Hurley <john.hurley@netronome.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net 1/2] net: avoid errors when trying to pop MLPS header on non-MPLS packets
Date: Fri, 11 Oct 2019 09:34:08 +0200	[thread overview]
Message-ID: <20191011073407.vvogkh53hm6hvb6h@netronome.com> (raw)
In-Reply-To: <9343e3ce8aed5d0e109ab0805fb452e8f55f0130.1570732834.git.dcaratti@redhat.com>

On Thu, Oct 10, 2019 at 08:43:52PM +0200, Davide Caratti wrote:
> the following script:
> 
>  # tc qdisc add dev eth0 clsact
>  # tc filter add dev eth0 egress matchall action mpls pop
> 
> implicitly makes the kernel drop all packets transmitted by eth0, if they
> don't have a MPLS header. This behavior is uncommon: other encapsulations
> (like VLAN) just let the packet pass unmodified. Since the result of MPLS
> 'pop' operation would be the same regardless of the presence / absence of
> MPLS header(s) in the original packet, we can let skb_mpls_pop() return 0
> when dealing with non-MPLS packets.
> 
> Fixes: 2a2ea50870ba ("net: sched: add mpls manipulation actions to TC")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>

Hi Davide,

For the TC use-case I think this is correct for the reasons you explain
above.

For the OVS use-case I also think it is fine because
__ovs_nla_copy_actions() will ensure that MPLS POP only occurs
for packets with an MPLS Ethernet protocol. That is, this condition
should never occur in that use-case.

And it appears that there are no other users of this function.

I think it might be worth adding something about use-cases other than TC
to the changelog, but that aside:

Reviewed-by: Simon Horman <simon.horman@netronome.com>

> ---
>  net/core/skbuff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 529133611ea2..cd59ccd6da57 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -5536,7 +5536,7 @@ int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto)
>  	int err;
>  
>  	if (unlikely(!eth_p_mpls(skb->protocol)))
> -		return -EINVAL;
> +		return 0;
>  
>  	err = skb_ensure_writable(skb, skb->mac_len + MPLS_HLEN);
>  	if (unlikely(err))
> -- 
> 2.21.0
> 

  reply	other threads:[~2019-10-11  7:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 18:43 [PATCH net 0/2] net/sched: fix wrong behavior of MPLS push/pop action Davide Caratti
2019-10-10 18:43 ` [PATCH net 1/2] net: avoid errors when trying to pop MLPS header on non-MPLS packets Davide Caratti
2019-10-11  7:34   ` Simon Horman [this message]
2019-10-11  9:26     ` John Hurley
2019-10-10 18:43 ` [PATCH net 2/2] net/sched: fix corrupted L2 header with MPLS 'push' and 'pop' actions Davide Caratti
2019-10-11  7:34   ` Simon Horman
2019-10-11  9:26     ` John Hurley
2019-10-11  9:26     ` John Hurley
2019-10-12  3:17   ` kbuild test robot

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=20191011073407.vvogkh53hm6hvb6h@netronome.com \
    --to=simon.horman@netronome.com \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=john.hurley@netronome.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.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).