[Home]

Summary:ASTERISK-16607: [patch] Asterisk 1.8.0-beta3 DNSMGR address corruption
Reporter:Andrew Fried (afried)Labels:
Date Opened:2010-08-23 11:51:45Date Closed:2010-10-05 15:10:08
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Core/PBX
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-rpt1.txt
( 1) issue_17902.rev1.txt
Description:This may be related to 0017496.  DNSMGR appears to be assigning the wrong ip addresses to host names that appear in iax.conf and "forgettting" previous lookups.

This is causing inbound calls from contexts with hostnames to be handled by the default context.


****** ADDITIONAL INFORMATION ******

Hosts appearing in iax.conf contexts:

70.167.247.167 SIP.fried.us
198.186.193.60 ASTERISK.deteque.com
64.34.181.47 DID.voip.les.net
173.208.45.51 EAST.voipjet.com

A status output from dnsmgr shows that the addresses are getting assigned to the wrong hosts.  Below shows the ipaddress from voipjet assigned to let.net.  Also note that some updates reflect that the address was unknown.

This is causing incoming calls to be handed by the default contexts since inbound calls are not matching up with the hosts in the appropriate contexts.




[Aug 23 11:58:43] NOTICE[1061]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'east.voipjet.com' changed from (null) to 173.208.45.51:0
[Aug 23 11:58:43] NOTICE[1061]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'did.voip.les.net' changed from 173.208.45.51:0 to 64.34.181.47:0
[Aug 23 11:58:43] NOTICE[1061]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'sip.fried.us' changed from 64.34.181.47:0 to 70.167.247.167:0
[Aug 23 11:58:43] NOTICE[1061]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'asterisk.deteque.com' changed from 70.167.247.167:0 to 198.186.193.60:0
Comments:By: Leif Madsen (lmadsen) 2010-08-23 12:52:22

I think we'll need some additional information here such as a trace of when this is happening using PCAP and the Asterisk console along with debug logging from Asterisk.

Also examples of configurations that are experiencing this so we can reproduce it would be desirable.

By: Andrew Fried (afried) 2010-08-23 16:24:19

I changed the dnsmgr refresh interval to 30 seconds and set a few minutes worth of logs in under asterisk-rpt1.txt.  There is a definite pattern that might help with debugging:

The first entry shows an existing ip as null, which is probably an uninitialized variable.  It then pulls the correct address via dns.

The next message indicates that the existing dns value is the same as the one found in the previous dns resolution.  It then does a lookup and returns the correct value.

The next message also shows the previous lookup value as the current ip for the host name being looked up.

If I were to guess, it appears that the "changed from" address always reflects the previous dns lookup rather than whatever should be stored.

Getting pcaps of the dns traffic is going to be difficult since the servers all run bind locally and have quite a steady stream of lookups.

As for the zone file, nothing out of the ordinary:

[voipjet-deteque]

type=peer
context=default
host=east.voipjet.com
username=[redacted]
auth=md5
secret=[redacted]
accountcode=voipjet
dtmfmode=rfc2833
disallow=all
allow=ulaw


[pbx-deteque]

type=friend
context=guest
host=asterisk.deteque.com
auth=rsa
inkeys=asterisk.deteque.com
outkeys=sip.fried.us
accountcode=PBX
dtmfmode=rfc2833
encryption=yes
disallow=all
allow=ulaw

By: Andrew Fried (afried) 2010-08-23 17:54:14

Another tidbit of information.  When I ran "dnsmgr refresh" I also got indications that the lookups were not being stored correctly:

dnsmgr refresh
   -- Refreshing DNS lookups.
   -- refreshing 'sip.flowroute.com'
      > ast_get_srv: SRV lookup for '_sip._udp.sip.flowroute.com' mapped to host sip.flowroute.com, port 5060
   -- refreshing 'east.voipjet.com'
[Aug 23 22:59:55] NOTICE[27197]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'east.voipjet.com' changed from (null) to 173.208.45.51:0
   -- refreshing 'asterisk.dc-fop.org'
[Aug 23 22:59:55] NOTICE[27197]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'asterisk.dc-fop.org' changed from (null) to 216.151.240.100:0
   -- refreshing 'asterisk.deteque.com'
[Aug 23 22:59:55] NOTICE[27197]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'asterisk.deteque.com' changed from (null) to 198.186.193.60:0
   -- Refreshing DNS lookups.
      > ast_get_srv: SRV lookup for '_sip._udp.sip.flowroute.com' mapped to host sip.flowroute.com, port 5060
[Aug 23 23:00:02] NOTICE[26960]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'east.voipjet.com' changed from (null) to 173.208.45.51:0
[Aug 23 23:00:02] NOTICE[26960]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'asterisk.dc-fop.org' changed from 173.208.45.51:0 to 216.151.240.100:0
[Aug 23 23:00:02] NOTICE[26960]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host 'asterisk.deteque.com' changed from 216.151.240.100:0 to 198.186.193.60:0

By: Elazar Broad (ebroad) 2010-08-24 14:29:42

I noticed this as well, though not with the dnsmgr itself, but with the ast_sockaddr_stringify_fmt() method in netsock2.c, which dnsmgr uses to "pretty-print" the address/port pairs, ast_sockaddr_stringify_fmt() seems to *almost* always return the last data passed to it as opposed to what is actually(currently) passed to it when called.

elazar



