Community discussions

MikroTik App
 
ShyLion
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Thu Sep 28, 2017 7:24 am

What's wrong with "where" ?

Sun Mar 03, 2019 8:57 am

What am i doing wrong?
[lion@rb_bus_008] > ip firewall filter print where chain=input and action=drop                              
Flags: X - disabled, I - invalid, D - dynamic 
 0    chain=input action=drop protocol=tcp dst-port=8728 

 1    chain=input action=drop connection-state=invalid 

 2    chain=input action=drop 
[lion@rb_bus_008] > ip firewall filter print where chain=input and action=drop and protocol=tcp
Flags: X - disabled, I - invalid, D - dynamic 
[lion@rb_bus_008] > 
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: What's wrong with "where" ?  [SOLVED]

Sun Mar 03, 2019 10:39 am

Hmmm, this is a bug that MT should look at.
It seems that som field does work fine without quotes, but some not.

So this does not work
ip firewall filter print where chain=input and action=drop and protocol=tcp
But this work:
ip firewall filter print where chain=input and action=drop and protocol="tcp"
So to make sure it works, until MT fix this bug, quote everything
ip firewall filter print where chain="input" and action="drop" and protocol="tcp"
and seems to be optional, so this works as well
ip firewall filter print where chain="input" action="drop" protocol="tcp"
 
ShyLion
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Thu Sep 28, 2017 7:24 am

Re: What's wrong with "where" ?

Sun Mar 03, 2019 12:03 pm

Thankyou, that really helps!
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7042
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: What's wrong with "where" ?

Mon Mar 04, 2019 10:27 am

When you are trying to match a string, always use quotes. Console tries to guess the type of the variable, but sometimes it is not possible and you get unexpected result.

Who is online

Users browsing this forum: No registered users and 16 guests