Re: [PATCH net-next v2] net: ipv6: seg6: report lwtunnel setup errors via extack
From: Gabriel Goller
Date: Wed Sep 23 2026 - 07:56:58 EST
On 22.09.2026 23:49, Andrea Mayer wrote:
> On Tue, 22 Sep 2026 11:08:33 +0200
> Gabriel Goller <g.goller@xxxxxxxxxxx> wrote:
>
> Hi Gabriel,
>
> > seg6_build_state() rejected invalid configurations with a generic -EINVAL, so
> > "ip route add ... encap seg6 ..." always reported "Invalid argument".
> >
> > Attach an extack message to each of them. The checks themselves and their return
> > values are unchanged.
> >
> > Signed-off-by: Gabriel Goller <g.goller@xxxxxxxxxxx>
>
> The commit message stays in the changelog, so wrapping the body at 75
> columns would be better.
Done, thanks.
> > ---
> >
> > v2 (https://lore.kernel.org/netdev/20260918153544.1178884-1-g.goller@xxxxxxxxxxx/):
> > * dropped tests
> >
> > net/ipv6/seg6_iptunnel.c | 25 ++++++++++++++++++++-----
> > 1 file changed, 20 insertions(+), 5 deletions(-)
> >
> > diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
> > index 61c6a27bf202..e7f75970e26e 100644
> > --- a/net/ipv6/seg6_iptunnel.c
> > +++ b/net/ipv6/seg6_iptunnel.c
> > @@ -756,8 +756,12 @@ static int seg6_build_state(struct net *net, struct nlattr *nla,
> > struct seg6_lwt *slwt;
> > int err;
> >
> > - if (family != AF_INET && family != AF_INET6)
> > + if (family != AF_INET && family != AF_INET6) {
> > + NL_SET_ERR_MSG(
> > + extack,
> > + "unsupported address family for SRv6 encapsulation");
> > return -EINVAL;
> > + }
>
> checkpatch flags this line ("Lines should not end with a '('"). The
> two-line form used in the rest of the file would be better:
>
> NL_SET_ERR_MSG(extack,
> "unsupported address family for SRv6 encapsulation");
>
> The string goes a bit over 80 columns but should stay on one line for grep.
Fixed this.
Thanks for the review!
Gabriel
> A side note: the source_inline bot failure looks like a false positive,
> the script matches "inline" inside the string literal.
>
> Thanks,
> Andrea
>
>