[OpenSIPS-Users] check if ip address belongs to ip and subnet subscriber

Vlad Paiu vladpaiu at opensips.org
Tue Feb 4 12:47:46 CET 2014


Hello,

Internally, when using ip.pton, OpenSIPS stores the binary 
representation of the IP as a character array ( due to the different 
size of IPv4 vs IPv6 ), so using the & will not work properly - that's 
why you're code snippet is not working as expected.  Will try to look 
and see how to fix this - if possible at all.

In the mean time, I'd strongly suggest using the permissions module - 
there is no performance penalty when reloading the address table ( while 
the new table info is loading, OpenSIPS will hold the old table info in 
memory , and once the loading is done there new and old IP lists will 
just be swapped ).

I'd suggest having a address groupid integer stored in the subscriber 
table which needs be added in the load_credentials param ( to be loaded 
at auth time ), and then run
     check_source_address("$avp(subscriber_grp)")

Best Regards,

Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com

On 04.02.2014 09:24, Edwin wrote:
> Vlad,
>
> The $avp(sourceip_net) in the test was 255.255.255.0. I want to use a
> netmask so clients can use any ip from the ip block we have assigned them.
>
> I'm also testing the permission module (as Stefano suggested) which is of
> course perfect in this case. The only thing I 'worry about' is that
> everytime a ip is changed in the address table and we hit the 'address
> reload' is this has an impact on a live system with many registrations per
> second... (so will there be a little timeout or does the process seamless
> continue). This because clients can change there own ip / subnet in a web
> based management system.
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/check-if-ip-address-belongs-to-ip-and-subnet-subscriber-tp7589375p7589419.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list