aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
authorMark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>2016-09-04 18:20:20 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-06 16:56:13 -0400
commit5a56a0b3a45dd0cc5b2f7bec6afd053a474ed9f5 (patch)
tree817eb48162ca954a29d301a60d2792ab1af47eb4 /net/ipv4/fib_frontend.c
parentdaa7ee8dfa64233789221685e73a6ef8159f80de (diff)
net: Don't delete routes in different VRFs
When deleting an IP address from an interface, there is a clean-up of routes which refer to this local address. However, there was no check to see that the VRF matched. This meant that deletion wasn't confined to the VRF it should have been. To solve this, a new field has been added to fib_info to hold a table id. When removing fib entries corresponding to a local ip address, this table id is also used in the comparison. The table id is populated when the fib_info is created. This was already done in some places, but not in ip_rt_ioctl(). This has now been fixed. Fixes: 021dd3b8a142 ("net: Add routes to the table associated with the device") Acked-by: David Ahern <dsa@cumulusnetworks.com> Tested-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index ef2ebeb89d0f..1b25daf8c7f1 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -509,6 +509,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt,
509 if (!dev) 509 if (!dev)
510 return -ENODEV; 510 return -ENODEV;
511 cfg->fc_oif = dev->ifindex; 511 cfg->fc_oif = dev->ifindex;
512 cfg->fc_table = l3mdev_fib_table(dev);
512 if (colon) { 513 if (colon) {
513 struct in_ifaddr *ifa; 514 struct in_ifaddr *ifa;
514 struct in_device *in_dev = __in_dev_get_rtnl(dev); 515 struct in_device *in_dev = __in_dev_get_rtnl(dev);
@@ -1027,7 +1028,7 @@ no_promotions:
1027 * First of all, we scan fib_info list searching 1028 * First of all, we scan fib_info list searching
1028 * for stray nexthop entries, then ignite fib_flush. 1029 * for stray nexthop entries, then ignite fib_flush.
1029 */ 1030 */
1030 if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local)) 1031 if (fib_sync_down_addr(dev, ifa->ifa_local))
1031 fib_flush(dev_net(dev)); 1032 fib_flush(dev_net(dev));
1032 } 1033 }
1033 } 1034 }