diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-show-dhclient.pl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/scripts/vyatta-show-dhclient.pl b/scripts/vyatta-show-dhclient.pl index a158598..0f3990b 100755 --- a/scripts/vyatta-show-dhclient.pl +++ b/scripts/vyatta-show-dhclient.pl @@ -124,7 +124,20 @@ sub dhclient_show_lease { print "subnet mask: $new_subnet_mask\n" if defined $new_subnet_mask; if (defined $new_domain_name) { print "domain name: $new_domain_name"; - if (`grep domain /etc/resolv.conf 2> /dev/null`) { + my $cli_domain_overrides = 0; + my $if_domain_exists = `grep domain /etc/resolv.conf 2> /dev/null | wc -l`; + if ($if_domain_exists > 0) { + my @domain = `grep domain /etc/resolv.conf`; + for my $each_domain_text_found (@domain) { + my @domain_text_split = split(/\t/, $each_domain_text_found, 2); + my $domain_at_start_of_line = $domain_text_split[0]; + chomp $domain_at_start_of_line; + if ($domain_at_start_of_line eq "domain") { + $cli_domain_overrides = 1; + } + } + } + if ($cli_domain_overrides == 1) { print "\t[overridden by domain-name set using CLI]\n"; } else { print "\n"; |