[sr-dev] [kamailio/kamailio] IPOPS is_in_subnet function doesn't match host address in cidr notation (#1250)

kbdfck notifications at github.com
Wed Sep 27 19:33:05 CEST 2017


### 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20170927/ca2e6002/attachment.html>


More information about the sr-dev mailing list