Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp607764lqp; Sun, 9 Jun 2024 10:35:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWn7kjxhIGMc7flNuRwv/v8LePEPKpXvFVLMepK5oiMXAAugoLNtIYHTCRSZYUUlCMROQcl4S/9qqIxS40IOukLecE25ciEXhFuhTl9ig== X-Google-Smtp-Source: AGHT+IEybWOI5oozJYwPEMigbL5DLErQMJdPXFp/ukadQKJYFPf3C2klO4XGKHstElIVYd7Nrn0S X-Received: by 2002:a17:902:da8e:b0:1f4:b702:f12d with SMTP id d9443c01a7336-1f6d02f1f55mr84488765ad.26.1717954554976; Sun, 09 Jun 2024 10:35:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717954554; cv=pass; d=google.com; s=arc-20160816; b=OyJxIfsO6BswNw21560ADWIw8chTKbHiFOyFL2zWrIysEzqPgNkmaKLNpkPWfTx5ZP xIZfYhZr5iWDW2buDVlxnEcMsVAcJ6rRRnAwOc3JRT8B9yT44pT5kSWpM3FeSogj9HU2 7ctKSQyZomj2ei3e1pvY68qodGEs69o9dFdmnruXpjCMn1ZKA88OJ+Xa3t/Q4qz/q2jA v0p6QvWUK4efKJRY8vnfjyP1WrDLjnXonftY+snJa56N6ojQRqVwAuWYu/86p5ffv/eD RXgQnMHYPatb1QpdOibn44OXBbu87a0yztZLMPfj/i3KpLYSajTzY1PXdv9JSh33SlWo qtBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Zum8GvX69SnWBe4DoCpsA1sTpckA29roiLcZVSZUWYc=; fh=NMJjGA7aflQMPIhpvsA4i+dCSr7fXFZYjo6umaJRvs0=; b=ArXMc7Qy2OlQSaLvroTwIXWI1ONg15MlQA8tTcOLn7MTWerQLCiwgxpW0gWbRZUkBg bfX7VsqRsk72VlTtnv/lzuWfNtS0aEgDirlH6f3lmqQebyFiSuJJbIEIjitmfSBp3kxX /Q6y28SIggYFdUQEfQ9gV6bgndGK6zwFj/ySQW8E7LO2XWK0ZUexG5embjfSeiKRS6qA M7+0H2ZX5qhNKWdUinyq0A6/eQRfovTIZ9sb4t7SuHDwvmvNbGTNWWFIRxaEkct7Hsuq +qFOCxpSHeMoJGF2fQ2f22nHvPyxqbiNS5qIsOuB7HJkq07ITRFoGN8tBn4HbPjMcyXe jGMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=IFoy71mO; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-207447-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207447-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f701059903si16528715ad.100.2024.06.09.10.35.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 10:35:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207447-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=IFoy71mO; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-207447-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207447-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 949F128146A for ; Sun, 9 Jun 2024 17:35:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D88F150275; Sun, 9 Jun 2024 17:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="IFoy71mO" Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0526746544; Sun, 9 Jun 2024 17:34:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717954501; cv=none; b=j9+uEEdYVuIEWIVQLf4dkov23q6390zhLBkxiTH/GoJg6Tn3o0EXsrohSbm178w7J6pHFK/iT0o4+bBP1CDa1MYZhYNovD+IBZQnjcP1OY7E67gpf+zc3+9C3mlUouU4mXgg1EiX8YpQBnQfDyof1YVH8wm8wHup/UbwyMPjLRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717954501; c=relaxed/simple; bh=tui1WJ7baOGzKyf18IUbLIlkbfJr/Fu2MdHRU5e5qNY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=diiHbVfMp7favAnWUAalg8bSx19OZLXKDHsvNEG80DkBi2MBp2SJXwxLYzn9Yzg08V5vBrIb1djoKdyLqC14L0KHws9+SYmXy7gbQaQObUCwONB5/6cGT9upJdAYDRhuNb483v0V9FhjesyDNja0T5IqHSBLhfvRZ9cTsoZK+oQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=IFoy71mO; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 7C09B60178; Sun, 9 Jun 2024 17:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1717954497; bh=tui1WJ7baOGzKyf18IUbLIlkbfJr/Fu2MdHRU5e5qNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFoy71mOjo5t2qezRI5PX4FHJW2kFybFXf5/hSM0TMqBk3kMP/sGNkGumIoCuFrQ5 TTo8C972eigjkbLLRB7h4DkMJTwVRzZQ7S6s+I6sggSi+/0tvaP8LHuw6EEdKGFNcm Z70WS5KqgE03OhEl7ptaV1AUZ35Z1pHszJ3PbBQzxPJVaQEBIjOPZYjk8c2Bd5VsqJ kZAX5tODRrt0M/mF1lJwNFWwAH0QyLTkk6JZ87x9qiFJnCxmWAwJ6ktFcX++2W0UpP bF3s2XtuIx5J2aVFAL8jd5vcZyTASLLxRcn9D0kLK1/9oumNB5T5f3biD5Z736NZrw /XZNnNR0YcVYQ== Received: by x201s (Postfix, from userid 1000) id AF31C204548; Sun, 09 Jun 2024 17:34:29 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Edward Cree , Martin Habets , linux-net-drivers@amd.com, Saeed Mahameed , Leon Romanovsky , Tariq Toukan , linux-rdma@vger.kernel.org, Jesse Brandeburg , Tony Nguyen , intel-wired-lan@lists.osuosl.org, Louis Peens , oss-drivers@corigine.com, linux-kernel@vger.kernel.org, Davide Caratti , i.maximets@ovn.org Subject: [PATCH net-next 3/5] net/mlx5e: flower: validate encapsulation control flags Date: Sun, 9 Jun 2024 17:33:53 +0000 Message-ID: <20240609173358.193178-4-ast@fiberby.net> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240609173358.193178-1-ast@fiberby.net> References: <20240609173358.193178-1-ast@fiberby.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Encapsulation control flags are currently not used anywhere, so all flags are currently unsupported by all drivers. This patch adds validation of this assumption, so that encapsulation flags may be used in the future. In case any encapsulation control flags are masked, flow_rule_match_has_enc_control_flags() sets a NL extended error message, and we return -EOPNOTSUPP. Only compile tested. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index 8dfb57f712b0d..721f35e597579 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c @@ -850,6 +850,12 @@ int mlx5e_tc_tun_parse(struct net_device *filter_dev, flow_rule_match_enc_control(rule, &match); addr_type = match.key->addr_type; + if (flow_rule_has_enc_control_flags(match.mask->flags, + extack)) { + err = -EOPNOTSUPP; + goto out; + } + /* For tunnel addr_type used same key id`s as for non-tunnel */ if (addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) { struct flow_match_ipv4_addrs match; -- 2.45.1