Re: [PATCH net-next v5] net: ipv6: seg6: report lwtunnel setup errors via extack

From: Andrea Mayer

Date: Tue Oct 13 2026 - 14:58:03 EST


On Fri, 9 Oct 2026 17:20:13 +0200
Gabriel Goller <g.goller@xxxxxxxxxxx> wrote:

Hi Gabriel,

thanks for the v5.

> seg6_build_state() rejected invalid configurations with a generic -EINVAL,
> so "ip route add ... encap seg6 ..." sometimes reported "Invalid argument".
>
> Add extack messages to the checks that lacked one, and use
> NL_REQ_ATTR_CHECK() for the missing SRH attribute so that userspace can
> tell which attribute is missing. The checks themselves and their return
> values are unchanged.
>
> Signed-off-by: Gabriel Goller <g.goller@xxxxxxxxxxx>
> ---
>
> v5 (https://lore.kernel.org/all/20261005140637.644840-1-g.goller@xxxxxxxxxxx/):
> * use NL_REQ_ATTR_CHECK() for the missing SRH attribute (Jakub)
> * reword the inline mode message to "inline mode requires the IPv6
> address family", since it also applies to IPv4 nexthop objects
> (Andrea)
> * consistently call the header "IPv6 Segment Routing Header" (RFC 8754)
> in all messages (Andrea)
> * include the offending mode value in the invalid mode message
> * reword the commit message to match
>
> v4 (https://lore.kernel.org/all/20260923120228.172643-1-g.goller@xxxxxxxxxxx/):
> * use NL_SET_ERR_MSG when the SRH attr is missing
> * use NL_SET_ERR_MSG_ATTR when we have an invalid attr
>
> v3 (https://lore.kernel.org/all/20260922090851.38978-1-g.goller@xxxxxxxxxxx/):
> * format fix
> * use NL_SET_ERR_MSG_ATTR
>
> v2 (https://lore.kernel.org/all/20260918153544.1178884-1-g.goller@xxxxxxxxxxx/):
> * dropped tests
>
> net/ipv6/seg6_iptunnel.c | 26 +++++++++++++++++++++-----
> 1 file changed, 21 insertions(+), 5 deletions(-)
>
> [snip]
> default:
> + NL_SET_ERR_MSG_ATTR_FMT(extack, tb[SEG6_IPTUNNEL_SRH],
> + "invalid SRv6 encapsulation mode %d",
> + tuninfo->mode);
> return -EINVAL;

A small nit on this one, as it is new in v5: I would have kept the
v4 text here, "invalid SRv6 encapsulation mode". No need for a new
version just for this.

Reviewed-by: Andrea Mayer <andrea.mayer@xxxxxxxxxxx>

Thanks,
Andrea