From patchwork Sun Oct 3 07:13:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 12532539 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 BA642C433F5 for ; Sun, 3 Oct 2021 07:14:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88EA2619E9 for ; Sun, 3 Oct 2021 07:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbhJCHQZ (ORCPT ); Sun, 3 Oct 2021 03:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhJCHQS (ORCPT ); Sun, 3 Oct 2021 03:16:18 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AC4FC0613EC for ; Sun, 3 Oct 2021 00:14:31 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id c29so1372779pfp.2 for ; Sun, 03 Oct 2021 00:14:31 -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=lSf8xH80yKLt1ZSeIX7c9+aBTj+tdUQgAFHaI47gfkk=; b=iAGiXLYOuZhQOT2wU87uLVE8q295iFM5qppNxqq17zEMZ7hGGOCXGEUIf3TmFjz3tZ Qz8enyA/42gZYzvvI+h5xiXB3TC2Gu2jsYQ36YSO44CzFvJxDkqEDlpSAz9Ne7CgmNNO nY1jGc/gp9A5FrpeGROXi4ST/r0pA6Mvytzww= 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=lSf8xH80yKLt1ZSeIX7c9+aBTj+tdUQgAFHaI47gfkk=; b=ZHSasGo2w8O2U00CNsSVjJ8i9JR8os+J9W9V+VScH5cdhI0px/nzOKesYO8MowHlCf bI+9jUVennUYfTTFcAvXEN7snrW7ycNJndFKjZxkZhuHf0fEd4h/K8b9ghMt2TZqBIFJ osyfm12IbVJJqFzkaBSRIEPLqlwxvwFsy9gauRQ7dyK3h4mWwmqwdLL9Trdv3Ejfk/Ce uy4S46nrnodfMyBqTZMk2rhh4VNOLtYBcNu+dOH7uwNYxjq9VL5ga6BYceymfp5iodr4 ab3ra3D7KrNJgi4RwhTTpFFai0NYcHXKEFBeWRd0ztgffMR0JaL4zdE3sv/wImt6cuBW Pzeg== X-Gm-Message-State: AOAM532JRhWKAP0ojF05ryqmqG1YnUaCBx3YnNq09OIdJqdzw/nud06V 4kx6PJrW2/xXGOgBV81fF2p4ocxRrMRAFlgJ4WBeAZ6eW1GyfV6s1n+HDTuOV81IMNbUuyqf8V4 H8+J2TVnf7jZW4RO4CdaU7gBWnZHROiJ9oRqDuLWfECXXRLAFinzSzRoOwBjkY7dpvxPfhwDfcf DLtaAKRUM= X-Google-Smtp-Source: ABdhPJypMDFLGrqolNsa4o1PzpzIxZImErZ068XFp5VY597skzvKpH5PQX7CjD3EzEjx4n30p/OYOg== X-Received: by 2002:a63:200a:: with SMTP id g10mr5575892pgg.242.1633245269525; Sun, 03 Oct 2021 00:14:29 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id p27sm10545289pfq.164.2021.10.03.00.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 00:14:28 -0700 (PDT) From: Boris Sukholitko To: netdev@vger.kernel.org, Jamal Hadi Salim , Jiri Pirko , Cong Wang Cc: "David S . Miller" , Jakub Kicinski , wangqing@vivo.com, wenxu@ucloud.cn, eranbe@nvidia.com, dcaratti@redhat.com, gustavoars@kernel.org, zhangkaiheb@126.com, vladimir.oltean@nxp.com, alobakin@pm.me, Ilya Lifshits , Boris Sukholitko Subject: [PATCH net-next] net: flow_dissector: do not set invalid PPP protocol Date: Sun, 3 Oct 2021 10:13:45 +0300 Message-Id: <20211003071345.1661-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;