From 34b70e943b9b8b133434ab7705e2543feee85c8c Mon Sep 17 00:00:00 2001
From: Mohit Mehta <mohit.mehta@vyatta.com>
Date: Thu, 26 Jun 2008 16:52:58 +0000
Subject: => display text saying the domain-name received from dhcp-server   
 is overridden by domain-name set in our CLI in op-mode command    'show dhcp
 client leases'

---
 scripts/vyatta-show-dhclient.pl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'scripts')

diff --git a/scripts/vyatta-show-dhclient.pl b/scripts/vyatta-show-dhclient.pl
index b696f8f..a158598 100755
--- a/scripts/vyatta-show-dhclient.pl
+++ b/scripts/vyatta-show-dhclient.pl
@@ -122,7 +122,14 @@ sub dhclient_show_lease {
 	}
     }
     print "subnet mask: $new_subnet_mask\n" if defined $new_subnet_mask;
-    print "domain name: $new_domain_name\n" if defined $new_domain_name;
+    if (defined $new_domain_name) {
+      print "domain name: $new_domain_name";
+      if (`grep domain /etc/resolv.conf 2> /dev/null`) {
+        print "\t[overridden by domain-name set using CLI]\n";
+      } else {
+        print "\n";
+      }
+    }
     print "router     : $new_routers\n" if defined $new_routers;
     print "name server: $new_domain_name_servers\n" if 
 	defined $new_domain_name_servers;
-- 
cgit v1.2.3


From 8896340fc868fc6338a7e1ded1a45793aaafd1a8 Mon Sep 17 00:00:00 2001
From: Mohit Mehta <mohit.mehta@vyatta.com>
Date: Fri, 27 Jun 2008 03:12:09 +0000
Subject: better detection of whether domain-name set using CLI is overriding
 domain-search received from dhcp client. used in 'show dhcp client leases'

---
 scripts/vyatta-show-dhclient.pl | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

(limited to 'scripts')

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";
-- 
cgit v1.2.3