diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-05-15 00:40:27 +0200 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-06-26 04:58:47 +0200 |
commit | e7addf02a1164499c515fdcfc8c8bb75c383ff90 (patch) | |
tree | b15565a91cf39e4229a332eaf19bdf65c6777695 /lib/nexthop.c | |
parent | lib: Add a couple functions to nexthop_group.c (diff) | |
download | frr-e7addf02a1164499c515fdcfc8c8bb75c383ff90.tar.xz frr-e7addf02a1164499c515fdcfc8c8bb75c383ff90.zip |
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.c')
-rw-r--r-- | lib/nexthop.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/nexthop.c b/lib/nexthop.c index 4cea14955..405db6a5c 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(©->gate, &nexthop->gate, sizeof(nexthop->gate)); + memcpy(©->src, &nexthop->src, sizeof(nexthop->src)); + memcpy(©->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 |