<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
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>
</body>
</html>