Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2682700rwb; Fri, 11 Nov 2022 13:05:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf5cMGO1/LN16YZbOmmZieNiILlN4fvXfElIw8KH+XrevR79/Akqn1gDISYyaUg7uEDixogi X-Received: by 2002:a17:90a:ac08:b0:213:5a55:7dd2 with SMTP id o8-20020a17090aac0800b002135a557dd2mr1608106pjq.50.1668200745797; Fri, 11 Nov 2022 13:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668200745; cv=none; d=google.com; s=arc-20160816; b=mBjwASph6NLhDguQGzzNw9Xi9CEkkU7DMJiYlt4SwZsIbNw4IoFdF/3D6AYM0YwQDJ NukUO60oBxqfME5EW8PHzWaxJUOE9Hz9hzmU6SxG/A1xnXlee7QK8ri2E8MipKc5m8wq Wwn/ci3TwIu8LJK1790T1eMJdU6b/OExcRheJp3T74LxhYsqdRrvTIjBA783Tx6p36CE oruIlFHStWr2Zu04xVSWsvAWQkk67c0aVRAVEPzK2PiatTIk970Qb+JPn+znYDDCsKNa zoaM+gIdZgzo1AKKc3G8Y2lMzq6kaKhmMdRkotG0CeCgHYe5jC7tx2Fh8Fsf1TvnEI4C cNrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=B12MKUKtvOLgGXlIX/YXOWokDcl/6BmGBXPeQeFKB1E=; b=XvlldINjs3IVdtDRQQci5b9Rq3zULWu38HpfIFmcUGQ3wjo8cbprURYqiJiX9cne0o ynXapJuJI5L3MnV+XoRVENfUtw6uAEUyqD9HIgw53MDwSgzymQdfE1jyJASisIUCab+2 Rp3l68va9kzt8PQa16hz0huVhI0z+vuv36z5/UPA0rtFywxKSCWkrm/xF/QtOCpM18AR 08/Vsolu9ndbV2wtPYONtbdEybqk48rteh6RRpdPaaBmQ78uVj/BM5+LmS2M9P5F28vQ fMOHNzdq8HtLO6dTearcBgmpuVP3ayGHlvbAvj8FflpDMGlK04LFaEbnMBokv6fPBegk +WdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QqNbuF6l; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a170902e80700b0017a7506e0dcsi3551499plg.231.2022.11.11.13.05.33; Fri, 11 Nov 2022 13:05:45 -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=@gmail.com header.s=20210112 header.b=QqNbuF6l; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234088AbiKKUoY (ORCPT + 90 others); Fri, 11 Nov 2022 15:44:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbiKKUoW (ORCPT ); Fri, 11 Nov 2022 15:44:22 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494C145A26; Fri, 11 Nov 2022 12:44:21 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id a67so9149115edf.12; Fri, 11 Nov 2022 12:44:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=B12MKUKtvOLgGXlIX/YXOWokDcl/6BmGBXPeQeFKB1E=; b=QqNbuF6lthzfDA6xT4mz5BzHhSuYLXOIKWaFH2nOgbkCTmUcA3ivV78Yux5CyWdkrL 1ze/V8s9ZmYHBlQq7wbdbInXAhqER2LdkFcSmTQs/KEqLIHkcpAx7AXucMc4hyl4GGRC +VejOznWiluaEmE6ErRdH9xyaRf93sNAez0dvr0fbUHK+F7mRzaG36i6FqLmZyEHCHI2 KhJeN9+ioCdMSWiStLOb8NB4HsietthS/l17NFUJ4ZN1q1U1j6dkAaWdHmFtcudPPZth UitA8kEC6Yy4nNSfqR3crpmqMzWvxtTHMvjbSZtuR5Axsewj1G7h5rKiiasRj2VJC6X1 +4bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B12MKUKtvOLgGXlIX/YXOWokDcl/6BmGBXPeQeFKB1E=; b=01xh+wOOlObQnzEaPZNV47TrP9edb50ABQnABRnPyion623cV8IjpHe0Pp7o4HW4wA WabQF0dk8P8FMYYe7Q5SfXzVMUBGAlf6BomFLe07p7cDFEjRHfd1hf8w9dcCXDihM70G XrjjJW/fRpKJ2fuFj0dDpDuLYfOddL4LFQqUIapAnE3J61c0Bd3LsZc+zvvyoEtCKvjg hrSfH6WEObg/z/QM1N9w6UnEQbhYGhsTBsJf4aC+AMXTkoEEIK9R39PKBLfB56KPdolU HpFNBbPFJOjf6evgPyrz8MyjPvKd375x2Rc8c9AdyKqMJGB7u9dCq1V9SUCkJG+54Uw7 FpYw== X-Gm-Message-State: ANoB5pnlMOVgSLedco/RDcWj9GoyyoiZxeSNCRYklgzqEd1KgrIoJr0e +DbIwE/dhQZWhDN93GjdgjvdV4+isVl0D/sez6hYLHKJSFs= X-Received: by 2002:a50:9512:0:b0:457:1323:1b7e with SMTP id u18-20020a509512000000b0045713231b7emr2910613eda.311.1668199459685; Fri, 11 Nov 2022 12:44:19 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrii Nakryiko Date: Fri, 11 Nov 2022 12:44:07 -0800 Message-ID: Subject: Re: [PATCH bpf-next] selftests/bpf: Fix error undeclared identifier 'NF_NAT_MANIP_SRC' To: Stanislav Fomichev Cc: Lorenzo Bianconi , Rong Tao , ast@kernel.org, Rong Tao , kernel test robot , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , Kumar Kartikeya Dwivedi , Daniel Xu , "open list:BPF [GENERAL] (Safe Dynamic Programs and Tools)" , "open list:KERNEL SELFTEST FRAMEWORK" , open list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Fri, Nov 11, 2022 at 10:55 AM Stanislav Fomichev wrote: > > On Fri, Nov 11, 2022 at 10:12 AM Lorenzo Bianconi wrote: > > > > > On Fri, Nov 11, 2022 at 9:54 AM Lorenzo Bianconi wrote: > > > > > > > > > On 11/11, Rong Tao wrote: > > > > > > 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. We copy enum > > > > > > nf_nat_manip_type to test_bpf_nf.c fix this error. > > > > > > > > > > > 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. > > > > > > > > > > $ grep NF_NAT_MANIP_SRC > > > > > ./tools/testing/selftests/bpf/tools/include/vmlinux.h > > > > > NF_NAT_MANIP_SRC = 0, > > > > > > > > > > Doesn't look like your kernel config compiles netfilter nat modules? > > > > > > > > yes, 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. > > > > > > Right, but if we unconditionally define this enum, I think you'll > > > break the case where it's compiled as a built-in? > > > Since at least in my vmlinux.h I have all the defines and this test > > > includes vmlinux.h... > > > > yes, it is correct. > > And it will break the CI: > It does break CI ([0]). We could use BPF CO-RE and ___suffix rule to avoid this. But we can also say that selftests/bpf/config{,} has to be used by bots that want to build BPF selftests. [0] https://github.com/kernel-patches/bpf/actions/runs/3446651033/jobs/5752592868 > $ grep NETFILTER tools/testing/selftests/bpf/config > CONFIG_NETFILTER=y > > So yeah, not sure what to do here. The selftests expect "sane" configs > (see that bpf/config above) which is not what the bot seems to be > doing... > > > > > Regards, > > > > Lorenzo > > > > > > > > > > > > > > > Link: https://lore.kernel.org/lkml/202210280447.STsT1gvq-lkp@intel.com/ > > > > > > Reported-by: kernel test robot > > > > > > Signed-off-by: Rong Tao > > > > > > --- > > > > > > tools/testing/selftests/bpf/progs/test_bpf_nf.c | 5 +++++ > > > > > > 1 file changed, 5 insertions(+) > > > > > > > > > > > diff --git a/tools/testing/selftests/bpf/progs/test_bpf_nf.c > > > > > > b/tools/testing/selftests/bpf/progs/test_bpf_nf.c > > > > > > index 227e85e85dda..307ca166ff34 100644 > > > > > > --- a/tools/testing/selftests/bpf/progs/test_bpf_nf.c > > > > > > +++ b/tools/testing/selftests/bpf/progs/test_bpf_nf.c > > > > > > @@ -3,6 +3,11 @@ > > > > > > #include > > > > > > #include > > > > > > > > > > > +enum nf_nat_manip_type { > > > > > > + NF_NAT_MANIP_SRC, > > > > > > + NF_NAT_MANIP_DST > > > > > > +}; > > > > > > + > > > > > > #define EAFNOSUPPORT 97 > > > > > > #define EPROTO 71 > > > > > > #define ENONET 64 > > > > > > -- > > > > > > 2.31.1 > > > > >