Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp411636rwb; Fri, 18 Nov 2022 03:22:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4LFHVfah4aB32zhbOlMkOu1kkrLauv0ezQfMfVVCbSIzFZkwwWvoS1ww9NwfnUBfl6cPPz X-Received: by 2002:aa7:d816:0:b0:458:4868:814 with SMTP id v22-20020aa7d816000000b0045848680814mr5787207edq.190.1668770548326; Fri, 18 Nov 2022 03:22:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668770548; cv=none; d=google.com; s=arc-20160816; b=Sr5oVEJLX7XyQnuSovgwPVD7w5pm9uYmIBGwtAOP83xFUD7qxHSVlmz0KfR02j3Isx 7cm8E8ded5WijPq7w7t4TRlQ9edSLr5oynXbG6aSNxaMuOuzZ6bH+8ABJCxMbW6W/20d e8CfQnwmb/gT/PXSsgEL3+ztalqQHKNgmLnPDLVcBNPmIOJ4/FgAWju1Xyb/zar+PNxK Cb3vh3hw2kGjR/PunUDhn8uMOoJCEbxQTBhmzdwcjOlONcHEiPfXXzjfCXO1ic2OoLHT PGwxBK97T8QtpVg/crMvnTh23V9hRBf9PlvtPK3ZVlmsLeRNBvqfiLjoNwKFihrh9IbD cx8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=MkUuJqC5knLu15iz/Yio5B2ANJ39GlQS9OEBylssg3c=; b=1KvI8RGry4LJ7L98DfMIJ1BHztU3Fms5wO+qevAkhEDcBoSSj9R1oxnZK4rp32zt2z hzcelq77Y/cCkxRVqShDpoyoFy23+aWnhf4tD45+jG+0SICIMJHFoFvga7HnS1NrdBZ5 7LdVSsu+O9H5AocT0z3rvQJKowDuBa+u4PnrWjgVy52HSS6B2KqnnEBm0M49vBt92H7L 8yCzPS3Mll0i9z32CqHdq6bPJolI7gIUyE32j1eGh1o6/6f/pEuhSep1WLAAqghqIcyR JA65oO8lZVyt7lYBENSWG5VHbSD7/BGmW1LaJVuEg0+uXcYqc+Z+PmQh7UkGMZpLUWkJ n77A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eHc8HEcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wy4-20020a170906fe0400b007a31138203asi2927932ejb.669.2022.11.18.03.21.55; Fri, 18 Nov 2022 03:22:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eHc8HEcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241577AbiKRLIR (ORCPT + 91 others); Fri, 18 Nov 2022 06:08:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235247AbiKRLIO (ORCPT ); Fri, 18 Nov 2022 06:08:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C178F98243; Fri, 18 Nov 2022 03:08:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6783262445; Fri, 18 Nov 2022 11:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97123C433C1; Fri, 18 Nov 2022 11:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668769692; bh=a7U9Td57moV6dIsrSQNM+u0ybC2RzlpWe+s9uXaiWpY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=eHc8HEcwNzAT221n92/PtkwnIgsRBYxmhZ4OdueqydLXGaNyL5dRh0EAakmCaM2Bm w1/zhcJ/5sVlBcjwnFFhzSOOB7TjgiW1QystlvJMjaS18MFOYymtTqRtonb3N0vZHP Y6YU8zDqdBpuOJWX9hehdcMF/TuC6FIxRlqioFx13DWv5e0xKo1a2sh+hAa69Qa+qh gyhC7vOsUCuNYHt8fDFlDpKtDZslk+UGEhfil2K5zrI46cwEyZIeID3X6AdMewP+Nq Y1ie/swCopE0FaUJao64SLxwqlw0X4/5PQ5Al6eri5Cje+UdLa27tGeEo4qQfbKsEo aXRchAM2qjI8g== Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id CC1AE7A71D0; Fri, 18 Nov 2022 12:08:09 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Rong Tao , andrii.nakryiko@gmail.com, sdf@google.com Cc: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, dxu@dxuuu.xyz, haoluo@google.com, john.fastabend@gmail.com, jolsa@kernel.org, kpsingh@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, lkp@intel.com, lorenzo@kernel.org, martin.lau@linux.dev, memxor@gmail.com, mykolal@fb.com, rongtao@cestc.cn, rtoax@foxmail.com, shuah@kernel.org, song@kernel.org, yhs@fb.com Subject: Re: [PATCH bpf-next v2] selftests/bpf: Fix error: undeclared identifier 'NF_NAT_MANIP_SRC' In-Reply-To: References: X-Clacks-Overhead: GNU Terry Pratchett Date: Fri, 18 Nov 2022 12:08:09 +0100 Message-ID: <87mt8oy0yu.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rong Tao writes: > From: Rong Tao > > commit 472caa69183f("netfilter: nat: un-export nf_nat_used_tuple") > introduce NF_NAT_MANIP_SRC/DST enum in include/net/netfilter/nf_nat.h, > and commit b06b45e82b59("selftests/bpf: add tests for bpf_ct_set_nat_info > kfunc") use NF_NAT_MANIP_SRC/DST in test_bpf_nf.c. > > In bpf kself-test config (tools/testing/selftests/bpf/config) nf_nat > is compiled as built-in, this issue occurs just if it is compiled as > module. we just hardcode 1/0 here. > > How to reproduce the error: > > $ make -C tools/testing/selftests/bpf/ > ... > CLNG-BPF [test_maps] test_bpf_nf.bpf.o > error: use of undeclared identifier 'NF_NAT_MANIP_SRC' > bpf_ct_set_nat_info(ct, &saddr, sport, NF_NAT_MANIP_SRC); > ^ > error: use of undeclared identifier 'NF_NAT_MANIP_DST' > bpf_ct_set_nat_info(ct, &daddr, dport, NF_NAT_MANIP_DST); > ^ > 2 errors generated. > > Signed-off-by: Rong Tao This will fix the compilation, but the selftest won't actually work when nf_nat is compiled as a module (see [0]). Would be better to fix the test properly instead of just papering over the compilation issue like this. That requires a bit more surgery to the selftests, though... -Toke [0] https://lore.kernel.org/r/87leoh372s.fsf@toke.dk