Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Wed, 18 Nov 2026 20:36
Re: [PATCH v1 net 7/8] tcp: Pass inet_sdif() to __inet_lookup_established() in tcp_v4_err().
Author: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 20:36
Date: Wed, 18 Nov 2026 20:36
70 lines
10288 bytes
10288 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message for "tcp: Pass inet_sdif() to
__inet_lookup_established() in tcp_v4_err()." only describes half ofโฆ
--
tcp: Pass inet_sdif() to __inet_lookup_established() in tcp_v4_err().
This commit changes tcp_v4_err() to pass inet_sdif(skb) instead of 0 as
the sdif argument to __inet_lookup_established(). The goal is to stop
ICMP errors that arrive through a VRF from reaching sockets that are not
bound to the device.
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index bc909fedda3a8..35a1309f8b21c 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -504,7 +504,8 @@ int tcp_v4_err(struct sk_buff *skb, u32 info)
> int err;
>
> sk = __inet_lookup_established(net, iph->daddr, th->dest, iph->saddr,
> - ntohs(th->source), inet_iif(skb), 0);
> + ntohs(th->source), inet_iif(skb),
> + inet_sdif(skb));
[Severity: Low]
The code change looks correct to me. It now uses the same dif/sdif pair
that tcp_v4_rcv() already uses. However, the commit message only covers
half of the behavior change:
So, ICMP error coming from VRF can be leaked to a socket not
bound to the device.
Should the commit message also say what changes for sockets bound to the
VRF slave device?
For a packet received through a VRF, inet_iif(skb) returns the VRF master
ifindex. inet_sdif(skb) returns IPCB(skb)->iif, which is the slave
ifindex. The match is done here:
include/net/inet_sock.h:inet_bound_dev_eq() {
if (!bound_dev_if)
return !sdif || l3mdev_accept;
return bound_dev_if == dif || bound_dev_if == sdif;
}
With the old sdif of 0, a socket whose sk_bound_dev_if is the slave
ifindex never matched in tcp_v4_err(). Such sockets got no ICMP errors at
all, which could leave them in a PMTU black hole.
After this patch those sockets do match. They will now see:
ICMP_DEST_UNREACH / ICMP_FRAG_NEEDED -> tcp_v4_mtu_reduced()
hard errors in TCP_SYN_SENT / TCP_SYN_RECV -> tcp_done_with_error()
Users can see this change. Would it help stable backporters and
maintainers to mention it in the changelog?
> if (!sk) {
> __ICMP_INC_STATS(net, ICMP_MIB_INERRORS);
> return -ENOENT;
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117053543.84032-1-kuniyu%40google.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads