From: Shawn Routhier Date: Wed, 20 Jan 2016 16:00:36 +0000 (-0800) Subject: [master] Handle bad ouis better and print hostnames better X-Git-Tag: v4_3_4~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1eea8583f6377b1649928fc551d8d5d9f56d443;p=thirdparty%2Fdhcp.git [master] Handle bad ouis better and print hostnames better Handle bad ouis better and print hostnames better in the dhcp lease script --- diff --git a/RELNOTES b/RELNOTES index 22889ec27..ae7c1a746 100644 --- a/RELNOTES +++ b/RELNOTES @@ -167,6 +167,10 @@ by Eric Young (eay@cryptsoft.com). Thanks to Bill Parker (wp02855 at gmail dot com) who identified this issue. [ISC-Bugs #41485] +- Updated contrib/dhcp-lease-list.pl to handle garbage in the oui file better + and to print out the hostnames a bit better. + [ISC-Bugs #41288] + Changes since 4.3.3b1 - None diff --git a/contrib/dhcp-lease-list.pl b/contrib/dhcp-lease-list.pl index f7e8c0c3f..3e6fd7294 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