linux/tools
Ido Schimmel f036e68212 ipv4: Fix incorrect TOS in fibmatch route get reply
The TOS value that is returned to user space in the route get reply is
the one with which the lookup was performed ('fl4->flowi4_tos'). This is
fine when the matched route is configured with a TOS as it would not
match if its TOS value did not match the one with which the lookup was
performed.

However, matching on TOS is only performed when the route's TOS is not
zero. It is therefore possible to have the kernel incorrectly return a
non-zero TOS:

 # ip link add name dummy1 up type dummy
 # ip address add 192.0.2.1/24 dev dummy1
 # ip route get fibmatch 192.0.2.2 tos 0xfc
 192.0.2.0/24 tos 0x1c dev dummy1 proto kernel scope link src 192.0.2.1

Fix by instead returning the DSCP field from the FIB result structure
which was populated during the route lookup.

Output after the patch:

 # ip link add name dummy1 up type dummy
 # ip address add 192.0.2.1/24 dev dummy1
 # ip route get fibmatch 192.0.2.2 tos 0xfc
 192.0.2.0/24 dev dummy1 proto kernel scope link src 192.0.2.1

Extend the existing selftests to not only verify that the correct route
is returned, but that it is also returned with correct "tos" value (or
without it).

Fixes: b61798130f ("net: ipv4: RTM_GETROUTE: return matched fib result when requested")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-07-18 11:11:02 +02:00
..
accounting
arch asm-generic updates for 6.11 2024-07-16 12:09:03 -07:00
bootconfig
bpf bpftool: improve skeleton backwards compat with old buggy libbpfs 2024-07-09 19:03:05 -07:00
build
certs
cgroup
counter
crypto
debugging
firewire
firmware
gpio gpio: add sloppy logic analyzer using polling 2024-07-01 10:54:11 +02:00
hv tools: hv: suppress the invalid warning for packed member alignment 2024-05-28 05:27:35 +00:00
iio
include Networking changes for 6.11. Not much excitement - a handful of large 2024-07-16 19:28:34 -07:00
kvm/kvm_stat
laptop
leds
lib libbpf: improve old BPF skeleton handling for map auto-attach 2024-07-09 19:03:36 -07:00
memory-model kcsan: Add __data_racy documentation and module description 2024-07-15 15:44:40 -07:00
mm
net/ynl tools: ynl: use ident name for Family, too. 2024-07-03 19:13:20 -07:00
objtool Objtool changes for v6.11: 2024-07-16 16:55:33 -07:00
pci
pcmcia
perf perf dsos: When adding a dso into sorted dsos maintain the sort order 2024-07-07 22:26:29 -07:00
power Merge branches 'pm-opp' and 'pm-tools' 2024-07-15 18:55:14 +02:00
rcu tools/rcu: Add rcu-updaters.sh script 2024-06-06 11:44:42 -07:00
scripts
sound
spi
testing ipv4: Fix incorrect TOS in fibmatch route get reply 2024-07-18 11:11:02 +02:00
thermal
time
tracing tools/latency-collector: Fix -Wformat-security compile warns 2024-05-23 10:46:01 -04:00
usb
verification
virtio
wmi
workqueue
writeback writeback: add wb_monitor.py script to monitor writeback info on bdi 2024-05-05 17:53:51 -07:00
Makefile