Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: Refactor memory allocation in zebra_rnh.c (backport #14798) #14805

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions zebra/zebra_rnh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,11 +1425,39 @@ void show_nexthop_json_helper(json_object *json_nexthop,
nexthop->nh_srv6->seg6local_action));
json_object_object_add(json_nexthop, "seg6local",
json_seg6local);
<<<<<<< HEAD

json_seg6 = json_object_new_object();
json_object_string_addf(json_seg6, "segs", "%pI6",
&nexthop->nh_srv6->seg6_segs);
json_object_object_add(json_nexthop, "seg6", json_seg6);
=======
if (nexthop->nh_srv6->seg6_segs &&
nexthop->nh_srv6->seg6_segs->num_segs == 1) {
json_seg6 = json_object_new_object();
json_object_string_addf(json_seg6, "segs", "%pI6",
&nexthop->nh_srv6->seg6_segs
->seg[0]);
json_object_object_add(json_nexthop, "seg6", json_seg6);
} else {
if (nexthop->nh_srv6->seg6_segs) {
json_segs = json_object_new_array();
for (int seg_idx = 0;
seg_idx <
nexthop->nh_srv6->seg6_segs->num_segs;
seg_idx++)
json_object_array_add(
json_segs,
json_object_new_stringf(
"%pI6",
&nexthop->nh_srv6
->seg6_segs
->seg[seg_idx]));
json_object_object_add(json_nexthop, "seg6",
json_segs);
}
}
>>>>>>> 531866c53 (zebra: Refactor memory allocation in zebra_rnh.c)
}
}

Expand Down
Loading