URI parser/writer for ares_set_servers_csv()/ares_get_servers_csv()#882
URI parser/writer for ares_set_servers_csv()/ares_get_servers_csv()#882bradh352 merged 7 commits intoc-ares:mainfrom
Conversation
|
@bagder any comment on the URI scheme ? |
|
I'm still pondering about why we need to make the syntax URL-like at all. Since this is a custom format that no one else supports, then why not make our own format that does not risk problems the say way calling it a "URL syntax" will? We can basically replace This spec needs to add a lot of restrictions and "it is almost like a URL except for these cases" anyway so it's not like they will be "true" URLs anyway. |
Thats a fair question and the reasons I can come up with are:
|
|
@bagder if you're strongly against it we can go another way, but if you're indifferent i'm inclined to merge this so I can integrate my DNS over TLS branch since this is a dependency :) |
The DNS server format is insufficient for future configurations, such as supporting DNS over TLS (DoT) and DNS over HTTPS (DoH), as well as additional functionality such as domain-specific servers. Already, in the case where different UDP and TCP ports are used, it is impossible to represent in the current format.
In order to try to use some standardized format, we are going to define our own URI schemes that should be parse-able by any URI parser. The new scheme will only be used when the configuration cannot otherwise be expressed using the current
ipaddr%iface:portformat, which is the format used as the nameserver configuration in/etc/resolv.conf. However, the parserares_set_servers_csv()shall accept the new URI scheme format even when it is not necessary.This PR implements a URI parser and writer and hooks the basic usage into
ares_set_servers_csv()andares_get_servers_csv()as well as provides updated documentation in the relevant manpages.We will define these URI schemes:
dns://- Normal DNS server (UDP + TCP). We need to be careful not to conflict with query params defined in https://datatracker.ietf.org/doc/html/rfc4501 since we'd technically be extending this URI scheme. Port defaults to53.dns+tls://- DNS over TLS. Port defaults to853.dns+https://- DNS over HTTPS. Port defaults to443.We initially will define these query parameters (additional arguments may be required in the future to specify options such as TLS certificate validation rules):
tcpport- TCP port to use, only fordns://scheme. Theportspecified as part of theauthoritycomponent of the URI will be used for both UDP and TCP by default, this option will override the TCP port.ipaddr- Only fordns+tls://anddns+https://. If theauthoritycomponent of the URI contains a hostname, this is used to specify the ip address of the hostname. If not specified, will need to use a non-secure server to perform a DNS lookup to retrieve this information. It is always recommended to have both the ip address and fully qualified domain name specified.hostname- Only fordns+tls://anddns+https://. If theauthoritycomponent of the URI contains an ip address, this is used to specify the fully qualified domain name of the server. If not specified, will need to use a non-secure server to perform a DNS reverse lookup to retrieve this information. It is always recommended to have both the ip address and fully qualified domain name specified.domain- If specified, this server is a domain-specific server. Any queries for this domain will be routed to this server. Multiple servers may be tagged with the same domain.Examples:
NOTE: While we are defining the scheme for things like domain-specific servers, DNS over TLS and DNS over HTTPS, the underlying implementations for those features do not yet exist and therefore will result in errors if they are attempted to be used.
Non-compliance in implementation
All these could be easily implemented/fixed if desired, however any such changes would be of no use to the current c-ares usage of URIs:
Authored-By: Brad House (@bradh352)