From patchwork Tue Apr 27 20:43:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 427964 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4970288jao; Tue, 27 Apr 2021 13:44:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyg3o/R79a0HXvmtaURYQLJJibs2Vhc3/4/ubvEI4qXn8JjugALTMksLz2aPZPp0yDCqFpL X-Received: by 2002:a05:6402:1a47:: with SMTP id bf7mr6726734edb.173.1619556242435; Tue, 27 Apr 2021 13:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619556242; cv=none; d=google.com; s=arc-20160816; b=HLFBRtwckcesDgkjjbEImlwfE7s/xq3JhyNFywdB1Bo5q6m3ujOhbIdBJPiyHJ4pP7 k6JQw6gBOrOrcTawZajgOg8we1HChw895tvqFaM3nFzczPA+V4Bu9ODhOajEydTGlRd7 MCGQNV5F0wKmC/TLYQRlU7I6Dun7nu6SNcZFT6eG6KJxm+ia12zUXy0vgNiQn8Rjcens yX8Du8jOV68oM45vkInEUQpn/QBMjM4eW190xRj2YtFCmqIDBN24AGKNIY39OjDT5qNV oLl6OVq+mzK3SPi0Le0QS9oOuc0O41oprlEf/BFg3vn0hWbd/1TJg8qKWJ7AT373Ouxs I4Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=eeyWl7EWOu7bqrOKgntlEtuxoDP1NIOKAAZrZW2sq1M=; b=aOQvUqnCpUmQHxwcTJOvXvmZID5MKKCOGNqrB7WhisE86ATU1kV2DK4XNb6BWR/U1r QoUsGvSbakdtGcDj+0hISO1ICuEnKIBc1LDajran+QGA4NR48Gk/YC8Fw4f2AdCouc4D WTf+Yu6ZcdWrO4oxwxGjkhtKdU36tmFq8lBv7eJb13zRDAuTGhfxLtjlA699nHsPhm0g Zd9HPgTrJWVdjFhrR5NU25JLS9TTA3eGV8R4Zeg91mfvwsmXE+hKZqVQDhyUMJ4y9tpj wYxpU6UxqZQ8PPQOWutxg9IhmMQf4Sv0KQcBdPPObhRNNWg2rvjSdGcJGzqU9RQ8qam/ K+vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g4si831651ejj.279.2021.04.27.13.44.02; Tue, 27 Apr 2021 13:44:02 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239034AbhD0Uoo (ORCPT + 8 others); Tue, 27 Apr 2021 16:44:44 -0400 Received: from mail.netfilter.org ([217.70.188.207]:54322 "EHLO mail.netfilter.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239010AbhD0Uok (ORCPT ); Tue, 27 Apr 2021 16:44:40 -0400 Received: from localhost.localdomain (unknown [90.77.255.23]) by mail.netfilter.org (Postfix) with ESMTPSA id C522864145; Tue, 27 Apr 2021 22:43:18 +0200 (CEST) From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net-next 7/7] netfilter: nft_socket: fix build with CONFIG_SOCK_CGROUP_DATA=n Date: Tue, 27 Apr 2021 22:43:45 +0200 Message-Id: <20210427204345.22043-8-pablo@netfilter.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210427204345.22043-1-pablo@netfilter.org> References: <20210427204345.22043-1-pablo@netfilter.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann In some configurations, the sock_cgroup_ptr() function is not available: net/netfilter/nft_socket.c: In function 'nft_sock_get_eval_cgroupv2': net/netfilter/nft_socket.c:47:16: error: implicit declaration of function 'sock_cgroup_ptr'; did you mean 'obj_cgroup_put'? [-Werror=implicit-function-declaration] 47 | cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); | ^~~~~~~~~~~~~~~ | obj_cgroup_put net/netfilter/nft_socket.c:47:14: error: assignment to 'struct cgroup *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion] 47 | cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data); | ^ Change the caller to match the same #ifdef check, only calling it when the function is defined. Fixes: e0bb96db96f8 ("netfilter: nft_socket: add support for cgroupsv2") Signed-off-by: Arnd Bergmann Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nft_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c index f9c5ff6024e0..d601974c9d2e 100644 --- a/net/netfilter/nft_socket.c +++ b/net/netfilter/nft_socket.c @@ -34,7 +34,7 @@ static void nft_socket_wildcard(const struct nft_pktinfo *pkt, } } -#ifdef CONFIG_CGROUPS +#ifdef CONFIG_SOCK_CGROUP_DATA static noinline bool nft_sock_get_eval_cgroupv2(u32 *dest, const struct nft_pktinfo *pkt, u32 level) { @@ -106,7 +106,7 @@ static void nft_socket_eval(const struct nft_expr *expr, } nft_socket_wildcard(pkt, regs, sk, dest); break; -#ifdef CONFIG_CGROUPS +#ifdef CONFIG_SOCK_CGROUP_DATA case NFT_SOCKET_CGROUPV2: if (!nft_sock_get_eval_cgroupv2(dest, pkt, priv->level)) { regs->verdict.code = NFT_BREAK;