'mark' member in 'struct nf_conn' is conditionally defined by CONFIG_NF_CONNTRACK_MARK so any reference to it should follow the same. $ make -C tools/testing/selftests/bpf progs/test_bpf_nf.c:219:12: error: no member named 'mark' in 'struct nf_conn' if (ct->mark == 42) { ~~ ^ progs/test_bpf_nf.c:220:9: error: no member named 'mark' in 'struct nf_conn' ct->mark++; ~~ ^ progs/test_bpf_nf.c:221:34: error: no member named 'mark' in 'struct nf_conn' test_exist_lookup_mark = ct->mark; Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@xxxxxxxxx> --- .../testing/selftests/bpf/progs/test_bpf_nf.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/progs/test_bpf_nf.c b/tools/testing/selftests/bpf/progs/test_bpf_nf.c index 77ad8adf68da..0b285de8b7e7 100644 --- a/tools/testing/selftests/bpf/progs/test_bpf_nf.c +++ b/tools/testing/selftests/bpf/progs/test_bpf_nf.c @@ -157,7 +157,10 @@ nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32, struct nf_conn *ct_ins; bpf_ct_set_timeout(ct, 10000); - ct->mark = 77; + #if defined(CONFIG_NF_CONNTRACK_MARK) + ct->mark = 77; + #endif + /* snat */ saddr.ip = bpf_get_prandom_u32(); @@ -188,7 +191,9 @@ nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32, bpf_ct_change_timeout(ct_lk, 10000); test_delta_timeout = ct_lk->timeout - bpf_jiffies64(); test_delta_timeout /= CONFIG_HZ; - test_insert_lookup_mark = ct_lk->mark; + #if defined(CONFIG_NF_CONNTRACK_MARK) + test_insert_lookup_mark = ct_lk->mark; + #endif bpf_ct_change_status(ct_lk, IPS_CONFIRMED | IPS_SEEN_REPLY); test_status = ct_lk->status; @@ -210,10 +215,12 @@ nf_ct_test(struct nf_conn *(*lookup_fn)(void *, struct bpf_sock_tuple *, u32, sizeof(opts_def)); if (ct) { test_exist_lookup = 0; - if (ct->mark == 42) { - ct->mark++; - test_exist_lookup_mark = ct->mark; - } + #if defined(CONFIG_NF_CONNTRACK_MARK) + if (ct->mark == 42) { + ct->mark++; + test_exist_lookup_mark = ct->mark; + } + #endif bpf_ct_release(ct); } else { test_exist_lookup = opts_def.error; -- 2.34.1