summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-08-08 13:39:19 -0400
committerGitHub <noreply@github.com>2017-08-08 13:39:19 -0400
commitd3d9c86f540ce6b7a8e048519085c9c60d075c15 (patch)
treeba3f82f85b96672e31ab9f85ede2159230703bd2 /zebra/interface.c
parentd1783281630a888a61a24299ae73c973588ff481 (diff)
parent6201e30b57911dff672c05e94c314c92e8d1cb20 (diff)
Merge pull request #919 from opensourcerouting/static-routes-ifindex-update
fixup static routes' ifindexes when interfaces (dis)appear
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 03ddf8d386..c4d0363994 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -48,6 +48,7 @@
#include "zebra/rt_netlink.h"
#include "zebra/interface.h"
#include "zebra/zebra_vxlan.h"
+#include "zebra/zebra_static.h"
#define ZEBRA_PTM_SUPPORT
@@ -119,8 +120,6 @@ static int if_zebra_new_hook(struct interface *ifp)
route_table_init_with_delegate(&zebra_if_table_delegate);
ifp->info = zebra_if;
-
- zebra_vrf_static_route_interface_fixup(ifp);
return 0;
}
@@ -510,6 +509,8 @@ void if_add_update(struct interface *ifp)
zlog_debug(
"interface %s vrf %u index %d becomes active.",
ifp->name, ifp->vrf_id, ifp->ifindex);
+
+ static_ifindex_update(ifp, true);
} else {
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("interface %s vrf %u index %d is added.",
@@ -675,6 +676,8 @@ void if_delete_update(struct interface *ifp)
zlog_debug("interface %s vrf %u index %d is now inactive.",
ifp->name, ifp->vrf_id, ifp->ifindex);
+ static_ifindex_update(ifp, false);
+
/* Delete connected routes from the kernel. */
if_delete_connected(ifp);
@@ -714,6 +717,8 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id)
old_vrf_id = ifp->vrf_id;
+ static_ifindex_update(ifp, false);
+
/* Uninstall connected routes. */
if_uninstall_connected(ifp);
@@ -737,6 +742,8 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id)
/* Install connected routes (in new VRF). */
if_install_connected(ifp);
+ static_ifindex_update(ifp, true);
+
/* Due to connected route change, schedule RIB processing for both old
* and new VRF.
*/
@@ -745,8 +752,6 @@ void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id)
ifp->vrf_id, ifp->name);
rib_update(old_vrf_id, RIB_UPDATE_IF_CHANGE);
rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
-
- zebra_vrf_static_route_interface_fixup(ifp);
}
static void ipv6_ll_address_to_mac(struct in6_addr *address, u_char *mac)
@@ -859,8 +864,6 @@ void if_up(struct interface *ifp)
ifp->vrf_id, ifp->name);
rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
- zebra_vrf_static_route_interface_fixup(ifp);
-
/* Handle interface up for specific types for EVPN. Non-VxLAN interfaces
* are checked to see if (remote) neighbor entries need to be installed
* on them for ARP suppression.