Skip to content

Commit

Permalink
MdePkg/UefiDevicePathLib: Fix the wrong MAC address length
Browse files Browse the repository at this point in the history
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).

Cc: Liming Gao <liming.gao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
  • Loading branch information
jiaxinwu committed Mar 15, 2017
1 parent f4fc7d5 commit 2d67f2b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,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;
Expand Down

0 comments on commit 2d67f2b

Please sign in to comment.