I'm trying to run a very simple script, but apparently I'm doing it wrongly. The steps the script should run are as follows:
- Read a list of IP addresses from an address-list
- For each of the IP address, check if it is a lease of the DHCP server
- If yes, extract the comment that the specific DHCP lease entry has
- Apply the comment to the address list entry. If not, jump to the next address
Code: Select all
:foreach key,value in [/ip firewall address-list find where list=no_internet_access] do={
:local address [/ip firewall address-list get $value address];
:local comment [/ip dhcp-server lease get [/ip dhcp-server lease find address=$address] comment];
/ip firewall address-list set [/ip firewall address-list find where address=$address] comment=$comment
}
Code: Select all
invalid internal item number
Code: Select all
:local comment [/ip dhcp-server lease get [/ip dhcp-server lease find address=$address] comment];
Code: Select all
[/ip dhcp-server lease find address=$address]
Note: I made a test by putting $address as a global variable and check its content; the content is correct, as it contains only one IP address.
Does anyone have a suggestione?
Thanks