From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F7D4C47404 for ; Fri, 11 Oct 2019 09:26:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23E482196E for ; Fri, 11 Oct 2019 09:26:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="1N2vYMEU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727688AbfJKJ0Z (ORCPT ); Fri, 11 Oct 2019 05:26:25 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:37501 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfJKJ0Z (ORCPT ); Fri, 11 Oct 2019 05:26:25 -0400 Received: by mail-io1-f65.google.com with SMTP id b19so20092925iob.4 for ; Fri, 11 Oct 2019 02:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7K7HvBfbpKkN44KKW0z6d1aTtcMDNeUCKnzQEGc2GO4=; b=1N2vYMEUIAZvJkFAEVSN7XqxTKA83SCORXpkAopqpw4njctrlBNqiCPu2tlgmAbN7g ZMs9Cd2kDgSBbllUZM6J9SLELrMzwQI1qeAMC8DDTBcF1OUUe1E6P3ngu70NhpKoAGII nWsE/nfb435MK8UaQvtdWKll7GWaEtoKlrQ0so9cdPTNnmbSZGlKalRky6YUmDeLkAOo 8lf/iMD6aBk5M3QJ2P53RDeVeF/3z/BF790iS/dUYuZ3dSpx/vNKkFVzYnwZBEUOc+a0 X1RYmFI35ORH6K1GrRoNaqofspkCNntEPUKH4H4ir7B+fgAVP6zrFnTDR/eBjQ4MgSBO xXjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7K7HvBfbpKkN44KKW0z6d1aTtcMDNeUCKnzQEGc2GO4=; b=Y3hvVnFMkmqRu8JLinpXS4pSrp68BXPVzUh7LdBQO0j7zjmpGazWlnudKPjgeQ14eI NujmGDLkZHJNx8xyqO50elCEYdVR5/F0nkMmrJzmBGKU9AZW1W7ICzUSue2/A5LsPoWH x3fL1ogvUb8utXFNCzwcHqHv/drIIB660x6r+FzqcMcSY4Nd3jCwmbDZ0f8lEO7tv71f 9GmVMjYp5aXmv2vXKr6TVKdBZMzcfmi9YwkiDJFkj3eR3YUFjlaymsb0M93wTFh35rip KlKQtaVvtfo96Dx3E22Gb48yIlst7gg+pGHtewdRtDGCm+nwn3/42p51FaGb9imT1jG9 kCdQ== X-Gm-Message-State: APjAAAWHQ/UZULKcaJIQRrDrtTDxVPeJFtkK1Iy9kBVtfzJSva/fYJDk V4jqccYGqwvqVxagVuFOs/0aK/94D9WUavUddDF2ow== X-Google-Smtp-Source: APXvYqxcvUx9hpxobMqnYbKt0hb/Orc4ejVHzr/QsynEjRJtZhmwMizLNtUpEKXtiBk/H4SH+68ObKFiwaZV5X7shoQ= X-Received: by 2002:a02:a792:: with SMTP id e18mr16860596jaj.143.1570785984331; Fri, 11 Oct 2019 02:26:24 -0700 (PDT) MIME-Version: 1.0 References: <20191011073437.uwtftvhofrrm5r5v@netronome.com> In-Reply-To: <20191011073437.uwtftvhofrrm5r5v@netronome.com> From: John Hurley Date: Fri, 11 Oct 2019 10:26:13 +0100 Message-ID: Subject: Re: [PATCH net 2/2] net/sched: fix corrupted L2 header with MPLS 'push' and 'pop' actions To: Simon Horman Cc: Davide Caratti , "David S. Miller" , Cong Wang , Lorenzo Bianconi , Linux Netdev List Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Oct 11, 2019 at 8:34 AM Simon Horman wrote: > > On Thu, Oct 10, 2019 at 08:43:53PM +0200, Davide Caratti wrote: > > the following script: > > > > # tc qdisc add dev eth0 clsact > > # tc filter add dev eth0 egress protocol ip matchall \ > > > action mpls push protocol mpls_uc label 0x355aa bos 1 > > > > causes corruption of all IP packets transmitted by eth0. On TC egress, we > > can't rely on the value of skb->mac_len, because it's 0 and a MPLS 'push' > > operation will result in an overwrite of the first 4 octets in the packet > > L2 header (e.g. the Destination Address if eth0 is an Ethernet); the same > > error pattern is present also in the MPLS 'pop' operation. Fix this error > > in act_mpls data plane, computing 'mac_len' as the difference between the > > network header and the mac header (when not at TC ingress), and use it in > > MPLS 'push'/'pop' core functions. > > > > CC: Lorenzo Bianconi > > Fixes: 2a2ea50870ba ("net: sched: add mpls manipulation actions to TC") > > Signed-off-by: Davide Caratti > > Reviewed-by: Simon Horman >