diff options
author | Christian Hesse <mail@eworm.de> | 2020-12-18 10:11:18 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-12-18 10:11:18 +0100 |
commit | cb72eccc6cf66cab0412f7bd696aa079fffc5180 (patch) | |
tree | 8fd805bd3d0735a2f699428c22c7ef44da250e1c | |
parent | 503dc3c32ccd7c75086bec878fd9149a8632c82c (diff) |
ipv6-update: update interface specific address list entries
-rw-r--r-- | doc/ipv6-update.md | 6 | ||||
-rw-r--r-- | ipv6-update | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/ipv6-update.md b/doc/ipv6-update.md index 5295bd5..f736433 100644 --- a/doc/ipv6-update.md +++ b/doc/ipv6-update.md @@ -43,6 +43,12 @@ firewall rules, comment has to be "`ipv6-pool-`" and actual pool name: As this entry is mandatory it is created automatically if it does not exist, with the comment also set for list. +Address list entries for specific interfaces can be updated as well. The +interface needs to get its address from pool `isp` and the address list entry +has to be associated to an interface in comment: + + / ipv6 firewall address-list add address=2003:cf:2f0f:de01::/64 comment="ipv6-pool-isp, interface=br-local" list=local; + 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 1baa0a4..2224a11 100644 --- a/ipv6-update +++ b/ipv6-update @@ -31,6 +31,18 @@ # give the interfaces a moment to receive their addresses :delay 2s; + :foreach ListEntry in=[ / ipv6 firewall address-list find where comment~("^ipv6-pool-" . $Pool . ",") ] do={ + :local ListEntryVal [ / ipv6 firewall address-list get $ListEntry ]; + :local Comment [ $ParseKeyValueStore ($ListEntryVal->"comment") ]; + + :local Address [ / ipv6 address find where from-pool=$Pool interface=($Comment->"interface") ]; + :if ([ :len $Address ] = 1) do={ + :set Address [ / ipv6 address get $Address address ]; + :log info ("Updating IPv6 address list with new IPv6 prefix " . $Address . " from interface " . ($Comment->"interface")); + / ipv6 firewall address-list set address=$Address $ListEntry; + } + } + :foreach Record in=[ / ip dns static find where comment~("^ipv6-pool-" . $Pool . ",") ] do={ :local RecordVal [ / ip dns static get $Record ]; :local Comment [ $ParseKeyValueStore ($RecordVal->"comment") ]; |