diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-08-07 21:45:02 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-08-07 21:55:23 -0400 |
| commit | a6e85307c362b56a8431f3d44e14c97302ffe99d (patch) | |
| tree | ce9a01c1c4e7f74e8b7c86de6b1f45b89b6b1eb3 /staticd | |
| parent | 3a738964ec92473c21a5fe75a7fa8de28a344ff8 (diff) | |
staticd: Fix blackhole routes being installed
When we are ready to install a route, we were treating
blackhole routes as something that should be nexthop tracked
which does not work as well as one would expect.
Additionally add some test code to show that this actually
fixes this issue.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'staticd')
| -rw-r--r-- | staticd/static_routes.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/staticd/static_routes.c b/staticd/static_routes.c index b2c61bcbab..34f58a98e2 100644 --- a/staticd/static_routes.c +++ b/staticd/static_routes.c @@ -73,6 +73,7 @@ int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, struct static_route *cp; struct static_route *update = NULL; struct route_table *stable = svrf->stable[afi][safi]; + struct interface *ifp; if (!stable) return -1; @@ -182,11 +183,26 @@ int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, si->next = cp; /* check whether interface exists in system & install if it does */ - if (!ifname) + switch (si->type) { + case STATIC_IPV4_GATEWAY: + case STATIC_IPV6_GATEWAY: static_zebra_nht_register(rn, si, true); - else { - struct interface *ifp; + break; + case STATIC_IPV4_GATEWAY_IFNAME: + case STATIC_IPV6_GATEWAY_IFNAME: + ifp = if_lookup_by_name(ifname, nh_svrf->vrf->vrf_id); + if (ifp && ifp->ifindex != IFINDEX_INTERNAL) + si->ifindex = ifp->ifindex; + else + zlog_warn("Static Route using %s interface not installed because the interface does not exist in specified vrf", + ifname); + static_zebra_nht_register(rn, si, true); + break; + case STATIC_BLACKHOLE: + static_install_route(rn, si, safi); + break; + case STATIC_IFNAME: ifp = if_lookup_by_name(ifname, nh_svrf->vrf->vrf_id); if (ifp && ifp->ifindex != IFINDEX_INTERNAL) { si->ifindex = ifp->ifindex; @@ -194,6 +210,8 @@ int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, } else zlog_warn("Static Route using %s interface not installed because the interface does not exist in specified vrf", ifname); + + break; } return 1; |
