From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383712; b=HjizI0mS3HKgiuNz+bL4zbjsIGjOf7kvgZh8YbrxbnZzvO4VOO73I5dMVB9oC8vhH0us KoTnh8LoHodTTYPKCJbCb3W86JpwJLIiPbhqBeMIlb5sMYXN0Q+pRKD71ukoU2PBv/6S9 +xcuR2ToEFTrDu+mbF3szjNXaHm3535tOkEtoPr4ys+BY/OEQc6iy2aH+cuI2I0r5EfIR gh4tv4M7jta0vM1osN8NR9Swwcs5ZV9AbgKR06ItGiFmu44DGMtQLebl3NkJltauE0vV0 T+nlCdxPAvnB2P20xQvODbB76ffzU5jTng1ZcC8pdNJaUIT8mYSYYw7RT+5DzN8R8Ng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383712; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Queue-Id; bh=LiMKbuYThzvX8HRIObzaA8usS9+GsNbcRTonl7e/4hI=; b=uoILqilo4+DnR7e/a2qxujjI4DZz/JaNTtRwgu/EcaOwCOtclLO1X78iDbLPLxvVSc3P DKZF/H/8UwZhvRpq74kzlMjf7yJjnA2bUV1VTXRwSRd7cYEpSWSHffdtyu4dkjbrJ0Z51 kW87y0ihc6w9MvjEHzxLMLtOzmbJJl690zt9rL9Poj30oiHTAF7Jn0tc0FhU+KT1verCl Vh8hLUDoYh8erIX8PWZPoPHLti+jzqvp2IvnZyL2v3ZcesQP2X1jpQxiaVq+grZu6X4ad v3W4bAZL+UE+mb8qXmsuyDlmvdxsdWxAvqEnU4qUlf8x79GX+BOaPbc8yvLkYDvY29w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qXApDj72; arc=none smtp.remote-ip=195.10.208.42 Received: from mout-b-112.mailbox.org (mout-b-112.mailbox.org [195.10.208.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B0EE606A32F; Fri, 4 Dec 2026 11:28:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4B0EE606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=qXApDj72 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-112.mailbox.org (Postfix) with ESMTPS id 4jgq4N3h7Yz5vW9; Fri, 04 Dec 2026 12:28:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796383700; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LiMKbuYThzvX8HRIObzaA8usS9+GsNbcRTonl7e/4hI=; b=qXApDj72KfIX00OZonyWxUONw/1IN75s5XkHlZZjfrU2YLOi4xi1iK8wAmEQGs5WPSOOpb znb0iLtlJZdcel8MGoeZkSFBRjmiDav7jeaRny7MkDU61deLDKFY2HwFJ0QnFZMPAHmr1c 6NF4ALFz7D5xrenroKhv5ddgmayCjfCvX+NcSW4UzNEF9GD06pmEqkC+PF/Xr6Hrykt51W zwvsJe9X6qAurPQo7p5UfSnHKIu8i/ohVc4jAtTgUq9quWbogRI+xWzZGMZgob63f/yhLV zZz2n0MsK0ZC/Xprl2DS1gpVYf6LSBcvVMaJSdQtGGGR9+p/E6cb9mjjbz28Qg== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=ralf@mandelbit.com From: Ralf Lici To: netdev@vger.kernel.org Cc: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , linux-kernel@vger.kernel.org, Antonio Quartulli Subject: [PATCH net-next 1/2] ipv6: stamp the default route node with a fresh serial on link failure Date: Fri, 4 Dec 2026 12:28:03 +0100 Message-ID: <9b0213020e4e2965acea95513181eba738a54a38.1796382778.git.ralf@mandelbit.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4jgq4N3h7Yz5vW9 ip6_link_failure invalidates the cached dsts of an RTF_DEFAULT route by writing -1 into the node's fn_sernum. Once the node already holds -1, another link failure leaves the serial unchanged, so dsts cached with that cookie can survive subsequent failures. The assignment also leaves net->ipv6.fib6_sernum unchanged, and -1 is outside the range that fib6_new_sernum allocates from, so the serial cannot be ordered against the namespace generation. Use fib6_update_sernum under tb6_lock to allocate and stamp a fresh serial instead. Advancing the namespace generation also invalidates unrelated dsts using nexthop objects, which are validated against that generation. This happens once per ip6_link_failure call: once per queued skb when the neighbour of the default router fails, and once per packet on the tunnel transmit error paths that call dst_link_failure, some of which a remote host can trigger with ICMP errors. These are error paths and add no cost to the fast path. This is a preparation for validating dsts by comparing serials by age, which needs every node serial to come from fib6_new_sernum. Signed-off-by: Ralf Lici --- net/ipv6/route.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index d3c77941d2cf..b641df277483 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1532,9 +1532,11 @@ static struct rt6_info *rt6_make_pcpu_route(struct net *net, */ static DEFINE_SPINLOCK(rt6_exception_lock); -/* Exceptions are accounted to the netns their dst was allocated in. - * Unlike dev_net(dst->dev), it does not change when the device moves to - * another netns or when dst_dev_put() points the dst to blackhole_netdev. +/* Return the netns the dst was allocated in, which owns the fib6 table of + * its route. Exceptions are accounted to it, and ip6_link_failure advances + * its generation. Unlike dev_net(dst->dev), it does not change when the + * device moves to another netns or when dst_dev_put() points the dst to + * blackhole_netdev. */ static struct net *rt6_exception_net(const struct rt6_info *rt) { @@ -2874,13 +2876,13 @@ static void ip6_link_failure(struct sk_buff *skb) rt6_remove_exception_rt(rt); } else { struct fib6_info *from; - struct fib6_node *fn; from = rcu_dereference(rt->from); - if (from) { - fn = rcu_dereference(from->fib6_node); - if (fn && (rt->rt6i_flags & RTF_DEFAULT)) - WRITE_ONCE(fn->fn_sernum, -1); + if (from && from->fib6_table && + (rt->rt6i_flags & RTF_DEFAULT)) { + spin_lock_bh(&from->fib6_table->tb6_lock); + fib6_update_sernum(rt6_exception_net(rt), from); + spin_unlock_bh(&from->fib6_table->tb6_lock); } } rcu_read_unlock(); -- 2.56.1