]> git.proxmox.com Git - mirror_iproute2.git/commit - ip/iproute.c
ip: extend route get to return matching fib route
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Fri, 2 Jun 2017 04:53:28 +0000 (21:53 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 5 Jun 2017 19:33:50 +0000 (12:33 -0700)
commitaa883d86c093126cf4d1404e54b40bf6e620fb11
treed5aa2722bb4886426dca15d7be05391357b759bb
parentd9bcafb4fe2e066e2c597b5b32356ed3f2b12bda
ip: extend route get to return matching fib route

Uses newly introduced RTM_GETROUTE flag RTM_F_FIB_MATCH
to return a matching fib route. Introduces 'fibmatch'
keyword to ip route get.

ipv4:
----
$ip route show
default via 192.168.0.2 dev eth0
10.0.14.0/24
        nexthop via 172.16.0.3  dev dummy0 weight 1
        nexthop via 172.16.1.3  dev dummy1 weight 1

$ip route get 10.0.14.2
10.0.14.2 via 172.16.1.3 dev dummy1  src 172.16.1.1
    cache

$ip route get fibmatch 10.0.14.2
10.0.14.0/24
        nexthop via 172.16.0.3  dev dummy0 weight 1
        nexthop via 172.16.1.3  dev dummy1 weight 1

ipv6:
----
$ip -6 route show
2001:db9:100::/120  metric 1024
        nexthop via 2001:db8:2::2  dev dummy0 weight 1
        nexthop via 2001:db8:12::2  dev dummy1 weight 1

$ip -6 route get 2001:db9:100::1
2001:db9:100::1 from :: via 2001:db8:12::2 dev dummy1  \
                src 2001:db8:12::1  metric 1024  pref medium

$ip -6 route get fibmatch 2001:db9:100::1
2001:db9:100::/120  metric 1024
        nexthop via 2001:db8:12::2  dev dummy1 weight 1
        nexthop via 2001:db8:2::2  dev dummy0 weight 1

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Acked-by: David Ahern <dsahern@gmail.com>
ip/iproute.c
man/man8/ip-route.8.in