summaryrefslogtreecommitdiff
path: root/src/validators/ipv6-srv6-segments
diff options
context:
space:
mode:
Diffstat (limited to 'src/validators/ipv6-srv6-segments')
-rw-r--r--src/validators/ipv6-srv6-segments13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/validators/ipv6-srv6-segments b/src/validators/ipv6-srv6-segments
new file mode 100644
index 0000000..e72a4f9
--- /dev/null
+++ b/src/validators/ipv6-srv6-segments
@@ -0,0 +1,13 @@
+#!/bin/sh
+segments="$1"
+export IFS="/"
+
+for ipv6addr in $segments; do
+ ipaddrcheck --is-ipv6-single $ipv6addr
+ if [ $? -gt 0 ]; then
+ echo "Error: $1 is not a valid IPv6 address"
+ exit 1
+ fi
+done
+exit 0
+