Article View: linux.kernel.netdev
Article #17204Re: [PATCH net-next v2 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route()
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:54
Date: Mon, 16 Nov 2026 13:54
120 lines
12123 bytes
12123 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The fix only works when multicast forwarding is off.
- [Low] The commit fixes a reproducible, user-visible failure: on
CONFIG_IPV6_MROUTE kernels with mc_forwarding at 0, `ip -6 route get…
--
ipv6: check mc_forwarding before calling ip6mr_get_route()
This commit makes the ip6mr_get_route() call in rt6_fill_node() depend
on devconf_all->mc_forwarding. With multicast forwarding disabled,
multicast route get queries with an iif then emit RTA_IIF and the normal
route attributes. The goal is to match IPv4 rt_fill_info() behavior.
> Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com>
> Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
[Severity: Low]
This fixes a user-visible "RTNETLINK answers: Message too long" from
ip -6 route get, but the commit has no Fixes: tag.
git blame traces the multicast ip6mr_get_route() branch in
rt6_fill_node(), which had no mc_forwarding check, back to:
commit 7bc570c8b4f7 ("[IPV6] MROUTE: Support multicast forwarding.")
Later commits changed that branch: fd61c6ba313d ("net: ipv6: remove
nowait arg to rt6_fill_node") reworked the error handling, and
22d0bd82cc7c ("ipv6: use rt6_info members when dst is set in
rt6_fill_node") changed the condition.
Could a Fixes: tag be added so stable backporters can tell which
releases need this?
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 04098cf32eabe..cb8cfd8b5c8b7 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -5862,7 +5862,8 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
> #endif
> if (iif) {
> #ifdef CONFIG_IPV6_MROUTE
> - if (ipv6_addr_is_multicast(&rt6_dst->addr)) {
> + if (ipv6_addr_is_multicast(&rt6_dst->addr) &&
> + atomic_read(&net->ipv6.devconf_all->mc_forwarding)) {
> int err = ip6mr_get_route(net, skb, rtm, portid);
>
> if (err == 0)
[Severity: Medium]
Does this cover only the forwarding-disabled case? The commit message
says the -ENODEV comes from skb->dev being NULL in the reply skb that
inet6_rtm_getroute() allocates. After this patch, skb->dev is still
never set.
In the iif branch of inet6_rtm_getroute(), dev is resolved and passed
to the lookup, but the reply skb only gets a dst:
net/ipv6/route.c:inet6_rtm_getroute() {
...
dst = ip6_route_input_lookup(net, dev, &fl6, NULL, flags);
...
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
...
skb_dst_set(skb, &rt->dst);
...
}
When a multicast routing daemon opens an mroute socket, ip6mr_sk_init()
does:
atomic_inc(&net->ipv6.devconf_all->mc_forwarding);
After that the new check passes, and ip6mr_get_route() is still called
with a NULL skb->dev. On a cache miss, the (*,G) lookup guarded by
"if (!cache && skb->dev)" is skipped, and then:
net/ipv6/ip6mr.c:ip6mr_get_route() {
...
dev = skb->dev;
if (!dev || (vif = ip6mr_find_vif(mrt, dev)) < 0) {
rcu_read_unlock();
return -ENODEV;
}
...
}
This happens even when the iif is a configured MIF.
In that setup, would "ip -6 route get <mcast> from <src> iif <dev>"
still return -EMSGSIZE? With the follow-up "ipv6: preserve
ip6mr_get_route() error in rt6_fill_node()" applied, it would return
-ENODEV instead, but the query would still fail.
For comparison, IPv4's inet_rtm_getroute() sets the device on the reply
skb:
fl4.flowi4_iif = iif; /* for rt_fill_info */
skb->dev = dev;
This lets ipmr_get_route() find the VIF, then either queue an
unresolved entry or return the mroute data.
Should inet6_rtm_getroute() also set skb->dev = dev in its iif branch,
so that the "matching IPv4 behavior" claim also holds with
mc_forwarding enabled?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112094630.197244-1-sunwenbo%40cmss.chinamobile.com
Technical Details
Message-ID:
<179483727465.3136.6148701646538562238@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364378-linux-kernel-netdev=dewy.ruReferences:
<20261112094630.197244-2-sunwenbo@cmss.chinamobile.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364378-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/2] ipv6: check mc_forwarding before calling ip6mr_get_route() Date: Mon, 16 Nov 2026 13:54:34 +0000 Organization: Usenet Network Message-ID: <179483727465.3136.6148701646538562238@kernel.org> References: <20261112094630.197244-2-sunwenbo@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2078026"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mdJxDkY4YEQtYm+yS8qnEhPk5gE= sha256:0uKh+EZsYcgssSVM7Gh0792ON5IEqrGRDewcS+9UC1g= sha1:mCxsu/IySinQE518SBLKUEWDO/w= sha256:2tpmyGKLCy3mgrwQks0G8MRhumX1hcPBgOYAyWCdPZg= 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 80CF8114C47; Mon, 16 Nov 2026 16:55:06 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 vtSnWBF3ifaK; Mon, 16 Nov 2026 16:55:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-364378-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 4DEA3114C45; Mon, 16 Nov 2026 16:54:54 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 9614E6028A3; Mon, 16 Nov 2026 13:54:53 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794837277; b=K0rMJIFZrphX8CH9ytsUy/LUpsp8A2b1KrpkOePniDUiyje5TFwPmd5i6yjz810uz7T4 I3uxwhHLBUDc0+wNDclGiaIB2EqFzMPmU5YFgwJV9DGpKvbuoWtCBwdQZFPPY4JQAikP8 htJ0TZ485m5sx46OKzNGVFBzChic/0p3S1CM+qOJKtRtFUY0OdRz+3ywEHsNAE+ed8qAK NRd3mdUPHrXm+j/0rgVP6EApXeoEdrpCd8MTEx3CMFZ6uecuOq3y3Bm++M5IVm9YAOT0S m+IZLauIcoyVN6S4VAFqdXCOjUtkOYTQH5uHiX/20eW5ys1eBsjj4OxIoCeRH1QAd+g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837277; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=t0vCWWTPkvwu94AAgs5iNxQ9S0DD+Z0UfxoWRg06VN0=; b=Le4E/HMwLgXYnMYHOnBBntw4vVrMo9Jiycjj6Q5pzmqPfdOEaMj9NWQVVhHYiIE+9YxP U1HpVsRBz7Mjrqki0ev+tRYrMnEn0VMvgNHWhlxYOpeeFHXc7TLsKwuGEQnX9c9FUb6M3 MyNX2f7ovb+LarZRKb2F/KJ9v6rhItbzG4fqNBIPB7ly9hHT+DFg0Hndq6SeMcos+8Zy+ Rsnq9sllPRiBJlvB5H+pDm2PPQf8w43AQjxVus7pycMhAK2qZ/BM4jzjnRuG6ZarP/a0E HtXGKr2ggKjR6jRRWrA4yv51kLn+QWWTvkiDw1JmrEcH/YLXbiEtQMh2l2aqXfhTbXQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GpDGO6sM; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE63160A2619; Mon, 16 Nov 2026 13:54:36 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GpDGO6sM X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794837276; b=BshcXA58z/Jl9JSNiIkDhWbdvPiUN5UIWMfH/ZNkOD/NnnZjV9gBJPLimikJVBXSSDAX JXTM3yo6ZtsJuiPQHbbuGIlcnYwJ0OA7WiYjRYSAIX4veiBi2Y+pAno2nSKUQ+XBbnRxm YTd4AAqRrHIyMutk7Fuq2S5TdkfWmdFZEh4e9yW6bUv9wiKzZHwOLFhXXdzkabW+T5OD0 +dccYTMFN6HLx3GSUKm5WIKePZ8LeJN7boo3wfBXBebvy3Y2jNV7W4kTAbR1otdImZaAI XrkJ2y3mcpXMEguFqu+bDlfkQZiO5pLJ77rrJqLS1oUzmk//0StpWGUr1iFoMWWwMbw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837276; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=t0vCWWTPkvwu94AAgs5iNxQ9S0DD+Z0UfxoWRg06VN0=; b=ObvaeKNyTQqikuY7ISLbKTKBxNYjeWjmc5zICzy6xRAWZ8B/vy0wB+UtK15SI8xeHS5E UfUktZZojZAHTUi6pupUmnuhW7UFvmi28XM5k6kGozx1mPoMjWrKL1PSRjbfxUuRUinIM dKWkb3tJdS8g1Qinl4oTCMklF+XkGnX3NiAdZHoLzMlVECpX2SfKrdIBBhpUCOsbWF4Ie UF0xPYH2VhAV3w2pqJsT8teRRkF+Z5G+Y/iwBtT/6hXWKXMtvU7K54MemW8WxFNzJ+BQb exE814elEsvip+I8Y9vf6gHK17M8/bFbEx2BoW7yTLZ2vKsRInyvJQbF09R9R2T+s1A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GpDGO6sM; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BDB9606A881; Mon, 16 Nov 2026 13:54:36 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22AE51F000C8; Mon, 16 Nov 2026 13:54:35 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794837275; bh=t0vCWWTPkvwu94AAgs5iNxQ9S0DD+Z0UfxoWRg06VN0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=GpDGO6sMlQBreQYCRJmJ/0bWNM80eG7deRFvxuXsexyqexCstLJbY3yeAurWnim+K Onh6hgf0wZPsdhdKisWOHp2WLDoF0bSqzyT5SWU4XIIq50sF0AQFq8iAsv2zi91bdA 0FT0mvVjLxZdIhe863MwVK/j0wHEE5iVd8rzyXdbjsrvMUsoSTAvCnhHB7xfOZRe1z +2yHIcAhx6n8gx/nAYvMF7rAB2dePai0CpnQtoMqH1kB9rLIZYb3S8MCKYiGKnxGV1 cGTSE1ss1HQcIcTx5FPMf6MCQyVVoz9oVveMO5d2h5DL73jeDqV0Vv0fqNjpoDscSL JoSGwjdh+yi2Q== X-Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, hangbin.liu@linux.dev, liuhangbin@kylinos.cn, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 1342116488@qq.com X-In-Reply-To: <20261112094630.197244-2-sunwenbo@cmss.chinamobile.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list