[edk2] [Patch] MdePkg/UefiDevicePathLib: Fix the wrong MAC address length

Jiaxin Wu posted 1 patch 7 years, 1 month ago
Failed in applying to current master (apply log)
MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 4 ++++
1 file changed, 4 insertions(+)
[edk2] [Patch] MdePkg/UefiDevicePathLib: Fix the wrong MAC address length
Posted by Jiaxin Wu 7 years, 1 month ago
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>
---
 MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index ae38859..a52cbef 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -1798,10 +1798,14 @@ 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;
 }
 
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdePkg/UefiDevicePathLib: Fix the wrong MAC address length
Posted by Ni, Ruiyu 7 years, 1 month ago
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Jiaxin Wu
> Sent: Friday, March 10, 2017 2:47 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan
> <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: [edk2] [Patch] MdePkg/UefiDevicePathLib: 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).
> 
> 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>
> ---
>  MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> index ae38859..a52cbef 100644
> --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
> @@ -1798,10 +1798,14 @@ 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;
>  }
> 
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdePkg/UefiDevicePathLib: Fix the wrong MAC address length
Posted by Ye, Ting 7 years, 1 month ago
Reviewed-by: Ye Ting <ting.ye@intel.com> 

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Friday, March 10, 2017 2:47 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [Patch] MdePkg/UefiDevicePathLib: 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).

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>
---
 MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index ae38859..a52cbef 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -1798,10 +1798,14 @@ 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;  }
 
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdePkg/UefiDevicePathLib: Fix the wrong MAC address length
Posted by Fu, Siyuan 7 years, 1 month ago
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin Wu
Sent: 2017年3月10日 14:47
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [Patch] MdePkg/UefiDevicePathLib: 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).

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>
---
 MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index ae38859..a52cbef 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -1798,10 +1798,14 @@ 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;  }
 
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel