[asterisk-dev] [Code Review] 3343: res_pjsip: Enable DNS support.

Olle E. Johansson oej at edvina.net
Thu Mar 13 07:02:34 CDT 2014


On 13 Mar 2014, at 12:06, Joshua Colp <jcolp at digium.com> wrote:

> Olle E. Johansson wrote:
>> 
>> On 13 Mar 2014, at 11:42, Joshua Colp <reviewboard at asterisk.org
>> <mailto:reviewboard at asterisk.org>> wrote:
>> 
>>> In case others are wondering as Olle was:
>>> 
>>> PJLIB-Util (part of pjproject) provides a DNS client which can
>>> optionally (but is highly suggested) to be used with PJSIP. It
>>> provides asynchronous DNS, SRV lookups, multiple record support,
>>> etc. Right now this isn't enabled so we are simply doing A/AAAA
>>> record lookups. The reason it's not enabled is that explicit
>>> nameservers *must* be provided to it when enabling it. It will not
>>> use the system ones by itself. The change up on reviewboard enables
>>> it by default using the system nameservers it finds, but with the
>>> ability to override or completely disable it if a user wants. The
>>> reason I also provide reload functionality is that people in
>>> #asterisk-dev expressed a concern that users may change nameservers
>>> but don't want to restart Asterisk, which is understandable.
>> 
>> Interesting to get answer in another channel... For both of us.
>> 
>> My question still stands - why would anyone want one part of Asterisk
>> use other DNS servers than the rest of Asterisk and the rest of the
>> system? If there is something wrong with the system resolver, that
>> needs to be fixed.
>> 
>> I do not see the need for us to have a configuration option here.
>> Someone else may have a good reason for it.
> 
> I can't guarantee that the code which automatically determines and gets the nameservers from the system will work on all platforms. It's using res_init / res_ninit which, depending on the implementation, parses resolv.conf and stores the information. I think it *should* work but for cases where it won't the ability to manually set them is there. For most people you don't even need to know it exists or set it.

So we have yet another internal resolver? Is that a good thing? Why are we not using the system resolver?

We need to have some direction here. I think adding yet another DNS resolver is bad and will make it hard to add functions like DNSsec/DANE support. Making it possible for one piece of asterisk to use another DNS resolver is poor design, we should not open up for that.  The number of debug problems and runtime issues I see is reaching infinity. "I can ping this server, but the sip channel can't reach it" is just a start.

Is there a way we can either avoid using yet another resolver, or since this is propably better - switch all of Asterisk to use it and we'll get asynch DNS everywhere?

I can understand why a library like PJsip have support for this, in some cases it's the only way when writing clients like soft phones. That doesn't mean we have to expose it. We can still select and decide for ourselves about our design. 

Summary
- Don't add yet another DNS resolver randomly
- Don't allow using different DNS servers in parts of a server app and please don't allow anyone to configure anything else than the system resolvers in a server application.

/O


More information about the asterisk-dev mailing list