diff options
Diffstat (limited to 'staticd/static_zebra.c')
| -rw-r--r-- | staticd/static_zebra.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index b75e1a1cdf..bd293edebc 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -47,6 +47,7 @@ /* Zebra structure to hold current status. */ struct zclient *zclient; static struct hash *static_nht_hash; +uint32_t zebra_ecmp_count = MULTIPATH_NUM; /* Inteface addition message from zebra. */ static int static_ifp_create(struct interface *ifp) @@ -168,24 +169,25 @@ static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) { struct static_nht_data *nhtd, lookup; struct zapi_route nhr; + struct prefix matched; afi_t afi = AFI_IP; - if (!zapi_nexthop_update_decode(zclient->ibuf, &nhr)) { + if (!zapi_nexthop_update_decode(zclient->ibuf, &matched, &nhr)) { zlog_err("Failure to decode nexthop update message"); return 1; } - if (nhr.prefix.family == AF_INET6) + if (matched.family == AF_INET6) afi = AFI_IP6; if (nhr.type == ZEBRA_ROUTE_CONNECT) { - if (static_nexthop_is_local(vrf_id, &nhr.prefix, - nhr.prefix.family)) + if (static_nexthop_is_local(vrf_id, &matched, + nhr.prefix.family)) nhr.nexthop_num = 0; } memset(&lookup, 0, sizeof(lookup)); - lookup.nh = &nhr.prefix; + lookup.nh = &matched; lookup.nh_vrf_id = vrf_id; nhtd = hash_lookup(static_nht_hash, &lookup); @@ -193,8 +195,8 @@ static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS) if (nhtd) { nhtd->nh_num = nhr.nexthop_num; - static_nht_reset_start(&nhr.prefix, afi, nhtd->nh_vrf_id); - static_nht_update(NULL, &nhr.prefix, nhr.nexthop_num, afi, + static_nht_reset_start(&matched, afi, nhtd->nh_vrf_id); + static_nht_update(NULL, &matched, nhr.nexthop_num, afi, nhtd->nh_vrf_id); } else zlog_err("No nhtd?"); @@ -302,12 +304,14 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg) static_nht_hash_alloc); nhtd->refcount++; - DEBUGD(&static_dbg_route, - "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, - nh->nh_vrf_id); + if (nhtd->refcount > 1) { + DEBUGD(&static_dbg_route, + "Already registered nexthop(%pFX) for %pRN %d", + &p, rn, nhtd->nh_num); + if (nhtd->nh_num) + static_nht_update(&rn->p, nhtd->nh, + nhtd->nh_num, afi, + nh->nh_vrf_id); return; } } else { @@ -323,6 +327,9 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg) static_nht_hash_free(nhtd); } + DEBUGD(&static_dbg_route, "%s nexthop(%pFX) for %pRN", + reg ? "Registering" : "Unregistering", &p, rn); + if (zclient_send_rnh(zclient, cmd, &p, false, false, nh->nh_vrf_id) == ZCLIENT_SEND_FAILURE) zlog_warn("%s: Failure to send nexthop to zebra", __func__); |
