lkml.org 
[lkml]   [2019]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.3 087/197] net: avoid errors when trying to pop MLPS header on non-MPLS packets
    Date
    From: Davide Caratti <dcaratti@redhat.com>

    [ Upstream commit dedc5a08da07874c6e0d411e7f39c5c2cf137014 ]

    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.

    For the OVS use-case, this is acceptable because __ovs_nla_copy_actions()
    already ensures that MPLS 'pop' operation only occurs with packets having
    an MPLS Ethernet type (and there are no other callers in current code, so
    the semantic change should be ok).

    v2: better documentation of use-cases for skb_mpls_pop(), thanks to Simon
    Horman

    Fixes: 2a2ea50870ba ("net: sched: add mpls manipulation actions to TC")
    Reviewed-by: Simon Horman <simon.horman@netronome.com>
    Acked-by: John Hurley <john.hurley@netronome.com>
    Signed-off-by: Davide Caratti <dcaratti@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    net/core/skbuff.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/net/core/skbuff.c
    +++ b/net/core/skbuff.c
    @@ -5524,7 +5524,7 @@ int skb_mpls_pop(struct sk_buff *skb, __
    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))

    \
     
     \ /
      Last update: 2019-10-27 22:29    [W:4.160 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site