station: Identify devices by MAC OUI vendor lookup
Embed the IEEE OUI registry (~1MB pre-processed text file) and resolve the vendor for every station MAC. Locally administered MACs (U/L bit set, used by iOS/Android private addresses and virtual interfaces) are skipped so we don't return spurious matches against randomized prefixes. The vendor name shows up in the device card as a secondary line, and falls back to the title position when no DHCP hostname is available — "Apple" with the IP and MAC is far more useful than "Sans nom". The lookup table loads lazily (sync.Once) on the first call so the ~40k-entry parse only runs when the station discovery code is exercised.
This commit is contained in:
parent
950f73371c
commit
70140bc289
10 changed files with 39518 additions and 3 deletions
|
|
@ -59,11 +59,13 @@ func (b *Backend) GetStations() ([]backend.Station, error) {
|
|||
for _, entry := range arpEntries {
|
||||
// Only include entries with valid flags (2 = COMPLETE, 6 = COMPLETE|PERM)
|
||||
if entry.Flags == 2 || entry.Flags == 6 {
|
||||
mac := entry.HWAddress.String()
|
||||
st := backend.Station{
|
||||
MAC: entry.HWAddress.String(),
|
||||
MAC: mac,
|
||||
IP: entry.IP.String(),
|
||||
Hostname: "", // No hostname available from ARP
|
||||
Type: backend.GuessDeviceType("", entry.HWAddress.String()),
|
||||
Type: backend.GuessDeviceType("", mac),
|
||||
Vendor: backend.LookupVendor(mac),
|
||||
Signal: 0, // Not available from ARP
|
||||
RxBytes: 0, // Not available from ARP
|
||||
TxBytes: 0, // Not available from ARP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue