summaryrefslogtreecommitdiff
path: root/scripts/vyatta-show-dhclient.pl
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-06-27 03:12:09 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-06-27 03:12:09 +0000
commit8896340fc868fc6338a7e1ded1a45793aaafd1a8 (patch)
tree0968e458d1a277fe0d6fb09ab636f739ca52aefd /scripts/vyatta-show-dhclient.pl
parent34b70e943b9b8b133434ab7705e2543feee85c8c (diff)
downloadvyatta-op-8896340fc868fc6338a7e1ded1a45793aaafd1a8.tar.gz
vyatta-op-8896340fc868fc6338a7e1ded1a45793aaafd1a8.zip
better detection of whether domain-name set using CLI is overriding
domain-search received from dhcp client. used in 'show dhcp client leases'
Diffstat (limited to 'scripts/vyatta-show-dhclient.pl')
-rwxr-xr-xscripts/vyatta-show-dhclient.pl15
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";