]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: fix fnhe usage by non-cached routes
authorJulian Anastasov <ja@ssi.bg>
Wed, 2 May 2018 06:41:19 +0000 (09:41 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 May 2018 02:52:35 +0000 (22:52 -0400)
commit63af6e49ae190e264991966557d84fe01528451c
treeb340c7c1a126376591db0bac4fb7c5ed6074dac0
parent268a90e6775117681e4cdf9c6d6f657b90c04c88
ipv4: fix fnhe usage by non-cached routes

Allow some non-cached routes to use non-expired fnhe:

1. ip_del_fnhe: moved above and now called by find_exception.
The 4.5+ commit bce5eab1ed60 expires fnhe only when caching
routes. Change that to:

1.1. use fnhe for non-cached local output routes, with the help
from (2)

1.2. allow __mkroute_input to detect expired fnhe (outdated
fnhe_gw, for example) when do_cache is false, eg. when itag!=0
for unicast destinations.

2. __mkroute_output: keep fi to allow local routes with orig_oif != 0
to use fnhe info even when the new route will not be cached into fnhe.
After commit 432776eff1cf ("net: ipv4: set orig_oif based on fib
result for local traffic") it means all local routes will be affected
because they are not cached. This change is used to solve a PMTU
problem with IPVS (and probably Netfilter DNAT) setups that redirect
local clients from target local IP (local route to Virtual IP)
to new remote IP target, eg. IPVS TUN real server. Loopback has
64K MTU and we need to create fnhe on the local route that will
keep the reduced PMTU for the Virtual IP. Without this change
fnhe_pmtu is updated from ICMP but never exposed to non-cached
local routes. This includes routes with flowi4_oif!=0 for 4.6+ and
with flowi4_oif=any for 4.14+).

3. update_or_create_fnhe: make sure fnhe_expires is not 0 for
new entries

Fixes: 432776eff1cf ("net: ipv4: set orig_oif based on fib result for local traffic")
Fixes: e5ef031b069d ("route: do not cache fib route info on local routes with oif")
Fixes: bce5eab1ed60 ("route: check and remove route cache when we get route")
Cc: David Ahern <dsahern@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/route.c