git: 577ea37d6d5c - main - loader.efi: Expose efi_devpath_get_mac to get mac
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 12 Sep 2026 18:19:12 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=577ea37d6d5cf4ab9fb556f7ec21276db683e600
commit 577ea37d6d5cf4ab9fb556f7ec21276db683e600
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-09-11 16:04:10 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-09-12 16:59:17 +0000
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
---
stand/efi/include/efilib.h | 1 +
stand/efi/libefi/efinet.c | 9 +++------
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/stand/efi/include/efilib.h b/stand/efi/include/efilib.h
index 96de2a6344a2..3d7d59d7f88b 100644
--- a/stand/efi/include/efilib.h
+++ b/stand/efi/include/efilib.h
@@ -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);
diff --git a/stand/efi/libefi/efinet.c b/stand/efi/libefi/efinet.c
index 18e437a9823a..89a27cbaa9f7 100644
--- a/stand/efi/libefi/efinet.c
+++ b/stand/efi/libefi/efinet.c
@@ -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;