diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2015-10-05 19:49:04 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-07 13:31:16 +0200 |
commit | deaa0a6a930edc79081268bf23b196d0340499af (patch) | |
tree | f545f2206ff791f60b301a70ae0b779e08545e8a /net | |
parent | Merge tag 'mac80211-next-for-davem-2015-10-05' of git://git.kernel.org/pub/sc... (diff) | |
download | linux-deaa0a6a930edc79081268bf23b196d0340499af.tar.xz linux-deaa0a6a930edc79081268bf23b196d0340499af.zip |
net: Lookup actual route when oif is VRF device
If the user specifies a VRF device in a get route query the custom route
pointing to the VRF device is returned:
$ ip route ls table vrf-red
unreachable default
broadcast 10.2.1.0 dev eth1 proto kernel scope link src 10.2.1.2
10.2.1.0/24 dev eth1 proto kernel scope link src 10.2.1.2
local 10.2.1.2 dev eth1 proto kernel scope host src 10.2.1.2
broadcast 10.2.1.255 dev eth1 proto kernel scope link src 10.2.1.2
$ ip route get oif vrf-red 10.2.1.40
10.2.1.40 dev vrf-red
cache
Add the flags to skip the custom route and go directly to the FIB. With
this patch the actual route is returned:
$ ip route get oif vrf-red 10.2.1.40
10.2.1.40 dev eth1 src 10.2.1.2
cache
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/route.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 54e6f456a760..bf1486bd7e81 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2507,6 +2507,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh) fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0; fl4.flowi4_mark = mark; + if (netif_index_is_l3_master(net, fl4.flowi4_oif)) + fl4.flowi4_flags = FLOWI_FLAG_L3MDEV_SRC | FLOWI_FLAG_SKIP_NH_OIF; + if (iif) { struct net_device *dev; |