net/ipv6: Only update MTU metric if it set
authorDavid Ahern <dsahern@gmail.com>
Thu, 30 Aug 2018 21:15:43 +0000 (14:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 2 Sep 2018 21:03:54 +0000 (14:03 -0700)
commit15a81b418e22a9aa4a0504471fdcb0f4ebf69b96
tree70d74313e773b9ab34e3bccf90ca398f8f47f561
parent18eb8aea7fb2fb4490e578b1b8a1096c34b2fc48
net/ipv6: Only update MTU metric if it set

Jan reported a regression after an update to 4.18.5. In this case ipv6
default route is setup by systemd-networkd based on data from an RA. The
RA contains an MTU of 1492 which is used when the route is first inserted
but then systemd-networkd pushes down updates to the default route
without the mtu set.

Prior to the change to fib6_info, metrics such as MTU were held in the
dst_entry and rt6i_pmtu in rt6_info contained an update to the mtu if
any. ip6_mtu would look at rt6i_pmtu first and use it if set. If not,
the value from the metrics is used if it is set and finally falling
back to the idev value.

After the fib6_info change metrics are contained in the fib6_info struct
and there is no equivalent to rt6i_pmtu. To maintain consistency with
the old behavior the new code should only reset the MTU in the metrics
if the route update has it set.

Fixes: d4ead6b34b67 ("net/ipv6: move metrics from dst to rt6_info")
Reported-by: Jan Janssen <medhefgo@web.de>
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_fib.c