diff options
Diffstat (limited to 'zebra/zapi_msg.c')
| -rw-r--r-- | zebra/zapi_msg.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index e61e68b7fe..d207ee4046 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -564,7 +564,7 @@ int zsend_redistribute_route(int cmd, struct zserv *client, SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); api.nexthop_num = re->nexthop_active_num; } - for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next) { + for (nexthop = re->ng->nexthop; nexthop; nexthop = nexthop->next) { if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE)) continue; @@ -665,7 +665,8 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client, * nexthop we are looking up. Therefore, we will just iterate * over the top chain of nexthops. */ - for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next) + for (nexthop = re->ng->nexthop; nexthop; + nexthop = nexthop->next) if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE)) num += zserv_encode_nexthop(s, nexthop); @@ -1422,6 +1423,8 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) re->flags = api.flags; re->uptime = monotime(NULL); re->vrf_id = vrf_id; + re->ng = nexthop_group_new(); + if (api.tableid) re->table = api.tableid; else @@ -1433,6 +1436,8 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) "%s: received a route without nexthops for prefix %pFX from client %s", __func__, &api.prefix, zebra_route_string(client->proto)); + + nexthop_group_delete(&re->ng); XFREE(MTYPE_RE, re); return; } @@ -1531,7 +1536,8 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) EC_ZEBRA_NEXTHOP_CREATION_FAILED, "%s: Nexthops Specified: %d but we failed to properly create one", __PRETTY_FUNCTION__, api.nexthop_num); - nexthops_free(re->ng.nexthop); + nexthops_free(re->ng->nexthop); + nexthop_group_delete(&re->ng); XFREE(MTYPE_RE, re); return; } @@ -1573,7 +1579,8 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) flog_warn(EC_ZEBRA_RX_SRCDEST_WRONG_AFI, "%s: Received SRC Prefix but afi is not v6", __PRETTY_FUNCTION__); - nexthops_free(re->ng.nexthop); + nexthops_free(re->ng->nexthop); + nexthop_group_delete(&re->ng); XFREE(MTYPE_RE, re); return; } |
