From nobody Thu Apr 2 12:27:58 2026 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (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 6E22223D2AB; Sun, 29 Mar 2026 10:25:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.126.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774779903; cv=none; b=Nz8rFhXC/S0vJgHrbKiBdWY8h90LqcGh1UEfrIIp+uWRYjJShyPSnHFNfBWey+Ys91bc/ZeRcqBgjw3YkTmrgfMAA6xYMaYW9QzM4amDenikl1YhB84KRszOe69bJHVNae6KLxRvb3vl/IS2z/nJYSvo9daYIDG9DHbS07kxlQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774779903; c=relaxed/simple; bh=apYe6lSrS+a3Sp+pbSOXODOzy5wo4UOC8YD4tT7Ki04=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=J473ChD8XiCXciBdcnLn4zVVkZyJGF7XX5WAWPQByIks8KUy5H4rG7u0AdykkrNXZmd5bJqQZOFBUhhwyXB++777y3YQE2gpVRaYVqlU3PibelFoTTidjU7oG8cb6jnThPOC/hnmFFjXXdHYzALxdkKkz2PBiGP2YMfbckD6H+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=moehl.eu; spf=pass smtp.mailfrom=moehl.eu; dkim=pass (2048-bit key) header.d=moehl.eu header.i=maximilian@moehl.eu header.b=ZLIkeQNp; arc=none smtp.client-ip=212.227.126.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=moehl.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=moehl.eu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=moehl.eu header.i=maximilian@moehl.eu header.b="ZLIkeQNp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=moehl.eu; s=s1-ionos; t=1774779899; x=1775384699; i=maximilian@moehl.eu; bh=Ob0kz/Bt1b8DFffYxiZDCy79PwTTmaiwjGjmfn5xAZc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID: MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=ZLIkeQNpulKnVl9hY+peF3DD951ZpDbxuL8VKSD/iIZqASUG+uoprGunXOq9GDZ6 KtR37XGpnV314uc584FSAWuyxUGZXnAOmou9BYmlPIgjYk0f1D43XDWXuDf7wBWGz xhiU8gR/y4GQkUIptWW6O2GyuH72rsAfNCvTl1Vv0TzWSuvQyhRs09tq72KcaK4cz npJAUv/tPW2ND0zO4ezcJfZRnSmDXAVCgQN4NzndrO52/L6upZhvCPdMyrpo52o1Y WRniwbFxdR4s2XR05vTe8A2g0JbHYT6RrEI8fZD6iC+tL+SYEKaC33Qfm89SNYHgS g3hwqAlZvST126UjAA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from client.hidden.invalid by mrelayeu.kundenserver.de (mreue011 [212.227.17.165]) with ESMTPSA (Nemesis) id 1MirX2-1vcx9F2A20-00cE91; Sun, 29 Mar 2026 11:12:29 +0200 From: Maximilian Moehl To: "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maximilian Moehl Subject: [PATCH] net/ipv6: repeat route lookup with saddr set for ECMP Date: Sun, 29 Mar 2026 11:12:01 +0200 Message-ID: <20260329091201.63646-1-maximilian@moehl.eu> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:z3+FHQUWGPd7b8fXdGtA7Wwgfb/EUDNKMRiSriR1HJoncjJE5fa QaHTT2m3vQk/B2AkLknxr4oti0HLWfZ9f1XU61Sx32TwMWXnHEyQf0BP+UKMMO/NyagERPR FEUngCrzTwXwPu4TimUoIqlK/sKCOlmktBsufsxjp/QRZuYyJQfvfVML5qtIGytyw9pXaKt C+ZbO8Ng5tWeW1+aFG34A== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:46/8E3Vdst8=;v6Lp1ODk5dOHMOeC4S/OBhvCNnZ /I7y4GdIa9Y8dbhDEV0UJblIPVhewef/wqPPquELfuMyYkCHvdhKRzZXGAWIoB6jxi+nWNjYl UdRUQy0zqZsNvq62OKLgAIua4L3YrocL+Tt6S2Edk9/U1rUBGxXsFgRLeuJixl7qKyKwVflzZ EZwSydoj6uk/hFqVk7pGpJ0GQ6/5UvAhpq97ESkzY07NyCh6RnjpXGsceg+802hynVOo/K27U GV+8FZlswqu9CwrAtYlDVEptbiRAIQ/vTz/cIoIpqD6e7LtXlJZR8r9ChRmscHwcTA2d0jCfQ BkbRf0iv1SmvJSecNkNPDlYi6ky4AnfnVwEXBaEBgXmctwkzD8RWoaSb7pt+s6griJ0SHPNPg qXxdmf2ZPw3XtdOI7g262InUwmb9Ceb7jaGr4viODf87WCtueJfm9dbMqg2iswA6mznWsENQV DC1m+hzr5SYGB5Vcxo203BhNINhNzxQytN2X4bGMpWdyFn9qLg9siiohTmBFKEde/FXJy4Stl ivrWlTF2eJvahQ/M3H9oyMkVhp2LhM8v5XGruexOtFCKeT6nPN/A5VopXgCb/diS7++qzjKd5 ywk7KHP73okEU/e0pRCVBgFIsFilNGZztJSAhNENj1JdRX565Eu3J97rb/OtqH+BLhga5gRE0 OBsYt7S/jqcD4mv9LpjKUizZ71C4xGhPqhqjy9w9w3vgqU7mMeAdg900b1lJcS/SS1t0lQcN5 fvE0YhgpgAJkNXGEfEnDBR6wAJZe4seuxrbe1kN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dWOUu3WpHY8PxkD6xJdQM9LQG6t2OS2JbLgKja4jaZeGO8zb9cobey5oB88vLWhrA22 jxyMaWJYA+CbxhddPPeQViytKgAo7L8BQJWGjRD5HE8siCUCKnmvsJWrAVoHmY6sFEdPbUjfz oA/rEQGiv+HWpIDnxgc6uIGEUuHFqYlXl0gTFX8EHW76mP/ue0 Content-Type: text/plain; charset="utf-8" When the routing decision involves ECMP, the initial hash is calculated with saddr being :: and the decision which interface to select from an ECMP group is based on that hash. If the route lookup has to be repeated, e.g. because a route was updated, the hash is calculated with saddr set to the previously selected address. This can cause the selected interface to change, breaking ongoing connections. To ensure the initial interface selection is based on an actual saddr the route lookup is repeated after the source address selection if a hash was calculated. Signed-off-by: Maximilian Moehl Link: https://lore.kernel.org/all/aOYLRyIlc7XU7-7n@shredder/ --- I've created a write-up of what I've done, including the steps taken to test the patch: https://moehl.eu/blog/linux-ipv6-ecmp-instability.html net/ipv6/ip6_output.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 8e2a6b28cea7..465fce51d017 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1148,6 +1148,18 @@ static int ip6_dst_lookup_tail(struct net *net, cons= t struct sock *sk, *dst =3D NULL; } =20 + /* If ECMP was involved the initial hash was calculted + * with saddr=3D:: which can result in instability + * when it is later re-calculated with the selected + * saddr. Lookup the route again with the chosen + * saddr to get a stable result. + */ + if (fl6->mp_hash) { + fl6->mp_hash =3D 0; + dst_release(*dst); + *dst =3D NULL; + } + if (fl6->flowi6_oif) flags |=3D RT6_LOOKUP_F_IFACE; } base-commit: dc9e9d61e301c087bcd990dbf2fa18ad3e2e1429 --=20 2.53.0