There is no function that both sets the nhg id, and sets
the ZAPI_MESSAGE_NHG flag if the nhg id is valid.
Create a ZAPI API to do this, and apply the changes wherever
needed.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
/* EVPN MAC-IP routes are installed with a L3 NHG id */
if (nhg_id && bgp_evpn_path_es_use_nhg(bgp, info, nhg_id)) {
mpinfo = NULL;
- api->nhgid = *nhg_id;
- if (*nhg_id)
- SET_FLAG(api->message, ZAPI_MESSAGE_NHG);
+ zapi_route_set_nhg_id(api, nhg_id);
} else {
mpinfo = info;
}
SET_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP);
};
+static inline void zapi_route_set_nhg_id(struct zapi_route *api,
+ uint32_t *nhg_id)
+{
+ api->nexthop_num = 0;
+ api->nhgid = *nhg_id;
+ if (api->nhgid)
+ SET_FLAG(api->message, ZAPI_MESSAGE_NHG);
+};
+
extern enum zclient_send_status
zclient_send_mlag_register(struct zclient *client, uint32_t bit_map);
extern enum zclient_send_status
/* Only send via ID if nhgroup has been successfully installed */
if (nhgid && sharp_nhgroup_id_is_installed(nhgid)) {
- SET_FLAG(api.message, ZAPI_MESSAGE_NHG);
- api.nhgid = nhgid;
+ zapi_route_set_nhg_id(&api, &nhgid);
} else {
for (ALL_NEXTHOPS_PTR(nhg, nh)) {
/* Check if we set a VNI label */