<div dir="ltr">Hi,<div>It looks from the code that the subnet IP address must be masked.</div><div><a href="https://github.com/kamailio/kamailio/blob/master/src/modules/ipops/ipops_mod.c#L393">https://github.com/kamailio/kamailio/blob/master/src/modules/ipops/ipops_mod.c#L393</a><br></div><div><br></div><div><div><span style="white-space:pre">     </span>if ((ip->s_addr & ipv4_mask) == net_addr.s_addr)</div><div><span style="white-space:pre">               </span>return 1;</div><div><span style="white-space:pre">     </span>return 0;</div></div><div><br></div><div>So <a href="http://10.1.1.0/24">10.1.1.0/24</a> will match 10.1.1.241</div><div>but <a href="http://10.1.1.128/24">10.1.1.128/24</a> will NOT match 10.1.1.241</div><div><br></div><div>Regards,</div><div>Hugh</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 March 2018 at 12:39, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
maybe it is what Hugh said in his response, respectively that the subnet<br>
needs to have the lowest bits masked.<br>
<br>
Can you run with debug=3? Maybe ipops module writes more debug message<br>
to track it.<br>
<br>
Cheers,<br>
Daniel<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 14.03.18 13:33, <a href="mailto:volga629@networklab.ca">volga629@networklab.ca</a> wrote:<br>
> Hello Daniel,<br>
> I adjusted var to $dd and still not match<br>
><br>
>        if(is_method("INVITE")) {<br>
>                #$avp(destIP)=$(du{s.select,1,<wbr>:});<br>
>                #$avp(subnet) = $avp(destIP) + "/16";<br>
>                #xlog("L_INFO", "Initial Request: [$rm] destination ip<br>
> [$avp(destIP)] and sourceip [$si]\n");<br>
>                xlog("L_INFO", "Initial Request: [$rm] destination ip<br>
> [$dd] and sourceip [$si]\n");<br>
>                if(!is_in_subnet("$si", "$dd/16")) {<br>
>                        xlog("L_INFO", "Subnets not match processing<br>
> rtp...destination ip [$dd] and source ip [$si]\n");<br>
>                        route(RTP_MANAGE);<br>
>                }<br>
>        }<br>
><br>
><br>
> Mar 14 13:21:06 sbc00 /usr/sbin/kamailio[1104]: {1 2 INVITE<br>
> Edz14KmQgLQpO5L323Wodw..} INFO: <script>: Initial Request: [INVITE]<br>
> destination ip [10.0.1.241] and sourceip [10.0.1.242]<br>
> Mar 14 13:21:06 sbc00 /usr/sbin/kamailio[1104]: {1 2 INVITE<br>
> Edz14KmQgLQpO5L323Wodw..} INFO: <script>: Subnets not match processing<br>
> rtp...destination ip [<a href="http://10.0.1.241/16" rel="noreferrer" target="_blank">10.0.1.241/16</a>] and source ip [10.0.1.242]<br>
><br>
><br>
> Slava<br>
><br>
> On Wed, Mar 14, 2018 at 6:19 AM, Daniel-Constantin Mierla<br>
> <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br>
>> Hello,<br>
>><br>
>><br>
>> On 14.03.18 00:19, <a href="mailto:volga629@networklab.ca">volga629@networklab.ca</a> wrote:<br>
>>>  Hello Everyone,<br>
>>>  Not sure what I am missing, but can't match ip address to subnet<br>
>>><br>
>>>  Log says<br>
>>><br>
>>>   INFO: <script>: Subnets not match processing rtp...destination ip<br>
>>>  [10.0.1.242] and sourceip [10.0.1.241]<br>
>>><br>
>>><br>
>>>         if(is_method("INVITE")) {<br>
>>>                 $avp(destip)=$(du{s.select,1,:<wbr>});<br>
>>>                 $avp(subnet) = $avp(destip) + "/16";<br>
>> if you want to get the host part (ip) of the $du, then just use $dd.<br>
>><br>
>>>                 xlog("L_INFO", "Initial Request: [$rm] destination ip<br>
>>>  [$avp(destip)] and sourceip [$si]\n");<br>
>>>                 if(!is_in_subnet("$si", "$avp(subnet)")) {<br>
>><br>
>> So instead of the above if, get rid of the avps and you can just use:<br>
>><br>
>>                if(!is_in_subnet("$si", "$dd/16")) {<br>
>><br>
>> Cheers,<br>
>> Daniel<br>
>>>                         xlog("L_INFO", "Subnets not match processing<br>
>>>  rtp...destination ip [$avp(subnet)] and source ip [$si]\n");<br>
>>>                         route(RTP_MANAGE);<br>
>>>                 }<br>
>>>         }<br>
>>><br>
>>><br>
>>><br>
>>>  [root@prx00 ~]# rpm -qa | grep kamailio<br>
>>>  kamailio-mysql-5.1.2-2.<wbr>git4c840b7e9.fc27.x86_64<br>
>>>  kamailio-5.1.2-2.<wbr>git4c840b7e9.fc27.x86_64<br>
>>><br>
>>><br>
>>>  Slava.<br>
>>><br>
>>><br>
>>>  _____________________________<wbr>__________________<br>
>>>  Kamailio (SER) - Users Mailing List<br>
>>>  <a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
>>>  <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
>><br>
>> --<br>
>> Daniel-Constantin Mierla<br>
>> <a href="http://www.twitter.com/miconda" rel="noreferrer" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" rel="noreferrer" target="_blank">www.linkedin.com/in/miconda</a><br>
>> Kamailio Advanced Training - April 16-18, 2018, Berlin - <a href="http://www.asipto.com" rel="noreferrer" target="_blank">www.asipto.com</a><br>
>> Kamailio World Conference - May 14-16, 2018 - <a href="http://www.kamailioworld.com" rel="noreferrer" target="_blank">www.kamailioworld.com</a><br>
>><br>
>><br>
><br>
<br>
--<br>
Daniel-Constantin Mierla<br>
<a href="http://www.twitter.com/miconda" rel="noreferrer" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" rel="noreferrer" target="_blank">www.linkedin.com/in/miconda</a><br>
Kamailio Advanced Training - April 16-18, 2018, Berlin - <a href="http://www.asipto.com" rel="noreferrer" target="_blank">www.asipto.com</a><br>
Kamailio World Conference - May 14-16, 2018 - <a href="http://www.kamailioworld.com" rel="noreferrer" target="_blank">www.kamailioworld.com</a><br>
<br>
<br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
</div></div></blockquote></div><br></div>