return -1;
}
+static int zclient_nexthop_update(ZAPI_CALLBACK_ARGS)
+{
+ struct vrf *vrf = vrf_lookup_by_id(vrf_id);
+ struct prefix match;
+ struct zapi_route route;
+
+ if (!vrf) {
+ zlog_warn("nexthop update for unknown VRF ID %u", vrf_id);
+ return 0;
+ }
+
+ if (!zapi_nexthop_update_decode(zclient->ibuf, &match, &route)) {
+ zlog_err("failed to decode nexthop update");
+ return -1;
+ }
+
+ if (zclient->nexthop_update)
+ zclient->nexthop_update(vrf, &match, &route);
+
+ return 0;
+}
+
static zclient_handler *const lib_handlers[] = {
/* fundamentals */
[ZEBRA_CAPABILITIES] = zclient_capability_decode,
[ZEBRA_INTERFACE_UP] = zclient_interface_up,
[ZEBRA_INTERFACE_DOWN] = zclient_interface_down,
+ /* NHT pre-decode */
+ [ZEBRA_NEXTHOP_UPDATE] = zclient_nexthop_update,
+
/* BFD */
[ZEBRA_BFD_DEST_REPLAY] = zclient_bfd_session_replay,
[ZEBRA_INTERFACE_BFD_DEST_UPDATE] = zclient_bfd_session_update,
typedef int (zclient_handler)(ZAPI_CALLBACK_ARGS);
/* clang-format on */
+struct zapi_route;
+
/* Structure for the zebra client. */
struct zclient {
/* The thread master we schedule ourselves on */
/* Pointer to the callback functions. */
void (*zebra_connected)(struct zclient *);
void (*zebra_capabilities)(struct zclient_capabilities *cap);
+ void (*nexthop_update)(struct vrf *vrf, struct prefix *match,
+ struct zapi_route *nhr);
int (*handle_error)(enum zebra_error_types error);