sharpd: use zclient->nexthop_update

Same as above.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2022-11-29 12:09:45 +01:00
parent ac18d56a0b
commit 94fc9c04fc

View file

@ -666,27 +666,20 @@ static int sharp_debug_nexthops(struct zapi_route *api)
return i; return i;
} }
static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS)
static void sharp_nexthop_update(struct vrf *vrf, struct prefix *matched,
struct zapi_route *nhr)
{ {
struct sharp_nh_tracker *nht; struct sharp_nh_tracker *nht;
struct zapi_route nhr;
struct prefix matched;
if (!zapi_nexthop_update_decode(zclient->ibuf, &matched, &nhr)) {
zlog_err("%s: Decode of update failed", __func__);
return 0;
}
zlog_debug("Received update for %pFX actual match: %pFX metric: %u", zlog_debug("Received update for %pFX actual match: %pFX metric: %u",
&matched, &nhr.prefix, nhr.metric); matched, &nhr->prefix, nhr->metric);
nht = sharp_nh_tracker_get(&matched); nht = sharp_nh_tracker_get(matched);
nht->nhop_num = nhr.nexthop_num; nht->nhop_num = nhr->nexthop_num;
nht->updates++; nht->updates++;
sharp_debug_nexthops(&nhr); sharp_debug_nexthops(nhr);
return 0;
} }
static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS) static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS)
@ -1063,7 +1056,6 @@ static zclient_handler *const sharp_handlers[] = {
[ZEBRA_INTERFACE_ADDRESS_ADD] = interface_address_add, [ZEBRA_INTERFACE_ADDRESS_ADD] = interface_address_add,
[ZEBRA_INTERFACE_ADDRESS_DELETE] = interface_address_delete, [ZEBRA_INTERFACE_ADDRESS_DELETE] = interface_address_delete,
[ZEBRA_ROUTE_NOTIFY_OWNER] = route_notify_owner, [ZEBRA_ROUTE_NOTIFY_OWNER] = route_notify_owner,
[ZEBRA_NEXTHOP_UPDATE] = sharp_nexthop_update,
[ZEBRA_NHG_NOTIFY_OWNER] = nhg_notify_owner, [ZEBRA_NHG_NOTIFY_OWNER] = nhg_notify_owner,
[ZEBRA_REDISTRIBUTE_ROUTE_ADD] = sharp_redistribute_route, [ZEBRA_REDISTRIBUTE_ROUTE_ADD] = sharp_redistribute_route,
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = sharp_redistribute_route, [ZEBRA_REDISTRIBUTE_ROUTE_DEL] = sharp_redistribute_route,
@ -1088,6 +1080,7 @@ void sharp_zebra_init(void)
zclient_init(zclient, ZEBRA_ROUTE_SHARP, 0, &sharp_privs); zclient_init(zclient, ZEBRA_ROUTE_SHARP, 0, &sharp_privs);
zclient->zebra_connected = zebra_connected; zclient->zebra_connected = zebra_connected;
zclient->zebra_buffer_write_ready = sharp_zclient_buffer_ready; zclient->zebra_buffer_write_ready = sharp_zclient_buffer_ready;
zclient->nexthop_update = sharp_nexthop_update;
} }
void sharp_zebra_terminate(void) void sharp_zebra_terminate(void)