[asterisk-dev] [Code Review] 2860: pjsip: race condition in registrar

Mark Michelson reviewboard at asterisk.org
Tue Sep 17 14:38:46 CDT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2860/#review9720
-----------------------------------------------------------



branches/12/res/res_pjsip_registrar.c
<https://reviewboard.asterisk.org/r/2860/#comment18886>

    s/oar/aor/



branches/12/res/res_pjsip_registrar.c
<https://reviewboard.asterisk.org/r/2860/#comment18887>

    Since ser was allocated with the correct amount of space for the aor_name, you have the option of using strcpy() safely here.



branches/12/res/res_pjsip_registrar.c
<https://reviewboard.asterisk.org/r/2860/#comment18889>

    There is a new recommended format for hash and cmp functions for ao2_containers. See https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=25919686



branches/12/res/res_pjsip_registrar.c
<https://reviewboard.asterisk.org/r/2860/#comment18890>

    Why store the aor and aor_name separately? If you have the aor, you can get its name with ast_sorcery_object_get_id().


- Mark Michelson


On Sept. 16, 2013, 10:08 p.m., Kevin Harwell wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2860/
> -----------------------------------------------------------
> 
> (Updated Sept. 16, 2013, 10:08 p.m.)
> 
> 
> Review request for Asterisk Developers, Joshua Colp and Mark Michelson.
> 
> 
> Bugs: AST-1213
>     https://issues.asterisk.org/jira/browse/AST-1213
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> While handling a registration request a race condition could occur if/when two+ clients registered at the same time.  This happened when one request obtained a copy of the current contacts for an AOR and another request did the same before the first request updated.  Thus the second would update and overwrite the first (or vice-versa depending on which actually updated first).  In the case of it being the same contact two "add" events would be raised.
> 
> pjsip registration handling is now serialized to alleviate this issue.
> 
> 
> Diffs
> -----
> 
>   branches/12/res/res_pjsip_registrar.c 399015 
> 
> Diff: https://reviewboard.asterisk.org/r/2860/diff/
> 
> 
> Testing
> -------
> 
> Had a few phones register themselves with asterisk using pjsip registration.  Also ran all the pjsip registration testsuite tests and made sure they all passed.
> 
> 
> Thanks,
> 
> Kevin Harwell
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130917/db401fd2/attachment-0001.htm>


More information about the asterisk-dev mailing list