diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-05-01 17:56:23 -0400 | 
|---|---|---|
| committer | Stephen Worley <sworley@cumulusnetworks.com> | 2020-09-28 12:40:59 -0400 | 
| commit | 27141ea94e4ec770f2df8cca3840ac8c3bc101c1 (patch) | |
| tree | 7b0e90c7866fcf7f4cf092ca9c21db34ebbdf97f /zebra/zapi_msg.c | |
| parent | 2f35a820bf51f114c3c382f65c2dd3e1e9b67194 (diff) | |
lib, zebra: Add ability to send down a nhgid over route install
Modify the send down of a route to use the nexthop group id
if we have one associated with the route.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zapi_msg.c')
| -rw-r--r-- | zebra/zapi_msg.c | 22 | 
1 files changed, 17 insertions, 5 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 2d04da5052..7c00ae1032 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1806,6 +1806,16 @@ stream_failure:  	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; @@ -1851,8 +1861,9 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)  	else  		re->table = zvrf->table_id; -	if (!CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP) -	    || api.nexthop_num == 0) { +	if (!CHECK_FLAG(api.message, ZAPI_MESSAGE_NHG) +	    && (!CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP) +		|| api.nexthop_num == 0)) {  		flog_warn(EC_ZEBRA_RX_ROUTE_NO_NEXTHOPS,  			  "%s: received a route without nexthops for prefix %pFX from client %s",  			  __func__, &api.prefix, @@ -1871,9 +1882,10 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)  				zebra_route_string(client->proto), &api.prefix);  	} -	if (!zapi_read_nexthops(client, &api.prefix, api.nexthops, api.flags, -				api.message, api.nexthop_num, -				api.backup_nexthop_num, &ng, NULL) +	if (zapi_msg_get_nhg(&api, &ng) +	    || !zapi_read_nexthops(client, &api.prefix, api.nexthops, api.flags, +				   api.message, api.nexthop_num, +				   api.backup_nexthop_num, &ng, NULL)  	    || !zapi_read_nexthops(client, &api.prefix, api.backup_nexthops,  				   api.flags, api.message,  				   api.backup_nexthop_num,  | 