By: Andrew Fried (afried) 2010-08-25 21:53:59

I believe this issues is more than simply a display problem as evidenced by the fact that incoming calls are not being properly handled by the correct incoming context.  In my case, all of the incoming calls land in "guest".

I even tried hardcoding IP addresses into the host fields.  The calls still land in guest, and dnsmgr produced this log entry:

[Aug 25 22:48:39] NOTICE[1670]: dnsmgr.c:167 dnsmgr_refresh: dnssrv: host '64.34.181.47' changed from 173.208.45.51:0 to 64.34.181.47:0

By: Andrew Fried (afried) 2010-08-26 19:04:34

One more tidbit of information that coincides with ebroad's reference to ast_sockaddr_stringify_fmt() - I found this in my logs:

Aug 27 00:08:43] ERROR[3077]: netsock2.c:94 ast_sockaddr_stringify_fmt: getnameinfo(): ai_family not supported

As an FYI, this asterisk server is running Ubuntu 10.4.

By: Russell Bryant (russell) 2010-09-13 14:01:35

I have uploaded a patch that fixes some bugs that I found.  For this bug report, I would only expect this fix to address incorrect information being shown by log messages.  It should not affect call handling.  However, please give a try and report if the dnsmgr log entries appear to be correct now.

If your calls are still not being processed as you expect, that may be a different issue.

By: Russell Bryant (russell) 2010-09-13 14:02:57

Note that this patch is against the 1.8 branch (rev 286455).

By: Digium Subversion (svnbot) 2010-09-21 10:43:34

Repository: asterisk
Revision: 287895

U   branches/1.8/channels/chan_sip.c
U   branches/1.8/main/acl.c
U   branches/1.8/main/dnsmgr.c
U   branches/1.8/res/res_rtp_asterisk.c

------------------------------------------------------------------------
r287895 | russell | 2010-09-21 10:43:34 -0500 (Tue, 21 Sep 2010) | 10 lines

Don't use ast_strdupa() from within the arguments to a function.

(closes issue ASTERISK-16607)
Reported by: afried
Patches:
     issue_17902.rev1.txt uploaded by russell (license 2)
Tested by: russell

Review: https://reviewboard.asterisk.org/r/927/

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=287895

By: Digium Subversion (svnbot) 2010-09-21 10:45:47

Repository: asterisk
Revision: 287896

_U  trunk/
U   trunk/channels/chan_sip.c
U   trunk/main/acl.c
U   trunk/main/dnsmgr.c
U   trunk/res/res_rtp_asterisk.c

------------------------------------------------------------------------
r287896 | russell | 2010-09-21 10:45:47 -0500 (Tue, 21 Sep 2010) | 17 lines

Merged revisions 287895 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r287895 | russell | 2010-09-21 10:43:33 -0500 (Tue, 21 Sep 2010) | 10 lines
 
 Don't use ast_strdupa() from within the arguments to a function.
 
 (closes issue ASTERISK-16607)
 Reported by: afried
 Patches:
       issue_17902.rev1.txt uploaded by russell (license 2)
 Tested by: russell
 
 Review: https://reviewboard.asterisk.org/r/927/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=287896

By: Andrew Fried (afried) 2010-09-26 02:24:26

The issue has not been fixed as of 1.8.0-rc2

When you issue the command "dnsmgr refresh" you still receive a "changed from (null) to ..." message.

dnsmgr is still non-functional.

By: Russell Bryant (russell) 2010-09-28 07:35:15

What do you mean by non-functional?  The message you refer to is not necessarily a problem.  On the first lookup, it's going to go from no address to having an address.

By: Russell Bryant (russell) 2010-09-30 16:05:18

Just as an update, I have been able to reproduce some problems with dnsmgr and am now investigating further.

By: Russell Bryant (russell) 2010-10-01 15:12:50

I just put up another patch that resolves some memory corruption in the dnsmgr caused by chan_iax2.

https://reviewboard.asterisk.org/r/965

By: Digium Subversion (svnbot) 2010-10-05 15:09:07

Repository: asterisk
Revision: 290378

U   branches/1.8/channels/chan_iax2.c

------------------------------------------------------------------------
r290378 | dvossel | 2010-10-05 15:09:07 -0500 (Tue, 05 Oct 2010) | 11 lines

Resolves dnsmgr memory corruption in chan_iax2.

(closes issue ASTERISK-16607)
Reported by: afried
Patches:
     issue_17902.rev1.txt uploaded by russell (license 2)
Tested by: afried, russell, dvossel

Review: https://reviewboard.asterisk.org/r/965/


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=290378

By: Digium Subversion (svnbot) 2010-10-05 15:10:06

Repository: asterisk
Revision: 290379

_U  trunk/
U   trunk/channels/chan_iax2.c

------------------------------------------------------------------------
r290379 | dvossel | 2010-10-05 15:10:06 -0500 (Tue, 05 Oct 2010) | 17 lines

Merged revisions 290378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r290378 | dvossel | 2010-10-05 15:09:06 -0500 (Tue, 05 Oct 2010) | 11 lines
 
 Resolves dnsmgr memory corruption in chan_iax2.
 
 (closes issue ASTERISK-16607)
 Reported by: afried
 Patches:
       issue_17902.rev1.txt uploaded by russell (license 2)
 Tested by: afried, russell, dvossel
 
 Review: https://reviewboard.asterisk.org/r/965/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=290379