From patchwork Wed Sep 29 11:32:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 12525305 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76BF1C433F5 for ; Wed, 29 Sep 2021 11:32:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5115661406 for ; Wed, 29 Sep 2021 11:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245647AbhI2Led (ORCPT ); Wed, 29 Sep 2021 07:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbhI2Lec (ORCPT ); Wed, 29 Sep 2021 07:34:32 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48290C06161C for ; Wed, 29 Sep 2021 04:32:51 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id lp15-20020a17090b4a8f00b0019f4059bd90so169304pjb.3 for ; Wed, 29 Sep 2021 04:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:mime-version; bh=xDKomLsNp0N+F4pL0iKne/4E1RX9gHyf2Ku+PZJ02uM=; b=Ee9ybrApPLXVxxPjPH8KZhDe863E2eJuSz9yaaatzgrh/YwwWQsrG2eVFyUXi/PSsg xY6mz/74uWD9TcvBq1YXCGnfJXNm7MYfIGPxRAVwaDNvcDOz3EGJxMovb1ikDpFJHpGx tflNY331nWeHIvbKQqzdtr8hFH1SftqjEB5GI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=xDKomLsNp0N+F4pL0iKne/4E1RX9gHyf2Ku+PZJ02uM=; b=W1Dcj7T3cp79TM0PvXhRMeHXub7iX7JdSpMRfRsDtuEhhdiVF8npWBoCsSliZvf5A6 yB116TgtEgBSejU+TUlLJYsAhfuxi4jax03YRi+h5dVrmCGzQ43IF1lHK53VicUH5gL2 uYe+MM9GeyUwGOrwZLiYu0QvdD8oXk/l/l+okLtB6QPs2OQZS7CC2//GBlIAou+o8wrd 9ikMlKHhLO0MUAMv0bG2wqI6VoLuAD0HzCXjBQFU3aGBSUjzt7D2QofOBKZdfAFqJb84 zg4izSKGs2Lh6f7sivJnKa65kmQxOKXL4vZbZSAO3WxJFURvm2A3z59QzSrx1weNnjnu 5+XA== X-Gm-Message-State: AOAM532sCshDQz+pR8POh1Wwu0VurpVPllsFuU5fiEm2Gmw00w3lnlte cWZh5o7zCZuZX7+vvH+pJ1U4zzSn2jWV3DsUAXZTVVwNPodg756p+IlGlbZ/0JgEjZz98z4ci1v j4n3+mgPz8jyl4DcekJbqvFymR7tQ3nGoczE5NS65k9eHU2ksAjXw61IIzxV74Yza5LSriR/352 1jXIIj83mWJA== X-Google-Smtp-Source: ABdhPJz4dgl30mdgy/8s+9P23Sxnfqts2M0w0Gd5rKjRSZ7+YHJah/adp8PALvp/aizjVRU2DzivMQ== X-Received: by 2002:a17:90a:47:: with SMTP id 7mr5909159pjb.46.1632915170256; Wed, 29 Sep 2021 04:32:50 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id k3sm1772711pjg.43.2021.09.29.04.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 04:32:49 -0700 (PDT) From: Boris Sukholitko To: netdev@vger.kernel.org, Jamal Hadi Salim , Jiri Pirko , Cong Wang Cc: "David S . Miller" , Jakub Kicinski , Vladimir Oltean , Vadym Kochan , Ilya Lifshits , Boris Sukholitko Subject: [PATCH net-next] dissector: do not set invalid PPP protocol Date: Wed, 29 Sep 2021 14:32:23 +0300 Message-Id: <20210929113223.22108-1-boris.sukholitko@broadcom.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The following flower filter fails to match non-PPP_IP{V6} packets wrapped in PPP_SES protocol: tc filter add dev eth0 ingress protocol ppp_ses flower \ action simple sdata hi64 The reason is that proto local variable is being set even when FLOW_DISSECT_RET_OUT_BAD status is returned. The fix is to avoid setting proto variable if the PPP protocol is unknown. Signed-off-by: Boris Sukholitko --- net/core/flow_dissector.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index bac0184cf3de..7d0a9f84aaf7 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -1196,9 +1196,8 @@ bool __skb_flow_dissect(const struct net *net, break; } - proto = hdr->proto; nhoff += PPPOE_SES_HLEN; - switch (proto) { + switch (hdr->proto) { case htons(PPP_IP): proto = htons(ETH_P_IP); fdret = FLOW_DISSECT_RET_PROTO_AGAIN;