summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rwxr-xr-xscripts/vyatta-show-dhclient.pl163
-rw-r--r--templates/show/dhcp/client/leases/interface/node.def1
-rw-r--r--templates/show/dhcp/client/leases/interface/node.tag/node.def5
-rw-r--r--templates/show/dhcp/client/leases/node.def2
-rw-r--r--templates/show/dhcp/client/node.def1
6 files changed, 0 insertions, 173 deletions
diff --git a/Makefile.am b/Makefile.am
index cceb2f5..f8daadf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,6 @@ interp_DATA += functions/interpreter/vyatta-image-complete
bin_SCRIPTS = scripts/vyatta-show-interfaces
bin_SCRIPTS += scripts/vyatta-show-interfaces.pl
-bin_SCRIPTS += scripts/vyatta-show-dhclient.pl
bin_SCRIPTS += scripts/vyatta-show-dmi
bin_SCRIPTS += scripts/show-dhcp-leases.pl
bin_SCRIPTS += scripts/vyatta-boot-image.pl
diff --git a/scripts/vyatta-show-dhclient.pl b/scripts/vyatta-show-dhclient.pl
deleted file mode 100755
index ecfa67b..0000000
--- a/scripts/vyatta-show-dhclient.pl
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/usr/bin/perl
-#
-# Module: vyatta-show-dhclient.pl
-#
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc.
-# All Rights Reserved.
-#
-# Author: Stig Thormodsrud
-# Date: January 2008
-# Description: Script to display dhcp client lease info
-#
-# **** End License ****
-#
-
-use lib "/opt/vyatta/share/perl5/";
-use POSIX;
-use strict;
-use warnings;
-
-my $lease_dir = '/var/lib/dhcp';
-
-sub dhclient_get_lease_files {
- my ($intf) = @_;
- my @lease_files;
-
- if ( $intf eq "all" ) {
- opendir( my $dh, $lease_dir ) or die "Can't open $lease_dir: $!";
- @lease_files = grep { /^dhclient_.*.lease$/ } readdir($dh);
- closedir $dh;
- }
- else {
- my $file = 'dhclient_' . $intf . '.lease';
- @lease_files = ($file) if -f "$lease_dir/$file";
- }
-
- return @lease_files;
-}
-
-sub dhclient_parse_vars {
- my $file = shift;
-
- open( my $f, '<', "$lease_dir/$file" )
- or return;
-
- my %var_list;
- my $line;
- $line = <$f>;
- chomp $line;
- $var_list{'last_update'} = $line;
-
- while ( $line = <$f> ) {
- chomp $line;
- if ( $line =~ m/(\w+)=\'([\w\s.]+)\'/ ) {
- my $var = $1;
- my $val = $2;
- $var_list{$var} = $val;
- }
- }
- close $f;
-
- return %var_list;
-}
-
-# Get current domain (if any) defined in resolv.conf
-sub resolve_domain {
- open( my $rc, '<', '/etc/resolv.conf' )
- or return;
-
- while (<$rc>) {
- next unless m/^domain (\S+)/;
- return $1;
- }
-}
-
-sub dhclient_show_lease {
- my ($file) = @_;
-
- my %var_list = dhclient_parse_vars($file);
-
- my $interface = $var_list{'interface'};
- print "interface : $interface\n" if defined $interface;
-
- my $new_ip_address = $var_list{'new_ip_address'};
- if ($new_ip_address) {
- print "ip address : $new_ip_address\t";
- my $ip_active = `ip addr list $interface`;
- if ( $ip_active =~ m/$new_ip_address/ ) {
- print "[Active]\n";
- }
- else {
- print "[Inactive]\n";
- }
- }
-
- my $new_subnet_mask = $var_list{'new_subnet_mask'};
- print "subnet mask: $new_subnet_mask\n" if defined $new_subnet_mask;
-
- my $new_domain_name = $var_list{'new_domain_name'};
- if ($new_domain_name) {
- print "domain name: $new_domain_name";
- my $cur_domain = resolve_domain();
- print "\t[overridden by domain-name set using CLI]"
- if ( defined $cur_domain && $cur_domain ne $new_domain_name );
- print "\n";
- }
-
- my $new_routers = $var_list{'new_routers'};
- print "router : $new_routers\n" if defined $new_routers;
-
- my $new_domain_name_servers = $var_list{'new_domain_name_servers'};
- print "name server: $new_domain_name_servers\n"
- if defined $new_domain_name_servers;
-
- my $new_dhcp_server_identifier = $var_list{'new_dhcp_server_identifier'};
- print "dhcp server: $new_dhcp_server_identifier\n"
- if defined $new_dhcp_server_identifier;
-
- my $new_dhcp_lease_time = $var_list{'new_dhcp_lease_time'};
- print "lease time : $new_dhcp_lease_time\n" if defined $new_dhcp_lease_time;
-
- my $last_update = $var_list{'last_update'};
- print "last update: $last_update\n" if defined $last_update;
-
- my $new_expiry = $var_list{'new_expiry'};
- my $new_expiry_str;
- if ($new_expiry) {
- $new_expiry_str =
- strftime( "%a %b %d %R:%S %Z %Y", localtime($new_expiry) );
- }
-
- print "expiry : $new_expiry_str\n" if defined $new_expiry_str;
-
- my $reason = $var_list{'reason'};
- print "reason : $reason\n" if defined $reason;
- print "\n";
-}
-
-#
-# main
-#
-
-my $intf = 'all';
-if ( $#ARGV >= 0 ) {
- $intf = $ARGV[0];
-}
-
-my @dhclient_files = dhclient_get_lease_files($intf);
-foreach my $file ( sort @dhclient_files ) {
- dhclient_show_lease($file);
-}
-
-exit 0;
diff --git a/templates/show/dhcp/client/leases/interface/node.def b/templates/show/dhcp/client/leases/interface/node.def
deleted file mode 100644
index ab13930..0000000
--- a/templates/show/dhcp/client/leases/interface/node.def
+++ /dev/null
@@ -1 +0,0 @@
-help: Show DHCP client information for a given interface
diff --git a/templates/show/dhcp/client/leases/interface/node.tag/node.def b/templates/show/dhcp/client/leases/interface/node.tag/node.def
deleted file mode 100644
index 39ee6ac..0000000
--- a/templates/show/dhcp/client/leases/interface/node.tag/node.def
+++ /dev/null
@@ -1,5 +0,0 @@
-help: Show DHCP client information for interface
-allowed: local -a array ;
- array=( /sys/class/net/eth* /sys/class/net/en* /sys/class/net/bond[0-9]* /sys/class/net/br* ) ;
- echo -n ${array[@]##*/}
-run: /opt/vyatta/bin/vyatta-show-dhclient.pl "$6"
diff --git a/templates/show/dhcp/client/leases/node.def b/templates/show/dhcp/client/leases/node.def
deleted file mode 100644
index abded1e..0000000
--- a/templates/show/dhcp/client/leases/node.def
+++ /dev/null
@@ -1,2 +0,0 @@
-help: Show DHCP client leases
-run: /opt/vyatta/bin/vyatta-show-dhclient.pl
diff --git a/templates/show/dhcp/client/node.def b/templates/show/dhcp/client/node.def
deleted file mode 100644
index 094eaf4..0000000
--- a/templates/show/dhcp/client/node.def
+++ /dev/null
@@ -1 +0,0 @@
-help: Show DHCP client information