diff options
Diffstat (limited to 'scripts/system/vyatta_update_resolv.pl')
-rwxr-xr-x | scripts/system/vyatta_update_resolv.pl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl index 4c54cfce..0dfa4bec 100755 --- a/scripts/system/vyatta_update_resolv.pl +++ b/scripts/system/vyatta_update_resolv.pl @@ -68,11 +68,14 @@ if ($dhclient_script == 0 && @search_domains > 0 && $domain_name && length($doma } my $search_domain_list = ''; +my $search_includes_system = 0; + foreach my $domain (@search_domains) { if (length($search_domain_list) > 0) { $search_domain_list .= ' '; } $search_domain_list .= $domain; + $search_includes_system = 1; } # add domain searches received from the dhcp client to those already in /etc/resolv.conf, as long as domain-name is not set in the CLI @@ -90,7 +93,10 @@ if (!defined($domain_name)) { my @dhcp_domains = split(/\s+/, $search_string, 2); my $dhcp_domain = $dhcp_domains[1]; chomp $dhcp_domain; - $search_domain_list .= ' ' . $dhcp_domain; + if (length($search_domain_list) > 0) { + $search_domain_list .= ' '; + } + $search_domain_list .= $dhcp_domain; $search_includes_dhcp = 1; } } @@ -100,10 +106,14 @@ if (!defined($domain_name)) { my $search = ''; if (length($search_domain_list) > 0) { my $source; - if ($search_includes_dhcp == 1) { - $source = "(system + dhcp)"; + if ($search_includes_system == 1) { + if ($search_includes_dhcp == 1) { + $source = "(system + dhcp)"; + } else { + $source = "(system)"; + } } else { - $source = "(system)"; + $source = "(dhcp)"; } $search = "#line generated by vyatta_update_resolv.pl $source\nsearch\t\t$search_domain_list\n"; } |