Skip to contentSkip to conversation

ipv4: Set offload_failed flag in fibmatch results

PATCH Applied Benjamin Poirier 4 participants 4 messages Sep 26, 2023 – Oct 4, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv4: Set offload_failed flag in fibmatch results

Due to a small omission, the offload_failed flag is missing from ipv4 fibmatch results. Make sure it is set correctly.

The issue can be witnessed using the following commands:
echo "1 1" > /sys/bus/netdevsim/new_device
ip link add dummy1 up type dummy
ip route add 192.0.2.0/24 dev dummy1
echo 1 > /sys/kernel/debug/netdevsim/netdevsim1/fib/fail_route_offload ip route add 198.51.100.0/24 dev dummy1
ip route

	# 192.168.15.0/24 has rt_trap
	# 198.51.100.0/24 has rt_offload_failed

ip route get 192.168.15.1 fibmatch
# Result has rt_trap
ip route get 198.51.100.1 fibmatch
# Result differs from the route shown by ip route, it is missing # rt_offload_failed
ip link del dev dummy1
echo 1 > /sys/bus/netdevsim/del_device

Fixes 36c5100e859d ("IPv4: Add "offload failed" indication to routes")
---
 net/ipv4/route.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/route.c +2 -0
index a57062283219..b214b5a2e045 100644
@@ -3417,6 +3417,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 				    fa->fa_type == fri.type) {
 					fri.offload = READ_ONCE(fa->offload);
 					fri.trap = READ_ONCE(fa->trap);
+					fri.offload_failed =
+						READ_ONCE(fa->offload_failed);
 					break;
 				}
 			}
Signature · 1 line
2.40.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · Benjamin Poirier

Due to a small omission, the offload_failed flag is missing from ipv4 fibmatch results. Make sure it is set correctly.

The issue can be witnessed using the following commands:
echo "1 1" > /sys/bus/netdevsim/new_device
ip link add dummy1 up type dummy
ip route add 192.0.2.0/24 dev dummy1
echo 1 > /sys/kernel/debug/netdevsim/netdevsim1/fib/fail_route_offload ip route add 198.51.100.0/24 dev dummy1
ip route

	# 192.168.15.0/24 has rt_trap
	# 198.51.100.0/24 has rt_offload_failed

ip route get 192.168.15.1 fibmatch
# Result has rt_trap
ip route get 198.51.100.1 fibmatch
# Result differs from the route shown by ip route, it is missing # rt_offload_failed
ip link del dev dummy1
echo 1 > /sys/bus/netdevsim/del_device

Quoted 3 lines
Fixes 36c5100e859d ("IPv4: Add "offload failed" indication to routes")
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Benjamin Poirier
Quoted 20 lines · Benjamin Poirier

Due to a small omission, the offload_failed flag is missing from ipv4 fibmatch results. Make sure it is set correctly.

The issue can be witnessed using the following commands:
echo "1 1" > /sys/bus/netdevsim/new_device
ip link add dummy1 up type dummy
ip route add 192.0.2.0/24 dev dummy1
echo 1 > /sys/kernel/debug/netdevsim/netdevsim1/fib/fail_route_offload ip route add 198.51.100.0/24 dev dummy1
ip route

	# 192.168.15.0/24 has rt_trap
	# 198.51.100.0/24 has rt_offload_failed

ip route get 192.168.15.1 fibmatch
# Result has rt_trap
ip route get 198.51.100.1 fibmatch
# Result differs from the route shown by ip route, it is missing # rt_offload_failed
ip link del dev dummy1
echo 1 > /sys/bus/netdevsim/del_device

Quoted 7 lines
Fixes 36c5100e859d ("IPv4: Add "offload failed" indication to routes")
---
 net/ipv4/route.c | 2 ++
 1 file changed, 2 insertions(+)
#3 lore raw
In reply to Benjamin Poirier
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 20 lines · On Tue, 26 Sep 2023 14:27:30 -0400 you wrote:

Due to a small omission, the offload_failed flag is missing from ipv4 fibmatch results. Make sure it is set correctly.

The issue can be witnessed using the following commands:
echo "1 1" > /sys/bus/netdevsim/new_device
ip link add dummy1 up type dummy
ip route add 192.0.2.0/24 dev dummy1
echo 1 > /sys/kernel/debug/netdevsim/netdevsim1/fib/fail_route_offload ip route add 198.51.100.0/24 dev dummy1
ip route

	# 192.168.15.0/24 has rt_trap
	# 198.51.100.0/24 has rt_offload_failed

ip route get 192.168.15.1 fibmatch
# Result has rt_trap
ip route get 198.51.100.1 fibmatch
# Result differs from the route shown by ip route, it is missing # rt_offload_failed
ip link del dev dummy1
echo 1 > /sys/bus/netdevsim/del_device

Quoted 1 line

[...]

Here is the summary with links:
- [net] ipv4: Set offload_failed flag in fibmatch results

    https://git.kernel.org/netdev/net/c/0add5c597f32

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html