Community discussions

MikroTik App
 
msatter
Forum Guru
Forum Guru
Topic Author
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Changed scripting coding between V6 and v7

Mon Sep 20, 2021 4:13 pm

Here we can put the differences in scripting between v6 an v7 so if there thing not working anymore you can take a peek here if it already know. It saves a lot of keyboard from breakage by hitting with them on the monitor....flatscreen.

Please no discussions and just state the changes like underneath.

v6
/ip firewall nat> :put "$[:len [find routing-mark="Leak-IKEV" ]]"         
2
/ip firewall nat> :put "$[:len [find routing-mark "Leak-IKEV" ]]" 
0

v7
/ip firewall nat> :put "$[:len [find routing-mark="Leak-IKEV" ]]"         
0
/ip firewall nat> :put "$[:len [find routing-mark "Leak-IKEV" ]]" 
2
Exactly reversed behavior here.

In answer to mrz: this will work on v6 and v7. I use this to check if there are only two of them and if more, remove all matching en add these two lines.
/ip firewall nat> :put "$[:len [find routing-mark~"Leak-IKEV" ]]"  
Last edited by msatter on Mon Sep 20, 2021 4:49 pm, edited 1 time in total.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Changed scripting coding between V6 and v7

Mon Sep 20, 2021 4:37 pm

[find routing-mark "Leak-IKEV" ] is incorrect syntax to what you want to achieve. With this you are matching all rule that has routing-mark set to any value.

routing-mark="Leak-IKEV" is correct way, but unfortunately at the moment string matching is broken, it will be fixed in one of the next RC version.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Changed scripting coding between V6 and v7

Mon Sep 20, 2021 5:49 pm

What changes between 6.47.10 and 7.1rc4:
On 6.x we can define "routing-mark" at any point where it can be set, as well as NAT.
On 7.1rc4 first of all the routing table must be defined before it can be used on other sections, such as NAT.

Synthesis
# 6.47.10
:put [:len [/ip firewall nat find where routing-mark="Leak-IKEV"]]

# 7.1rc4
:put [:len [/ip firewall nat find where routing-mark=[/routing table find where name="Leak-IKEV"]]]

Who is online

Users browsing this forum: Kanzler, ko00000000001, nichky and 16 guests