Skip to contents

Looks up the organization that owns each MAC address block, using the longest matching prefix (MA-S, then MA-M, then MA-L).

Usage

lookup_vendor(mac, registry = get_oui_registry())

Arguments

mac

A character vector of MAC addresses in any supported notation.

registry

A data frame as returned by get_oui_registry(), with at least the columns assignment and organization.

Value

A character vector with the organization names (NA if unknown).

Details

Locally administered addresses (see is_local_MAC()), such as randomized Wi-Fi addresses, are not part of the IEEE registries and usually return NA.

Examples

# A small registry, to run without internet access
registry <- data.frame(
  registry = c("MA-L", "MA-M"),
  assignment = c("00000C", "70B3D51"),
  organization = c("Cisco Systems, Inc", "Example Medium Co")
)
macs <- c("00-00-0C-12-34-56", "70:B3:D5:1A:00:00", "02:00:00:00:00:01")
lookup_vendor(macs, registry)
#> [1] "Cisco Systems, Inc" "Example Medium Co"  NA                  

# \donttest{
# With the full IEEE registries (needs an internet connection)
oui <- try(get_oui_registry(cache_dir = tempdir()))
if (is.data.frame(oui)) lookup_vendor(get_MAC(), oui)
#> [1] NA                      "Microsoft Corporation" "Microsoft Corporation"
# }