Community discussions

MikroTik App
 
Shumkov
just joined
Topic Author
Posts: 15
Joined: Tue Oct 01, 2019 9:08 pm

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.
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
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...

Who is online

Users browsing this forum: marcelofares and 19 guests