[asterisk-dev] [Code Review]: If DNS is unavailable at start-up, update peer address so registration works when DNS comes back

Terry Wilson reviewboard at asterisk.org
Wed Aug 3 12:00:28 CDT 2011



> On Aug. 2, 2011, 11:19 a.m., kobaz wrote:
> > /branches/1.8/channels/chan_sip.c, lines 12764-12769
> > <https://reviewboard.asterisk.org/r/1335/diff/2/?file=17694#file17694line12764>
> >
> >     Wouldn't you want the same logic here as it is above, for setting the port via srv records?
> >

Here, the port will be copied from r->us by ast_sockaddr_copy. r->us has the port set just above this code block. In the dnsmgr case in sip_reg_timeout, we aren't guaranteed to have the port set in r->us, so I specifically set it from r->portno.


> On Aug. 2, 2011, 11:19 a.m., kobaz wrote:
> > /branches/1.8/channels/chan_sip.c, lines 12765-12766
> > <https://reviewboard.asterisk.org/r/1335/diff/2/?file=17694#file17694line12765>
> >
> >     Wouldn't you always want to replace the address if you have a good find_peer result?  Why only replace it if it's empty?

Possibly. I tried to limit myself to just the error that was reported: the case where there was no DNS and therefor the address was blank. I'm just trying to limit behavior changes as much as possible while still fixing the issue. 


- Terry


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


On Aug. 2, 2011, 10:19 a.m., Terry Wilson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1335/
> -----------------------------------------------------------
> 
> (Updated Aug. 2, 2011, 10:19 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> If Asterisk starts and no DNS is available, outbound registrations will fail indefinitely. This patch copies the address from the sip_registry struct, which will be updated, to the peer->addr when necessary.
> 
> If dnsmgr is enabled, the registration fails without the patch because even though the address on the registry is updated via dnsmgr, the address is just copied on the first try. Since we use ast_sockaddr_copy, dnsmgr can't update the address that is copied to the sip_pvt or peers.
> 
> 
> This addresses bug ASTERISK-18000.
>     https://issues.asterisk.org/jira/browse/ASTERISK-18000
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_sip.c 330109 
> 
> Diff: https://reviewboard.asterisk.org/r/1335/diff
> 
> 
> Testing
> -------
> 
> Disable DNS server, load asterisk, watch registration fail. Start DNS server, watch registration succeed. Both with and without dnsmgr tested.
> 
> 
> Thanks,
> 
> Terry
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110803/951e48b0/attachment.htm>


More information about the asterisk-dev mailing list