X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=blobdiff_plain;f=make-manuf;h=120b32b3deccc710bb59f840dc406772e53e4c5d;hp=e15cb672f85704a3260409aa9630cfca27f90380;hb=279d0ab898de61ea418179026341dda23a3db4a2;hpb=aeb14609596d33a5339a71b0312ae3b4391940e6 diff --git a/make-manuf b/make-manuf index e15cb672f8..120b32b3de 100755 --- a/make-manuf +++ b/make-manuf @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# $Id: make-manuf,v 1.1 2000/11/23 18:22:00 gerald Exp $ +# $Id: make-manuf,v 1.6 2002/08/03 23:09:24 jmayer Exp $ # # Make-manuf - Creates a file containing ethernet OUIs and their # company IDs. It merges the databases at @@ -13,15 +13,17 @@ # with the listing in "oui.txt", with the entries in "manuf.tmpl" taking # precedence. +# LWP is part of the standard Perl module libwww eval "require LWP::UserAgent;"; if( $@ ) { - die "LWP isn't installed. Bailing.\n"; + die "LWP isn't installed. It is part of the standard Perl\n" . + " module libwww. Bailing.\n"; } $template = "manuf.tmpl"; $outfile = "manuf"; $inheader = 1; -$ieee_url = "http://standards.ieee.org/regauth/oui/oui.txt"; +$ieee_url = "http://standards.ieee.org/regauth/oui/oui_public.txt"; $cb_url = "http://www.cavebear.com/CaveBear/Ethernet/Ethernet.txt"; %oui_list = (); $hp = "[0-9a-fA-F]{2}"; @@ -59,7 +61,7 @@ open (TMPL, "< $template") || die "Couldn't open template file for reading ($template)\n"; open (OUT, "> $outfile") || - die "Couldn't open template file for writing ($template)\n"; + die "Couldn't open output file for writing ($outfile)\n"; # Write out the header and populate the OUI list with our entries. while ($line = ) { @@ -68,34 +70,42 @@ while ($line = ) { print(OUT "$line\n"); } elsif (($oui, $manuf) = ($line =~ /^($oui_re)\s+(\S.*)$/)) { $inheader = 0; + # Ensure OUI is all upper-case + $oui =~ tr/a-f/A-F/; $oui_list{$oui} = $manuf; $tmpl_added++; } } -foreach $line (split(/\n/, $cb_list)) { - if (($oui, $manuf) = ($line =~ /^($cb_re)\s+(\S.*)$/)) { - ($h1, $h2, $h3) = ($oui =~ /($hp)($hp)($hp)/); # The CaveBear bytes have no separators - $oui = "$h1:$h2:$h3"; +# Add IEEE entries for OUIs not yet known. +foreach $line (split(/\n/, $ieee_list)) { + if (($oui, $manuf) = ($line =~ /^($ieee_re)\s+\(hex\)\s+(\S.*)$/)) { + $oui =~ tr /-/:/; # The IEEE bytes are separated by dashes. + # Ensure OUI is all upper-case + $oui =~ tr/a-f/A-F/; if (exists $oui_list{$oui}) { - printf "$oui - Skipping CaveBear \"$manuf\" in favor of \"$oui_list{$oui}\"\n"; - $cb_skipped++; + printf "$oui - Skipping IEEE \"$manuf\" in favor of \"$oui_list{$oui}\"\n"; + $ieee_skipped++; } else { $oui_list{$oui} = $manuf; - $cb_added++; + $ieee_added++; } } } -foreach $line (split(/\n/, $ieee_list)) { - if (($oui, $manuf) = ($line =~ /^($ieee_re)\s+\(hex\)\s+(\S.*)$/)) { - $oui =~ tr /-/:/; # The IEEE bytes are separated by dashes. +# Add CaveBear entries for OUIs not yet known. +foreach $line (split(/\n/, $cb_list)) { + if (($oui, $manuf) = ($line =~ /^($cb_re)\s+(\S.*)$/)) { + ($h1, $h2, $h3) = ($oui =~ /($hp)($hp)($hp)/); # The CaveBear bytes have no separators + $oui = "$h1:$h2:$h3"; + # Ensure OUI is all upper-case + $oui =~ tr/a-f/A-F/; if (exists $oui_list{$oui}) { - printf "$oui - Skipping IEEE \"$manuf\" in favor of \"$oui_list{$oui}\"\n"; - $ieee_skipped++; + printf "$oui - Skipping CaveBear \"$manuf\" in favor of \"$oui_list{$oui}\"\n"; + $cb_skipped++; } else { $oui_list{$oui} = $manuf; - $ieee_added++; + $cb_added++; } } } @@ -107,10 +117,10 @@ foreach $oui (sort(keys %oui_list)) { $total_added = $tmpl_added + $cb_added + $ieee_added; print <<"Fin" Original entries : $tmpl_added -CaveBear added : $cb_added IEEE added : $ieee_added +CaveBear added : $cb_added Total : $total_added -CaveBear skipped : $cb_skipped IEEE skipped : $ieee_skipped +CaveBear skipped : $cb_skipped Fin