### Description

is_in_subnet function requires subnet param to be network address and fails for 
host address in cidr notation despite it is contained in corresponding subnet.

For example, is_in_subnet("1.2.3.2", "1.2.3.0/30") returns true
but
is_in_subnet("1.2.3.2", "1.2.3.2/30") returns false, although 1.2.3.2 is 
present in 1.2.3.2/30 and 1.2.3.2 is allowed IP of 1.2.3.0/30

Of course, "1.2.3.2/30" this is not actually a subnet specification and rather 
is IP in CIDR notation, but sometimes it is required to check if some IP 
matches specified IP with CIDR.

### Possible Solutions

It would be cool if is_in_subnet take such cases as matches. I think this 
should not break anything, because host IP and CIDR always define network 
containing specified host.
Another solution would be separate function with more relaxed behavior...

This happens on Kamailio 5.1 devel.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1250
_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to