diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-03-27 14:45:07 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-03-27 15:52:25 -0400 |
| commit | d583db98be91bc53f3a3ab0113230204d5a05a97 (patch) | |
| tree | bc671cf2a2a642c68224ec2883c2783d9254322f /zebra/zebra_static.c | |
| parent | 90f86c0a4d3242e4158d973ebb40d2eda16ed065 (diff) | |
zebra: Ensure ifindexes are updated for nexthops that are leaked.
When a interface is moved from one vrf to another, we get a callback
to move the static routes. Extend the work to look at all static
routes across all vrf's since we allow static route leaking now.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_static.c')
| -rw-r--r-- | zebra/zebra_static.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index c544d5855d..75d625c6b5 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -574,33 +574,39 @@ static void static_ifindex_update_af(struct interface *ifp, bool up, afi_t afi, safi_t safi) { struct route_table *stable; - struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id); struct route_node *rn; struct static_route *si; struct prefix *p, *src_pp; struct prefix_ipv6 *src_p; + struct vrf *vrf; - stable = zebra_vrf_static_table(afi, safi, zvrf); - if (!stable) - return; + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { + struct zebra_vrf *zvrf; - for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) { - srcdest_rnode_prefixes(rn, &p, &src_pp); - src_p = (struct prefix_ipv6 *)src_pp; + zvrf = vrf->info; - for (si = rn->info; si; si = si->next) { - if (!si->ifname[0]) - continue; - if (up) { - if (strcmp(si->ifname, ifp->name)) - continue; - si->ifindex = ifp->ifindex; - static_install_route(afi, safi, p, src_p, si); - } else { - if (si->ifindex != ifp->ifindex) + stable = zebra_vrf_static_table(afi, safi, zvrf); + if (!stable) + continue; + + for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) { + srcdest_rnode_prefixes(rn, &p, &src_pp); + src_p = (struct prefix_ipv6 *)src_pp; + + for (si = rn->info; si; si = si->next) { + if (!si->ifname[0]) continue; - static_uninstall_route(afi, safi, p, src_p, si); - si->ifindex = IFINDEX_INTERNAL; + if (up) { + if (strcmp(si->ifname, ifp->name)) + continue; + si->ifindex = ifp->ifindex; + static_install_route(afi, safi, p, src_p, si); + } else { + if (si->ifindex != ifp->ifindex) + continue; + static_uninstall_route(afi, safi, p, src_p, si); + si->ifindex = IFINDEX_INTERNAL; + } } } } |
