summaryrefslogtreecommitdiff
path: root/zebra/zapi_msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zapi_msg.c')
-rw-r--r--zebra/zapi_msg.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index d207ee4046..ecbf39dda0 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -522,7 +522,7 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
struct zapi_route api;
struct zapi_nexthop *api_nh;
struct nexthop *nexthop;
- int count = 0;
+ uint8_t count = 0;
afi_t afi;
size_t stream_size =
MAX(ZEBRA_MAX_PACKET_SIZ, sizeof(struct zapi_route));
@@ -559,11 +559,6 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
memcpy(&api.src_prefix, src_p, sizeof(api.src_prefix));
}
- /* Nexthops. */
- if (re->nexthop_active_num) {
- SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
- api.nexthop_num = re->nexthop_active_num;
- }
for (nexthop = re->ng->nexthop; nexthop; nexthop = nexthop->next) {
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
continue;
@@ -595,6 +590,12 @@ int zsend_redistribute_route(int cmd, struct zserv *client,
count++;
}
+ /* Nexthops. */
+ if (count) {
+ SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
+ api.nexthop_num = count;
+ }
+
/* Attributes. */
SET_FLAG(api.message, ZAPI_MESSAGE_DISTANCE);
api.distance = re->distance;