Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4793866pxy; Tue, 27 Apr 2021 12:47:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJJlc7rmkJhoSzDV/nsDq0zLiMw8l5RXWj1t8lozBf+CZLfBn107ct2w3SIJOrLeOaspmp X-Received: by 2002:a50:d782:: with SMTP id w2mr6413704edi.346.1619552875152; Tue, 27 Apr 2021 12:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619552875; cv=none; d=google.com; s=arc-20160816; b=t+Rd0yi3HEblOTuO6qm7Us/ei78GTHQZLfgwNphZsOrZhMdhq4ALTdP0nnvs+Vf9Us sUElj01BUQuNyNPiTRRrXutgO6UCRNMiamBHfaRQSrVNCwDTdaDUlWhx98WRGIyi3ODD CGiBv+l7EFSt0K/JIz82JZQzhVkw2tkKApKfEpV4A53R+WrAtTtU65yrHafywLA/wtMj NB2g/bPY04MrS6+vuIFeV9oHQRWqP+SZDZe0+us5xpSfQv8AL99s3fF9pzM6U8Hd0o2Q sOkckXAgTIAZr9cfDiUJlT8Beivm87ssuCyxuD9z4XvIvUdZRz2t3B2zrd7nih2GZycD q1ZQ== 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 :dkim-signature; bh=dXZL4VMhEat97ja3ZjZ4RJDfasecMv9OcN7Yqb3fR44=; b=KDJnOPZ38k8m12sqCG3gR5+TNkEeCe1InoIjVK6BHklJ7VQRnpaf47O512csyd3sHq GHxltaOHM5i8Um6VxUAN90v6MEI9IkVc+HwlHQmR96ZYZyEEEXr08czv0z0fjkp7GqJC RUkeGRmiwB5ZsJhOqelOY6tBKYxO7bzrlmg8TGvog+pc0b8hSXEbEipq51t82FdkRZye 0rKN2FF4qhm7bRqWgu+u/liJfHpuKHPqGykSjWSgY9k9TgUJlDeadDCETzYZMPxNORS8 2lhxMkzoKfdp9TX3Cv97tJsNF0l6P9tFbhdPCLrT3ZWmAFYZwLDVnB21cMQmho9+Ujpi AXKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r4uY2em2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si3532018ede.27.2021.04.27.12.47.32; Tue, 27 Apr 2021 12:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r4uY2em2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238980AbhD0Tqo (ORCPT + 99 others); Tue, 27 Apr 2021 15:46:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:50240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235661AbhD0Tqn (ORCPT ); Tue, 27 Apr 2021 15:46:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E71C6023B; Tue, 27 Apr 2021 19:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619552759; bh=xLX5Y1/h9Ll5Xq3l/iKgtd536wc5fsuPUiC9i35GC2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4uY2em21Cu3E3S8kfddwM0mxkRxB9zBBQRGyyb7mSCF9MrLOo+kvN00n9VCLj8WN 8c3ZCrGMVzcdnz8Ms05Uksdy6/xGONCIhNaAdG5F7Qw0ZEJP99TsPjg/FERUtkddZ1 hjY0xnBpwNzPmkAWx+bHwgxPHGE/ksoIXzqLPo6otOLWj2s8UE4LMdUyiO5kpfZwXy bObx/C9cMN5fjE//6/FrvYX6jU2sn+PR8/ZF17cxVNSJJDtT+eX6KiBZEj8an4eIcG 7ic2zr4fZW505hvMnXlekVtU+tM7QevYQI10b94RGuQ2TmwoPXdCRC9ECebHxTA09q UwcJoHFyeB/hw== From: Arnd Bergmann To: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Jakub Kicinski Cc: Arnd Bergmann , Balazs Scheidler , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] netfilter: nft_socket: fix build with CONFIG_SOCK_CGROUP_DATA=n Date: Tue, 27 Apr 2021 21:45:19 +0200 Message-Id: <20210427194528.2325108-2-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210427194528.2325108-1-arnd@kernel.org> References: <20210427194528.2325108-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- I don't actually know what the right fix is for this, I only checked that my patch fixes the build failure. Is is possible that the function should always be defined. Please make sure you review carefully before applying. --- net/netfilter/nft_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 2.29.2