🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3609

Re: [PATCH net-next v2 1/2] seg6: skip the route refcount in seg6local IPv6 lookups

#3609
From: Gabriel Goller
Date: Thu, 15 Oct 2026 14:30
62 lines
6735 bytes
Hi Yuya,

> [snip]
> @@ -372,17 +374,41 @@ seg6_lookup_any_nexthop(struct sk_buff *skb, struct in6_addr *nhaddr,
>  		rt = net->ipv6.ip6_blk_hole_entry;
>  		dst = &rt->dst;
>  		dst_hold(dst);
> +		flags &= ~RT6_LOOKUP_F_DST_NOREF;
>  	}
>  
>  	skb_dst_drop(skb);
> -	skb_dst_set(skb, dst);
> +	if ((flags & RT6_LOOKUP_F_DST_NOREF) && !dst->rt_uncached_list)
> +		skb_dst_set_noref(skb, dst);
> +	else
> +		skb_dst_set(skb, dst);
>  	return dst->error;
>  }
>  
> +static int seg6_lookup_nexthop_noref(struct sk_buff *skb,
> +				     struct in6_addr *nhaddr, u32 tbl_id)
> +{
> +	return seg6_lookup_any_nexthop_noref(skb, nhaddr, tbl_id, false, 0);
> +}
> +
>  int seg6_lookup_nexthop(struct sk_buff *skb,
>  			struct in6_addr *nhaddr, u32 tbl_id)
>  {
> -	return seg6_lookup_any_nexthop(skb, nhaddr, tbl_id, false, 0);
> +	int err;
> +
> +	rcu_read_lock();
> +	err = seg6_lookup_nexthop_noref(skb, nhaddr, tbl_id);
> +	if (!skb_dst_force(skb)) {
> +		struct dst_entry *dst;
> +
> +		dst = &dev_net(skb->dev)->ipv6.ip6_blk_hole_entry->dst;

I think we should use ip6_null_entry instead of ip6_blk_hole_entry here.
Previously this path (failure to acquire the dst ref) was reached through
ip6_pol_route() and ip6_hold_safe(), which uses ip6_null_entry and returns
-ENETUNREACH as an error.
After this patch, the error is triggered here and we use ip6_blk_hole_entry,
which returns -EINVAL.

What do you think?

> +		dst_hold(dst);
> +		skb_dst_set(skb, dst);
> +		err = dst->error;
> +	}
> +	rcu_read_unlock();
> +
> +	return err;
>  }
>  
>  static __u8 seg6_flv_lcblock_octects(const struct seg6_flavors_info *finfo)
> [snip]

Thanks,
Gabriel
Technical Details
Message-ID: <atDhp1tk31K4RAKS@luna.proxmox.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346779-linux-kernel-netdev=dewy.ru
References: <20261010-seg6-lookup-noref-v2-0-51c09dd98197@gmail.com> <20261010-seg6-lookup-noref-v2-1-51c09dd98197@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346779-linux-kernel-netdev=dewy.ru
From: g.goller@proxmox.com (Gabriel Goller)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 1/2] seg6: skip the route refcount in
 seg6local IPv6 lookups
Date: Thu, 15 Oct 2026 16:30:02 +0200
Organization: Usenet Network
Message-ID: <atDhp1tk31K4RAKS@luna.proxmox.com>
References: <20261010-seg6-lookup-noref-v2-0-51c09dd98197@gmail.com>
 <20261010-seg6-lookup-noref-v2-1-51c09dd98197@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="2552850"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:TolMmPUXvkNP0X/8HS3T2woV5nY= sha256:NkvN914xoEfcwgrZUC3Tj9eInzCiOofGQgR8yGGTq+w=
	sha1:OO6AtOiBhIXOJGimwem4iPU3Rzo= sha256:nEu+jcRQOtRhXDN7g8KyiUT4rU3EE+vCSBjGvLsqAjw=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 8E62E11032D; Thu, 15 Oct 2026 17:58:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.95
X-Spam-Status: No, score=-2.95 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 9OkNUtlVB6T2;
	Thu, 15 Oct 2026 17:58:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-346779-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=proxmox.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id D589C11032B; Thu, 15 Oct 2026 17:58:45 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 3387DA52F3; Thu, 15 Oct 2026 14:35:22 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 672C85326D6;
	Thu, 15 Oct 2026 14:30:09 +0000 (UTC)
X-Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD70754147A;
	Thu, 15 Oct 2026 14:30:06 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=94.136.29.106
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792074609; cv=none; b=Vd555irXNkUjZ3lhngYq0Gs30qLKXbceU+gN6VW0yBipBWbDcYnef+8m56buMTXA6mCeHvytpNIJokXFsN1PUnD0grbkliE5bT5FHrDM17wRwQjGKtTKPYsXFtI3dziHhmxdS/UUnRHcmZuVehsQIDZ0miIpGy2aCYKgJBsI094=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792074609; c=relaxed/simple;
	bh=lq8RYLtftn0YhOXhEbW5g1tapV0Qbr0ZcmUwb/mGbbI=;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To; b=BNk1ufEIhLfRPoW08DtO83XaLpOIm2aT6RhYxnE2p8CilRSS9Cclfy+ifg9Afl7dr4LLk4bX476Iny/mWP8qtOHuzUoz7OOc4A8gTesXW6kIh4xC8W9T+DuQKU1Z2QbTCWWq/VazNx8qMhGQcv97FLj+qxCsDuD2GZ24w0p7HYM=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com; spf=pass smtp.mailfrom=proxmox.com; arc=none smtp.client-ip=94.136.29.106
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proxmox.com
X-Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
	by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2554A42375;
	Thu, 15 Oct 2026 16:30:04 +0200 (CEST)
X-Cc: Andrea Mayer <andrea.mayer@uniroma2.it>, 
	"David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, 
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, 
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261010-seg6-lookup-noref-v2-1-51c09dd98197@gmail.com>
X-User-Agent: NeoMutt/20260504
X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2
X-Bm-Transport-Timestamp: 1792074603492