From nobody Tue Dec 2 00:25:53 2025 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 237BF30B514 for ; Mon, 24 Nov 2025 13:53:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763992411; cv=pass; b=J35orAwBZeUt7TL2VLHh/rvu9aN1gqbm7QatnLyIwYUfJkSfX3HTDGzkUawB6V+sWN3h/7LEb/d01aHFWx8dhRfiLRJveOVu/EKvVRWAiUoP18hsWkkYwpM2But6jSdOmVpgfp27o7ZmFx9uIp8GIOJrwU4sEiM2U6UXfTVk9cU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763992411; c=relaxed/simple; bh=s5h8gSB7v6bsXNAhS9y3RI1hx5UQsmHua34zCqEP0I4=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=KOOBH30m2dUhWQfGYb+Ky9X+bdvzsWBFpTMUe/M3C9DBwQHC7FhaaEZfbPr0vrKJfu+vMdJnafpuAcRJ4L0mJez5bOrLcXRii5lyYO/lYBRgltPNDU7ZqTFsIxGBnA5Ye4jQBQWLX0HF2pNHtt0AIANVZQsYnFAp6cuQG8dsy9s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=azey.net; spf=pass smtp.mailfrom=azey.net; dkim=pass (1024-bit key) header.d=azey.net header.i=me@azey.net header.b=QPd06RrO; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=azey.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=azey.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=azey.net header.i=me@azey.net header.b="QPd06RrO" ARC-Seal: i=1; a=rsa-sha256; t=1763992373; cv=none; d=zohomail.eu; s=zohoarc; b=CdXkQYfMBGRUPeUpKV4Uh5qSRG9zF1JFpwjI74FnDy4z2PAGW6Pwp+c+lZBtt3xOn7tqZv7CGWjDCl6TX8JGdrtmQxzkgxnSc8giuc7QtDug8evyZ7GYnA8ZQqAFVhDbHUTIGkKtYR4Av9z2kfzuj9P5DKfLJ0sKDh1/ec2dix8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1763992373; h=Content-Type:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=rBkX/nDuN24GUNqkAosSgW7yt3kwIvRuz+2yBGUA6hE=; b=IhO6d2xM+BtEU6ppNc42SlBXp2NuX1spGH2WOYDH9beTkUlVt/ll0rHT6YHVQK/LOunqeM3nwMdVDf94s/2I5Tnu/zqo9xqp4AVSYNwo8UxT1XR6zzE6YMqnGweBHd9NXeJeCDZF4LDmtcd11onjPcECO5Tdx6l7pG/i1wQv990= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=azey.net; spf=pass smtp.mailfrom=me@azey.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1763992373; s=zmail; d=azey.net; i=me@azey.net; h=Date:Date:From:From:To:To:Subject:Subject:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To:Cc; bh=rBkX/nDuN24GUNqkAosSgW7yt3kwIvRuz+2yBGUA6hE=; b=QPd06RrOe6IVecQxCNPH5+JtrlR0SlpgQZiIffVVaOmOkIjFEKKTFz1TiA0vo6HA 5Y+43PjGQsD+ry5sqS3HL7Tj2DRkGZ6Oj7W8nlbtuSF1bsGDQ5kyBTI9c855oFoLuDB jSVmRahiF4UCR8hdP+a1x0RVvqdh/HRb0QS7hFhI= Received: by mx.zoho.eu with SMTPS id 1763992368103378.52597944823765; Mon, 24 Nov 2025 14:52:48 +0100 (CET) Date: Mon, 24 Nov 2025 14:52:45 +0100 From: azey To: David Ahern , nicolasdichtel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net/ipv6: allow device-only routes via the multipath API Message-ID: <3k3facg5fiajqlpntjqf76cfc6vlijytmhblau2f2rdstiez2o@um2qmvus4a6b> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="alsnc4vfxlzkwrw2" Content-Disposition: inline X-Zoho-Virus-Status: 1 X-Zoho-Virus-Status: 1 X-Zoho-AV-Stamp: zmail-av-1.4.3/263.908.66 X-ZohoMailClient: External --alsnc4vfxlzkwrw2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: [PATCH v2] net/ipv6: allow device-only routes via the multipath API MIME-Version: 1.0 Content-Type: text/plain; protected-headers="v1"; charset="utf-8" At some point after b5d2d75e079a ("net/ipv6: Do not allow device only routes via the multipath API"), the IPv6 stack was updated such that device-only multipath routes can be installed and work correctly. This change removes checks that prevent them from being installed, and adds a fib6_explicit_ecmp flag to fib6_info. The flag is only checked in rt6_qualify_for_ecmp() and exists to prevent regressions. Signed-off-by: azey --- Changes in v2: - Added fib6_explicit_ecmp flag to fib6_info to prevent regressions. Very simple (and naive) fix, all it does is flag routes created as multipath and check for the flag in rt6_qualify_for_ecmp(). I'm not sure whether it should be an RTF_ flag in fib6_flags instead, but there aren't any unused bits in that field so I made it separate. - Removed hanging has_gateway as reported by bot Link to v1: https://lore.kernel.org/netdev/a6vmtv3ylu224fnj5awi6xrgnjoib5r2jm3kny672h= emsk5ifi@ychcxqnmy5us/ --- include/net/ip6_fib.h | 3 ++- include/net/ip6_route.h | 5 +++-- net/ipv6/route.c | 11 ++--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 88b0dd4d8e09..da9d03cbbab4 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -196,7 +196,8 @@ struct fib6_info { dst_nocount:1, dst_nopolicy:1, fib6_destroying:1, - unused:4; + fib6_explicit_ecmp:1, + unused:3; =20 struct list_head purge_link; struct rcu_head rcu; diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 7c5512baa4b2..5f00e9e252c2 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -73,8 +73,9 @@ static inline bool rt6_need_strict(const struct in6_addr = *daddr) static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i) { /* the RTF_ADDRCONF flag filters out RA's */ - return !(f6i->fib6_flags & RTF_ADDRCONF) && !f6i->nh && - f6i->fib6_nh->fib_nh_gw_family; + return f6i->fib6_explicit_ecmp || + (!(f6i->fib6_flags & RTF_ADDRCONF) && !f6i->nh && + f6i->fib6_nh->fib_nh_gw_family); } =20 void ip6_route_input(struct sk_buff *skb); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index aee6a10b112a..7ac69bf5ccf2 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5119,7 +5119,6 @@ static int rtm_to_fib6_multipath_config(struct fib6_c= onfig *cfg, } =20 do { - bool has_gateway =3D cfg->fc_flags & RTF_GATEWAY; int attrlen =3D rtnh_attrlen(rtnh); =20 if (attrlen > 0) { @@ -5133,17 +5132,9 @@ static int rtm_to_fib6_multipath_config(struct fib6_= config *cfg, "Invalid IPv6 address in RTA_GATEWAY"); return -EINVAL; } - - has_gateway =3D true; } } =20 - if (newroute && (cfg->fc_nh_id || !has_gateway)) { - NL_SET_ERR_MSG(extack, - "Device only routes can not be added for IPv6 using the multipa= th API."); - return -EINVAL; - } - rtnh =3D rtnh_next(rtnh, &remaining); } while (rtnh_ok(rtnh, remaining)); =20 @@ -5448,6 +5439,8 @@ static int ip6_route_multipath_add(struct fib6_config= *cfg, goto cleanup; } =20 + rt->fib6_explicit_ecmp =3D true; + err =3D ip6_route_info_create_nh(rt, &r_cfg, GFP_KERNEL, extack); if (err) { rt =3D NULL; base-commit: bd10acae08aeb9cd2f555acdbacb98b9fbb02a27 --=20 2.51.0 --alsnc4vfxlzkwrw2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQsyzQDQ/6KK5HOf3X5T0pxxcIejwUCaSRjLQAKCRD5T0pxxcIe j/WdAQC5XfnFt5i3LGoLoDcsdOXkgll0eLgliYVd9CZnpMkyvAEA1/PeFW98Al2j fZ12LSAl4M6sUmppD80haqluvb5GJQk= =UlVp -----END PGP SIGNATURE----- --alsnc4vfxlzkwrw2--