summaryrefslogtreecommitdiff
path: root/lib/nexthop_group.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2019-05-14 15:40:27 -0700
committerStephen Worley <sworley@cumulusnetworks.com>2019-06-25 22:58:47 -0400
commite7addf02a1164499c515fdcfc8c8bb75c383ff90 (patch)
treeb15565a91cf39e4229a332eaf19bdf65c6777695 /lib/nexthop_group.c
parent6c8b51e172a67c8e575299ad493f1702a0608336 (diff)
lib: Put single nexthop copy into its own function
Put the code to copy a single nexthop into a function of its own. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'lib/nexthop_group.c')
-rw-r--r--lib/nexthop_group.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index d250e0e9b6..4575ad6f70 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -186,19 +186,8 @@ void copy_nexthops(struct nexthop **tnh, const struct nexthop *nh,
for (nh1 = nh; nh1; nh1 = nh1->next) {
nexthop = nexthop_new();
- nexthop->vrf_id = nh1->vrf_id;
- nexthop->ifindex = nh1->ifindex;
- nexthop->type = nh1->type;
- nexthop->flags = nh1->flags;
- memcpy(&nexthop->gate, &nh1->gate, sizeof(nh1->gate));
- memcpy(&nexthop->src, &nh1->src, sizeof(nh1->src));
- memcpy(&nexthop->rmap_src, &nh1->rmap_src,
- sizeof(nh1->rmap_src));
- nexthop->rparent = rparent;
- if (nh1->nh_label)
- nexthop_add_labels(nexthop, nh1->nh_label_type,
- nh1->nh_label->num_labels,
- &nh1->nh_label->label[0]);
+ nexthop_copy(nexthop, nh1, rparent);
+
nexthop_add(tnh, nexthop);
if (CHECK_FLAG(nh1->flags, NEXTHOP_FLAG_RECURSIVE))