[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK+XE==VWnV+d7z321o50O1BZcHpS8aBNk-E3-Doe-gy2OUCrg@mail.gmail.com>
Date: Fri, 11 Oct 2019 10:26:01 +0100
From: John Hurley <john.hurley@...ronome.com>
To: Simon Horman <simon.horman@...ronome.com>
Cc: Davide Caratti <dcaratti@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Cong Wang <xiyou.wangcong@...il.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: [PATCH net 1/2] net: avoid errors when trying to pop MLPS header
on non-MPLS packets
On Fri, Oct 11, 2019 at 8:34 AM Simon Horman <simon.horman@...ronome.com> wrote:
>
> 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@...hat.com>
>
Acked-by: John Hurley <john.hurley@...ronome.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@...ronome.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
> >
Powered by blists - more mailing lists