mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-21 01:15:42 +02:00
dhcp-to-dns: explicitly expect type=A...
... which is provided since 7.16beta7 (but require next stable release
7.16 as that is available meanwhile).
I had this on my wishlist for a long time, and opened an issue in
March 2023 about it (SUP-111312).
Back then I changed the code to support both, see commit
779b3b8872
.
This commit is contained in:
parent
e851cd5ad0
commit
6548f83ef4
2 changed files with 5 additions and 5 deletions
|
@ -4,7 +4,7 @@
|
|||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
#
|
||||
# provides: lease-script, order=20
|
||||
# requires RouterOS, version=7.14
|
||||
# requires RouterOS, version=7.16
|
||||
#
|
||||
# check DHCP leases and add/remove/update DNS entries
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-to-dns.md
|
||||
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
: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 . "\\b") (!type or type=A) ] do={
|
||||
:foreach DnsRecord in=[ /ip/dns/static/find where comment~("^" . $CommentPrefix . "\\b") type=A ] do={
|
||||
:local DnsRecordVal [ /ip/dns/static/get $DnsRecord ];
|
||||
:local DnsRecordInfo [ $ParseKeyValueStore ($DnsRecordVal->"comment") ];
|
||||
:local MacInServer ($DnsRecordInfo->"macaddress" . " in " . $DnsRecordInfo->"server");
|
||||
|
@ -83,7 +83,7 @@
|
|||
:local FullCN ($HostName . "." . $NetDomain);
|
||||
:local MacInServer ($LeaseVal->"active-mac-address" . " in " . $LeaseVal->"server");
|
||||
|
||||
:local DnsRecord [ /ip/dns/static/find where comment=$Comment (!type or type=A) ];
|
||||
:local DnsRecord [ /ip/dns/static/find where comment=$Comment type=A ];
|
||||
:if ([ :len $DnsRecord ] > 0) do={
|
||||
:local DnsRecordVal [ /ip/dns/static/get $DnsRecord ];
|
||||
|
||||
|
@ -116,7 +116,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
:if ([ :len [ /ip/dns/static/find where name=$FullA (!type or type=A) ] ] > 1) do={
|
||||
:if ([ :len [ /ip/dns/static/find where name=$FullA type=A ] ] > 1) do={
|
||||
$LogPrintOnce warning $ScriptName ("The name '" . $FullA . "' appeared in more than one A record!");
|
||||
}
|
||||
} else={
|
||||
|
|
|
@ -4,7 +4,7 @@ Create DNS records for DHCP leases
|
|||
[](https://github.com/eworm-de/routeros-scripts/stargazers)
|
||||
[](https://github.com/eworm-de/routeros-scripts/network)
|
||||
[](https://github.com/eworm-de/routeros-scripts/watchers)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://mikrotik.com/download/changelogs/)
|
||||
[](https://t.me/routeros_scripts)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A4ZXBD6YS2W8J)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue