[asterisk-bugs] [Asterisk 0014756]: [patch] Realtime - incorrect set peer ip-address and port after restart
Asterisk Bug Tracker
noreply at bugs.digium.com
Fri Jun 12 14:52:39 CDT 2009
The following issue has been RESOLVED.
======================================================================
https://issues.asterisk.org/view.php?id=14756
======================================================================
Reported By: Alexei Gradinari
Assigned To: mmichelson
======================================================================
Project: Asterisk
Issue ID: 14756
Category: Channels/chan_sip/Registration
Reproducibility: always
Severity: minor
Priority: normal
Status: resolved
Target Version: 1.4.27
Asterisk Version: 1.6.0.6
Regression: No
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
Resolution: duplicate
Duplicate: 15194
Fixed in Version: 1.6.0.11
======================================================================
Date Submitted: 2009-03-25 15:52 CDT
Last Modified: 2009-06-12 14:52 CDT
======================================================================
Summary: [patch] Realtime - incorrect set peer ip-address and
port after restart
Description:
After restarting asterisk sets peer ip-address and port based on
fullcontact from database.
I think it's wrong because the SIP Contact may contain NAT inside
ip-address.
For example
if the Contact is sip:TEST707 at 192.168.0.43
After restart asterisk and before SIP peer registers again
SIP peer ip-address and port are incorrect
asterisk -r -x 'sip show peer TEST707 load'
Addr->IP : 192.168.0.43 Port 5060
after SIP peer registers
Addr->IP : 64.231.137.147 Port 29277
The bug in the function 'sip_peer' in this code
================================================
if (fullcontact->used > 0) {
ast_copy_string(peer->fullcontact, fullcontact->str,
sizeof(peer->fullcontact));
peer->rt_fromcontact = TRUE;
/* We have a hostname in the fullcontact, but if we don't
have an
* address listed on the entry (or if it's 'dynamic'),
then we need to
* parse the entry to obtain the IP address, so a dynamic
host can be
* contacted immediately after reload (as opposed to
waiting for it to
* register once again). */
/* XXX May need to revisit the final argument; does the
realtime DB store whether
* the original contact was over TLS or not? XXX */
__set_address_from_contact(fullcontact->str, &peer->addr,
0);
}
================================================
The call of function __set_address_from_contact overwrite the peer
ip-address and ports.
I think the code should be
================================================
if (fullcontact->used > 0) {
ast_copy_string(peer->fullcontact, fullcontact->str,
sizeof(peer->fullcontact));
peer->rt_fromcontact = TRUE;
if (!(peer->addr.sin_addr..s_addr && peer->addr.sin_port))
{
/* We have a hostname in the fullcontact, but if we
don't have an
* address listed on the entry (or if it's 'dynamic'),
then we need to
* parse the entry to obtain the IP address, so a
dynamic host can be
* contacted immediately after reload (as opposed to
waiting for it to
* register once again). */
/* XXX May need to revisit the final argument; does
the realtime DB store whether
* the original contact was over TLS or not? XXX */
__set_address_from_contact(fullcontact->str,
&peer->addr, 0);
}
}
================================================
So we have to use 'fullcontact' only if peer ip-address or port aren't
set.
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
duplicate of 0015194 [patch] [SIP realtime] "sip reload...
======================================================================
----------------------------------------------------------------------
(0106356) mmichelson (administrator) - 2009-06-12 14:52
https://issues.asterisk.org/view.php?id=14756#c106356
----------------------------------------------------------------------
Actually, upon closer inspection, it appears that a similar fix has already
been added to the 1.6.0 branch in revision 197704. This was committed to
fix issue https://issues.asterisk.org/view.php?id=15194. Since a fix for this
issue already exists in the 1.6.0
branch, I am closing this issue.
Issue History
Date Modified Username Field Change
======================================================================
2009-06-12 14:52 mmichelson Note Added: 0106356
2009-06-12 14:52 mmichelson Relationship added duplicate of 0015194
2009-06-12 14:52 mmichelson Duplicate ID 0 => 15194
2009-06-12 14:52 mmichelson Status ready for review =>
resolved
2009-06-12 14:52 mmichelson Fixed in Version => 1.6.0.11
2009-06-12 14:52 mmichelson Resolution open => duplicate
2009-06-12 14:52 mmichelson Assigned To => mmichelson
======================================================================
More information about the asterisk-bugs
mailing list