summaryrefslogtreecommitdiff
path: root/lib/nexthop.h
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-07-01 15:55:16 -0400
committerMark Stapp <mjs@voltanet.io>2020-07-17 13:12:33 -0400
commit0cac0cf4a7b60c889221c856087db5861a6bc5b7 (patch)
treecb451db3f02abbd72ad234e56ae73b71ff22b456 /lib/nexthop.h
parent474aebd9391588d4cd5169187fd0e9abc812de42 (diff)
lib: add nexthop_str2backup
Add an api to convert an input list into an array of backup nexthop indexes; useful for cli input. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'lib/nexthop.h')
-rw-r--r--lib/nexthop.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/nexthop.h b/lib/nexthop.h
index e40c27d873..eaf67e6af1 100644
--- a/lib/nexthop.h
+++ b/lib/nexthop.h
@@ -235,6 +235,15 @@ extern struct nexthop *nexthop_dup(const struct nexthop *nexthop,
extern struct nexthop *nexthop_dup_no_recurse(const struct nexthop *nexthop,
struct nexthop *rparent);
+/*
+ * Parse one or more backup index values, as comma-separated numbers,
+ * into caller's array of uint8_ts. The array must be NEXTHOP_MAX_BACKUPS
+ * in size. Mails back the number of values converted, and returns 0 on
+ * success, <0 if an error in parsing.
+ */
+int nexthop_str2backups(const char *str, int *num_backups,
+ uint8_t *backups);
+
#ifdef _FRR_ATTRIBUTE_PRINTFRR
#pragma FRR printfrr_ext "%pNH" (struct nexthop *)
#endif