mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 19:07:03 +07:00
Merge branch 'ipv4-fix-route-update-on-metric-change'
Paolo Abeni says: ==================== ipv4: fix route update on metric change. This fixes connected route update on some edge cases for ip addr metric change. It additionally includes self tests for the covered scenarios. The new tests fail on unpatched kernels and pass on the patched one. v1 -> v2: - add selftests ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
45f3380699
@ -1148,7 +1148,7 @@ void fib_modify_prefix_metric(struct in_ifaddr *ifa, u32 new_metric)
|
||||
if (!(dev->flags & IFF_UP) ||
|
||||
ifa->ifa_flags & (IFA_F_SECONDARY | IFA_F_NOPREFIXROUTE) ||
|
||||
ipv4_is_zeronet(prefix) ||
|
||||
prefix == ifa->ifa_local || ifa->ifa_prefixlen == 32)
|
||||
(prefix == ifa->ifa_local && ifa->ifa_prefixlen == 32))
|
||||
return;
|
||||
|
||||
/* add the new */
|
||||
|
@ -1438,6 +1438,27 @@ ipv4_addr_metric_test()
|
||||
fi
|
||||
log_test $rc 0 "Prefix route with metric on link up"
|
||||
|
||||
# explicitly check for metric changes on edge scenarios
|
||||
run_cmd "$IP addr flush dev dummy2"
|
||||
run_cmd "$IP addr add dev dummy2 172.16.104.0/24 metric 259"
|
||||
run_cmd "$IP addr change dev dummy2 172.16.104.0/24 metric 260"
|
||||
rc=$?
|
||||
if [ $rc -eq 0 ]; then
|
||||
check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.0 metric 260"
|
||||
rc=$?
|
||||
fi
|
||||
log_test $rc 0 "Modify metric of .0/24 address"
|
||||
|
||||
run_cmd "$IP addr flush dev dummy2"
|
||||
run_cmd "$IP addr add dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 260"
|
||||
run_cmd "$IP addr change dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 261"
|
||||
rc=$?
|
||||
if [ $rc -eq 0 ]; then
|
||||
check_route "172.16.104.2 dev dummy2 proto kernel scope link src 172.16.104.1 metric 261"
|
||||
rc=$?
|
||||
fi
|
||||
log_test $rc 0 "Modify metric of address with peer route"
|
||||
|
||||
$IP li del dummy1
|
||||
$IP li del dummy2
|
||||
cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user