* [PATCH] net: ipv6: fix dif and sdif mismatch in raw6_icmp_error
@ 2026-07-17 14:32 lirongqing
2026-07-20 12:48 ` Joe Damato
0 siblings, 1 reply; 2+ messages in thread
From: lirongqing @ 2026-07-17 14:32 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Kuniyuki Iwashima, Willem de Bruijn, Li RongQing,
Kees Cook, netdev, linux-kernel
From: Li RongQing <lirongqing@baidu.com>
In raw6_icmp_error(), raw_v6_match() is called with inet6_iif(skb) passed
to both the 'dif' and 'sdif' arguments. This is a copy-paste or typo error,
as the last argument should represent the secondary interface index (sdif).
This mismatch breaks ICMPv6 error handling for IPv6 raw sockets in VRF
(Virtual Routing and Forwarding) environments. When a raw socket is bound
to a VRF master device, raw_v6_match() fails to find a match because it is
not given the correct sdif value, causing the socket to miss relevant
ICMPv6 error notifications.
Fix this by properly passing inet6_sdif(skb) as the last argument to
raw_v6_match().
Fixes: 5108ab4bf446fa ("net: ipv6: add second dif to raw socket lookups")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
net/ipv6/raw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 3cc5869..b88d364 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -349,7 +349,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
if (!raw_v6_match(net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr,
- inet6_iif(skb), inet6_iif(skb)))
+ inet6_iif(skb), inet6_sdif(skb)))
continue;
rawv6_err(sk, skb, type, code, inner_offset, info);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] net: ipv6: fix dif and sdif mismatch in raw6_icmp_error
2026-07-17 14:32 [PATCH] net: ipv6: fix dif and sdif mismatch in raw6_icmp_error lirongqing
@ 2026-07-20 12:48 ` Joe Damato
0 siblings, 0 replies; 2+ messages in thread
From: Joe Damato @ 2026-07-20 12:48 UTC (permalink / raw)
To: lirongqing
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Kuniyuki Iwashima, Willem de Bruijn, Kees Cook,
netdev, linux-kernel
On Fri, Jul 17, 2026 at 10:32:30PM +0800, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> In raw6_icmp_error(), raw_v6_match() is called with inet6_iif(skb) passed
> to both the 'dif' and 'sdif' arguments. This is a copy-paste or typo error,
> as the last argument should represent the secondary interface index (sdif).
>
> This mismatch breaks ICMPv6 error handling for IPv6 raw sockets in VRF
> (Virtual Routing and Forwarding) environments. When a raw socket is bound
> to a VRF master device, raw_v6_match() fails to find a match because it is
> not given the correct sdif value, causing the socket to miss relevant
> ICMPv6 error notifications.
>
> Fix this by properly passing inet6_sdif(skb) as the last argument to
> raw_v6_match().
>
> Fixes: 5108ab4bf446fa ("net: ipv6: add second dif to raw socket lookups")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> net/ipv6/raw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
> index 3cc5869..b88d364 100644
> --- a/net/ipv6/raw.c
> +++ b/net/ipv6/raw.c
> @@ -349,7 +349,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
> const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
>
> if (!raw_v6_match(net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr,
> - inet6_iif(skb), inet6_iif(skb)))
> + inet6_iif(skb), inet6_sdif(skb)))
Looking at the commit under fixes, this does look like a copy/paste bug to me.
I wonder if a future contribution would be a test to exercise this path?
Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-20 12:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 14:32 [PATCH] net: ipv6: fix dif and sdif mismatch in raw6_icmp_error lirongqing
2026-07-20 12:48 ` Joe Damato
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox