summaryrefslogtreecommitdiff
path: root/contrib/dhcp-lease-list.pl
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/dhcp-lease-list.pl')
-rw-r--r--contrib/dhcp-lease-list.pl7
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/dhcp-lease-list.pl b/contrib/dhcp-lease-list.pl
index f7e8c0c3..3e6fd729 100644
--- a/contrib/dhcp-lease-list.pl
+++ b/contrib/dhcp-lease-list.pl
@@ -15,6 +15,9 @@
#
# 2013-04-22 - added option to choose lease file, made manufacture information
# optional, sar
+#
+# 2016-01-19 - updated to better trim the manu string and output the hostnames, sar
+
use strict;
use warnings;
use POSIX qw(strftime);
@@ -41,7 +44,7 @@ sub get_manufactorer_for_mac($) {
if (defined $oui) {
$manu = join('-', ($_[0] =~ /^(..):(..):(..):/));
$manu = `grep -i '$manu' $oui | cut -f3`;
- chomp($manu);
+ $manu =~ s/^\s+|\s+$//g;
}
return $manu;
@@ -142,7 +145,7 @@ sub output_leases() {
}
foreach (@leases) {
if ($opt_format eq 'human') {
- printf("%-19s%-16s%-15s%-20s%-20s\n",
+ printf("%-19s%-16s%-14.14s %-20s%-20s\n",
$_->{'mac'}, # MAC
$_->{'ip'}, # IP address
$_->{'hostname'}, # hostname