I have a router CCR1009-8G-1S-1S+ Software version - 6.37.1. I need to manipulate the firewall address-list from the script. I have the following configuration:
[admin@MikroTik] > ip firewall address-list print
Flags: X - disabled, D - dynamic
LIST ADDRESS TIMEOUT
0 ;;; devads.skypeassets.net
host_skype_ad 0.0.0.0
1 ;;; devapps.skype.net
host_skype_ad 1.1.1.1
2 ;;; qawww.skypeassets.net
host_skype_ad 2.2.2.2
3 ;;; qaapi.skype.net
host_skype_ad 3.4.5.6
4 ;;; preads.skypeassets.net
host_skype_ad 3.4.5.7
5 ;;; static.skypeassets.com
host_skype_ad 3.4.5.8
6 ;;; serving.plexop.net
host_skype_ad 3.4.5.2
7 ;;; preg.bforex.com
host_skype_ad 3.4.5.1
8 ;;; ads1.msads.net
host_skype_ad 3.4.5.62
9 ;;; flex.msn.com
host_skype_ad 3.4.5.61
And have the folowing script:
[admin@MikroTik] > system script print
Flags: I - invalid
0 name="resolvehostnames" owner="admin" policy=read,write last-started=oct/04/2016 09:39:00 run-count=54 source=
define variables
:local list
:local comment
:local newip
:local oldip
Loop through each entry in the address list.
:foreach i in=[/ip firewall address-list find] do={
Get the first five characters of the list name
:set list [:pick [/ip firewall address-list get $i list] 0 5]
If they're 'host_', then we've got a match - process it
:if ($list = "host_") do={
Get the comment for this address list item (this is the host name to use)
:set comment [/ip firewall address-list get $i comment]
:set oldip [/ip firewall address-list get $i address]
Resolve it and set the address list entry accordingly.
: if ($newip != $oldip) do={:set newip [:resolve $comment]
/ip firewall address-list set $i address=$newip}
}
}
Sorry for that, but I can't understand why the command:
[admin@MikroTik] > ip firewall address-list find
[admin@MikroTik] >
gives me nothing...
There is a topic Command find does not work with the bug in RB751U-2HnD Software version: 5.20. Does it the same ?