OSDN Git Service

ipv6: use rt6_info members when dst is set in rt6_fill_node
authorXin Long <lucien.xin@gmail.com>
Tue, 11 Sep 2018 06:33:58 +0000 (14:33 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 Sep 2018 09:55:53 +0000 (02:55 -0700)
commit1328a5a40fdef0cd1c82698074b40b490558c6b6
tree1cb735c7d24a899c89fb4ac8f4f23721f0980ca1
parentb5fc7f300cdbc7d8bee3a0b77bb1a37bfa367b18
ipv6: use rt6_info members when dst is set in rt6_fill_node

[ Upstream commit 22d0bd82cc7cec7d9ed4bd5913f3ab65643364be ]

In inet6_rtm_getroute, since Commit 93531c674315 ("net/ipv6: separate
handling of FIB entries from dst based routes"), it has used rt->from
to dump route info instead of rt.

However for some route like cache, some of its information like flags
or gateway is not the same as that of the 'from' one. It caused 'ip
route get' to dump the wrong route information.

In Jianlin's testing, the output information even lost the expiration
time for a pmtu route cache due to the wrong fib6_flags.

So change to use rt6_info members for dst addr, src addr, flags and
gateway when it tries to dump a route entry without fibmatch set.

v1->v2:
  - not use rt6i_prefsrc.
  - also fix the gw dump issue.

Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/route.c