diff options
author | Geoff Adams <gadams@avernus.com> | 2018-11-08 11:34:47 -0800 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2018-11-09 07:50:26 +0100 |
commit | 46598c867d0cc7d9642056d8743e03e394d67767 (patch) | |
tree | fa5dd951dfebc1737c585914d829e48151ee6f2c | |
parent | 5860c93c6145ae5ecafcf42e72ea536c33be0051 (diff) | |
download | vyos-1x-46598c867d0cc7d9642056d8743e03e394d67767.tar.gz vyos-1x-46598c867d0cc7d9642056d8743e03e394d67767.zip |
T978: Support PowerDNS Recursor outbound queries over IPv6.
This requires adding a query-local-address6 setting to enable outbound
IPv6 queries in general, and also formatting upstream nameserver IPv6
addresses in such a way that Recursor can parse them.
(cherry picked from commit 5d2e36da657fd2e15f9dc8d5588b06478bd3d55c)
-rwxr-xr-x | src/conf_mode/dns_forwarding.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/conf_mode/dns_forwarding.py b/src/conf_mode/dns_forwarding.py index 17788f12a..c21a91a30 100755 --- a/src/conf_mode/dns_forwarding.py +++ b/src/conf_mode/dns_forwarding.py @@ -39,6 +39,8 @@ threads=1 allow-from=0.0.0.0/0, ::/0 log-common-errors=yes non-local-bind=yes +query-local-address=0.0.0.0 +query-local-address6=:: # cache-size max-cache-entries={{ cache_size }} @@ -114,10 +116,10 @@ def get_config(): if conf.exists('domain'): for node in conf.list_nodes('domain'): - server = conf.return_values("domain {0} server".format(node)) + servers = conf.return_values("domain {0} server".format(node)) domain = { "name": node, - "servers": server + "servers": bracketize_ipv6_addrs(servers) } dns['domains'].append(domain) @@ -138,6 +140,8 @@ def get_config(): dns['name_servers'] = dns['name_servers'] + system_name_servers conf.set_level('service dns forwarding') + dns['name_servers'] = bracketize_ipv6_addrs(dns['name_servers']) + if conf.exists('listen-address'): dns['listen_on'] = conf.return_values('listen-address') @@ -193,6 +197,10 @@ def get_config(): return dns +def bracketize_ipv6_addrs(addrs): + """Wraps each IPv6 addr in addrs in [], leaving IPv4 addrs untouched.""" + return ['[{0}]'.format(a) if a.count(':') > 1 else a for a in addrs] + def verify(dns): # bail out early - looks like removal from running config if dns is None: |