aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Luis Duran <jlduran@gmail.com>2022-02-25 14:47:53 +0000
committerWarner Losh <imp@FreeBSD.org>2022-02-27 16:11:55 +0000
commit81a659e364e2ee84dd3220c0f87fb9add8fbfbed (patch)
tree19432ce2e30ddb6d01026861d0993db53421f305
parentbff83dd3956b54705557fa840e038265dcccf673 (diff)
downloadsrc-81a659e364e2ee84dd3220c0f87fb9add8fbfbed.tar.gz
src-81a659e364e2ee84dd3220c0f87fb9add8fbfbed.zip
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
-rw-r--r--lib/libefivar/efivar-dp-parse.c4
1 files changed, 4 insertions, 0 deletions
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;