[Home]

Summary:ASTERISK-28004: dns: Core ast_dns_get_nameservers does not support configured IPv6 servers
Reporter:Isaac McDonald (imcdona)Labels:pjsip
Date Opened:2018-08-06 17:14:16Date Closed:2021-09-08 18:17:55
Priority:MinorRegression?
Status:Closed/CompleteComponents:Core/DNS
Versions:13.22.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOS 7.4 64bitAttachments:
Description:PJSIP DNS resolution breaks when using the IPv6 loopback address as a nameserver in /etc/resolve.conf.

Steps to reproduce: Note that the hostname used in the AOR had a TTL of 60 seconds during my testing to force pjsip not to cache the results

1. Install dnsmasq "yum install dnsmasq"

2. create /etc/dnsmasq.d/dns.conf and add the following:
listen-address=::1,127.0.0.1
no-resolv
server=1.1.1.1

3. Set nameserver in /etc/resolv.conf to IPv6 localhost address:
nameserver ::1

4. Create a pjsip trunk to register with a hostname in the aor. example:
contact=sip:someuser@testhost.example.com:5060

5. Note how SIP registrations to the sip trunk fail. Note how calls via the trunk also fail. It may take a few minutes before you get failures.

6. Note the following messages in the asterisk log:
'No working DNS nameserver (PJLIB_UTIL_EDNSNOWORKINGNS)' sending OPTIONS request to endpoint

7. Change the nameserver in /etc/resove.conf to:
nameserver 127.0.0.1

8. Reload asterisk "asterisk -rx"core reload"

9. Note how the trunk created in step 4 registers. Calls placed via the trunk also complete.


Comments:By: Asterisk Team (asteriskteam) 2018-08-06 17:14:17.847-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Joshua C. Colp (jcolp) 2018-08-15 08:24:24.756-0500

How have you installed PJSIP? Did you use the bundled version?

By: Isaac McDonald (imcdona) 2018-08-21 12:07:17.262-0500

I installed PJSIP via yum on CentOS. The package version is:

Name        : pjproject
Arch        : x86_64
Version     : 2.3
Release     : 6.el7
Size        : 2.1 M
Repo        : installed
From repo   : epel
Summary     : Libraries for building embedded/non-embedded VoIP applications
URL         : http://www.pjsip.org
License     : GPLv2+
Description : This package provides the Open Source, comprehensive, high performance,
           : small footprint multimedia communication libraries written in C
           : language for building embedded/non-embedded VoIP applications.
           : It contains:
           : - PJSIP - Open Source SIP Stack
           : - PJMEDIA - Open Source Media Stack
           : - PJNATH - Open Source NAT Traversal Helper Library
           : - PJLIB-UTIL - Auxiliary Library
           : - PJLIB - Ultra Portable Base Framework Library
           : - PJSUA2 - Object Oriented abstractions layer for PJSUA

By: Joshua C. Colp (jcolp) 2018-08-21 12:39:38.819-0500

That version of PJSIP is quite old and does not support DNS resolution using an IPv6 nameserver. I would suggest trying bundled[1] which uses the latest release and any unreleased patches we may have.

[1] https://blogs.asterisk.org/2016/03/16/asterisk-13-8-0-now-easier-pjsip-install-method/

By: Richard Mudgett (rmudgett) 2018-08-21 12:43:48.489-0500

Not to mention that bundled has patches applied and is configured to work in server mode.

By: Isaac McDonald (imcdona) 2018-08-21 13:57:29.310-0500

Recompiling Asterisk with the bundled version of PJSIP doesn't fix the issue.

With OS provided PJSIP:
pjproject show buildopts
PJ_VERSION                : 2.3

With bundled PJSIP
pjproject show buildopts
PJ_VERSION                : 2.7.2

By: Sean Bright (seanbright) 2019-03-06 11:06:23.659-0600

Yes, the way that Asterisk determines the system nameservers cannot ever return anything other than IPv4 addresses currently. It could be done, but you would have to take a look inside {{struct __res_state}} (which is a disaster) and add all of the necessary {{configure}} checks and all of that jazz.

By: Friendly Automation (friendly-automation) 2021-09-08 18:17:56.597-0500

Change 16413 merged by Kevin Harwell:
dns.c: Load IPv6 DNS resolvers if configured.

[https://gerrit.asterisk.org/c/asterisk/+/16413|https://gerrit.asterisk.org/c/asterisk/+/16413]

By: Friendly Automation (friendly-automation) 2021-09-08 18:18:06.179-0500

Change 16414 merged by Kevin Harwell:
dns.c: Load IPv6 DNS resolvers if configured.

[https://gerrit.asterisk.org/c/asterisk/+/16414|https://gerrit.asterisk.org/c/asterisk/+/16414]

By: Friendly Automation (friendly-automation) 2021-09-08 18:18:20.008-0500

Change 16415 merged by Kevin Harwell:
dns.c: Load IPv6 DNS resolvers if configured.

[https://gerrit.asterisk.org/c/asterisk/+/16415|https://gerrit.asterisk.org/c/asterisk/+/16415]

By: Friendly Automation (friendly-automation) 2021-09-08 18:18:29.768-0500

Change 16412 merged by Kevin Harwell:
dns.c: Load IPv6 DNS resolvers if configured.

[https://gerrit.asterisk.org/c/asterisk/+/16412|https://gerrit.asterisk.org/c/asterisk/+/16412]