<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
You can create an external perl script that to the job.<br>
<br>
<div class="moz-cite-prefix">Il 30/01/2014 12.38, Edwin Haselhoff ha
scritto:<br>
</div>
<blockquote cite="mid:52EA39D2.6020600@gmail.com" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Stefano,<br>
<br>
I tested the permission module but changes to the table are not
'real time', I have to reload the table every time (or did I
miss something?).<br>
<br>
<br>
<br>
Stefano Pisani schreef op 30-1-2014 12:32:<br>
</div>
<blockquote cite="mid:52EA385D.1050600@omnianet.it" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Hi,<br>
use module permission.<br>
<br>
s<br>
<br>
Il 30/01/2014 12.21, Edwin Haselhoff ha scritto:<br>
</div>
<blockquote cite="mid:52EA35C0.8010406@gmail.com" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
Hi all,<br>
<br>
For security reasons I want to check if the $si ip is part of
ip and subnet of a subscriber so added '$(avp(sourceip)' and
'$(avp(sourceip_mask)' to the subscriber table.<br>
<small>(I know I can use permissions module, but this is in
cache and we like to make changes real time without haveing
to reload the table in cache)</small><br>
<br>
I tried something like this where sourceip_net and
sourceip_mask is the ip subnet belonging to the subscriber:<br>
<br>
$si = 10.100.5.42
(00001010000101000001111000101010)<br>
$avp(sourceip_net) = 10.20.30.40;
(00001010000101000001111000101000)<br>
$avp(sourceip_mask) = 29;<br>
<br>
if($si{ip.isip} &&
$(si{ip.pton}{s.substr,0,$avp(sourceip_mask)}) ==
$(avp(sourceip_net){ip.pton}{s.substr,0,$avp(sourceip_mask)}))<br>
{<br>
xlog("L_INFO", " ip $si belongs to $au\n");<br>
}<br>
else<br>
{<br>
xlog("L_INFO", " ip $si does not belong to $au\n");<br>
sl_send_reply("403", "Forbidden");<br>
exit;<br>
}<br>
<br>
<br>
So I expect the ip is valid and the comparison is true
(00001010000101000001111000101 =
00001010000101000001111000101) but it doesn't seem to work
like I expect.<br>
<br>
It's difficult to output ip.pton to xlog (unreadable). Does it
output a binary format like I expect?<br>
<br>
Any ideas how to accomplish this?<br>
<br>
Thanks,<br>
<br>
Edwin<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>