return;
}
-static bool zapi_msg_get_nhg(struct zapi_route *api, struct nexthop_group **ng)
-{
- if (!CHECK_FLAG(api->message, ZAPI_MESSAGE_NHG))
- return false;
-
- /* TODO lookup the ng from api->nhgid */
- *ng = NULL;
- return true;
-}
-
static void zread_route_add(ZAPI_HANDLER_ARGS)
{
struct stream *s;
zebra_route_string(client->proto), &api.prefix);
}
- if (zapi_msg_get_nhg(&api, &ng)
+ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NHG))
+ re->nhe_id = api.nhgid;
+
+ if (!re->nhe_id
|| !zapi_read_nexthops(client, &api.prefix, api.nexthops, api.flags,
api.message, api.nexthop_num,
api.backup_nexthop_num, &ng, NULL)
return;
}
- /* Include backup info with the route. We use a temporary nhe here;
+ /*
+ * If we have an ID, this proto owns the NHG it sent along with the
+ * route, so we just send the ID into rib code with it.
+ *
+ * Havent figured out how to handle backup NHs with this yet, so lets
+ * keep that separate.
+ * Include backup info with the route. We use a temporary nhe here;
* if this is a new/unknown nhe, a new copy will be allocated
* and stored.
*/
- zebra_nhe_init(&nhe, afi, ng->nexthop);
- nhe.nhg.nexthop = ng->nexthop;
- nhe.backup_info = bnhg;
+ if (!re->nhe_id) {
+ zebra_nhe_init(&nhe, afi, ng->nexthop);
+ nhe.nhg.nexthop = ng->nexthop;
+ nhe.backup_info = bnhg;
+ }
ret = rib_add_multipath_nhe(afi, api.safi, &api.prefix, src_p,
re, &nhe);