Community discussions

MikroTik App
 
User avatar
Shumkov
just joined
Topic Author
Posts: 14
Joined: Tue Oct 01, 2019 9:08 pm
Location: Russian Federation

Feature request: logical operator "in" for IP ranges

Sat Nov 28, 2020 9:01 am

put (192.168.0.1 in 192.168.0.0/24)
Output:
true
put (192.168.0.1 in 192.168.0.1-192.168.0.254)
Output:
false

Why?

This feature can be useful if you need to check if a conditional IP address is included in an IP pool consisting of several address ranges.
RB951G-2HnD / RouterOS 6.46.8 (Long-term)
 
User avatar
eworm
Forum Veteran
Forum Veteran
Posts: 738
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Feature request: logical operator "in" for IP ranges

Sat Dec 19, 2020 1:10 am

Let's have a looks:
[admin@mikrotik] > :put (192.168.0.1-192.168.0.254)
4294967043
The addresses are subtracted, so your original command evaluated to:
[admin@mikrotik] > :put (192.168.0.1 in 4294967043) 
false
Wondering if bitwise operators could help...
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts

Who is online

Users browsing this forum: No registered users and 34 guests