summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xsrc/pd_manager.sh31
-rwxr-xr-xsrc/pd_manager_run.sh4
2 files changed, 35 insertions, 0 deletions
diff --git a/src/pd_manager.sh b/src/pd_manager.sh
new file mode 100755
index 0000000..6260c3f
--- /dev/null
+++ b/src/pd_manager.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+delay=0.05
+IFS=","
+
+hour="$(( 3600 ))"
+day="$(( 24 * $hour ))"
+#preferred="$(( 5 * $hour ))"
+#valid="$(( $preferred + 10 * $hour ))"
+preferred="$(( 1 * $day ))"
+valid="$(( $preferred + 1 * $day ))"
+
+output=""
+
+add_prefix() {
+ local prefix=$1
+ res="$prefix,$preferred,$valid,"
+ /bin/echo ">$res" >> ./pd_manager.log
+ output="$output$res\n"
+}
+
+read duid iaid
+read prefix res1 res2
+echo "<$duid $iaid $prefix $res1 $res2" >> ./pd_manager.log
+
+sleep $delay
+add_prefix "2001:0470:de6f:1234::/64"
+add_prefix "2001:0470:de17:1234::/64"
+/bin/echo -e -n "$output\n\n"
+sleep $delay
+exit 0
diff --git a/src/pd_manager_run.sh b/src/pd_manager_run.sh
new file mode 100755
index 0000000..53ab4c6
--- /dev/null
+++ b/src/pd_manager_run.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+socat -v TCP-LISTEN:1234,reuseport,fork EXEC:./pd_manager.sh
+