From: Jakub Kicinski <kuba@kernel.org>
To: marcelomspessoto@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/4] selftests: net: test IPV6_FL_A_RENEW
Date: Thu, 6 Aug 2026 12:22:46 -0700 [thread overview]
Message-ID: <20260806192246.3335605-1-kuba@kernel.org> (raw)
In-Reply-To: <20260804025910.50145-2-marcelomspessoto@gmail.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
selftests: net: test IPV6_FL_A_RENEW
This adds selftest coverage for the IPV6_FL_A_RENEW flow label action: a
new flowlabel_renew() helper, an expect_fail_errno() assertion macro, and
tests that renew fails with ESRCH for a nonexistent label and succeeds for
an existing one. A long-running case verifies that renewing extends the
linger period so a new label cannot be created after the original linger
time.
A couple of questions below.
> diff --git a/tools/testing/selftests/net/ipv6_flowlabel_mgr.c b/tools/testing/selftests/net/ipv6_flowlabel_mgr.c
> index af95b48acea90..01fab414895c5 100644
> --- a/tools/testing/selftests/net/ipv6_flowlabel_mgr.c
> +++ b/tools/testing/selftests/net/ipv6_flowlabel_mgr.c
> @@ -27,6 +27,7 @@
>
> /* from net/ipv6/ip6_flowlabel.c */
> #define FL_MIN_LINGER 6
> +#define FL_MAX_LINGER 150
[Severity: Low]
Is FL_MAX_LINGER used anywhere? Grepping the file, the identifier appears
only on this definition line, both in this commit and at the end of the
series. The only linger values the test passes are
2 * (FL_MIN_LINGER * 2 + 1) and the implicit 0.
The kernel path this constant mirrors is the one RENEW error case the new
tests do not exercise:
net/ipv6/ip6_flowlabel.c:check_linger() {
if (ttl > FL_MAX_LINGER && !capable(CAP_NET_ADMIN))
return 0;
...
}
and fl6_renew() turns that 0 into -EPERM. Since the selftest is driven
through in_netns.sh as root, an over-max linger value would not reach that
branch anyway.
Would it make sense to either drop the define, or add an unprivileged
over-max linger case that expects EPERM? As it stands an unreferenced
object-like macro produces no warning, so it suggests coverage that is not
there.
Also, this isn't a bug, but the new line uses a single tab while the
adjacent #define FL_MIN_LINGER uses two, so the values no longer line up.
[ ... ]
> @@ -71,6 +84,17 @@ static int flowlabel_put(int fd, uint32_t label)
> return setsockopt(fd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &req, sizeof(req));
> }
>
> +static int flowlabel_renew(int fd, uint32_t label, uint16_t linger)
> +{
> + struct in6_flowlabel_req req = {
> + .flr_action = IPV6_FL_A_RENEW,
> + .flr_label = htonl(label),
> + .flr_linger = linger,
> + };
> +
> + return setsockopt(fd, SOL_IPV6, IPV6_FLOWLABEL_MGR, &req, sizeof(req));
> +}
[Severity: Low]
Should flr_share be set explicitly here? Leaving it out zeroes it, and 0
is IPV6_FL_S_NONE, which selects a second renew path in the kernel:
net/ipv6/ip6_flowlabel.c:ipv6_flowlabel_renew() {
rcu_read_lock();
for_each_sk_fl_rcu(sk, sfl) {
if (sfl->fl->label == freq->flr_label) {
err = fl6_renew(sfl->fl, freq->flr_linger,
freq->flr_expires);
...
if (freq->flr_share == IPV6_FL_S_NONE &&
ns_capable(net->user_ns, CAP_NET_ADMIN)) {
struct ip6_flowlabel *fl = fl_lookup(net, freq->flr_label);
if (fl) {
err = fl6_renew(fl, freq->flr_linger,
freq->flr_expires);
...
return -ESRCH;
}
The test runs as root via ipv6_flowlabel.sh -> in_netns.sh, so the
CAP_NET_ADMIN fallback is always available, and labels 5 and 6 are also
present in the per-netns hash because the same socket created them.
If the for_each_sk_fl_rcu() matching branch ever stopped matching, would
fl_lookup() not still find the label, so fl6_renew() returns 0 and both
the "renew succeeds" and the long-running EPERM linger-extension
assertions still pass?
Would setting flr_share to the label's share (IPV6_FL_S_EXCL for these
labels), or adding a case using a label the socket does not own, separate
the two branches?
Cross-instance finding from sashiko-gemini (2a95a5b15b2d5ec9fd64306a937e0876383a2116fb10cbee36476a293b84adb4):
[Severity: Medium]
The `expect_fail_errno` macro incorrectly formats the error message when the tested function unexpectedly succeeds, printing a stale `errno` value rather than clearly indicating unexpected success.
--
pw-bot: cr
next prev parent reply other threads:[~2026-08-06 19:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 2:59 [PATCH net-next v2 0/4] net: selftests: adjustments to ipv6_flowlabel_mgr Marcelo Mendes Spessoto Junior
2026-08-04 2:59 ` [PATCH net-next v2 1/4] selftests: net: test IPV6_FL_A_RENEW Marcelo Mendes Spessoto Junior
2026-08-06 19:22 ` Jakub Kicinski [this message]
2026-08-04 2:59 ` [PATCH net-next v2 2/4] selftests: net: test IPV6_FL_F_REMOTE Marcelo Mendes Spessoto Junior
2026-08-04 2:59 ` [PATCH net-next v2 3/4] selftests: net: test IPV6_FL_F_REFLECT Marcelo Mendes Spessoto Junior
2026-08-06 19:24 ` Jakub Kicinski
2026-08-04 2:59 ` [PATCH net-next v2 4/4] selftests: net: adopt harness for flow label mgr Marcelo Mendes Spessoto Junior
2026-08-06 19:22 ` Jakub Kicinski
2026-08-06 19:25 ` Jakub Kicinski
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=20260806192246.3335605-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=marcelomspessoto@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).