aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid Ahern <dsa@cumulusnetworks.com>2015-12-10 13:25:24 -0500
committerDavid S. Miller <davem@davemloft.net>2015-12-13 23:58:44 -0500
commit7f49e7a38b77a7538acf48762c22ccbd05d9535c (patch)
tree93cf3d05956b28bf4d69049da97c53ef032522dd /net/ipv4
parent98900a80d5343901634852190e2728ea1ffec250 (diff)
net: Flush local routes when device changes vrf association
The VRF driver cycles netdevs when an interface is enslaved or released: the down event is used to flush neighbor and route tables and the up event (if the interface was already up) effectively moves local and connected routes to the proper table. As of 4f823defdd5b the local route is left hanging around after a link down, so when a netdev is moved from one VRF to another (or released from a VRF altogether) local routes are left in the wrong table. Fix by handling the NETDEV_CHANGEUPPER event. When the upper dev is an L3mdev then call fib_disable_ip to flush all routes, local ones to. Fixes: 4f823defdd5b ("ipv4: fix to not remove local route on link down") Cc: Julian Anastasov <ja@ssi.bg> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_frontend.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index cc8f3e506cde..473447593060 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1155,6 +1155,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
1155static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) 1155static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr)
1156{ 1156{
1157 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 1157 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1158 struct netdev_notifier_changeupper_info *info;
1158 struct in_device *in_dev; 1159 struct in_device *in_dev;
1159 struct net *net = dev_net(dev); 1160 struct net *net = dev_net(dev);
1160 unsigned int flags; 1161 unsigned int flags;
@@ -1193,6 +1194,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
1193 case NETDEV_CHANGEMTU: 1194 case NETDEV_CHANGEMTU:
1194 rt_cache_flush(net); 1195 rt_cache_flush(net);
1195 break; 1196 break;
1197 case NETDEV_CHANGEUPPER:
1198 info = ptr;
1199 /* flush all routes if dev is linked to or unlinked from
1200 * an L3 master device (e.g., VRF)
1201 */
1202 if (info->upper_dev && netif_is_l3_master(info->upper_dev))
1203 fib_disable_ip(dev, NETDEV_DOWN, true);
1204 break;
1196 } 1205 }
1197 return NOTIFY_DONE; 1206 return NOTIFY_DONE;
1198} 1207}