I'm working on a larger script for new inbound load balancing support on Mikrotik and have a question for the script guru's.
Can I determine (boolean) if a specific IP is within a specific subnet, ie:
:put (10.10.10.5 & 10.0.0.0/8)
This is from the manual - :put (10.16.0.134 & ~255.255.255.0)
I know the & isn't correct above, I'm just not sure how to accomplish it. I am not sure that the scripting engine even deals with 0.0.0.0/0 style ip addresses at all actually. If I try this:
:put [:toip 10.10.10.1/32]
nothing is output. If I use the above without the /32 it works. I am assuming its not possible but want to throw this one out to the guru's to show me otherwise.
The main goal is to get a true or false if a specific ip is within a specific subnet. I am making an 'exclude' variable that stores ips that should be not matched, ie 10/8, 172.16.x.x, 192.168/16, and any others someone wants to exclude.
Sam