From: sashiko-bot@kernel.org
To: "Jakub Sitnicki" <jakub@cloudflare.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v3 2/2] selftests/bpf: Add LWT encap tests for skb metadata
Date: Sat, 20 Jun 2026 17:09:50 +0000 [thread overview]
Message-ID: <20260620170950.B273D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260619-bpf-lwt-drop-skb-metadata-v3-2-71d6a33ab76b@cloudflare.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The assertion `ASSERT_GE(tap_ifindex, 0)` incorrectly accepts 0, which is the error return value of `if_nametoindex()`, masking interface lookup failures.
--
commit 78aa5c949a7515e0e86daf8bde1669b476228831
Author: Jakub Sitnicki <jakub@cloudflare.com>
selftests/bpf: Add LWT encap tests for skb metadata
This commit adds testing for LWT encapsulation and XDP metadata sitting in the
skb headroom. It exercises LWT dispatch paths including BPF, mpls, seg6, and
ioam6 to ensure outer headers do not silently corrupt metadata.
> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
> index 26159e0499c76..448807676176c 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
[ ... ]
> @@ -518,3 +559,137 @@ void test_xdp_context_tuntap(void)
[ ... ]
> + SYS(close, "ip neigh add fd00::2 lladdr " TX_MAC " nud permanent dev " TAP_NAME);
> + SYS(close, "ip -6 route add fd00:1::/64 %s dev %s", encap, TAP_NAME);
> +
> + tap_ifindex = if_nametoindex(TAP_NAME);
> + if (!ASSERT_GE(tap_ifindex, 0, "if_nametoindex"))
> + goto close;
[Severity: Low]
Does this properly catch interface lookup failures?
Looking at if_nametoindex(), it returns 0 on error, so using ASSERT_GE
will evaluate to true when tap_ifindex is 0. This allows the test to mask
the lookup failure and inappropriately proceed with an invalid interface index
to bpf_xdp_attach().
Could this be ASSERT_GT(tap_ifindex, 0, ...) instead?
> +
> + ret = bpf_xdp_attach(tap_ifindex, bpf_program__fd(skel->progs.ing_xdp),
> + 0, NULL);
> + if (!ASSERT_GE(ret, 0, "bpf_xdp_attach"))
> + goto close;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260619-bpf-lwt-drop-skb-metadata-v3-0-71d6a33ab76b@cloudflare.com?part=2
prev parent reply other threads:[~2026-06-20 17:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 17:09 [PATCH net v3 0/2] Drop skb metadata before LWT encapsulation Jakub Sitnicki
2026-06-19 17:09 ` [PATCH net v3 1/2] net: lwtunnel: " Jakub Sitnicki
2026-06-20 17:09 ` sashiko-bot
2026-06-19 17:09 ` [PATCH net v3 2/2] selftests/bpf: Add LWT encap tests for skb metadata Jakub Sitnicki
2026-06-20 17:09 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260620170950.B273D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.