From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-248.mta0.migadu.com [91.218.175.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57C4E334C3B for ; Wed, 23 Sep 2026 01:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790127003; cv=none; b=P3v+8MmpRl+oPINnjXv+6CLynMNg19SJdV+QcdJltWSor9mtRVvp55qwlqjKz2iqyFC8yI5huZul4tQb+8JneaopyLr99q/AyOCQLNUZ3IIhZYYibcVeyjAnC43vzghJ6eFmnWTj5oXLVwGK+GFpAvSRB+BOxbWp9dX7z/uiw0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790127003; c=relaxed/simple; bh=dS5qUtvKQC1wRIgURnnfaocsTm6UxBc5fX4lBc2zSJk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gm3jgetaqAPvNwzm91ZIyjb6iKaCqlrYgT1oJj8UWSWUO45UygYu/E0tuJfSu9YSz/Sy3r8z07Q2PbCVHtcY7KSuzqZPIKwL4aMn77KM5xL20+rZNvyZMKTSGAMbBk/O37UvttNrr2Vz2dQAfKgkqlG1woeJKln5IsCE+/2ntjY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=FPNHYdsR; arc=none smtp.client-ip=91.218.175.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="FPNHYdsR" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=dS5qUtvKQC1wRIgURnnfaocsTm6UxBc5fX4lBc2zSJk=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790126999; v=1; x=1790731799; b=FPNHYdsRYakN8DSQIJSZSihPd9eAZpPYqpkQhtXfXSPNoM7zM9RqvHcw3sTcKBYTh8ZNw/IG sqX1jy7+/QwAjokpc3r3s4oW4YrgjEGwaYtAeJXJCeADNX3GNirTuFCzykQWSv9CjnxEAw2PbDg pBfpI97D34nTwouoANKmQ294= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id 380b12c68c1d1d35; Wed, 23 Sep 2026 01:29:59 +0000 X-Mizu-Trace-ID: 380b12c68c1d1d35 X-Migadu-Flow: FLOW_OUT Date: Wed, 23 Sep 2026 09:29:43 +0800 From: Hangbin Liu To: Gabriel Goller Cc: Andrea Mayer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2] net: ipv6: seg6: report lwtunnel setup errors via extack Message-ID: References: <20260922090851.38978-1-g.goller@proxmox.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260922090851.38978-1-g.goller@proxmox.com> On Tue, Sep 22, 2026 at 11:08:33AM +0200, Gabriel Goller wrote: > 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 > --- > > v2 (https://lore.kernel.org/netdev/20260918153544.1178884-1-g.goller@proxmox.com/): > * 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; > + } > > err = nla_parse_nested_deprecated(tb, SEG6_IPTUNNEL_MAX, nla, > seg6_iptunnel_policy, extack); > @@ -765,8 +769,10 @@ static int seg6_build_state(struct net *net, struct nlattr *nla, > if (err < 0) > return err; > > - if (!tb[SEG6_IPTUNNEL_SRH]) > + if (!tb[SEG6_IPTUNNEL_SRH]) { > + NL_SET_ERR_MSG(extack, "missing SRv6 SRH attribute"); I think we can use NL_SET_ERR_MSG_ATTR. Thanks Hangbin