<div dir="ltr">here is a patch against 4.0.5 to make this work with the address table<div><br></div><div><div>--- kamailio-4.0.5/modules/permissions/hash.c<span class="" style="white-space:pre">      </span>2013-12-20 11:42:46.000000000 -0500</div>
<div>+++ kamailio-4.0.5/modules/permissions/hash.c<span class="" style="white-space:pre">       </span>2014-01-06 05:48:54.000000000 -0500</div><div>@@ -486,13 +486,24 @@</div><div> {</div><div> <span class="" style="white-space:pre">  </span>struct addr_list *np;</div>
<div> <span class="" style="white-space:pre">   </span>str addr_str;</div><div>+        int_str avp_val;</div><div> </div><div> <span class="" style="white-space:pre">     </span>addr_str.s = (char*)addr->u.addr;</div><div> <span class="" style="white-space:pre">      </span>addr_str.len = 4;</div>
<div> </div><div>+        get_tag_avp(&tag_avp, &tag_avp_type);</div><div>+</div><div> <span class="" style="white-space:pre">      </span>for (np = table[perm_hash(addr_str)]; np != NULL; np = np->next) {</div><div>
 <span class="" style="white-space:pre">              </span>if (((np->port == 0) || (np->port == port))</div><div> <span class="" style="white-space:pre">                         </span>&& ip_addr_cmp(&np->addr, addr)) {</div><div>+<span class="" style="white-space:pre">                 </span>if ( np->tag.s != NULL ) {</div>
<div>+<span class="" style="white-space:pre">                           </span>avp_val.s.s = (char *)np->tag.s;</div><div>+<span class="" style="white-space:pre">                               </span>avp_val.s.len = strlen(avp_val.s.s);</div><div>+<span class="" style="white-space:pre">                              </span>if (add_avp(tag_avp_type|AVP_VAL_STR, tag_avp, avp_val) != 0) {</div>
<div>+<span class="" style="white-space:pre">                                   </span>LM_ERR("failed to set of tag_avp failed\n");</div><div>+<span class="" style="white-space:pre">                                    </span>return -1;</div><div>+<span class="" style="white-space:pre">                                </span>}<span class="" style="white-space:pre"> </span></div>
<div>+<span class="" style="white-space:pre">                   </span>}</div><div> <span class="" style="white-space:pre">                 </span>return np->grp;</div><div> <span class="" style="white-space:pre">                </span>}</div><div> <span class="" style="white-space:pre"> </span>}</div>
</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div>Kelvin Chua</div>
<br><br><div class="gmail_quote">On Mon, Jan 6, 2014 at 1:09 PM, Kelvin Chua <span dir="ltr"><<a href="mailto:kelchy@gmail.com" target="_blank">kelchy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">then the documentation has to be changed:<div><br></div><div><div title="1.4. Address Permissions" style="font-family:Helvetica,Arial;font-size:medium"><div style><h3>
1.4. Address Permissions</h3></div><p style="text-align:justify;font-size:12px">The module can be used to determine if an address (IP address and port) matches any of the IP subnets stored in cached Kamailio database table. Port 0 in cached database table matches any port. IP address and port to be matched can be either taken from the request (allow_source_address) or given as pvar arguments (allow_address).</p>

<p style="text-align:justify;font-size:12px">Addresses stored in cached database table can be grouped together into one or more groups specified by a group identifier (positive integer value, i.e., equal or greater than 1). Group identifier is given as argument to allow_address and allow_source_address functions.</p>

<p style="font-size:12px;text-align:justify"><font color="#ff0000">As a side effect of matching the address, non-NULL tag (see tag_col module parameter) is added as value to peer_tag AVP if peer_tag_avp module parameter has been defined.</font></p>
<span class="HOEnZb"><font color="#888888">
<p style="text-align:justify;font-size:12px"><br></p><p style="text-align:justify;font-size:12px"><br></p><div style><br></div></font></span></div><span class="HOEnZb"><font color="#888888"><div title="1.5. Trusted Requests" style="font-size:medium;font-family:Helvetica,Arial">

<div><div></div></div></div></font></span></div></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div>Kelvin Chua</div></font></span><div><div class="h5">
<br><br><div class="gmail_quote">On Sun, Jan 5, 2014 at 4:47 AM, Juha Heinanen <span dir="ltr"><<a href="mailto:jh@tutpro.com" target="_blank">jh@tutpro.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>Kelvin Chua writes:<br>
<br>
> is the peer_tag_avp used on allow_source_address_group?<br>
<br>
</div>based on fast scan of permissions module source, it appears that<br>
peer_tag_avp is set only by allow_trusted function.<br>
<br>
-- juha<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>