:global GlobalFuncReady false;
# Git commit id & info, expected configuration version
-:global CommitId "main/610/618e021b";
+:global CommitId "main/611/a8abd15c";
:global CommitTAG "unknown";
-:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 00:30:03 05.05.2026.";
+:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 00:35:02 05.05.2026.";
# The variables are received right here.
:global GlobalConfVersion 140;
:local ListRKN "FuckRKN";
:local ListComment ("ListRKN managed by " . $ScriptName);
-
:foreach aListItem in=[/ip/firewall/address-list find list=$ListRKN] do={
/ip firewall address-list remove $aListItem;
}
-
:foreach aItem in=$arrRKN do={
-#force the dns entries to be cached
:do {
:resolve $aItem;
} on-error={
- :log error "dns resolve failure [ ip - resolve ip ]"
+ :log error "dns resolve failure [ ip - resolve ip ]";
}
-
:foreach dnsRecord in=[/ip dns cache all find where (name=$aItem)] do={
-#if it's an A records add it directly
:if ([/ip dns cache all get $dnsRecord type]="A") do={
:local newAddress [/ip dns cache all get $dnsRecord data];
:do {
/ip firewall address-list add list=$ListRKN address=$newAddress comment=$aItem;
} on-error={
- :log error "error when adding ip to list: $newAddress"
+ :log error "error when adding ip to list: $newAddress";
}
}
-
-#if it's a CNAME follow it until we get A records
:if ([/ip dns cache all get $dnsRecord type]="CNAME") do={
:local cname;
- :local nextCname
+ :local nextCname;
:set cname [/ip dns cache all find where (name=$aItem && type="CNAME")];
:set nextCname [/ip dns cache all find where (name=[/ip dns cache all get $cname data] && type="CNAME")];
-
:while ($nextCname != "") do={
:set cname $nextCname;
:set nextCname [/ip dns cache all find where (name=[/ip dns cache all get $cname data] && type="CNAME")];
}
-
-#add the a records we found
:foreach aRecord in=[/ip dns cache all find where (name=[/ip dns cache all get $cname data] && type="A")] do={
:do {
/ip firewall address-list add list=$ListRKN address=[/ip dns cache all get $aRecord data] comment=$aItem;
} on-error={
- :log error "error when adding ip to list: $newAddress"
+ :log error "error when adding ip to list: $newAddress";
}
}
}
:if ([ :len [ /system/scheduler/find where name=$ScriptName ] ] = 0) do={
:log error ($ScriptName . "System Scheduler for script: " . $ScriptName . " is NOT SET! Fix It Now!");
- /system/scheduler/add name=$ScriptName on-event="/system/script { run $ScriptName; }" comment="Update RKN DNS Looup" interval=20m policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon; start-time=[/system/clock/get date];
+ /system/scheduler/add name=$ScriptName on-event="/system/script { run $ScriptName; }" comment="Update RKN DNS Looup" interval=00:20:00 policy="ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon" start-time=startup;
}
:set dnsLookupReady true;