diff options
author | Christian Hesse <mail@eworm.de> | 2023-03-29 15:49:41 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-03-29 15:49:41 +0200 |
commit | 779b3b8872b23b784c331d7a454c86439046f5d3 (patch) | |
tree | e65b8528e820c5193d7601a927df4d18df839ce2 | |
parent | 3d0107ed2c0f03998b6ca59f3731d785f05df1e8 (diff) |
dhcp-to-dns: use better condition
The condition worked, but could match others (AAAA, NXDOMAIN, ...) as
well (though these should not exist).
The problem is that matching with `type=A` does not return any results.
For historical reasons A records have no type, thus can be matched with
`!type`. I opened an issue to fix this... (SUP-111312)
So let's assum `!type` works and `type=A` could become valid...
-rw-r--r-- | dhcp-to-dns.rsc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/dhcp-to-dns.rsc b/dhcp-to-dns.rsc index 259a904..67ecacd 100644 --- a/dhcp-to-dns.rsc +++ b/dhcp-to-dns.rsc @@ -40,7 +40,7 @@ $ScriptLock $0 false 10; } :local PlaceBefore ([ /ip/dns/static/find where (name=$CommentString or (comment=$CommentString and name=-)) type=NXDOMAIN disabled ]->0); -:foreach DnsRecord in=[ /ip/dns/static/find where comment~("^" . $CommentPrefix) !(type=CNAME) ] do={ +:foreach DnsRecord in=[ /ip/dns/static/find where comment~("^" . $CommentPrefix) (!type or type=A) ] do={ :local DnsRecordVal [ /ip/dns/static/get $DnsRecord ]; :local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ]; :if ([ :len [ /ip/dhcp-server/lease/find where mac-address=$MacAddress address=($DnsRecordVal->"address") status=bound ] ] > 0) do={ |