dnsc: Fallback to getaddrinfo without any DNS servers #1195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On current Android and iOS platforms, access to the system DNS server lists is restricted (e.g. https://developer.android.com/about/versions/oreo/android-8.0-changes.html#o-pri). Even when it is available, it is often broken in certain situations (e.g. https://forums.developer.apple.com/forums/thread/75449). It is therefore practically impossible to perform manual DNS queries as
re
typically does for SIP.Currently,
re
partially supports these platforms by offering the option to usegetaddrinfo
, but even this fails when no DNS servers are known due to/etc/resolv.conf
not being accessible. Note that manually specifying 'well-known' DNS servers like8.8.8.8
is not an acceptable workaround for private networks. Nor is it acceptable to manually specify a fixed private DNS, IT admins will require DNS to be centrally distributed via DHCP.This change fixes the above use case by making two changes:
getaddrinfo
is configured.getaddrinfo
doesn't need to know the servers so we don't need to reject it withEINVAL
.getaddrinfo
is configured and there are no DNS servers, if SIP transport is set but not the port (e.g.sip:my-proxy.com;transport=tls
, use the default transport port and do a A / AAAA query instead of attempting a SRV / NAPTR that cannot possibly work.I have tested this on Android where
dns_srv_get
always fails to return any servers. Previously Baresip would fail to even register, with this change it is able to register and make calls using a URI such assip:my-proxy.com;transport=tls
.