diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-08 13:39:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-08 13:39:38 -0400 |
| commit | 76a86854181c27819e5cf71b12ae1fa5ccd9e02a (patch) | |
| tree | 691b03e51b9c99874d4ef26f9ca9b29cbee1b199 /zebra/interface.c | |
| parent | f66e92bc4856352dc4c1c81fa35b1dd570cd83e5 (diff) | |
| parent | 06e0a0cb3c630c2b221fecd2f081348b36943a6e (diff) | |
Merge pull request #920 from opensourcerouting/static-routes-ifindex-update-3.0reindent-3.0-before
[3.0] fixup static routes' ifindexes when interfaces (dis)appear
Diffstat (limited to 'zebra/interface.c')
| -rw-r--r-- | zebra/interface.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index 317cc722b4..c629dfb3f3 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -48,6 +48,7 @@ #include "zebra/zebra_ptm.h" #include "zebra/rt_netlink.h" #include "zebra/interface.h" +#include "zebra/zebra_static.h" #define ZEBRA_PTM_SUPPORT @@ -118,8 +119,6 @@ if_zebra_new_hook (struct interface *ifp) zebra_if->ipv4_subnets = route_table_init_with_delegate (&zebra_if_table_delegate); ifp->info = zebra_if; - - zebra_vrf_static_route_interface_fixup (ifp); return 0; } @@ -520,6 +519,7 @@ if_add_update (struct interface *ifp) if (IS_ZEBRA_DEBUG_KERNEL) zlog_debug ("interface %s vrf %u index %d becomes active.", ifp->name, ifp->vrf_id, ifp->ifindex); + static_ifindex_update(ifp, true); } else { @@ -695,6 +695,8 @@ 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); @@ -723,6 +725,8 @@ 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); @@ -746,6 +750,8 @@ 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. */ @@ -754,8 +760,6 @@ 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 @@ -862,8 +866,6 @@ if_up (struct interface *ifp) zlog_debug ("%u: IF %s up, scheduling RIB processing", ifp->vrf_id, ifp->name); rib_update (ifp->vrf_id, RIB_UPDATE_IF_CHANGE); - - zebra_vrf_static_route_interface_fixup (ifp); } /* Interface goes down. We have to manage different behavior of based |
