From f00554ed563b8a4ce0cc7fff7ea107d3ae8aa6b1 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Wed, 8 May 2024 16:41:05 +0200 Subject: lib: Add function to copy an SRv6 locator Add a new function to copy an SRv6 locator. Signed-off-by: Carmine Scarpitta --- lib/srv6.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/srv6.c') diff --git a/lib/srv6.c b/lib/srv6.c index abaff7eab..1f485fb8a 100644 --- a/lib/srv6.c +++ b/lib/srv6.c @@ -141,6 +141,21 @@ struct srv6_locator_chunk *srv6_locator_chunk_alloc(void) return chunk; } +void srv6_locator_copy(struct srv6_locator *copy, + const struct srv6_locator *locator) +{ + strlcpy(copy->name, locator->name, sizeof(locator->name)); + copy->prefix = locator->prefix; + copy->block_bits_length = locator->block_bits_length; + copy->node_bits_length = locator->node_bits_length; + copy->function_bits_length = locator->function_bits_length; + copy->argument_bits_length = locator->argument_bits_length; + copy->algonum = locator->algonum; + copy->current = locator->current; + copy->status_up = locator->status_up; + copy->flags = locator->flags; +} + void srv6_locator_free(struct srv6_locator *locator) { if (locator) { -- cgit v1.2.3