diff options
-rw-r--r-- | debian/changelog | 6 | ||||
-rwxr-xr-x | src/conf_mode/host_name.py | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 29dfa5512..4dccd806b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyos-1x (1.3.0-3) unstable; urgency=low + + fixes T1262 - dhcp requested WAN ip address doesn't get search parameter in /etc/resolv.conf + + -- hagbard <vyosdev@derith.de> Fri, 22 Feb 2019 10:50:24 -0800 + vyos-1x (1.3.0-2) unstable; urgency=low fixes T1257 - implement 'set system static-host-mapping' in host_name.py and remove old function calls diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py index 6886324f2..486d1ec8f 100755 --- a/src/conf_mode/host_name.py +++ b/src/conf_mode/host_name.py @@ -86,6 +86,18 @@ def get_resolvers(file): except IOError: return [] +def get_dhcp_search_doms(file): + search_doms = [] + try: + with open(file, 'r') as resolvconf: + for line in resolvconf.readlines(): + line = line.split('#',1)[0]; + line = line.rstrip(); + if 'search' in line: + return re.sub('^search','',line).lstrip().split() + except IOError: + return [] + default_config_data = { 'hostname': 'vyos', 'domain_name': '', @@ -174,6 +186,8 @@ def generate(config): if not config['no_dhcp_ns']: config['nameserver'] += dhcp_ns + for file in glob.glob('/etc/resolv.conf.dhclient-new*'): + config['domain_search'] = get_dhcp_search_doms(file) # We have third party scripts altering /etc/hosts, too. # One example are the DHCP hostname update scripts thus we need to cache in @@ -204,6 +218,7 @@ def generate(config): tmpl = jinja2.Template(config_tmpl_resolv) config_text = tmpl.render(config) + print (config_text) with open(config_file_resolv, 'w') as f: f.write(config_text) |