DHCP Leases, Interfaces, & ARP Table Tab Vendor MAC Change w/ 5-15 Snap



  • Did anyone else have the MAC addresses change to manufacturer names with the newest snap?
    2.0-RC2 (i386) built on Sun May 15 03:21:07 EDT 2011

    I know the first question is, did I install the "MAC to vendor" package, but I have not installed it.  I would not mind having two columns, one with the MAC, and one with the vendor (since I have the widescreen package installed).

    EDIT: NOTE: Install NMAP package before edit



  • Hi,

    I do not have this, bu I got this line above the lease table:

    Warning: file(/usr/local/share/nmap/nmap-mac-prefixes): failed to open stream: No such file or directory in /etc/inc/pfsense-utils.inc on line 2194 
    

    I have this on two machines with snapshot:
    2.0-RC2 (amd64) built on Sun May 15 04:20:20 EDT 2011



  • Yeah, looks like they changed it from:

                    if ($data['online'] != "online") {
                            echo "{$fspans}[{$data['mac']}](\"services_wol.php?if={$data['if']}&mac={$data['mac']}\" "\"""){$fspane} \n";
                    } else {
                    	echo "{$fspans}{$data['mac']}{$fspane} \n";
                    }
    
    

    To:

    		$mac=$data['mac']; 
    		$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
                    if ($data['online'] != "online") {
    			if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined
    	                        echo "{$fspans}[{$mac_man[$mac_hi]}](\"services_wol.php?if={$data['if']}&mac=$mac\" "\"""){$fspane} \n";
    			}else{	
                            	echo "{$fspans}[{$data['mac']}](\"services_wol.php?if={$data['if']}&mac={$data['mac']}\" "\"""){$fspane} \n";
    			}
                    }else{
    			if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined
    	                	echo "{$fspans}{$mac_man[$mac_hi]}{$fspane} \n";
    	                }else{
                    		echo "{$fspans}{$data['mac']}{$fspane} \n";
    			}
                    }
    
    


  • Now what I would like to know is how I can display both sets of info.  The MAC in one column and the Vendor in another right next to each other.  If the vendor isn't in the database, the vendor column would just be blank.



  • GOT IT!!  It is now displaying both sets of information correctly. :D
    NOTE: Install the nmap package
    (I left the beginnings and ends of some of the other code around it so it makes it easier to replace)

    Edit /usr/local/www/status_dhcp_leases.php

    		echo "\n";
                    echo "{$fspans}{$data['ip']}{$fspane} \n";
                    if ($data['online'] != "online") {
                            echo "{$fspans}[{$data['mac']}](\"services_wol.php?if={$data['if']}&mac={$data['mac']}\" "\"""){$fspane} \n";
                    } else {
                    	echo "{$fspans}{$data['mac']}{$fspane} \n";
                    }
    		$mac=$data['mac']; 
    		$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
                    if ($data['online'] != "online") {
    			if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined
    	                        echo "{$fspans}{$mac_man[$mac_hi]}{$fspane} \n";
    			}else{	
                            	echo " \n";
    			}
                    }else{
    			if(isset($mac_man[$mac_hi])){ // Manufacturer for this MAC is defined
    	                	echo "{$fspans}{$mac_man[$mac_hi]}{$fspane} \n";
    	                }else{
                    		echo " \n";
    			}
                    }
                    echo "{$fspans}"  . htmlentities($data['hostname']) . "{$fspane} \n";
    				if ($data['type'] != "static") {
    					echo "{$fspans}" . adjust_gmt($data['start']) . "{$fspane} \n";
    					echo "{$fspans}" . adjust_gmt($data['end']) . "{$fspane} \n";
    				} else {
    					echo "{$fspans} n/a {$fspane} \n";
    					echo "{$fspans} n/a {$fspane} \n";
    				}
    
    

    Now I just have to figure out how/where to edit the MAC database  :-\




  • Edit /usr/local/www/status_interfaces.php

    
    						echo "  |  ";
    			$mac=$ifinfo['macaddr']; 
    			$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
    			if(isset($mac_man[$mac_hi])){ print "" . htmlspecialchars($mac_man[$mac_hi]); print ""; }
    			      else {print htmlspecialchars($mac);}
    			?>
    
    




  • Edit /usr/local/www/diag_arp.php

    
    					  |					  |					  |					  |					  |													
    						  |						 
    												echo "  |  ";
    						$mac=$entry['mac']; 
    						$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
    						if(isset($mac_man[$mac_hi])){ print "{$mac_man[$mac_hi]}"; }
    						else{ print " "; }
    						?>
    						 | 
    														echo str_replace("Z_ ", "", $entry['dnsresolve']);
    							?>
    						 |						  |												
    
    		 |	
    
    




  • nice work! I hope one of the developers can add this to the mainline code.



  • The only problem that arises is that the changes will not fit on the normal screen size.  They would have to add it into the widescreen package.



  • You can also change it like so to add a column instead of being in the same column with the little pipe divider.

    Edit /usr/local/www/diag_arp.php

    
    					  |					  |					  |					  |					  |					  |													
    						  |						  |						 
    												$mac=$entry['mac']; 
    						$mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
    						if(isset($mac_man[$mac_hi])){ print "{$mac_man[$mac_hi]}"; }
    						else{ print " "; }
    						?>
    						 | 
    														echo str_replace("Z_ ", "", $entry['dnsresolve']);
    							?>
    						 |						  |												
    
    		 |	
    
    




  • I added the code and was able to see it fine without the widescreen package, 1024x768. Fits perfectly!



  • I edited the file, copied it to the directory but couldn't see anything.

    Should I have to restart the webserver - if yes how could I do that ?
    The Layout with mac AND vendor together is very interesting for me!



  • do you have the nmap package installed? You need that for it to display the vendor names



  • Hi,

    yes I did.
    Installed the nmpa package
    downloades the diag_arp.php file
    edited the file Notepadd++
    uploaded it
    copied it from /tmp/ to /usr/local/www/

    it now only shows me the complete vendor name without any mac.

    Strange - it should work…I just did copy & paste...



  • Did you replace the section as outlined above?  I did leave some of the other lines in there to show where it goes.

    Here, to make it easier, I added an attachment of my ARP file.

    EDIT: Decided to just upload all three.  Just make sure to get rid of the .txt at the end.

    diag_arp.php.txt
    status_dhcp_leases.php.txt
    status_interfaces.php.txt



  • I didn't get it work … :(

    I deleted /usr/local/www/diag_arp.php and copied there thge new on. I checked it with time and date.
    I restarted the webcopnfigurator from the console but with no success.

    I have iperf, nmap and openvpn export utility installed.
    I am using this snapshot:
    2.0-RC2 (amd64) built on Sun May 15 04:20:20 EDT 2011



  • I am so stupid…
    Your last post did it.

    Of course I have to edit all three .php files and not only just one....next time I will read the thread a second time ;-)

    Thank you very much for your patience!!
    Now it looks very well!



  • Can't say I haven't done that before to myself.  :P

    Glad you like it  :D


  • Rebel Alliance Developer Netgate

    I don't like that it replaces the MAC column, often I want/need the MAC and not the vendor, but I also don't want another column.

    I prefer the more subtle approach of putting the vendor in a tooltip when you hover over the MAC, or on a second line below the MAC in a smaller font.

    Basically either flip the parameters in diag_arp.php:

    						if(isset($mac_man[$mac_hi])){ print "{$mac}"; }
    

    Or replace these two lines:

    						if(isset($mac_man[$mac_hi])){ print "{$mac_man[$mac_hi]}"; }
    						else{ print $mac; }
    

    with

    						print $mac;
    						if(isset($mac_man[$mac_hi])){ print "
    _{$mac_man[$mac_hi]}_"; }
    


  • I'll use that on a customer since he has a small screen and we don't have the widescreen installed on his.  I think he'll like that change a lot.  Thanks JimP!!

    As for me personally, I have way too much white space with the widescreen and would like to fill it up with something useful instead of having 4 columns of info and the rest is white space between.  Looks bad on the interfaces tab with 2/3 of the screen not being used.  Looking into modifying that next.


  • Rebel Alliance Developer Netgate

    I just checked in the two-line version:
    https://github.com/bsdperimeter/pfsense/commit/701989fbe44f22fc7ea1848ac7c14f361178e5c2

    Myself and probably many others rely on having the MAC there to copy and paste as needed, so we don't want to lose that capability just because the nmap package is loaded.



  • That the whole reason I decided to edit it.  I enjoy having all the information in one place. To not only see the mac, but verify it with the company, and the ip.  Then I definitely know I have the correct device.



  • If there is a way to use the vencor and mac information without the nmap package I would prefer this way. ;)



  • not my call, but I like the tooltip idea. This way the page is clean and i just hover my mouse over to see the vendor info.. I did notice something tho. If a client online, it doesn't show me the vendor info.. i've attach a screenshot for you to see




  • ~~I think it might work if you post the vendor mac table in the same place.  Let me know if this works!

    Uninstall nmap. Download attachment and remove the .txt. Un 7zip it.  Drop attached file into /usr/local/share/nmap/~~

    @jimp:

    mkdir -p /usr/local/share/nmap/; fetch -o /usr/local/share/nmap/nmap-mac-prefixes http://nmap.org/svn/nmap-mac-prefixes
    

    NOTE: This is the newest update from nmap for the mac prefex listing.  It is not the one included into the nmap package. (had to manually update it)

    @Cino -  Like 192.168.0.10   :D


  • Rebel Alliance Developer Netgate

    Just fixed the other display as well, should be consistent now for online/offline.


  • Rebel Alliance Developer Netgate

    You could just do this also:

    mkdir -p /usr/local/share/nmap/; fetch -o /usr/local/share/nmap/nmap-mac-prefixes http://nmap.org/svn/nmap-mac-prefixes
    


  • @LostInIgnorance
    is working but I could not open your 7z file. Just downloaded mac-prefixes on the homepage.



  • @Nachtfalke - Deleted 7zip file from post to get rid of confusion and reposted what JimP had put.  I couldn't download it either for some odd reason.


Log in to reply