loader.efi: Expose efi_devpath_get_mac to get mac

This is a convenient way to test if a device path is a nic or not, so
expose it to the world.

Sponsored by:		Netflix
This commit is contained in:
Warner Losh committed 2026-09-12 10:59:17 -06:00
1 parent bbee544312
commit 577ea37d6d
2 files changed
+4 -6

No files matched your search

+1
View File
@@ -105,6 +105,7 @@ bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
void efi_free_devpath_name(CHAR16 *);
bool efi_devpath_same_disk(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
bool efi_devpath_get_mac(EFI_DEVICE_PATH *, uint8_t[6]);
EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *);
UINTN efi_devpath_length(EFI_DEVICE_PATH *);
EFI_DEVICE_PATH *efi_name_to_devpath(const char *path);
+3 -6
View File
@@ -267,13 +267,10 @@ efi_pxe_snapshot(EFI_HANDLE h, struct pxe_cache_entry *pce)
/*
* Walk a device path looking for the first MSG_MAC_ADDR_DP node and
* copy its 6-byte Ethernet MAC into out. Returns true on success.
* Used to correlate a PXE Base Code Protocol handle back to an SNP
* unit when the two protocols live on different handles (typical for
* UEFI: PXE Base Code is installed on a child handle whose device
* path ends in Ipv4()/Ipv6(), extending the SNP's MAC-terminated path).
* copy its 6-byte Ethernet MAC into out. Returns true on success,
* e.g. false if dp has no NIC node at all.
*/
static bool
bool
efi_devpath_get_mac(EFI_DEVICE_PATH *dp, uint8_t out[6])
{
MAC_ADDR_DEVICE_PATH *mac;