• 归档:2022-11-17



     

    ================================================================================

    ```

    selftests/bpf: Fix error: undeclared identifier 'NF_NAT_MANIP_SRC'

    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 could use BPF CO-RE and ___suffix rule to avoid this.

    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.

    ```

    V2: use BPF CO-RE and ___suffix rule to avoid this error.

    https://lore.kernel.org/lkml/tencent_E1424259BD97672AD1AF00A3468858065E08@qq.com/

    V1: https://lore.kernel.org/lkml/tencent_29D7ABD1744417031AA1B52C914B61158E07@qq.com/


     

    ================================================================================

    The motivation for this patch is to eliminate the compilation warning,

    maybe one day we will compile the kernel with "-Werror -Wall", at which

    point this compilation warning will turn into a compilation error, we

    should fix this error in advance.

    ================================================================================

    # TODO

    https://lore.kernel.org/lkml/CAEf4BzY0dsog-_1v9Phskt2YzyavL_fNsSi2hUvGZboggDqM2w@mail.gmail.com/


     

    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

    ```

    Subject: Re: [PATCH bpf-next] selftests/bpf: Fix error undeclared identifier 'NF_NAT_MANIP_SRC'

    Thank you all for your replies, my config:

    $ grep NETFILTER config

    CONFIG_NETFILTER=y

    ...

    CONFIG_NETFILTER_XT_MARK=m

    CONFIG_NETFILTER_XT_NAT=m

    ...

    CONFIG_NETFILTER_XT_MATCH_TCPMSS=m

    Link: https://github.com/kernel-patches/bpf/actions/runs/3446651033/jobs/5752592868

    ```


     

    ================================================================================

    https://lore.kernel.org/lkml/20221111173855.108360-1-sj@kernel.org/


     

    ```

    ```

    releases/gcc-10.1.0 OK

    commit d14c547abd484d3540b692bb8048c4a6efe92c8b

    Author: Martin Sebor

    Date: Fri Aug 28 13:13:28 2020 -0600

    Add -Wstringop-overread for reading past the end by string functions.

    gcc-11.1.0

    gcc/gcc/testsuite/gcc.dg/pragma-diag-10.c


     

    ================================================================================

    enum nf_inet_hooks {

    NF_INET_PRE_ROUTING = 0,

    NF_INET_LOCAL_IN = 1,

    NF_INET_FORWARD = 2,

    NF_INET_LOCAL_OUT = 3,

    NF_INET_POST_ROUTING = 4,

    NF_INET_NUMHOOKS = 5,

    NF_INET_INGRESS = 5,

    };

    enum nf_nat_manip_type {

    NF_NAT_MANIP_SRC,

    NF_NAT_MANIP_DST

    };


     

    ================================================================================

    ```

    docs/zh_CN: Update zh_CN/arm64/elf_hwcaps.rst

    Add updates from the Documentation/arm64/elf_hwcaps.rst, and synchronize

    the changes of commit 5d8505fd039c("arm64: Fix the documented event stream

    frequency").

    ```


     

    ================================================================================

    ```

    $ make -C tools/testing/selftests/bpf/

    CLNG-BPF [test_maps] test_kfunc_dynptr_param.bpf.o

    error: variable has incomplete type 'struct bpf_dynptr'

    struct bpf_dynptr ptr;

    ^

    bpf_helper_defs.h:42:8: note: forward declaration of 'struct bpf_dynptr'

    struct bpf_dynptr;

    ^

    error: variable has incomplete type 'struct bpf_dynptr'

    struct bpf_dynptr ptr;

    ^

    bpf_helper_defs.h:42:8: note: forward declaration of 'struct bpf_dynptr'

    struct bpf_dynptr;

    ^

    2 errors generated.

    ```

    ```

    [rongtao@RT-PC linux]$ make -C tools/testing/selftests/bpf/

    make: Entering directory '/home/sd/Git/linux/tools/testing/selftests/bpf'

    CLNG-BPF [test_maps] test_kfunc_dynptr_param.bpf.o

    progs/test_kfunc_dynptr_param.c:40:20: error: variable has incomplete type 'struct bpf_dynptr'

    struct bpf_dynptr ptr;

    ^

    /home/sd/Git/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helper_defs.h:42:8: note: forward declaration of 'struct bpf_dynptr'

    struct bpf_dynptr;

    ^

    progs/test_kfunc_dynptr_param.c:69:20: error: variable has incomplete type 'struct bpf_dynptr'

    struct bpf_dynptr ptr;

    ^

    /home/sd/Git/linux/tools/testing/selftests/bpf/tools/include/bpf/bpf_helper_defs.h:42:8: note: forward declaration of 'struct bpf_dynptr'

    struct bpf_dynptr;

    ^

    2 errors generated.

    ```

    enum nf_nat_manip_type


     

  • 相关阅读:
    webpack打包常用配置项
    What are the advantages of pipes over temporary files?
    【CSAPP】现代操作系统前几章
    MATLAB算法实战应用案例精讲-【智能优化算法】斑点鬣狗优化-SHO(附python和matlab代码)
    [附源码]SSM计算机毕业设计血库管理系统JAVA
    学习Java框架的重要性及步骤
    C语言 函数
    Java学习之多线程
    SpringBoot读取json文件
    一次函数和正比例函数的介绍
  • 原文地址:https://blog.csdn.net/Rong_Toa/article/details/127914204