diff options
author | Shawn Routhier <sar@isc.org> | 2016-01-20 08:00:36 -0800 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2016-01-20 08:00:36 -0800 |
commit | b1eea8583f6377b1649928fc551d8d5d9f56d443 (patch) | |
tree | 94d8e17f4b60fc828f1cfc6c0dffd6fbc5ff0be6 /contrib | |
parent | ba4c704dbaac0d7ea65025d503acb140cced0e68 (diff) | |
download | isc-dhcp-b1eea8583f6377b1649928fc551d8d5d9f56d443.tar.gz |
[master] Handle bad ouis better and print hostnames better
Handle bad ouis better and print hostnames better in
the dhcp lease script
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/dhcp-lease-list.pl | 7 |
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 |