diff options
Diffstat (limited to 'staticd/static_zebra.c')
| -rw-r--r-- | staticd/static_zebra.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index c6da00418b..13c04259d7 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -43,6 +43,8 @@ #include "static_nht.h" #include "static_vty.h" +bool debug; + /* Zebra structure to hold current status. */ struct zclient *zclient; static struct hash *static_nht_hash; @@ -154,18 +156,23 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) switch (note) { case ZAPI_ROUTE_FAIL_INSTALL: + static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED); zlog_warn("%s: Route %s failed to install for table: %u", __PRETTY_FUNCTION__, buf, table_id); break; case ZAPI_ROUTE_BETTER_ADMIN_WON: + static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED); zlog_warn("%s: Route %s over-ridden by better route for table: %u", __PRETTY_FUNCTION__, buf, table_id); break; case ZAPI_ROUTE_INSTALLED: + static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED); break; case ZAPI_ROUTE_REMOVED: + static_nht_mark_state(&p, vrf_id, STATIC_NOT_INSTALLED); break; case ZAPI_ROUTE_REMOVE_FAIL: + static_nht_mark_state(&p, vrf_id, STATIC_INSTALLED); zlog_warn("%s: Route %s failure to remove for table: %u", __PRETTY_FUNCTION__, buf, table_id); break; @@ -210,7 +217,8 @@ static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) if (nhtd) { nhtd->nh_num = nhr.nexthop_num; - static_nht_update(&nhr.prefix, nhr.nexthop_num, afi, + static_nht_reset_start(&nhr.prefix, afi, nhtd->nh_vrf_id); + static_nht_update(NULL, &nhr.prefix, nhr.nexthop_num, afi, nhtd->nh_vrf_id); } else zlog_err("No nhtd?"); @@ -267,7 +275,8 @@ static void static_nht_hash_free(void *data) XFREE(MTYPE_TMP, nhtd); } -void static_zebra_nht_register(struct static_route *si, bool reg) +void static_zebra_nht_register(struct route_node *rn, + struct static_route *si, bool reg) { struct static_nht_data *nhtd, lookup; uint32_t cmd; @@ -315,8 +324,11 @@ void static_zebra_nht_register(struct static_route *si, bool reg) static_nht_hash_alloc); nhtd->refcount++; - if (nhtd->refcount > 1) { - static_nht_update(nhtd->nh, nhtd->nh_num, + if (debug) + zlog_debug("Registered nexthop(%pFX) for %pRN %d", &p, + rn, nhtd->nh_num); + if (nhtd->refcount > 1 && nhtd->nh_num) { + static_nht_update(&rn->p, nhtd->nh, nhtd->nh_num, afi, si->nh_vrf_id); return; } @@ -389,6 +401,8 @@ extern void static_zebra_route_add(struct route_node *rn, api_nh->vrf_id = si->nh_vrf_id; api_nh->onlink = si->onlink; + si->state = STATIC_SENT_TO_ZEBRA; + switch (si->type) { case STATIC_IFNAME: if (si->ifindex == IFINDEX_INTERNAL) |
