From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 28E632D0292; Wed, 4 Feb 2026 15:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218480; cv=none; b=NlJI8ShsdGga0lhcV3AR4G1+KR2Dg7VA7rTCGYymKxnuiNCXzA3OUIarq4HUaRQqY1JNWjTuU23FMod1e8pQeWyEvNPDNVV2p8vnhrR7JOEsUB2UQtUOE57PEPmM11ey1nRJdZ148D2+M+td4Ab5SoPaCZ0ZuwYqTGURcLC/Erg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218480; c=relaxed/simple; bh=TC5qYpLqyRxznzKILF+RkL+CfFy2HeL+BNAAcOHMB/s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rk/YYQeH6JDTKrTamPyk9HH/jAWE+GFS6sq7V0z8A6OsosM4CXfNAwbEFQ2pCzDwDBRxiNVyak/kkTCdYk19E5BATTKZkaP0oOPIGHUKPXuETwAtFawYTxmBX838TLK07QG9iLo6QItb1TI/IPYTnVWC8Wu/ju/tlKxXfEwNCm4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Zszdpw4S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Zszdpw4S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 454DCC4CEF7; Wed, 4 Feb 2026 15:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770218479; bh=TC5qYpLqyRxznzKILF+RkL+CfFy2HeL+BNAAcOHMB/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zszdpw4SfOsNih5zs213nfd9XjRavBxFvZS8UIh2nkt9riuEGY0KwIXarDgbBsNYk ZZpyQouk8BNGQY3p15EY1/jglriVv5msPGaUjs0TFAC+V+ixLut5ZimHlrngPGJaDF nxwwnkv+eWyUBwXVdZ7T3SvIdGmVvBl8mBl9+0Vo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Fernando Fernandez Mancera , David Ahern , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 08/72] ipv6: use the right ifindex when replying to icmpv6 from localhost Date: Wed, 4 Feb 2026 15:40:11 +0100 Message-ID: <20260204143845.914141592@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143845.603454952@linuxfoundation.org> References: <20260204143845.603454952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Fernando Fernandez Mancera [ Upstream commit 03cbcdf93866e61beb0063392e6dbb701f03aea2 ] When replying to a ICMPv6 echo request that comes from localhost address the right output ifindex is 1 (lo) and not rt6i_idev dev index. Use the skb device ifindex instead. This fixes pinging to a local address from localhost source address. $ ping6 -I ::1 2001:1:1::2 -c 3 PING 2001:1:1::2 (2001:1:1::2) from ::1 : 56 data bytes 64 bytes from 2001:1:1::2: icmp_seq=1 ttl=64 time=0.037 ms 64 bytes from 2001:1:1::2: icmp_seq=2 ttl=64 time=0.069 ms 64 bytes from 2001:1:1::2: icmp_seq=3 ttl=64 time=0.122 ms 2001:1:1::2 ping statistics 3 packets transmitted, 3 received, 0% packet loss, time 2032ms rtt min/avg/max/mdev = 0.037/0.076/0.122/0.035 ms Fixes: 1b70d792cf67 ("ipv6: Use rt6i_idev index for echo replies to a local address") Signed-off-by: Fernando Fernandez Mancera Reviewed-by: David Ahern Link: https://patch.msgid.link/20260121194409.6749-1-fmancera@suse.de Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv6/icmp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index fd91fd139d76c..c7e815b7ca087 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -768,7 +768,9 @@ static enum skb_drop_reason icmpv6_echo_reply(struct sk_buff *skb) fl6.daddr = ipv6_hdr(skb)->saddr; if (saddr) fl6.saddr = *saddr; - fl6.flowi6_oif = icmp6_iif(skb); + fl6.flowi6_oif = ipv6_addr_loopback(&fl6.daddr) ? + skb->dev->ifindex : + icmp6_iif(skb); fl6.fl6_icmp_type = type; fl6.flowi6_mark = mark; fl6.flowi6_uid = sock_net_uid(net, NULL); -- 2.51.0