<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1978/">https://reviewboard.asterisk.org/r/1978/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On June 9th, 2012, 8:07 a.m., <b>Kevin Fleming</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/1978/diff/1/?file=28614#file28614line60" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/include/asterisk/event_defs.h</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">enum ast_event_type {</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">60</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">AST_EVENT_CFG_CHANGE</span> <span class="o">=</span> <span class="mh">0x0b</span><span class="p">,</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This is much too generic. If you are going to use the event subsystem to notify consumers of named ACL changes, then the event should be specific to that change.
I think it would be reasonable for a subscriber to also be able to subscribe to this event for a specific named ACL (by name), so that it can optimize its processing of updates to only the entries that use that named ACL.</pre>
</blockquote>
<p>On June 11th, 2012, 9:59 a.m., <b>jrose</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Oh, the reason I did this was because I thought most of the events were supposed to be fairly generic. Changing that isn't a big deal. The name for this event category is tentatively AST_EVENT_NAMED_ACL_CHANGE.
I'm not sure how easy it will be though to make consumers only update entries that use a particular named ACL since at present, named ACLs are just appended on to whatever ACL they were applied to without any additional information added to split them. Under the new configuration system, I think configs stay in tact. That might be one way to approach it, but since the configuration changes aren't being applied to everything right now, that's probably out.
I'm a little worried that the implementation of this would have to be consumer-specific and probably involve lists of peers/profiles/etc involved with specific named ACLs. I've got an idea of how to replace the named ACLs within individual ast_ha linked lists that goes something like the following...
1. ast_ha gets a new field, that being a character pointer which may be either NULL or if it's part of a named ACL, point to a string with the same value as the name of the named ACL it is attached to.
2. A new function ast_ha_named_acl_update(struct ast_ha *updating, char *named_acl) could be added which receives an ast_ha and the name of an ACL which is being swapped.
The process for doing this is fairly simple linked list stuff.
a. next with one trailing node pointer until a node with the name field is string equivalent to named_acl. The named_acl's beginning is stored in another ast_ha pointer.
b. sever the next pointer link on the trailing node. Save this node in another pointer as well so that it can be reattached later.
c. continue to iterate with a trailing node pointer until we find a node that doesn't match named_acl.
d. sever the next pointer link on the trailing node.
e. ast_free_ha on the beginning node for the separated chunk of the list that was made for the named_acl being refreshed.
f. now we have two nodes to work with, the first one being the end of the list containing everything before the stripped named ACL (end_of_the_beginning) and the second being the beginning of everything after the named ACL (beginning_of_the_end).
g. ast_append_named_acl(end_of_the_beginning, named_acl)
h. iterate through end_of_the_beginning until next = NULL
i. set that next to beginning_of_the_end.
Actually figuring out how to run that on all of the ast_ha's that use them is probably the tricky part though. It'd definitely be a step in the right direction for getting oej's desired more dynamic use of named ACLs working though.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I don't think you need to work on changing the subscribers to actually *use* the ability to subscribe to specific named ACLs, you just need to make the event publication process support it. Each consumer can then be improved to use that ability if they wish, or not; it's a performance optimization at that point.</pre>
<br />
<p>- Kevin</p>
<br />
<p>On June 8th, 2012, 2:04 p.m., jrose wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Mark Michelson, Terry Wilson, and Olle E Johansson.</div>
<div>By jrose.</div>
<p style="color: grey;"><i>Updated June 8, 2012, 2:04 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This feature is based on oej's deluxepine (or something like that) branch with a similarly named feature. ACLs are defined in acl.conf and can be used by pretty much anything that has ACL options permit/deny (acl='aclname'). acl= works similarly to permit= and deny= in that it simply appends to the working ACL, so they can be combined with other uses of permit/deny/acl.
Also in use in this patch are twilson's new config options.
Since named acls are duplicated when used in another configuration, configurations that use named acls need to be updated if acl.conf is reloaded. This is accomplished with a new event type and the consumption of that event is demonstrated currently only in manager.conf
If this seems like a proper approach to this problem, that will be replicated across other consumers of named acls.
NOTE: This code is very much WIP and not intended for merging.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Various tests for configuring and using named acls were performed, and a task for writing comprehensive testsuite tests is in the queue. Additionally, various means of reloading the configuration have been performed, and so far they pan out aside from a bug with an unchanged acl.conf which is a generic problem against config options accidentally introduced a little while back.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/CHANGES <span style="color: grey">(368662)</span></li>
<li>/trunk/channels/chan_h323.c <span style="color: grey">(368662)</span></li>
<li>/trunk/channels/chan_iax2.c <span style="color: grey">(368662)</span></li>
<li>/trunk/channels/chan_mgcp.c <span style="color: grey">(368662)</span></li>
<li>/trunk/channels/chan_sip.c <span style="color: grey">(368662)</span></li>
<li>/trunk/channels/chan_skinny.c <span style="color: grey">(368662)</span></li>
<li>/trunk/channels/chan_unistim.c <span style="color: grey">(368662)</span></li>
<li>/trunk/configs/acl.conf.sample <span style="color: grey">(PRE-CREATION)</span></li>
<li>/trunk/configs/iax.conf.sample <span style="color: grey">(368662)</span></li>
<li>/trunk/configs/manager.conf.sample <span style="color: grey">(368662)</span></li>
<li>/trunk/configs/sip.conf.sample <span style="color: grey">(368662)</span></li>
<li>/trunk/configs/skinny.conf.sample <span style="color: grey">(368662)</span></li>
<li>/trunk/include/asterisk/acl.h <span style="color: grey">(368662)</span></li>
<li>/trunk/include/asterisk/event_defs.h <span style="color: grey">(368662)</span></li>
<li>/trunk/main/acl.c <span style="color: grey">(368662)</span></li>
<li>/trunk/main/asterisk.c <span style="color: grey">(368662)</span></li>
<li>/trunk/main/manager.c <span style="color: grey">(368662)</span></li>
<li>/trunk/main/named_acl.c <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1978/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>