summaryrefslogtreecommitdiff
path: root/lib/nexthop.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nexthop.c')
-rw-r--r--lib/nexthop.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c
index 4cea14955a..405db6a5cb 100644
--- a/lib/nexthop.c
+++ b/lib/nexthop.c
@@ -425,6 +425,23 @@ uint32_t nexthop_hash(const struct nexthop *nexthop)
return key;
}
+void nexthop_copy(struct nexthop *copy, const struct nexthop *nexthop,
+ struct nexthop *rparent)
+{
+ copy->vrf_id = nexthop->vrf_id;
+ copy->ifindex = nexthop->ifindex;
+ copy->type = nexthop->type;
+ copy->flags = nexthop->flags;
+ memcpy(&copy->gate, &nexthop->gate, sizeof(nexthop->gate));
+ memcpy(&copy->src, &nexthop->src, sizeof(nexthop->src));
+ memcpy(&copy->rmap_src, &nexthop->rmap_src, sizeof(nexthop->rmap_src));
+ copy->rparent = rparent;
+ if (nexthop->nh_label)
+ nexthop_add_labels(copy, nexthop->nh_label_type,
+ nexthop->nh_label->num_labels,
+ &nexthop->nh_label->label[0]);
+}
+
/*
* nexthop printing variants:
* %pNHvv