aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-12-18 09:59:13 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-12-18 09:59:13 +0100
commit744a03896c3276ca0bee9af5735851bb64a7f542 (patch)
tree9d5a6f469c2f0827546781fdde5d41f463484da4
parente9210acfdb9c2c66ff422bbb341a4f8ab71a796d (diff)
ipv6-update: automatically add ipv6 address list entry
-rw-r--r--doc/ipv6-update.md3
-rw-r--r--ipv6-update5
2 files changed, 8 insertions, 0 deletions
diff --git a/doc/ipv6-update.md b/doc/ipv6-update.md
index 93ada42..5295bd5 100644
--- a/doc/ipv6-update.md
+++ b/doc/ipv6-update.md
@@ -40,6 +40,9 @@ firewall rules, comment has to be "`ipv6-pool-`" and actual pool name:
/ ipv6 firewall address-list add address=2003:cf:2f0f:de00::/56 comment=ipv6-pool-isp list=extern;
+As this entry is mandatory it is created automatically if it does not exist,
+with the comment also set for list.
+
Static DNS records need a special comment to be updated. Again it has to
start with "`ipv6-pool-`" and actual pool name, followed by a comma,
"`interface=`" and the name of interface this address is connected to:
diff --git a/ipv6-update b/ipv6-update
index bbe5b2d..56dbd16 100644
--- a/ipv6-update
+++ b/ipv6-update
@@ -17,6 +17,11 @@
:local Pool [ / ipv6 pool get [ find where prefix=$PdPrefix ] name ];
:local AddrList [ / ipv6 firewall address-list find where comment=("ipv6-pool-" . $Pool) ];
+:if ([ :len $AddrList ] = 0) do={
+ :log info ("Missing ipv6 address list entry for ipv6-pool-" . $Pool . ", adding.");
+ / ipv6 firewall address-list add list=("ipv6-pool-" . $Pool) address=:: comment=("ipv6-pool-" . $Pool);
+ :set AddrList [ / ipv6 firewall address-list find where comment=("ipv6-pool-" . $Pool) ];
+}
:local OldPrefix [ / ipv6 firewall address-list get $AddrList address ];
# give the interfaces a moment to receive their addresses