Summary: | ASTERISK-04965: DNS SRV lookups fail using BIND lightweight resolver | ||
Reporter: | Rick Alm (rickalm) | Labels: | |
Date Opened: | 2005-09-01 14:07:47 | Date Closed: | 2011-06-07 14:02:43 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | Using the following in sip.conf [asterlink] Type=peer Host=switch.asterlink.com causes the following error Sep 1 13:56:33 WARNING[30580]: acl.c:226 ast_get_ip_or_srv: Unable to lookup '' traced to a bug in srv.c where res_nsearch returns a 1 instead of a 0 on failed DNS lookups patch included in comments ****** ADDITIONAL INFORMATION ****** disclaimer on fax machine now --- srv.c 2005-09-01 13:56:19.142079472 -0500 +++ srv.c.rea 2005-09-01 13:56:08.980624248 -0500 @@ -113,10 +113,11 @@ if (chan) ret |= ast_autoservice_stop(chan); - if (ret <= 0) { + if (ret <= 1) { host[0] = '\0'; *port = -1; - return ret; + ret=0; } + return ret; } | ||
Comments: | By: Rick Alm (rickalm) 2005-09-01 14:20:22 uname -a Linux server3.misdoctor.com 2.6.10-1.771_FC2smp #1 SMP Mon Mar 28 01:10:51 EST 2005 i686 athlon i386 GNU/Linux By: Kevin P. Fleming (kpfleming) 2005-09-01 17:48:17 The only docs I can find say res_nsearch is supposed to return -1 in the case of a failure... what version of the BIND resolver library is on your machine? By: Brian West (bkw918) 2005-09-01 20:20:46 Do you have srv lookups on? /b By: Rick Alm (rickalm) 2005-09-02 07:57:59 [root@server3 lib]# grep res_nsearch * Binary file libnss1_dns-2.3.3.so matches Binary file libnss_dns-2.3.3.so matches Binary file libresolv-2.3.3.so matches [root@server3 asterisk]# cat /proc/version Linux version 2.6.10-1.771_FC2smp (bhcompile@porky.build.redhat.com) (gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)) #1 SMP Mon Mar 28 01:10:51 EST 2005 from sip.conf [general] srvlookup=yes ; Enable DNS SRV lookups on outbound calls By: Brian West (bkw918) 2005-09-02 09:58:02 find me on #asterlink I wanna look at this. /b By: Kevin P. Fleming (kpfleming) 2005-09-02 16:13:17 Unless you find documentation that says res_nsearch can return a positive value in a failure case, I'm very hesitant to change this code. By: Rick Alm (rickalm) 2005-09-06 15:41:27 Still researching, recient version of srv.c uses ast_search_dns. Discovered that resololver is searching for _sip._udp.switch-1.asterlink.com and then on failure trying _sip._udp.switch-1.asterlink.com.misdoctor.com (misdoctor.com is my domain) its matching with a CNAME (unexpected, doesnt do recursive and see that no SRV record is accociated) but since my DNS server has a "*" entry it resolves to my CNAME record. Thus returns a DNS result with NO valid data triggering the problems Temporary workaround is to end all FQDN entries in sip.conf with a '.' preventing local domain lookups When I have a valid patch will post it. By: Mark Spencer (markster) 2005-09-13 11:05:39 The manual page for res_nsearch *clearly* states that -1 is returned on failure or the number of bytes of answer (which could be 0). Clearly 1 is *not* a failure condition, and this is a bug in the resolver you are using, not in Asterisk. |