Page 1 of 1

converting a dynamic list to a static list

Posted: Tue Jun 24, 2008 4:11 pm
by adm1329
I have a handful of users that are allowed to connect to MSN Messenger, I am trying to block it for other users. I looked into Layer 7 filters, but I couldn't get it to work. What I finally decided to do was build a list of all MSN Messenger servers by creating a dynamic list everytime something tries to connect to an ip on port 1863 it adds the destination ip to the list. So my problem is on the rare occasion the router has to be rebooted the list is lost. I have been converting it by hand, but that is a very time consuming job.

I found an old post about it http://forum.mikrotik.com/viewtopic.php ... +to+static and have played around with the example trying to get it to work, but so far no luck.

This is the script I've got, but it's not working can anyone tell me why?
:foreach i in=[/ip firewall address-list find list=msn ]\
do= { \
:set w [/ip firewall address-list get $i address]
/ip firewall address-list remove [/ip firewall address-list find address=$w]
/ip firewall address-list add list=msn-static address=$w
}

I'm using a RB532 with OS 3.4.

Re: converting a dynamic list to a static list

Posted: Tue Jun 24, 2008 7:56 pm
by changeip
3.4 scripting is very buggy and mostly unusable. Upgrade to the latest and report back.

Re: converting a dynamic list to a static list

Posted: Tue Oct 07, 2008 4:09 pm
by adm1329
So I have finally got back around to this, I recently upgraded to 3.13 and have the same result. The only thing I can tell is that it wants the ":set w" to be ":set i"

Re: converting a dynamic list to a static list

Posted: Tue Oct 07, 2008 4:13 pm
by mrz
You have to declare w before usage.

Re: converting a dynamic list to a static list

Posted: Tue Oct 07, 2008 4:52 pm
by adm1329
thank you! being a newb to scripting that was easy to overlook, or maybe it was just easy for me to overlook