Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve MAC OUI vendor database handling and display for 'private' MAC addresses #5205

Closed
meyergru opened this issue Sep 11, 2021 · 3 comments
Labels
help wanted Contributor missing / timeout support Community support

Comments

@meyergru
Copy link
Contributor

meyergru commented Sep 11, 2021

Display for MAC vendors in status_dhcp_leases.php is based on a python implementation for IEEE databases.
There are two problems I see with this approach:

  1. The files are almost always outdated, unless an update for the python package was just being done. As of 21.7.2, the database is from August 2020. Thus, many modern hardware cannot be identified.
  2. Currently, one sees a lot of "fake", i.e. locally administered MACs, because in order to limit tracking, Apple has elected to use "private", or better: random MACs (cf. https://support.apple.com/guide/security/wi-fi-privacy-secb9cb3140c/web)

Therefore, I suggest offering a way for update the database either manually or regularly. This can easily be done by:

#! /bin/sh
cd /usr/local/lib/python3.8/site-packages/netaddr/eui
curl -s -o oui.txt http://standards-oui.ieee.org/oui/oui.txt
curl -s -o iab.txt http://standards-oui.ieee.org/iab/iab.txt
python3 ieee.py

For the second part, I suggest differentiating between "unknown" vendors and "private" MACs by changing this section in status_dhcp_leases.php:

                  <td>
                      <?=$data['mac'];?><br />
                      <small><i><?= !empty($mac_man[$mac_hi]) ? $mac_man[$mac_hi] : '' ?></i></small>
                  </td>

to read:

                  <td>
                      <?=$data['mac'];?><br />
                      <small><i><?= !empty($mac_man[$mac_hi]) ? $mac_man[$mac_hi] : 
                                                (stripos('EA62', substr($data['mac'], 1, 1)) !== false ?
                                                'Locally administered MAC' : '') ?></i></small>
                  </td>

(if you try this on your local machine, do not forget to restart the web gui via '/usr/local/etc/rc.restart_webgui')

One could improve that even more by adding some known locally administered MAC prefixes, like '52-54-00' for KVM virtual machines (VMware uses their own 'real' OUI prefixes already). This could be done by appending to oui.txt like so:

#! /bin/sh
cd /usr/local/lib/python3.8/site-packages/netaddr/eui
curl -s -o oui.txt http://standards-oui.ieee.org/oui/oui.txt
curl -s -o iab.txt http://standards-oui.ieee.org/iab/iab.txt
printf  "52-54-00   (hex)\t\tKVM virtual machine\r\n" >> oui.txt
printf "525400     (base 16)\t\tKVM virtual machine\r\n" >> oui.txt
printf "\t\t\t\t\r\n" >> oui.txt
printf "\t\t\t\t\r\n" >> oui.txt
printf "\t\t\t\tUS\r\n" >> oui.txt
python3 ieee.py
@AdSchellevis AdSchellevis added the support Community support label Sep 11, 2021
@AdSchellevis
Copy link
Member

It’s probably better to create a ticket at netaddr to support the missing pieces or support some sort of standard location for database overwrites.

Updating files within these packages is something we usually try to prevent for maintenance reasons.

@meyergru
Copy link
Contributor Author

You are correct, I opened an issue upstream. netaddr/netaddr#236

@OPNsense-bot
Copy link

This issue has been automatically timed-out (after 180 days of inactivity).

For more information about the policies for this repository,
please read https://github.com/opnsense/core/blob/master/CONTRIBUTING.md for further details.

If someone wants to step up and work on this issue,
just let us know, so we can reopen the issue and assign an owner to it.

@OPNsense-bot OPNsense-bot added the help wanted Contributor missing / timeout label Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributor missing / timeout support Community support
Development

No branches or pull requests

3 participants