From 81a659e364e2ee84dd3220c0f87fb9add8fbfbed Mon Sep 17 00:00:00 2001 From: Jose Luis Duran Date: Fri, 25 Feb 2022 11:47:53 -0300 Subject: [PATCH] libefivar: Fix the wrong MAC address length Network interface type should be checked before the conversion between text device path node and MAC device path. Otherwise, the MAC text string can't be converted to the representation of a device node, which leads to the series failure of network HII configuration(e.g. IP, VLAN, HTTP Boot configuration in Network Device List). Obtained from: https://github.com/tianocore/edk2/commit/2d67f2bae32040c77af8097a8ef1be272cb00e28 Pull Request: https://github.com/freebsd/freebsd-src/pull/581 --- lib/libefivar/efivar-dp-parse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libefivar/efivar-dp-parse.c b/lib/libefivar/efivar-dp-parse.c index 3fc4fd8a62fd..4040b001708d 100644 --- a/lib/libefivar/efivar-dp-parse.c +++ b/lib/libefivar/efivar-dp-parse.c @@ -1920,6 +1920,10 @@ DevPathFromTextMAC ( MACDevPath->IfType = (UINT8) Strtoi (IfTypeStr); Length = sizeof (EFI_MAC_ADDRESS); + if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) { + Length = 6; + } + StrHexToBytes (AddressStr, Length * 2, MACDevPath->MacAddress.Addr, Length); return (EFI_DEVICE_PATH_PROTOCOL *) MACDevPath;