Re: [edk2] [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration during driver start.

2019-02-11 Thread Ye, Ting
I agree to use debug message. No need to interrupt boot process. 

Thanks,
Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, February 12, 2019 8:48 AM
To: Fu, Siyuan 
Cc: edk2-devel@lists.01.org; Mike Turner ; Ye, 
Ting 
Subject: RE: [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration 
during driver start.

Looks it's enough to add the warning debug message. I have sent the version 2 
patch to do that.

Thanks,
Jiaxin 


> -Original Message-
> From: Fu, Siyuan
> Sent: Tuesday, February 12, 2019 8:28 AM
> To: Wu, Jiaxin 
> Cc: edk2-devel@lists.01.org; Mike Turner 
> ; Ye, Ting 
> Subject: RE: [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 
> configuration during driver start.
> 
> Yes, Jiaxin. You should not use popup messages unless you 100 percent 
> sure the code is running in setup browser.
> 
> BestRegards
> Fu Siyuan
> 
> 
> > -Original Message-
> > From: Mike Turner [mailto:michael.tur...@microsoft.com]
> > Sent: Monday, February 11, 2019 11:10 PM
> > To: Wu, Jiaxin ; Ye, Ting ; 
> > edk2- de...@lists.01.org
> > Cc: Fu, Siyuan 
> > Subject: RE: [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 
> > configuration during driver start.
> >
> > I haven't seen any patch for a popup, but message popups during 
> > driver
> binding
> > start are not a good thing.
> >
> > Michael R Turner
> > Surface UEFI Development
> > Microsoft Corporation
> > One Redmond Way
> > Redmond WA 98052
> >
> > 425-705-0928
> >
> > This email message may contain confidential and privileged
> information.  Any
> > unauthorized use is prohibited.  If you are not the intended 
> > recipient,
> please
> > contact the sender by reply email and destroy all copies of the 
> > original message.
> >
> >
> > -Original Message-
> > From: Wu, Jiaxin 
> > Sent: Sunday, February 10, 2019 7:10 PM
> > To: Ye, Ting ; edk2-devel@lists.01.org
> > Cc: Mike Turner ; Fu, Siyuan 
> > 
> > Subject: RE: [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 
> > configuration during driver start.
> >
> > Agree, thanks the comment. I will update the patch.
> >
> >
> >
> > > -Original Message-
> > > From: Ye, Ting
> > > Sent: Monday, February 11, 2019 11:09 AM
> > > To: Wu, Jiaxin ; edk2-devel@lists.01.org
> > > Cc: Michael Turner ; Fu, Siyuan 
> > > 
> > > Subject: RE: [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 
> > > configuration during driver start.
> > >
> > > Hi Jiaxin,
> > >
> > > I agree we need start IPv6 stack no matter the configuration is valid or 
> > > not.
> > > However I would suggest to add more comments and pop up warning 
> > > messages to let user know we continue to start IPv6 stack without 
> > > using previously saved configuration.
> > >
> > > Thanks,
> > > Ting
> > >
> > > -Original Message-
> > > From: Wu, Jiaxin
> > > Sent: Sunday, February 3, 2019 2:24 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Michael Turner ; Ye, Ting 
> > > ; Fu, Siyuan ; Wu, Jiaxin 
> > > 
> > > Subject: [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 
> > > configuration during driver start.
> > >
> > > REF:
> > >
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugz
> > >
> illa.tianocore.org%2Fshow_bug.cgi%3Fid%3D1448data=02%7C01%7C
> Micha
> > >
> el.Turner%40microsoft.com%7C93fb5d7f003b48c6561d08d68fce66f4%7C72f9
> 88b
> > >
> f86f141af91ab2d7cd011db47%7C1%7C0%7C636854514000398927sdata
> =bCAbT
> > > njjX9bmuRiASoCkPiZtdqUY14BDMgyLd%2BYNNx4%3Dreserved=0
> > >
> > > This patch is to clean the invalid data and continue to start IP6 driver.
> > >
> > > Cc: Michael Turner 
> > > Cc: Ye Ting 
> > > Cc: Fu Siyuan 
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Wu Jiaxin 
> > > Signed-off-by: Michael Turner 
> > > ---
> > >  NetworkPkg/Ip6Dxe/Ip6Driver.c | 20 ++--
> > >  1 file changed, 18 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c 
> > > b/NetworkPkg/Ip6Dxe/Ip6Driver.c index 4c607125a6..1bd1c61da8 
> > > 100644
> > > --- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
> > > +++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
> > > @@ -586,11 +586,19 @

Re: [edk2] LocateProtocol - gEfiTcp4ServiceBindingProtocolGuid

2019-02-10 Thread Ye, Ting
Hi Ivan,

The code you are using is not from EDKII trunk. You may ask the owner from the 
github for detailed info about the error.

It looks to me that your platform does not include modules required by UEFI 
network stack. For example, TCP driver which producing 
Tcp4ServiceBindingProtocol is missed.

You may refer to WIKI here for how to enable UEFI network stack: 
https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg-Getting-Started-Guide

Thanks,
Ting

-Original Message-
From: Ivan Novgorodtsev [mailto:inovgorodt...@itti.com.pl] 
Sent: Friday, February 8, 2019 3:25 PM
To: Ye, Ting 
Subject: RE: [edk2] LocateProtocol - gEfiTcp4ServiceBindingProtocolGuid

Hi Ting,

I'm really sorry for the late reply. I hope now you can see my attachments. In 
case they are removed again, i posted them also on imgur
here: https://imgur.com/a/8q3VtPN.

Kind regards, Ivan

> Hi Ivan,
>
> I can't find your attachment. Maybe removed by the mailing system.
>
> I have no idea about the tree you are using. Is it possible for you to 
> use the EDKII trunk code?  It is available at 
> https://github.com/tianocore/edk2.
>
> Thanks,
> Ting
>
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Ivan Novgorodtsev
> Sent: Friday, February 1, 2019 8:41 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] LocateProtocol - gEfiTcp4ServiceBindingProtocolGuid
>
> Hi,
> I'm having trouble with sending a tcp packet from UEFI Application. 
> I'm using code from this github:
> https://github.com/YunWang/uefi-programming-guider/tree/master/book/Ne
> twork
>
> I attached two screenshot were I suppose something went wrong. In 
> first one, at lines 91-94  LocateProtocol triggers return. Second 
> screenshot shows the error. Settings:
>
> *BootCheck.inf*
>
> [Packages]
>    MdePkg/MdePkg.dec
>    MdeModulePkg/MdeModulePkg.dec
>    ShellPkg/ShellPkg.dec
>
> [LibraryClasses]
>    UefiApplicationEntryPoint
>    UefiLib
>    UefiBootServicesTableLib
>    #used in application
>    ShellLib
>
> [Protocols]
>    gEfiShellProtocolGuid
>    gEfiTcp4ServiceBindingProtocolGuid
>    gEfiTcp4ProtocolGuid
>
> *Nt32Pkg.dsc*
>
> [LibraryClasses.common.UEFI_APPLICATION]
>    PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
> PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPri
> PrintLib|nt
> PrintLib|2Protocol.inf
>    #added below for application
>    ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
>
> In the background simple C# TCP Server is running, I can connect to it 
> for example using another C# app or using PuTTY.
>
> I would appreciate any useful information, thank you.
> Kind regards, Ivan
>
>
> ___
> 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 v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration during driver start.

2019-02-10 Thread Ye, Ting
Hi Jiaxin,

I agree we need start IPv6 stack no matter the configuration is valid or not. 
However I would suggest to add more comments and pop up warning messages to let 
user know we continue to start IPv6 stack without using previously saved 
configuration.

Thanks,
Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Sunday, February 3, 2019 2:24 PM
To: edk2-devel@lists.01.org
Cc: Michael Turner ; Ye, Ting 
; Fu, Siyuan ; Wu, Jiaxin 

Subject: [PATCH v1] NetworkPkg/Ip6Dxe: Clean the invalid IPv6 configuration 
during driver start.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1448

This patch is to clean the invalid data and continue to start IP6 driver.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Signed-off-by: Michael Turner 
---
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c 
index 4c607125a6..1bd1c61da8 100644
--- a/NetworkPkg/Ip6Dxe/Ip6Driver.c
+++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c
@@ -586,11 +586,19 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeManualAddress,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
-  goto UNINSTALL_PROTOCOL;
+  //
+  // Clean the invalid ManualAddress configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeManualAddress,
+ 0,
+ NULL
+ );
 }
   }
 
   //
   // If there is any default gateway address, set it.
@@ -602,11 +610,19 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeGateway,
DataItem->DataSize,
DataItem->Data.Ptr
);
 if (EFI_ERROR(Status)) {
-  goto UNINSTALL_PROTOCOL;
+  //
+  // Clean the invalid Gateway configuration.
+  //
+  Status = Ip6Cfg->SetData (
+ Ip6Cfg,
+ Ip6ConfigDataTypeGateway,
+ 0,
+ NULL
+ );
 }
   }
 
   //
   // ready to go: start the receiving and timer
--
2.17.1.windows.2

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


Re: [edk2] [PATCH v1 0/2] Uninstall protocols when error happen in Driver Binding Start.

2019-02-10 Thread Ye, Ting
Series Reviewed-By: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Sunday, February 3, 2019 2:23 PM
To: edk2-devel@lists.01.org
Cc: Michael Turner ; Ye, Ting 
; Fu, Siyuan ; Wu, Jiaxin 

Subject: [PATCH v1 0/2] Uninstall protocols when error happen in Driver Binding 
Start.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447

This patch is to uninstall Ip6ServiceBindingProtocol and Ip6ConfigProtocol when 
error happen in Driver Binding Start.

Cc: Michael Turner 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Signed-off-by: Michael Turner 

Jiaxin Wu (2):
  MdeModulePkg/Ip4Dxe: Uninstall protocols when error happen in DriverBinding 
Start.
  NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in DriverBinding 
Start.

 MdeModulePkg//Universal/Network/Ip4Dxe/Ip4Driver.c  |  9 --
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 28 +--
 2 files changed, 25 insertions(+), 12 deletions(-)

--
2.17.1.windows.2

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


Re: [edk2] [PATCH v2] CryptoPkg: Fix various typos

2019-02-10 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Antoine 
Coeur
Sent: Friday, February 8, 2019 12:12 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v2] CryptoPkg: Fix various typos

Fix various typos in CryptoPkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Coeur 
---
 CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c | 2 +-
 CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c 
b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
index d63c23df09..540c5715cb 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
@@ -142,7 +142,7 @@ IMPLEMENT_ASN1_FUNCTIONS (TS_TST_INFO)
   @param[in]  Asn1Time Pointer to the ASN.1 GeneralizedTime to be 
converted.
   @param[out] SigningTime  Return the corresponding EFI Time.
 
-  @retval  TRUE   The time convertion succeeds.
+  @retval  TRUE   The time conversion succeeds.
   @retval  FALSE  Invalid parameters.
 
 **/
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 9510a4a383..80f5c2578e 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
@@ -84,14 +84,14 @@ QuickSortWorker (
 }
   }
   //
-  // Swap pivot to it's final position (NextSwapLocaiton)
+  // Swap pivot to its final position (NextSwapLocation)
   //
   CopyMem (Buffer, Pivot, ElementSize);
   CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), 
ElementSize);
   CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), Buffer, 
ElementSize);
 
   //
-  // Now recurse on 2 paritial lists.  Neither of these will have the 'pivot' 
element.
+  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
element.
   // IE list is sorted left half, pivot element, sorted right half...
   //
   QuickSortWorker (
-- 
2.17.2 (Apple Git-113)

___
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] LocateProtocol - gEfiTcp4ServiceBindingProtocolGuid

2019-02-01 Thread Ye, Ting
Hi Ivan,

I can't find your attachment. Maybe removed by the mailing system.

I have no idea about the tree you are using. Is it possible for you to use the 
EDKII trunk code?  It is available at https://github.com/tianocore/edk2. 

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ivan 
Novgorodtsev
Sent: Friday, February 1, 2019 8:41 PM
To: edk2-devel@lists.01.org
Subject: [edk2] LocateProtocol - gEfiTcp4ServiceBindingProtocolGuid

Hi,
I'm having trouble with sending a tcp packet from UEFI Application. I'm using 
code from this github: 
https://github.com/YunWang/uefi-programming-guider/tree/master/book/Network

I attached two screenshot were I suppose something went wrong. In first one, at 
lines 91-94  LocateProtocol triggers return. Second screenshot shows the error. 
Settings:

*BootCheck.inf*

[Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   ShellPkg/ShellPkg.dec

[LibraryClasses]
   UefiApplicationEntryPoint
   UefiLib
   UefiBootServicesTableLib
   #used in application
   ShellLib

[Protocols]
   gEfiShellProtocolGuid
   gEfiTcp4ServiceBindingProtocolGuid
   gEfiTcp4ProtocolGuid

*Nt32Pkg.dsc*

[LibraryClasses.common.UEFI_APPLICATION]
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint
PrintLib|2Protocol.inf
   #added below for application
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf

In the background simple C# TCP Server is running, I can connect to it for 
example using another C# app or using PuTTY.

I would appreciate any useful information, thank you.
Kind regards, Ivan


___
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] CryptoPkg/BaseCryptLib: split CryptPkcs7Verify.c on behalf of runtime

2019-01-29 Thread Ye, Ting
Looks good to me.

Reviewed-by: Ye Ting  

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jian J 
Wang
Sent: Monday, January 28, 2019 4:38 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Long, Qin 
Subject: [edk2] [PATCH] CryptoPkg/BaseCryptLib: split CryptPkcs7Verify.c on 
behalf of runtime

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1493

Pkcs7GetAttachedContent() implementation in current CryptPkcs7Verify.c is 
actually shared by RuntimeCryptLib.inf, SmmCryptLib.inf and BaseCryptLib.inf, 
which are not correct since there's no use scenario for runtime and 
AllocatePool() used in this method can only be called in boot time.

This patch fix this issue by splitting file CryptPkcs7Verify.c into 3 parts.

  CryptPkcs7VerifyCommon.c  (shared among Base, SMM, Runtime)
  CryptPkcs7VerifyBase.c(shared between Base, SMM)
  CryptPkcs7VerifyRuntime.c (for Runtime only)

CryptPkcs7VerifyBase.c will have original implementation of
Pkcs7GetAttachedContent() as CryptPkcs7Verify.c. CryptPkcs7VerifyRuntime.c 
provide a NULL version of Pkcs7GetAttachedContent().

No functionality and interface change is involved in this patch.

Cc: Ting Ye 
Cc: Qin Long 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang 
---
 .../Library/BaseCryptLib/BaseCryptLib.inf |   5 +-
 .../Library/BaseCryptLib/InternalCryptLib.h   |  32 +
 .../Library/BaseCryptLib/PeiCryptLib.inf  |   3 +-
 .../BaseCryptLib/Pk/CryptPkcs7VerifyBase.c| 131 ++
 ...Pkcs7Verify.c => CryptPkcs7VerifyCommon.c} | 112 +--  
.../BaseCryptLib/Pk/CryptPkcs7VerifyRuntime.c |  45 ++
 .../Library/BaseCryptLib/RuntimeCryptLib.inf  |   6 +-
 .../Library/BaseCryptLib/SmmCryptLib.inf  |   5 +-
 8 files changed, 220 insertions(+), 119 deletions(-)  create mode 100644 
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyBase.c
 rename CryptoPkg/Library/BaseCryptLib/Pk/{CryptPkcs7Verify.c => 
CryptPkcs7VerifyCommon.c} (85%)  create mode 100644 
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyRuntime.c

diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index f29445ce34..c5558eedb7 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -6,7 +6,7 @@
 #  This external input must be validated carefully to avoid security issues 
such as  #  buffer overflow or integer overflow.
 #
-#  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2009 - 2019, Intel Corporation. All rights 
+reserved.
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License  #  which 
accompanies this distribution.  The full text of the license may be found at @@ 
-49,7 +49,8 @@
   Pk/CryptRsaExt.c
   Pk/CryptPkcs5Pbkdf2.c
   Pk/CryptPkcs7Sign.c
-  Pk/CryptPkcs7Verify.c
+  Pk/CryptPkcs7VerifyCommon.c
+  Pk/CryptPkcs7VerifyBase.c
   Pk/CryptDh.c
   Pk/CryptX509.c
   Pk/CryptAuthenticode.c
diff --git a/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h 
b/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h
index 8cccf72567..026793f664 100644
--- a/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h
+++ b/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h
@@ -33,4 +33,36 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define OBJ_length(o) ((o)->length)
 #endif
 
+/**
+  Check input P7Data is a wrapped ContentInfo structure or not. If not 
+construct
+  a new structure to wrap P7Data.
+
+  Caution: This function may receive untrusted input.
+  UEFI Authenticated Variable is external input, so this function will 
+ do basic  check for PKCS#7 data structure.
+
+  @param[in]  P7Data   Pointer to the PKCS#7 message to verify.
+  @param[in]  P7Length Length of the PKCS#7 message in bytes.
+  @param[out] WrapFlag If TRUE P7Data is a ContentInfo structure, otherwise
+   return FALSE.
+  @param[out] WrapData If return status of this function is TRUE:
+   1) when WrapFlag is TRUE, pointer to P7Data.
+   2) when WrapFlag is FALSE, pointer to a new 
ContentInfo
+   structure. It's caller's responsibility to free this
+   buffer.
+  @param[out] WrapDataSize Length of ContentInfo structure in bytes.
+
+  @retval TRUE The operation is finished successfully.
+  @retval FALSEThe operation is failed due to lack of resources.
+
+**/
+BOOLEAN
+WrapPkcs7Data (
+  IN  CONST UINT8  *P7Data,
+  IN  UINTNP7Length,
+  OUT BOOLEAN  *WrapFlag,
+  OUT UINT8**WrapData,
+  OUT UINTN*WrapDataSize
+  );
+
 #endif
diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
index e7b4b2f618..386810e4

Re: [edk2] Network Stack Budgeting

2019-01-23 Thread Ye, Ting
Hi Tom,

As I known it is up to platform BDS when to connect network stack, or even not 
to connect network stack. For example, in fast boot process, network stack will 
not be connected thus Snp.Start() has no chance to be called.
May I know which platforms you see this issue?

Thanks,
Ting


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Tomas 
Pilar (tpilar)
Sent: Wednesday, January 23, 2019 6:56 PM
To: edk2-devel@lists.01.org
Subject: [edk2] Network Stack Budgeting

Hi,

Recently I have done some performance improvements to my network driver. I am 
however finding that on some platforms, it's becoming impossible to boot if the 
network cable has a lot of traffic on it that is not filtered by the NIC itself 
(broadcast, multicast or directed unicast). It would seem the platform hangs in 
the DXE phase trying to process (drop) all the packets and not progressing 
through the boot order.

I am wondering if anyone has seen similar behaviour. Does the network stack 
have any budgeting?

Ideally this would be fixed by the network stack not calling Snp.Start() until 
in the BDS phase but it seems most platforms just call Snp.Start() immediately 
following the driver probe.

Cheers,
Tom


___
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 1/4] CryptoPkg/SmmCryptLib: permit use by MM_STANDALONE modules

2019-01-21 Thread Ye, Ting
Yes. No objections from me. Sorry for missed the previous mail.

Thanks,
Ting

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Monday, January 21, 2019 8:41 PM
To: Gao, Liming 
Cc: Wang, Jian J ; Ye, Ting ; 
edk2-devel@lists.01.org; Kinney, Michael D ; Wei, 
Gang ; Zhang, Chao B ; Yao, Jiewen 
; Wu, Hao A ; Zeng, Star 
; Achin Gupta ; Jagadeesh Ujja 

Subject: Re: [PATCH 1/4] CryptoPkg/SmmCryptLib: permit use by MM_STANDALONE 
modules

On Mon, 21 Jan 2019 at 13:40, Gao, Liming  wrote:
>
> Ard:
>   Wang, Jian is the reviewer of CryptoPkg. I think that his review-by is 
> enough.
>

OK, thanks!


> Thanks
> Liming
> > -Original Message-
> > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> > Sent: Monday, January 21, 2019 8:36 PM
> > To: Wang, Jian J ; Ye, Ting 
> > 
> > Cc: edk2-devel@lists.01.org; Kinney, Michael D 
> > ; Gao, Liming ; 
> > Wei, Gang ; Zhang, Chao B 
> > ; Yao, Jiewen ; Wu, 
> > Hao A ; Zeng, Star ; Achin 
> > Gupta ; Jagadeesh Ujja 
> > Subject: Re: [PATCH 1/4] CryptoPkg/SmmCryptLib: permit use by 
> > MM_STANDALONE modules
> >
> > On Fri, 18 Jan 2019 at 12:12, Ard Biesheuvel  
> > wrote:
> > >
> > > On Fri, 18 Jan 2019 at 08:08, Wang, Jian J  wrote:
> > > >
> > > >
> > > >
> > > > Reviewed-by: Jian J Wang 
> > > >
> > >
> > > Ting, do you have any objections to this patch?
> > >
> >
> > Ping?
> >
> >
> >
> > > >
> > > > > -Original Message-
> > > > > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> > > > > Sent: Thursday, January 17, 2019 5:22 AM
> > > > > To: edk2-devel@lists.01.org
> > > > > Cc: Ard Biesheuvel ; Kinney, 
> > > > > Michael D ; Gao, Liming 
> > > > > ; Ye, Ting ; Wei, 
> > > > > Gang ; Wang, Jian J 
> > > > > ; Zhang, Chao B 
> > > > > ; Yao, Jiewen ; 
> > > > > Wu, Hao A ; Zeng, Star 
> > > > > ; Achin Gupta ; 
> > > > > Jagadeesh Ujja 
> > > > > Subject: [PATCH 1/4] CryptoPkg/SmmCryptLib: permit use by 
> > > > > MM_STANDALONE modules
> > > > >
> > > > > Permit SmmCryptLib to be used by MM_STANDALONE modules
> > > > >
> > > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > > Signed-off-by: Ard Biesheuvel 
> > > > > ---
> > > > >  CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> > > > > b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> > > > > index c34699cd62bf..a681fe2f36b8 100644
> > > > > --- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> > > > > +++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> > > > > @@ -30,7 +30,7 @@ [Defines]
> > > > >MODULE_TYPE= DXE_SMM_DRIVER
> > > > >VERSION_STRING = 1.0
> > > > >PI_SPECIFICATION_VERSION   = 0x0001000A
> > > > > -  LIBRARY_CLASS  = BaseCryptLib|DXE_SMM_DRIVER 
> > > > > SMM_CORE
> > > > > +  LIBRARY_CLASS  = BaseCryptLib|DXE_SMM_DRIVER 
> > > > > SMM_CORE
> > > > > MM_STANDALONE
> > > > >
> > > > >  #
> > > > >  # The following information is for reference only and not 
> > > > > required by the build tools.
> > > > > --
> > > > > 2.17.1
> > > >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] Upgrade OpenSSL to 1.1.0j

2018-12-20 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wang, Jian J 
Sent: Wednesday, December 19, 2018 11:03 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Wei, Gang 
Subject: [PATCH] Upgrade OpenSSL to 1.1.0j

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1393

BZ#1089 (https://bugzilla.tianocore.org/show_bug.cgi?id=1089) requests to 
upgrade the OpenSSL to the latest 1.1.1 release. Since OpenSSL-1.1.1 has many 
changes, more porting efforts and feature evaluation are needed.
This might lead to a situation that it cannot catch the Q1'19 stable tag.

One of the solution is upgrade current version (1.1.0h) to 1.1.0j.
According to following web page in openssl.org, all security issues solved in 
1.1.1 have been also back-ported to 1.1.0.j. This can make sure that no 
security vulnerabilities left in edk2 master before 1.1.1.

https://www.openssl.org/news/vulnerabilities-1.1.1.html

Cc: Ting Ye 
Cc: Gang Wei 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang 
---
 CryptoPkg/CryptoPkg.dsc   |  1 +
 .../Library/Include/openssl/opensslconf.h | 20 ---
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   |  3 +++
 .../Library/OpensslLib/OpensslLibCrypto.inf   |  3 +++
 CryptoPkg/Library/OpensslLib/openssl  |  2 +-
 CryptoPkg/Library/OpensslLib/process_files.pl |  0
 6 files changed, 21 insertions(+), 8 deletions(-)  mode change 100644 => 
100755 CryptoPkg/Library/OpensslLib/process_files.pl

diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc index 
a0334d628b..321abe4d4c 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -121,6 +121,7 @@
   CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
   CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
   CryptoPkg/Library/TlsLib/TlsLib.inf
+  CryptoPkg/Library/OpensslLib/OpensslLib.inf
 
 [Components.IA32, Components.X64]
   CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
diff --git a/CryptoPkg/Library/Include/openssl/opensslconf.h 
b/CryptoPkg/Library/Include/openssl/opensslconf.h
index 1917d7ab24..28dd9ab93c 100644
--- a/CryptoPkg/Library/Include/openssl/opensslconf.h
+++ b/CryptoPkg/Library/Include/openssl/opensslconf.h
@@ -2,7 +2,7 @@
  * WARNING: do not edit!
  * Generated from include/openssl/opensslconf.h.in
  *
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy @@ 
-235,12 +235,18 @@ extern "C" {
  * still won't see them if the library has been built to disable deprecated
  * functions.
  */
-#if defined(OPENSSL_NO_DEPRECATED)
-# define DECLARE_DEPRECATED(f)
-#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
-# define DECLARE_DEPRECATED(f)f __attribute__ ((deprecated));
-#else
-# define DECLARE_DEPRECATED(f)   f;
+#ifndef DECLARE_DEPRECATED
+# if defined(OPENSSL_NO_DEPRECATED)
+#  define DECLARE_DEPRECATED(f)
+# else
+#  define DECLARE_DEPRECATED(f)   f;
+#  ifdef __GNUC__
+#   if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
+#undef DECLARE_DEPRECATED
+#define DECLARE_DEPRECATED(f)f __attribute__ ((deprecated));
+#   endif
+#  endif
+# endif
 #endif
 
 #ifndef OPENSSL_FILE
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 0300856cf2..6162d29143 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -175,6 +175,7 @@
   $(OPENSSL_PATH)/crypto/conf/conf_mall.c
   $(OPENSSL_PATH)/crypto/conf/conf_mod.c
   $(OPENSSL_PATH)/crypto/conf/conf_sap.c
+  $(OPENSSL_PATH)/crypto/conf/conf_ssl.c
   $(OPENSSL_PATH)/crypto/cpt_err.c
   $(OPENSSL_PATH)/crypto/cryptlib.c
   $(OPENSSL_PATH)/crypto/cversion.c
@@ -281,6 +282,7 @@
   $(OPENSSL_PATH)/crypto/evp/pmeth_lib.c
   $(OPENSSL_PATH)/crypto/evp/scrypt.c
   $(OPENSSL_PATH)/crypto/ex_data.c
+  $(OPENSSL_PATH)/crypto/getenv.c
   $(OPENSSL_PATH)/crypto/hmac/hm_ameth.c
   $(OPENSSL_PATH)/crypto/hmac/hm_pmeth.c
   $(OPENSSL_PATH)/crypto/hmac/hmac.c
@@ -418,6 +420,7 @@
   $(OPENSSL_PATH)/crypto/x509/x509_err.c
   $(OPENSSL_PATH)/crypto/x509/x509_ext.c
   $(OPENSSL_PATH)/crypto/x509/x509_lu.c
+  $(OPENSSL_PATH)/crypto/x509/x509_meth.c
   $(OPENSSL_PATH)/crypto/x509/x509_obj.c
   $(OPENSSL_PATH)/crypto/x509/x509_r2x.c
   $(OPENSSL_PATH)/crypto/x509/x509_req.c
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 23be4e1e14..b04bf62b4e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -175,6 +175,7 @@
   $(OPENSSL_PATH)/crypto/conf/conf_mall.c
   $(OPENSSL_PATH)/crypto/conf/conf_mod.c
   $(OPENSSL_PATH)/crypto/conf/conf_sap.c
+  $(OPENSSL_PATH)/crypto/

Re: [edk2] [PATCH] Maintainers.txt: Change package maintainer and reviewer of CryptoPkg.

2018-12-13 Thread Ye, Ting
Thanks all for the info and follow up. Laszlo, please let me know if there is 
additional step you think I need follow, thanks.

Best Regards,
Ting

From: Long, Qin
Sent: Friday, December 14, 2018 2:30 AM
To: Gao, Liming ; Laszlo Ersek ; Ye, 
Ting 
Cc: edk2-devel@lists.01.org
Subject: RE: [edk2] [PATCH] Maintainers.txt: Change package maintainer and 
reviewer of CryptoPkg.

Confirmed by Long, Qin mailto:qin.l...@intel.com>>

(And sorry for this rule breaking caused by me. I didn't notice this updates.)

Best Regards & Thanks,
LONG, Qin

From: Gao, Liming
Sent: Thursday, December 13, 2018 9:15 PM
To: Laszlo Ersek mailto:ler...@redhat.com>>; Ye, Ting 
mailto:ting...@intel.com>>; Long, Qin 
mailto:qin.l...@intel.com>>
Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Subject: RE: [edk2] [PATCH] Maintainers.txt: Change package maintainer and 
reviewer of CryptoPkg.

Laszlo:
  Yes. Long, Qin should send this patch. Because Long, Qin changes to another 
work group for a while, he doesn't work on edk2 project. Ting directly sends 
the patch to remove his name. I just include Long, Qin, and let him confirm 
this change.

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
> Ersek
> Sent: Thursday, December 13, 2018 6:38 PM
> To: Ye, Ting mailto:ting...@intel.com>>
> Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Subject: Re: [edk2] [PATCH] Maintainers.txt: Change package maintainer and 
> reviewer of CryptoPkg.
>
> Hi Ting,
>
> On 12/13/18 08:41, tye1 wrote:
> > Cc: Gang Wei mailto:gang@intel.com>>
> > Cc: Jian Wang mailto:jian.j.w...@intel.com>>
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ting Ye mailto:ting...@intel.com>>
> > ---
> >  Maintainers.txt | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/Maintainers.txt b/Maintainers.txt
> > index 001d8ba010..d5cb305da9 100644
> > --- a/Maintainers.txt
> > +++ b/Maintainers.txt
> > @@ -102,8 +102,9 @@ S: Maintained
> >
> >  CryptoPkg
> >  W: https://github.com/tianocore/tianocore.github.io/wiki/CryptoPkg
> > -M: Qin Long mailto:qin.l...@intel.com>>
> >  M: Ting Ye mailto:ting...@intel.com>>
> > +R: Gang Wei mailto:gang@intel.com>>
> > +R: Jian Wang mailto:jian.j.w...@intel.com>>
> >
> >  DynamicTablesPkg
> >  W: https://github.com/tianocore/tianocore.github.io/wiki/DynamicTablesPkg
> >
>
> This patch does not conform to the rule that we added lately; please see
> commit 9ebef6c0a7d3 ("Maintainers.txt: Add the rule to hand over the
> package maintain role", 2018-11-29).
>
> In other words, the patch should be sent out by Qin Long. Even though
> you co-maintain CryptoPkg with Qin Long, you shouldn't be able to
> deprive Qin Long from the role.
>
> Thanks,
> Laszlo
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto: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] CryptoPkg/IntrinsicLib: add missing BaseLib declaration

2018-12-06 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wang, Jian J 
Sent: Thursday, December 6, 2018 1:46 PM
To: edk2-devel@lists.01.org
Cc: Long, Qin ; Ye, Ting 
Subject: [PATCH] CryptoPkg/IntrinsicLib: add missing BaseLib declaration

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=596

BaseLib interfaces are used in this library but not declared in module's inf 
file. This patch fix this situation to keep inf and its code in consistency. No 
functionality or interface change are involved.

Cc: Qin Long 
Cc: Ting Ye 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang 
---
 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 
b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index 579da34aff..a91c850013 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -51,6 +51,7 @@
   MdePkg/MdePkg.dec
 
 [LibraryClasses]
+  BaseLib
   BaseMemoryLib
 
 [BuildOptions]
--
2.19.0.windows.1

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


Re: [edk2] Shell EFI (ipconfig.efi) for IPConfig2 Protocol

2018-12-05 Thread Ye, Ting
Hi,

You may try "ifconfig.efi" under shell, which supports Ip4Config2 protocol.
The source code is available under 
ShellPkg\Library\UefiShellNetwork1CommandsLib\Ifconfig.c

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
ankit.sin...@dell.com
Sent: Wednesday, December 5, 2018 5:33 PM
To: edk2-devel@lists.01.org
Subject: [edk2] Shell EFI (ipconfig.efi) for IPConfig2 Protocol

Hi,

Do we have any ipconfig.efi type utility to see the IP address details on shell 
(all the existing utilities are old and does not support new Ipconfig2 protocol)

Regards,
Ankit Singh

___
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] [RFC PATCH v3 11/11] CryptoPkg/BaseCryptLib: Hack to get time in MM Standalone mode

2018-11-30 Thread Ye, Ting
Hi Jagadeesh,

I don't suggest to update BaseCryptLib to use a PCD in StandaloneMmPkg, it 
makes other consumer of BaseCryptLib has dependency of StandaloneMmPkg. 
Also ToDo code below is not acceptable to me.  I am thinking you could consider 
creating a new instance for BaseCryptLib such as "MmCryptLib" if the update to 
TimerWrapp.c is necessary for MM Standalone mode.


Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Jagadeesh Ujja
Sent: Wednesday, November 28, 2018 5:35 PM
To: edk2-devel@lists.01.org; Gao, Liming ; Zhang, Chao B 
; leif.lindh...@linaro.org; ard.biesheu...@linaro.org
Subject: [edk2] [RFC PATCH v3 11/11] CryptoPkg/BaseCryptLib: Hack to get time 
in MM Standalone mode

This is hack to get the time when executing in MM Standalone mode. It is not 
clear how to implement a function that gets the current time. So using this as 
a hack for now.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf   |  5 
 CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf|  5 
 CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 27 +++-
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index c8aafefbab9c..df4aca6c20e2 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -76,6 +76,7 @@ [Sources.AARCH64]
 [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
 
 [LibraryClasses]
   BaseLib
@@ -86,6 +87,10 @@ [LibraryClasses]
   OpensslLib
   IntrinsicLib
   PrintLib
+  PcdLib
+
+[FeaturePcd]
+  gStandaloneMmPkgTokenSpaceGuid.PcdStandaloneMmEnable
 
 #
 # Remove these [BuildOptions] after this library is cleaned up diff --git 
a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
index 32628c8835a6..651a6736ba48 100644
--- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
@@ -80,6 +80,7 @@ [Sources.AARCH64]
 [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
 
 [LibraryClasses]
   BaseLib
@@ -91,6 +92,10 @@ [LibraryClasses]
   OpensslLib
   IntrinsicLib
   PrintLib
+  PcdLib
+
+[FeaturePcd]
+  gStandaloneMmPkgTokenSpaceGuid.PcdStandaloneMmEnable
 
 #
 # Remove these [BuildOptions] after this library is cleaned up diff --git 
a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
index 5f9b0c20d75d..d01b5c5fc113 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
@@ -3,6 +3,7 @@
   for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME).
 
 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -77,12 +78,26 @@ 
time_t time (time_t *timer)
   time_t  CalTime;
   UINTN   Year;
 
-  //
-  // Get the current time and date information
-  //
-  Status = gRT->GetTime (, NULL);
-  if (EFI_ERROR (Status) || (Time.Year < 1970)) {
-return 0;
+  if (!PcdGetBool (PcdStandaloneMmEnable)) {
+//
+// Get the current time and date information
+//
+Status = gRT->GetTime (, NULL);
+if (EFI_ERROR (Status) || (Time.Year < 1970)) {
+  return 0;
+}
+  } else {
+//
+//[ToDo] Find out a way to get the current time for code executing as 
MM_STANDALONE
+//
+Time.Year = 2007;
+Time.Month = 11;
+Time.Day = 29;
+Time.Hour = 17;
+Time.Minute = 43;
+Time.Second = 30;
+
+Year  = (UINTN) (Time.Year % 100);
   }
 
   //
--
2.7.4

___
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 v1 7/7] NetworkPkg: Remove some clarification from TCP/PXE/ISCSI driver INF.

2018-10-30 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Fu, Siyuan 
Sent: Tuesday, October 30, 2018 3:33 PM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin ; Ye, Ting 
Subject: [PATCH v1 7/7] NetworkPkg: Remove some clarification from 
TCP/PXE/ISCSI driver INF.

This patch is to remove the clarification about usage/difference between those 
drivers in MdeModulePkg and NetworkPkg, since the MdeModulePkg ones have been 
deleted now.

Cc: Jiaxin Wu 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan 
---
 NetworkPkg/IScsiDxe/IScsiDxe.inf | 10 --
 NetworkPkg/TcpDxe/TcpDxe.inf |  6 --
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf |  6 --
 3 files changed, 22 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDxe.inf b/NetworkPkg/IScsiDxe/IScsiDxe.inf
index 195dc191250f..bdf1313aa957 100644
--- a/NetworkPkg/IScsiDxe/IScsiDxe.inf
+++ b/NetworkPkg/IScsiDxe/IScsiDxe.inf
@@ -4,16 +4,6 @@
 #  The iSCSI driver provides iSCSI service in the preboot environment and 
supports  #  booting over iSCSI. This driver supports both IPv4 and IPv6 
network stack.
 #
-#  Notes:
-#  1) This driver can't co-work with the IScsiDxe driver in MdeModulePkg.
-#  2) This driver includes more bug fixes and supports more features (e.g. 
IPv6, Dns
-# support for target URL configuration, iSCSI keyword support) than the 
IscsiDxe
-# driver in MdeModulePkg. So, we recommend using this driver even though 
both of
-# them can be used.
-#  3) This driver depends on OpenSSL. To use this driver, please follow the
-# instructions found in the file "OpenSSL-HOWTO.txt" located in
-# CryptoPkg\Library\OpensslLib to enable the OpenSSL building first.
-#
 # Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.  # 
This program and the accompanying materials  # are licensed and made available 
under the terms and conditions of the BSD License diff --git 
a/NetworkPkg/TcpDxe/TcpDxe.inf b/NetworkPkg/TcpDxe/TcpDxe.inf index 
9433fb875cba..c4e3de7ec5ce 100644
--- a/NetworkPkg/TcpDxe/TcpDxe.inf
+++ b/NetworkPkg/TcpDxe/TcpDxe.inf
@@ -5,12 +5,6 @@
 #  It might provide TCPv4 Protocol or TCPv6 Protocol or both of them that 
depends on which network  #  stack has been loaded in system. This driver 
supports both IPv4 and IPv6 network stack.
 #
-#  Notes:
-#  1) This driver can't co-work with the Tcp4Dxe driver in MdeModulePkg.
-#  2) This driver includes more bug fixes and supports more features (e.g. 
IPv6, TCP Cancel
-# function) than the Tcp4Dxe driver in MdeModulePkg. So, we recommend 
using this driver
-# even though both of them can be used.
-#
 #  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.  #  
#  This program and the accompanying materials diff --git 
a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf 
b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
index 130a5456e2c1..63430711e71b 100644
--- a/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
+++ b/NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
@@ -5,12 +5,6 @@
 #  PXE-compatible device for network access or booting. This driver supports  
#  both IPv4 and IPv6 network stack.
 #
-#  Notes:
-#  1) This driver can't co-work with the UefiPxeBcDxe driver in MdeModulePkg.
-#  2) This driver includes more bug fixes and supports more features (e.g. 
IPv6,
-# MTFTP windowsize) than the UefiPxeBcDxe driver in MdeModulePkg. So, we
-# recommend using this driver even though both of them can be used.
-#
 #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.  #  
#  This program and the accompanying materials
--
2.18.0.windows.1

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


Re: [edk2] [Patch 0/2] Mtftp: Correct the total received and saved block number.

2018-10-25 Thread Ye, Ting
Series Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Thursday, October 25, 2018 4:56 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [Patch 0/2] Mtftp: Correct the total received and saved block number.

The block returned from Mtftp4RemoveBlockNum is not the total received and 
saved block number if it works in passive (Slave) mode.

The issue was exposed by the EMS test.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (2):
  MdeModulePke/Mtftp4Dxe: Correct the total received and saved block
number.
  NetworkPkg/Mtftp6Dxe: Correct the total received and saved block
number.

 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h |  6 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c  | 16 +++-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.c  | 10 +-  
.../Universal/Network/Mtftp4Dxe/Mtftp4Support.h  |  6 +++---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c  |  6 +++---
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h|  6 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c | 16 +++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.c | 10 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.h |  8 
 NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c |  6 +++---
 10 files changed, 55 insertions(+), 35 deletions(-)

--
2.17.1.windows.2

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


Re: [edk2] [PATCH] CryptoPkg/BaseCryptLib: Fix potential integer overflow issue.

2018-10-25 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Long Qin
Sent: Wednesday, October 24, 2018 9:22 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting 
Subject: [edk2] [PATCH] CryptoPkg/BaseCryptLib: Fix potential integer overflow 
issue.

The LookupFreeMemRegion() in RuntimeMemAllocate.c is used to look-up free 
memory region for runtime resource allocation, which was designed to support 
runtime authenticated variable service.
The direct offset subtractions in this function may bring possible integer 
overflow issue.

This patch is to add the extra parameter checks to remove this possible 
overflow risk.

Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Long Qin 
---
 .../Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c| 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c
index 463f2bf855..92bb9ddccd 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/RuntimeMemAllocation.c
@@ -2,7 +2,7 @@
   Light-weight Memory Management Routines for OpenSSL-based Crypto
   Library at Runtime Phase.
 
-Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -141,6 +141,12 
@@ LookupFreeMemRegion (
 
   StartPageIndex = RT_SIZE_TO_PAGES (mRTPageTable->LastEmptyPageOffset);
   ReqPages   = RT_SIZE_TO_PAGES (AllocationSize);
+  if (ReqPages > mRTPageTable->PageCount) {
+//
+// No enough region for object allocation.
+//
+return (UINTN)(-1);
+  }
 
   //
   // Look up the free memory region with in current memory map table.
@@ -176,6 +182,12 @@ LookupFreeMemRegion (
   // Look up the free memory region from the beginning of the memory table
   // until the StartCursorOffset
   //
+  if (ReqPages > StartPageIndex) {
+//
+// No enough region for object allocation.
+//
+return (UINTN)(-1);
+  }
   for (Index = 0; Index < (StartPageIndex - ReqPages); ) {
 //
 // Check Consecutive ReqPages Pages.
--
2.16.1.windows.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 v2] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.

2018-10-19 Thread Ye, Ting


Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Thursday, October 18, 2018 4:44 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan ; Ye, Ting ; Wu, Jiaxin 

Subject: [PATCH v2] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1251

*v2: Correct the type of parameters in Ikev2ParseProposalData(), and refined 
the corresponding description.

IpSecDxe failed to create the Child SA during parsing SA Payload, the issue was 
caused by the below commit:

SHA-1: 1e0db7b11987d0ec93be7dfe26102a327860fdbd
* MdeModulePkg/NetworkPkg: Checking for NULL pointer before use.

In above commit, it changed the value of IsMatch in 
Ikev2ChildSaParseSaPayload() to FALSE. That's correct but it exposed the 
potential bug in to match the correct proposal Data, which will cause the issue 
happen.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IpSecDxe/Ikev2/Utility.c | 64 ++---
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c 
b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
index 0c9c929705..63de56f09e 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
@@ -1993,34 +1993,51 @@ Ikev2IsSupportAlg (  }
 
 /**
   Get the preferred algorithm types from ProposalData.
 
-  @param[in]  ProposalData  Pointer to related IKEV2_PROPOSAL_DATA.
-  @param[out] PreferEncryptAlgorithmOutput of preferred encrypt algorithm.
-  @param[out] PreferIntegrityAlgorithm  Output of preferred integrity 
algorithm.
-  @param[out] PreferPrfAlgorithmOutput of preferred PRF algorithm. Only
-for IKE SA.
-  @param[out] PreferDhGroup Output of preferred DH group. Only for
-IKE SA.
-  @param[out] PreferEncryptKeylengthOutput of preferred encrypt key length
-in bytes.
-  @param[out] IsSupportEsn  Output of value about the Extented 
Sequence
-Number is support or not. Only for 
Child SA.
-  @param[in]  IsChildSa If it is ture, the ProposalData is for 
IKE
-SA. Otherwise the proposalData is for 
Child SA.
+  @param[in]  ProposalData  Pointer to related 
IKEV2_PROPOSAL_DATA.
+  @param[in, out] PreferEncryptAlgorithmPointer to buffer which is used to 
store the
+preferred encrypt algorithm.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred encrypt 
algorithm.
+  @param[in, out] PreferIntegrityAlgorithm  Pointer to buffer which is used to 
store the
+preferred integrity algorithm.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred integrity 
algorithm.
+  @param[in, out] PreferPrfAlgorithmPointer to buffer which is used to 
store the
+preferred PRF algorithm.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred PRF algorithm. 
Only
+for IKE SA.
+  @param[in, out] PreferDhGroup Pointer to buffer which is used to 
store the
+preferred DH group.
+Input value shall be initialized 
to zero that
+indicates to be parsed from 
ProposalData.
+Output of preferred DH group. Only 
for
+IKE SA.
+  @param[in, out] PreferEncryptKeylengthPointer to buffer which is used to 
store the
+preferred encrypt key length in 
bytes.
+  @param[in, out] IsSupportEsn  Pointer to buffer which is used to 
store the
+value about the Extented Sequence 
Number is
+support or not. Only for Child SA.
+  @param[in]  IsChildSa If it is ture, the ProposalData is 
for IKE
+SA. Otherwise the proposalData is 
for Child SA.
 
 **/
 VOID
 Ikev2ParseProposalData

Re: [edk2] [Patch] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.

2018-10-17 Thread Ye, Ting
Hi Jiaxin,

I am confused why we need set values to following local variables when 
Ikev2ParseProposalData marks them as 'out' attribute. Please adds more comments 
why '0' is required and updates 'out' to 'in out' if '0' is necessary.

+IntegrityAlgorithm = 0;
+EncryptAlgorithm   = 0;
+EncryptKeylength   = 0;
+IsSupportEsn   = FALSE;

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Tuesday, October 16, 2018 9:34 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [edk2] [Patch] NetworkPkg/IpSecDxe: Fix issue to parse SA Payload.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1251

IpSecDxe failed to create the Child SA during parsing SA Payload, the issue was 
caused by the below commit:

SHA-1: 1e0db7b11987d0ec93be7dfe26102a327860fdbd
* MdeModulePkg/NetworkPkg: Checking for NULL pointer before use.

In above commit, it changed the value of IsMatch in 
Ikev2ChildSaParseSaPayload() to FALSE. That's correct but it exposed the 
potential bug in to match the correct proposal Data, which will cause the issue 
happen.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/IpSecDxe/Ikev2/Utility.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/IpSecDxe/Ikev2/Utility.c 
b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
index 0c9c929705..d61bae8c9d 100644
--- a/NetworkPkg/IpSecDxe/Ikev2/Utility.c
+++ b/NetworkPkg/IpSecDxe/Ikev2/Utility.c
@@ -2502,15 +2502,16 @@ Ikev2ChildSaParseSaPayload (
   IntegrityAlgorithm == PreferIntegrityAlgorithm &&
   IsSupportEsn == PreferIsSupportEsn
   ) {
 IsMatch = TRUE;
   } else {
-PreferEncryptAlgorithm   = 0;
-PreferIntegrityAlgorithm = 0;
-IsSupportEsn = TRUE;
+IntegrityAlgorithm = 0;
+EncryptAlgorithm   = 0;
+EncryptKeylength   = 0;
+IsSupportEsn   = FALSE;
   }
-   ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) +
+  ProposalData = (IKEV2_PROPOSAL_DATA*)((UINT8*)(ProposalData + 1) 
+ +
  ProposalData->NumTransforms * sizeof 
(IKEV2_TRANSFORM_DATA));
 }
 
 ProposalData  = (IKEV2_PROPOSAL_DATA *)((IKEV2_SA_DATA 
*)SaPayload->PayloadBuf + 1);
 if (IsMatch) {
--
2.17.1.windows.2

___
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] NetworkPkg: Correct the time stamp and fix the integer overflow issue.

2018-10-17 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, October 16, 2018 1:36 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan ; Ye, Ting ; Wu, Jiaxin 

Subject: [Patch] NetworkPkg: Correct the time stamp and fix the integer 
overflow issue.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=883.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 18 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 16 
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c 
b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
index 10a99a00d4..9c7459c332 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
@@ -121,11 +121,11 @@ Dhcp6GenerateClientId (
 // Generate a time stamp of the seconds from 2000/1/1, assume 30day/month.
 //
 gRT->GetTime (, NULL);
 Stamp = (UINT32)
   (
-(Time.Year - 2000) * 360 + (Time.Month - 1)) * 30 + (Time.Day - 
1)) * 24 + Time.Hour) * 60 + Time.Minute) *
+UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + 
(Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) *
 60 +
 Time.Second
   );
 
 //
@@ -879,18 +879,18 @@ SetElapsedTime (
 
   //
   // Generate a time stamp of the centiseconds from 2000/1/1, assume 
30day/month.
   //
   gRT->GetTime (, NULL);
-  CurrentStamp = (UINT64)
-(
-  ((Time.Year - 2000) * 360 +
-   (Time.Month - 1)) * 30 +
-   (Time.Day - 1)) * 24 + Time.Hour) * 60 +
-   Time.Minute) * 60 + Time.Second) * 100
-   + DivU64x32(Time.Nanosecond, 1000)
-);
+  CurrentStamp = MultU64x32 (
+   UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 
+ (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) * 60 + Time.Second,
+   100
+   ) +
+ DivU64x32(
+   Time.Nanosecond,
+   1000
+   );
 
   //
   // Sentinel value of 0 means that this is the first DHCP packet that we are
   // sending and that we need to initialize the value.  First DHCP message
   // gets 0 elapsed-time.  Otherwise, calculate based on StartTime.
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index 60509fc9e6..7ab09e0367 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -1508,18 +1508,18 @@ CalcElapsedTime (
   //
   // Generate a time stamp of the centiseconds from 1900/1/1, assume 
30day/month.
   //
   ZeroMem (, sizeof (EFI_TIME));
   gRT->GetTime (, NULL);
-  CurrentStamp = (UINT64)
-(
-  ((Time.Year - 1900) * 360 +
-   (Time.Month - 1)) * 30 +
-   (Time.Day - 1)) * 24 + Time.Hour) * 60 +
-   Time.Minute) * 60 + Time.Second) * 100
-   + DivU64x32(Time.Nanosecond, 1000)
-);
+  CurrentStamp = MultU64x32 (
+   UINT32)(Time.Year - 1900) * 360 + (Time.Month - 1) * 30 
+ (Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) * 60 + Time.Second,
+   100
+   ) +
+ DivU64x32 (
+   Time.Nanosecond,
+   1000
+   );
 
   //
   // Sentinel value of 0 means that this is the first DHCP packet that we are
   // sending and that we need to initialize the value.  First DHCP Solicit
   // gets 0 elapsed-time.  Otherwise, calculate based on StartTime.
-- 
2.17.1.windows.2

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


Re: [edk2] [Patch] NetworkPkg/TlsDxe: Remove the redundant library class.

2018-10-17 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, October 16, 2018 9:55 AM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan ; Ye, Ting ; Wu, Jiaxin 

Subject: [Patch] NetworkPkg/TlsDxe: Remove the redundant library class.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1018.

Cc: Fu Siyuan 
Cc: Ye Ting 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 NetworkPkg/TlsDxe/TlsDxe.inf | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/NetworkPkg/TlsDxe/TlsDxe.inf b/NetworkPkg/TlsDxe/TlsDxe.inf index 
907feb735b..aaea0fc2ff 100644
--- a/NetworkPkg/TlsDxe/TlsDxe.inf
+++ b/NetworkPkg/TlsDxe/TlsDxe.inf
@@ -3,11 +3,11 @@
 #  EFI TLS Configuration Protocol.
 #
 #  This module produces EFI TLS (Transport Layer Security) Protocol and EFI 
TLS  #  Service Binding Protocol, to provide TLS services.
 #
-#  Copyright (c) 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2016 - 2018, Intel Corporation. All rights 
+reserved.
 #
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License  #  which 
accompanies this distribution. The full text of the license may be found at  #  
http://opensource.org/licenses/bsd-license.php.
@@ -50,11 +50,10 @@
   MemoryAllocationLib
   BaseMemoryLib
   BaseLib
   UefiLib
   DebugLib
-  NetLib
   BaseCryptLib
   TlsLib
 
 [Protocols]
   gEfiTlsServiceBindingProtocolGuid  ## PRODUCES
--
2.17.1.windows.2

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


Re: [edk2] [PATCH v2 0/5] Support windowsize to benefit tftp/pxe download performance.

2018-09-25 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, September 25, 2018 9:12 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Carsey, 
Jaben ; Shao, Ming ; Laszlo Ersek 
; Wu, Jiaxin 
Subject: [PATCH v2 0/5] Support windowsize to benefit tftp/pxe download 
performance.

*v2: The first three patches(1/2/3) are the same with version 1, just update 
the last two patches (4/5):
I)  This patch has been discarded since we rename and redefine the PCD 
in NetworkPkg instead of MdeModulePkg. The replacement is: 
[PATCH v2 4/5] NetworkPkg: Define one PCD for PXE to specify MTFTP windowsize.
II)  Since the 
new PCD (PcdPxeTftpWindowSize) was renamed/defined in NetworkPkg instead of 
MdeModulePkg, we udpate the consuming PXE driver. The new version patch is:
[PATCH v2 5/5] NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=886

The series patches are to support the TFTP windowsize option described in RFC 
7440.
TFTP shell command and UEFI PXE driver will use the feature to benefit the 
download performance.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Carsey Jaben 
Cc: Shao Ming 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 

Jiaxin Wu (5):
  MdeModulePke/Mtftp4Dxe: Support windowsize in read request operation.
  NetworkPkg/Mtftp6Dxe: Support windowsize in read request operation.
  ShellPkg/TftpDynamicCommand: Add one option for tftp command to
specify windowsize.
  NetworkPkg: Define one PCD for PXE to specify MTFTP windowsize.
  NetworkPkg/UefiPxeBcDxe: Use the specified MTFTP windowsize.

 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   5 +
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h  |  10 ++
 .../Network/Mtftp4Dxe/Mtftp4Option.c  |  25 +++-
 .../Network/Mtftp4Dxe/Mtftp4Option.h  |   8 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c   |  55 +--
 .../Network/Mtftp4Dxe/Mtftp4Support.c |   8 +-
 .../Network/Mtftp4Dxe/Mtftp4Support.h |  13 --
 .../Universal/Network/Mtftp4Dxe/Mtftp4Wrq.c   |   2 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Impl.h |  13 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.c   |  22 ++-
 NetworkPkg/Mtftp6Dxe/Mtftp6Option.h   |  14 +-
 NetworkPkg/Mtftp6Dxe/Mtftp6Rrq.c  |  53 +--
 NetworkPkg/Mtftp6Dxe/Mtftp6Support.c  |  10 ++
 NetworkPkg/Mtftp6Dxe/Mtftp6Wrq.c  |   2 +-
 NetworkPkg/NetworkPkg.dec |   6 +
 NetworkPkg/NetworkPkg.uni |   6 +
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   |  10 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.c  | 137 +-
 NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h  |   6 +-
 NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf  |   3 +
 .../DynamicCommand/TftpDynamicCommand/Tftp.c  |  65 +++--
 .../TftpDynamicCommand/Tftp.uni   |   6 +-
 22 files changed, 371 insertions(+), 108 deletions(-)

--
2.17.1.windows.2

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


Re: [edk2] [Patch] MdeModulePkg/Library/DxeHttpLib: Handle the blank value in HTTP header.

2018-09-12 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, September 4, 2018 3:17 PM
To: edk2-devel@lists.01.org
Cc: Stephen Benjamin ; Laszlo Ersek ; 
Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [Patch] MdeModulePkg/Library/DxeHttpLib: Handle the blank value in 
HTTP header.

This patch is to resolve the lock-up issue if the value of HTTP header is 
blank.  The issue is recorded @ 
https://bugzilla.tianocore.org/show_bug.cgi?id=1102.

Cc: Stephen Benjamin 
Cc: Laszlo Ersek 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 57 +++-
 1 file changed, 44 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c 
b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 5fbb50d03a..2fc3da8a2d 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -1595,63 +1595,94 @@ HttpGetFieldNameAndValue (
 return NULL;
   }
 
   //
   // Each header field consists of a name followed by a colon (":") and the 
field value.
+  // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
+  //
+  // message-header = field-name ":" [ field-value ]  // field-name = 
+ token  // field-value = *( field-content | LWS )  //  // Note: 
+ "*(element)" allows any number element, including zero; "1*(element)" 
requires at least one element.
+  //   [element] means element is optional.
+  //   LWS  = [CRLF] 1*(SP|HT), it can be ' ' or '\t' or '\r\n ' or 
'\r\n\t'.
+  //   CRLF = '\r\n'.
+  //   SP   = ' '.
+  //   HT   = '\t' (Tab).
   //
   FieldNameStr = String;
   FieldValueStr = AsciiStrGetNextToken (FieldNameStr, ':');
   if (FieldValueStr == NULL) {
 return NULL;
   }
 
   //
-  // Replace ':' with 0
+  // Replace ':' with 0, then FieldName has been retrived from String.
   //
   *(FieldValueStr - 1) = 0;
 
   //
-  // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
-  // Note: LWS  = [CRLF] 1*(SP|HT), it can be '\r\n ' or '\r\n\t' or ' ' or 
'\t'.
-  //   CRLF = '\r\n'.
-  //   SP   = ' '.
-  //   HT   = '\t' (Tab).
+  // Handle FieldValueStr, skip all the preceded LWS.
   //
   while (TRUE) {
 if (*FieldValueStr == ' ' || *FieldValueStr == '\t') {
   //
   // Boundary condition check.
   //
   if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 1) {
+//
+// Wrong String format!
+//
 return NULL;
   }
 
   FieldValueStr ++;
 } else if (*FieldValueStr == '\r') {
   //
   // Boundary condition check.
   //
   if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 3) {
-return NULL;
+//
+// No more preceded LWS, so break here.
+//
+break;
   }
 
-  if (*(FieldValueStr + 1) == '\n' && (*(FieldValueStr + 2) == ' ' || 
*(FieldValueStr + 2) == '\t')) {
-FieldValueStr = FieldValueStr + 3;
+  if (*(FieldValueStr + 1) == '\n' ) {
+if (*(FieldValueStr + 2) == ' ' || *(FieldValueStr + 2) == '\t') {
+  FieldValueStr = FieldValueStr + 3;
+} else {
+  //
+  // No more preceded LWS, so break here.
+  //
+  break;
+}
+  } else {
+//
+// Wrong String format!
+//
+return NULL;
   }
 } else {
+  //
+  // No more preceded LWS, so break here.
+  //
   break;
 }
   }
 
-  //
-  // Header fields can be extended over multiple lines by preceding each extra
-  // line with at least one SP or HT.
-  //
   StrPtr = FieldValueStr;
   do {
+//
+// Handle the LWS within the field value.
+//
 StrPtr = AsciiStrGetNextToken (StrPtr, '\r');
 if (StrPtr == NULL || *StrPtr != '\n') {
+  //
+  // Wrong String format!
+  //
   return NULL;
 }
 
 StrPtr++;
   } while (*StrPtr == ' ' || *StrPtr == '\t');
--
2.17.1.windows.2

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


Re: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Sync the direct route entry setting.

2018-08-31 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Friday, August 31, 2018 9:50 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Sync the direct route entry 
setting.

This patch is to sync the direct route entry setting in both the default and 
Instance route table {Subnet, Mask, NextHope}.

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c   |  7 ---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 13 ++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index c19a72730e..b52542cd84 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -557,17 +557,10 @@ Ip4Config2SetDefaultAddr (
 return Status;
   }
 }
   }
 
-  Ip4AddRoute (
-IpSb->DefaultRouteTable,
-StationAddress,
-SubnetMask,
-IP4_ALLZERO_ADDRESS
-);
-
   //
   // Add a route for the connected network.
   //
   Subnet = StationAddress & SubnetMask;
 
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 6a26143e30..c68dad7a3c 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -593,10 +593,11 @@ Ip4ConfigProtocol (
   IP4_SERVICE   *IpSb;
   IP4_INTERFACE *IpIf;
   EFI_STATUSStatus;
   IP4_ADDR  Ip;
   IP4_ADDR  Netmask;
+  IP4_ADDR  Subnet;
   EFI_ARP_PROTOCOL  *Arp;
   EFI_IP4_CONFIG2_PROTOCOL  *Ip4Config2;
   EFI_IP4_CONFIG2_POLICYPolicy;
 
   IpSb = IpInstance->Service;
@@ -670,14 +671,20 @@ Ip4ConfigProtocol (
 
   InsertTailList (>Interfaces, >Link);
 }
 
 //
-// Add a route to this connected network in the route table
+// Add a route to this connected network in the instance route table.
 //
-Ip4AddRoute (IpInstance->RouteTable, Ip, Netmask, IP4_ALLZERO_ADDRESS);
-
+Subnet = Ip & Netmask;
+
+Ip4AddRoute (
+  IpInstance->RouteTable, 
+  Subnet, 
+  Netmask, 
+  IP4_ALLZERO_ADDRESS
+  );
   } else {
 //
 // Use the default address. Check the state.
 //
 if (IpSb->State == IP4_SERVICE_UNSTARTED) {
--
2.17.1.windows.2

___
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 v2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 PXE boot.

2018-08-31 Thread Ye, Ting
Hi Siyuan,

Please fix below typo when check in the patch. "...cancelled"
Callback function when ARP request are finished. It will cancelled @@ 
-814,6 +897,7 @@ Ip4OnArpResolvedDpc (

Also do we need define a macro for "0x"/"0xu" used in Mtftp4 
and ifconfig?

Reviewed-by: Ye Ting  

Thanks,
Ting

-Original Message-
From: Fu, Siyuan 
Sent: Wednesday, August 29, 2018 4:53 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Wu, Jiaxin 
Subject: [PATCH v2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 
PXE boot.

V2 update:
The original patch has a problem, that if an IP child which not using default 
address is configured with /32 subnet mask, while the gateway is configured to 
the default route table, then the gateway won't take effect on that IP child. 
This patch fixed the problem.

This patch updates IP4 stack to support 32bit subnet mask in PXE boot process.
When 32bit subnet mask is used, the IP4 driver couldn't use the subnet mask to 
determine whether destination IP address is on-link or not, so it will always 
try to send all the packets to the destination IP address directly first, if 
failed it will continue to try the default gateway.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
---
 MdeModulePkg/Include/Library/NetLib.h |   5 +-
 MdeModulePkg/Library/DxeNetLib/DxeNetLib.c|  13 +-
 .../Universal/Network/Ip4Dxe/Ip4Common.h  |   2 +-
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 117 --
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h |   5 +-
 .../Universal/Network/Ip4Dxe/Ip4Impl.c|   2 +-
 .../Universal/Network/Ip4Dxe/Ip4Output.c  |  11 +-
 .../Universal/Network/Ip4Dxe/Ip4Route.c   |  26 +++-
 .../Universal/Network/Ip4Dxe/Ip4Route.h   |   9 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   6 +-
 10 files changed, 163 insertions(+), 33 deletions(-)

diff --git a/MdeModulePkg/Include/Library/NetLib.h 
b/MdeModulePkg/Include/Library/NetLib.h
index ef7bc429c1..b7ef99c7b5 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -422,8 +422,9 @@ NetGetIpClass (
 
   If all bits of the host address of IP are 0 or 1, IP is also not a valid 
unicast address,
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
-  mask (RFC3021).
-
+  mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
+  PPP link).
+  
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c 
b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index bf8f5523e6..63f4724062 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -654,8 +654,9 @@ NetGetIpClass (
 
   If all bits of the host address of IP are 0 or 1, IP is also not a valid 
unicast address,
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
-  mask (RFC3021).
-
+  mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
+  PPP link).
+  
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
@@ -669,18 +670,20 @@ NetIp4IsUnicast (
   IN IP4_ADDR   NetMask
   )
 {
+  INTN   MaskLength;
+  
   ASSERT (NetMask != 0);
 
   if (Ip == 0 || IP4_IS_LOCAL_BROADCAST (Ip)) {
 return FALSE;
   }
 
-  if (NetGetMaskLength (NetMask) != 31) {
+  MaskLength = NetGetMaskLength (NetMask);  ASSERT ((MaskLength >= 0) 
+ && (MaskLength <= IP4_MASK_NUM));  if (MaskLength < 31) {
 if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {
   return FALSE;
 }
-  } else {
-return TRUE;
   }
 
   return TRUE;
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
index e0fffc9d0d..994a81f4de 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
@@ -55,7 +55,7 @@ typedef struct _IP4_SERVICEIP4_SERVICE;
 /// Compose the fragment field to be used in the IP4 header.
 ///
 #define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
-((UINT16)(((Df) ? 0x4000 : 0) | ((Mf) ? 0x2000 : 0) | (((Offset) >> 3) & 
0x1fff)))
+((UINT16)(((Df) ? IP4_HEAD_DF_MASK : 0) | ((Mf) ? IP4_HEAD_MF_MASK 
+ : 0) | (((Offset) >> 3) & IP4_HEAD_OFFSET_MASK)))
 
 #define IP4_LAST_FRAGMENT(FragmentField)  \
   (((FragmentField) & IP4_HEAD_MF_MASK) == 0) diff --git 
a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
index 6e0e3290c7..b0172283b7 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
@@ 

Re: [edk2] [Patch 2/2] ShellPkg: Update Ifconfig command to accept 32bit subnet mask.

2018-08-31 Thread Ye, Ting
Reveiewed-by: Ye Ting  

-Original Message-
From: Fu, Siyuan 
Sent: Tuesday, August 28, 2018 9:53 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Ye, Ting ; Wu, Jiaxin 

Subject: [Patch 2/2] ShellPkg: Update Ifconfig command to accept 32bit subnet 
mask.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan 
Cc: Ruiyu Ni 
Cc: Ye Ting 
Cc: Wu Jiaxin 
---
 ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c 
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
index 52415e0ad0..e9f644c739 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
@@ -1032,6 +1032,7 @@ IfConfigSetInterfaceInfo (
   SubnetMask  = NTOHL (SubnetMask);
   TempGateway = NTOHL (TempGateway);
   if ((SubnetMask != 0) &&
+  (SubnetMask != 0xu) && 
   !NetIp4IsUnicast (TempGateway, SubnetMask)) {
 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
(STR_IFCONFIG_INVALID_GATEWAY), gShellNetwork1HiiHandle, VarArg->Arg);
 ShellStatus = SHELL_INVALID_PARAMETER;
-- 
2.18.0.windows.1

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


Re: [edk2] reg: Clarification required on ISCSI Initiator Implementation

2018-08-30 Thread Ye, Ting
Hi Siva,

The EFI_ISCSI_INITIATOR_NAME_PROTOCOL defined in UEFI specification supports 
only one iSCSI initiator name in UEFI system. 
In our implementation UEFI iSCSI is a single iSCSI initiator node but can 
maintain more than one NIC device/port.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Thursday, August 30, 2018 1:59 PM
To: edk2-devel@lists.01.org
Subject: [edk2] reg: Clarification required on ISCSI Initiator Implementation

Hello All,

As per the current ISCSI implementation there is only one Initiator name 
maintained even when there are multiple MAC and attempts are made from an UEFI 
system.

Is there history behind not allowing to change the Initiator Name specific to 
MAC ?

Thanks
Siva
___
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] reg: HTTP Request Failure over Internet

2018-07-25 Thread Ye, Ting
Hi Siva,

I didn't receive your patch either. Thanks for reporting the issue, we will try 
to reproduce it firstly.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Tuesday, July 24, 2018 8:43 PM
To: Sivaraman Nainar ; edk2-devel@lists.01.org
Subject: Re: [edk2] reg: HTTP Request Failure over Internet

On 07/24/18 14:05, Sivaraman Nainar wrote:
> Hello all,
> 
> When an application tried to download the remote file over internet with the 
> HTTP Get Request it getting failed. If we try via the Intranet then 
> application downloads the target file.
> 
> The remote file is available in the Apache server. With the attached patch 
> the download works fine in Internet and Intranet.
> 
> Could you review the solution and feedback?

The edk2-devel list software does not reflect attachments to subscribers.

While I disagree with that practice in general -- it breaks conversations where 
people justifiedly post small attachments, such as PNG screenshots, compressed 
log files and such --, for posting patches specifically, please use 
git-format-patch and git-send-email. The patch should be in the body of the 
email (please do not copy the patch though; that is guaranteed not to 
work -- please use the git tools).

Official guidelines:

https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process

Personal ones from yours truly:

https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers

Thanks,
Laszlo
___
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] reg: IP6 based Static IP Configuration in ISCSI

2018-07-23 Thread Ye, Ting
Hi Siva,

IPv4 RFCs do not define source address selection but IPv6 RFCs do. Even if we 
add setup options for IPv6 source address in iSCSI, it is still up to IP6 
driver to choose the best matched source address in current implementation.
For example, if you set fec0::2001/64 as source address in iSCSI UI, while the 
target address is fed0::100/64; and there is another source address 
fed0::1234/64 set by ifconfig6 previously, iSCSI drive will still use 
fed0::1234/64 not the one you configured in iSCSI UI.

This is the historical background the UI configuration for IPv6/IPv6 is 
different in iSCSI.

Thanks,
Ting

-Original Message-
From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in] 
Sent: Monday, July 23, 2018 3:25 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

The said behavior is there in IP4 Static IP based ISCSI Connection. The request 
we are raising here is Setup options to provide IP details and preserve the 
same.

-Siva
-Original Message-
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Monday, July 23, 2018 11:20 AM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

IP6 driver will perform source address selection to best match the IPv6 address 
of iSCSI target according to polices defined in RFC. If the IPv6 address of 
iSCSI target is not changed, the same IPv6 source address will be chosen under 
the same policy.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Friday, July 20, 2018 6:46 PM
To: Sivaraman Nainar ; Ye, Ting ; 
edk2-devel@lists.01.org
Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

We have one more clarification need. When we are doing this way of ISCSI 
connection using we can't preserve the IP settings in NVRam as we do in IP4 
case right.

In order to support that can we have setup questions as same as IP4 which will 
address this?

-Siva
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Monday, July 16, 2018 1:04 PM
To: Ye, Ting; edk2-devel@lists.01.org
Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

As you recommended with shell based IP assignment we are able to use the IP6 
Static IP bases ISCSI connection.

Thanks for your detailed clarification.

-Siva

-Original Message-
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Wednesday, July 4, 2018 1:17 PM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

Yes iSCSI UI does not allow the user to configure static IP address for 
initiator. But it does not mean iSCSI initiator cannot use existing IPv6 
address which is previously configured by using "ifconfig6" in Shell.
You may have a try.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Wednesday, July 4, 2018 3:04 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

What I am trying to do is setting STATIC IP for Initiator. But as per below VFR 
content, when we choose IP6 the controls to accept Static IP will be disabled. 
Right?

suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_IP6 OR
   ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG;

-Siva
-Original Message-----
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Wednesday, July 4, 2018 12:12 PM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

No, it is not correct.

In iSCSI UI, if you choose IP6 mode, you still have chance to use static 
address. Just NOT click the checkbox of "Enable DHCP".

Thanks,
Ting

-Original Message-
From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in]
Sent: Wednesday, July 4, 2018 2:32 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Ting,

Let me clarify in detail.

When we have IP4 mode selection in ISCSI we can set both Initiator and Target 
with Static Addresses.
But if we choose the IP6 mode by default no setup options available to choose 
static and it take DHCP as default. In this case even if we configure IP6 using 
IfConfig6, it will override by ISCSI. Is my understanding correct?

Thanks
Siva
-Original Message-
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Wednesday, July 4, 2018 7:37 AM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

We don't have such plan as I known. For IPv6, we leave it to IP6 driver to 
perform source address selection to best match the iSCSI target address.
You could use ifc

Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

2018-07-22 Thread Ye, Ting
Hi Siva,

IP6 driver will perform source address selection to best match the IPv6 address 
of iSCSI target according to polices defined in RFC. If the IPv6 address of 
iSCSI target is not changed, the same IPv6 source address will be chosen under 
the same policy.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Friday, July 20, 2018 6:46 PM
To: Sivaraman Nainar ; Ye, Ting ; 
edk2-devel@lists.01.org
Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

We have one more clarification need. When we are doing this way of ISCSI 
connection using we can't preserve the IP settings in NVRam as we do in IP4 
case right.

In order to support that can we have setup questions as same as IP4 which will 
address this?

-Siva
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Monday, July 16, 2018 1:04 PM
To: Ye, Ting; edk2-devel@lists.01.org
Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

As you recommended with shell based IP assignment we are able to use the IP6 
Static IP bases ISCSI connection.

Thanks for your detailed clarification.

-Siva

-Original Message-
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Wednesday, July 4, 2018 1:17 PM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

Yes iSCSI UI does not allow the user to configure static IP address for 
initiator. But it does not mean iSCSI initiator cannot use existing IPv6 
address which is previously configured by using "ifconfig6" in Shell.
You may have a try.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Wednesday, July 4, 2018 3:04 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

What I am trying to do is setting STATIC IP for Initiator. But as per below VFR 
content, when we choose IP6 the controls to accept Static IP will be disabled. 
Right?

suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_IP6 OR
   ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG;

-Siva
-Original Message-----
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Wednesday, July 4, 2018 12:12 PM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

No, it is not correct.

In iSCSI UI, if you choose IP6 mode, you still have chance to use static 
address. Just NOT click the checkbox of "Enable DHCP".

Thanks,
Ting

-Original Message-
From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in]
Sent: Wednesday, July 4, 2018 2:32 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Ting,

Let me clarify in detail.

When we have IP4 mode selection in ISCSI we can set both Initiator and Target 
with Static Addresses.
But if we choose the IP6 mode by default no setup options available to choose 
static and it take DHCP as default. In this case even if we configure IP6 using 
IfConfig6, it will override by ISCSI. Is my understanding correct?

Thanks
Siva
-Original Message-
From: Ye, Ting [mailto:ting...@intel.com]
Sent: Wednesday, July 4, 2018 7:37 AM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

We don't have such plan as I known. For IPv6, we leave it to IP6 driver to 
perform source address selection to best match the iSCSI target address.
You could use ifconfig6 to set static IP6 address before you configure iSCSI.

Thanks,
Ting



-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Tuesday, July 3, 2018 6:44 PM
To: edk2-devel@lists.01.org
Subject: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello,

At present in the ISCSI configuration we are able to specify the Static IP 
configuration for IP4 protocol. Is there any plan to support IP6 static IP 
configuration in ISCSI Configuration?

-Siva
___
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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
This e-mail is intended for the use of the addressee only and may contain 
privileged, confidential, or proprietary information that is exempt from 
disclosure under law. If you have received this message in error, please inform 
us promptly by reply e-mail, then delete the e-

Re: [edk2] [Patch v3] NetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) message body.

2018-07-04 Thread Ye, Ting
Looks good to me.

Reviewed-by: Ye Ting  

-Original Message-
From: Wu, Jiaxin 
Sent: Wednesday, July 4, 2018 8:41 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Gary Lin 
; Wu, Jiaxin 
Subject: [Patch v3] NetworkPkg/HttpDxe: Fix the bug when parsing HTTP(S) 
message body.

*v2: Resolve the conflict commit.

*v3: Fixed the failure if BodyLength in HTTP token is less than the received 
size of HTTPS message.

HttpBodyParserCallback function is to parse the HTTP(S) message body so as to 
confirm whether there is the next message header. But it doesn't record the 
parsing message data/length correctly.

This patch is refine the parsing logic so as to fix the potential failure.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Gary Lin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin 
Tested-by: Gary Lin 
---
 NetworkPkg/HttpDxe/HttpImpl.c  | 112 +  
NetworkPkg/HttpDxe/HttpProto.c |  10 +++  NetworkPkg/HttpDxe/HttpProto.h |  10 
+++
 3 files changed, 78 insertions(+), 54 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index f70e116f38..17deceb395 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -914,10 +914,11 @@ HttpBodyParserCallback (
   IN CHAR8  *Data,
   IN UINTN  Length,
   IN VOID   *Context
   )
 {
+  HTTP_CALLBACK_DATA*CallbackData;
   HTTP_TOKEN_WRAP   *Wrap;
   UINTN BodyLength;
   CHAR8 *Body;
 
   if (EventType != BodyParseEventOnComplete) { @@ -926,25 +927,22 @@ 
HttpBodyParserCallback (
 
   if (Data == NULL || Length != 0 || Context == NULL) {
 return EFI_SUCCESS;
   }
 
-  Wrap = (HTTP_TOKEN_WRAP *) Context;
-  Body = Wrap->HttpToken->Message->Body;
-  BodyLength = Wrap->HttpToken->Message->BodyLength;
+  CallbackData = (HTTP_CALLBACK_DATA *) Context;
+
+  Wrap   = (HTTP_TOKEN_WRAP *) (CallbackData->Wrap);
+  Body   = CallbackData->ParseData;
+  BodyLength = CallbackData->ParseDataLength;
+
   if (Data < Body + BodyLength) {
 Wrap->HttpInstance->NextMsg = Data;
   } else {
 Wrap->HttpInstance->NextMsg = NULL;
   }
 
-
-  //
-  // Free Tx4Token or Tx6Token since already received corrsponding HTTP 
response.
-  //
-  FreePool (Wrap);
-
   return EFI_SUCCESS;
 }
 
 /**
   The work function of EfiHttpResponse().
@@ -1189,33 +1187,43 @@ HttpResponseWorker (
  HttpInstance->Method,
  HttpMsg->Data.Response->StatusCode,
  HttpMsg->HeaderCount,
  HttpMsg->Headers,
  HttpBodyParserCallback,
- (VOID *) ValueInItem,
+ (VOID *) (>CallbackData),
  >MsgParser
  );
   if (EFI_ERROR (Status)) {
 goto Error2;
   }
 
   //
   // Check whether we received a complete HTTP message.
   //
   if (HttpInstance->CacheBody != NULL) {
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = (VOID *) 
HttpInstance->CacheBody;
+HttpInstance->CallbackData.ParseDataLength = 
+ HttpInstance->CacheLen;
+
+//
+// Parse message with CallbackData data.
+//
 Status = HttpParseMessageBody (HttpInstance->MsgParser, 
HttpInstance->CacheLen, HttpInstance->CacheBody);
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
+  }
 
-if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
-  //
-  // Free the MsgParse since we already have a full HTTP message.
-  //
-  HttpFreeMsgParser (HttpInstance->MsgParser);
-  HttpInstance->MsgParser = NULL;
-}
+  if (HttpIsMessageComplete (HttpInstance->MsgParser)) {
+//
+// Free the MsgParse since we already have a full HTTP message.
+//
+HttpFreeMsgParser (HttpInstance->MsgParser);
+HttpInstance->MsgParser = NULL;
   }
 }
 
 if ((HttpMsg->Body == NULL) || (HttpMsg->BodyLength == 0)) {
   Status = EFI_SUCCESS;
@@ -1330,16 +1338,30 @@ HttpResponseWorker (
 if (EFI_ERROR (Status)) {
   goto Error2;
 }
 
 //
-// Check whether we receive a complete HTTP message.
+// Process the received the body packet.
+//
+HttpMsg->BodyLength = MIN (Fragment.Len, (UINT32) 
+ HttpMsg->BodyLength);
+
+CopyMem (HttpMsg->Body, Fragment.Bulk, HttpMsg->BodyLength);
+
+//
+// Record the CallbackData data.
+//
+HttpInstance->CallbackData.Wrap = (VOID *) Wrap;
+HttpInstance->CallbackData.ParseData = HttpMsg->Body;
+HttpInstance->CallbackData.ParseDataLength = HttpMsg->BodyLeng

Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

2018-07-04 Thread Ye, Ting
Hi Siva,

Yes iSCSI UI does not allow the user to configure static IP address for 
initiator. But it does not mean iSCSI initiator cannot use existing IPv6 
address which is previously configured by using "ifconfig6" in Shell.
You may have a try.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Wednesday, July 4, 2018 3:04 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello Ting,

What I am trying to do is setting STATIC IP for Initiator. But as per below VFR 
content, when we choose IP6 the controls to accept Static IP will be disabled. 
Right?

suppressif ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_IP6 OR
   ideqval ISCSI_CONFIG_IFR_NVDATA.IpMode == IP_MODE_AUTOCONFIG;

-Siva
-Original Message-----
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Wednesday, July 4, 2018 12:12 PM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

No, it is not correct.

In iSCSI UI, if you choose IP6 mode, you still have chance to use static 
address. Just NOT click the checkbox of "Enable DHCP".

Thanks,
Ting

-Original Message-
From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in] 
Sent: Wednesday, July 4, 2018 2:32 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Ting,

Let me clarify in detail. 

When we have IP4 mode selection in ISCSI we can set both Initiator and Target 
with Static Addresses. 
But if we choose the IP6 mode by default no setup options available to choose 
static and it take DHCP as default. In this case even if we configure IP6 using 
IfConfig6, it will override by ISCSI. Is my understanding correct?

Thanks
Siva
-Original Message-
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Wednesday, July 4, 2018 7:37 AM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

We don't have such plan as I known. For IPv6, we leave it to IP6 driver to 
perform source address selection to best match the iSCSI target address.
You could use ifconfig6 to set static IP6 address before you configure iSCSI.

Thanks,
Ting



-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Tuesday, July 3, 2018 6:44 PM
To: edk2-devel@lists.01.org
Subject: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello,

At present in the ISCSI configuration we are able to specify the Static IP 
configuration for IP4 protocol. Is there any plan to support IP6 static IP 
configuration in ISCSI Configuration?

-Siva
___
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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] reg: IP6 based Static IP Configuration in ISCSI

2018-07-04 Thread Ye, Ting
Hi Siva,

No, it is not correct.

In iSCSI UI, if you choose IP6 mode, you still have chance to use static 
address. Just NOT click the checkbox of "Enable DHCP".

Thanks,
Ting

-Original Message-
From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in] 
Sent: Wednesday, July 4, 2018 2:32 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Ting,

Let me clarify in detail. 

When we have IP4 mode selection in ISCSI we can set both Initiator and Target 
with Static Addresses. 
But if we choose the IP6 mode by default no setup options available to choose 
static and it take DHCP as default. In this case even if we configure IP6 using 
IfConfig6, it will override by ISCSI. Is my understanding correct?

Thanks
Siva
-Original Message-----
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Wednesday, July 4, 2018 7:37 AM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Subject: RE: reg: IP6 based Static IP Configuration in ISCSI

Hi Siva,

We don't have such plan as I known. For IPv6, we leave it to IP6 driver to 
perform source address selection to best match the iSCSI target address.
You could use ifconfig6 to set static IP6 address before you configure iSCSI.

Thanks,
Ting



-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Tuesday, July 3, 2018 6:44 PM
To: edk2-devel@lists.01.org
Subject: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello,

At present in the ISCSI configuration we are able to specify the Static IP 
configuration for IP4 protocol. Is there any plan to support IP6 static IP 
configuration in ISCSI Configuration?

-Siva
___
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] report an issue about edk2 iscsi

2018-07-03 Thread Ye, Ting
Hi Robin,

Since you configured the attempt as following:

   Set: Connection retry count: 5, connection establishing timeout to [5000]


iSCSI driver will try to connect to iSCSI target in 6 times, each time it uses 
5 seconds as the timeout value.
So you need hold > 30 seconds in your case.


Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of xujiawu
Sent: Wednesday, July 4, 2018 10:25 AM
To: edk2-de...@ml01.01.org
Subject: [edk2] report an issue about edk2 iscsi

 

Hello, edk2-devel,

I want to report a issue about edk2 iscsi:

Set timeout to 5S and copy a big file from iscsi HDD,  disconnect Lan cable
>>5S then connect again, the big file still copy successfully.

 

BIOS: the latest EDK2

 

Test steps:

1.Power on and press Hotkey to bios setup, in Advanced menu->iscsi
configuration->mac address.

2.ISCSI initiator name: iqn.

3. Add an attempt: 

   set: iscsi attempt name: 1

   set: iscsi mode: enable/enable for mpio, internet protocol ipv4

   Set: Connection retry count: 5, connection establishing timeout to [5000]

   Set: enable DHCP, enable get target info via DHCP

   Set: authentication type: none

4. Saved and exit, reboot.

5. Boot to shell, type: fs2:(ISCSI HDD).

6. Plug USB 3.0 flash disk to board.

7. Copy a big file from ISCSI HDD to usb.

8. Plug out LAN cable and hold some time( >> timeout time 5s), then plug in 
again.

 

Actual result:

The copy file still can successful with ISCSI after timeout.

 

Expected result:

The copy file is copied fail with iSCSI after timeout.

 

 

Thanks,

Robin

___
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] reg: IP6 based Static IP Configuration in ISCSI

2018-07-03 Thread Ye, Ting
Hi Siva,

We don't have such plan as I known. For IPv6, we leave it to IP6 driver to 
perform source address selection to best match the iSCSI target address.
You could use ifconfig6 to set static IP6 address before you configure iSCSI.

Thanks,
Ting



-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Tuesday, July 3, 2018 6:44 PM
To: edk2-devel@lists.01.org
Subject: [edk2] reg: IP6 based Static IP Configuration in ISCSI

Hello,

At present in the ISCSI configuration we are able to specify the Static IP 
configuration for IP4 protocol. Is there any plan to support IP6 static IP 
configuration in ISCSI Configuration?

-Siva
___
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] reg: ISCSI Aborted attempt entry in IBFT Table

2018-06-06 Thread Ye, Ting
Hi Siva,

Per design, all successful attempts will be published to iBFT, no matter it is 
currently used or aborted. Only failed attempts are not published. 
I don't think the current behavior is wrong according to iBFT specification, 
see 
http://download.microsoft.com/download/7/E/7/7E7662CF-CBEA-470B-A97E-CE7CE0D98DC2/iBFT.docx.


Thanks,
Ting

-Original Message-
From: Sivaraman Nainar [mailto:sivaram...@amiindia.co.in] 
Sent: Wednesday, June 6, 2018 5:01 PM
To: Ye, Ting ; Omkar K ; 
edk2-devel@lists.01.org
Cc: Madhan B. Santharam 
Subject: RE: reg: ISCSI Aborted attempt entry in IBFT Table

Hello Ting,

Yes. In the use case we said:

NIC 1 - Target 1 : Login success
NIC 1 - Target 2 : Login success

NIC 2 - Target 1 : Login success

But iSCSI Driver will choose the first login session and abort the other in the 
same NIC. But even it is aborted it is Published to IBFT.

As you said the ESXi and SLES not able to proceed installation assuming more 
than one IBFT for the same NIC as illegal.

So what the clarification we are asking is since it's an aborted attempt can we 
skip adding IBFT entry for the aborted attempt.

Please refer the ticket already created for this has the proposed solution.

https://bugzilla.tianocore.org/show_bug.cgi?id=968

-Siva
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ye, Ting
Sent: Wednesday, June 06, 2018 2:04 PM
To: Omkar K; edk2-devel@lists.01.org
Cc: Madhan B. Santharam
Subject: Re: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

Hi Omkar,

If not MPIO, current iSCSI driver will try the configured attempts and only 
publish the successful entries in iBFT. The failed attempts will be removed.
In your case, it looks the ESXi and SLES OS treat the multiple entries on one 
NIC (different targets) are illegal. 


Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Omkar K
Sent: Tuesday, June 5, 2018 5:01 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Cc: Madhan B. Santharam 
Subject: Re: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

Hello Ting,

1. We did not enable MPIO.
2. in IScsiStart(), at this point

//
// Select the first login session. Abort others.
//
if (Private->Session == NULL) {
Private->Session = Session;
BootSelected = AttemptConfigData->AttemptConfigIndex;
//
// Don't validate other attempt in multipath mode if one is success.
//
if (mPrivate->EnableMpio) {
  break;
}
} else {
IScsiSessionAbort (Session);
FreePool (Session);
}

other than one attempt per Nic, other sessions are aborted. Still, all the 
attempts are published in IBFT.
We can observe the issue when different targets are configured on one NIC where 
all the attempts are published in IBFT.
But, the issue disappeared when the aborted attempts are not published in IBFT.

Thanks,
Omkar

-Original Message-----
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Monday, June 04, 2018 2:26 PM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Cc: Omkar K; Madhan B. Santharam
Subject: RE: reg: ISCSI Aborted attempt entry in IBFT Table

Hi Siva,

Per design, the iSCSI multipath I/O will publish all configured attempts to 
IBFT, no matter the connection is success or fail currently.
Did you enable the MPIO when you configure the attempts? 

I am not clear what do you mean "aborted attempt".

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Thursday, May 31, 2018 8:18 PM
To: edk2-devel@lists.01.org
Cc: Omkar K ; Madhan B. Santharam 
Subject: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

Hello all:
Here is the issue which requires clarification.
Issue Synopsis:
When there are more than one iSCSI target configured and Ibft table published 
with the connected and aborted attempt details, all the targets are not seen in 
ESXi and SLES OS. But in Windows it can see the targets connected.
Use case:
Target 1: IP : 192.xx.xx.31 Target 2 : IP : 192.xx.xx.1
NIC 1 configured with attempts Target 1 & Target 2 NIC 2 configured with 
attempts Target 1 Connection

Login

Ibft

Block Device in UEFI Shell

SLES / Esx OS

Windows

NIC1 Target1

Success

Published

Mounted

Target Seen



NIC1 Target2

Success

Published

Mounted

Target Seen



NIC1 Target1
NIC1 Target2
NIC2 Target1

Individual Login success

Published for all attempts (3)

NIC1 Target 1 NIC2 Target 1

None Seen

NIC1 Target 1 NIC2 Target 1


When the attempts which are login success but Aborted by ISCSI Driver are 
present in ibft table SLES and ESX not able to see the targets during 
Installation.
If the ISCSI Driver not adding the ibft entry for the aborted attempts then the 
targets are seen in Esx and SLES.
So it requires clarification that If the driver need to SKIP adding the aborted 
attempt entry to ibf

Re: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

2018-06-06 Thread Ye, Ting
Hi Omkar,

If not MPIO, current iSCSI driver will try the configured attempts and only 
publish the successful entries in iBFT. The failed attempts will be removed.
In your case, it looks the ESXi and SLES OS treat the multiple entries on one 
NIC (different targets) are illegal. 


Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Omkar K
Sent: Tuesday, June 5, 2018 5:01 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Cc: Madhan B. Santharam 
Subject: Re: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

Hello Ting,

1. We did not enable MPIO.
2. in IScsiStart(), at this point

//
// Select the first login session. Abort others.
//
if (Private->Session == NULL) {
Private->Session = Session;
BootSelected = AttemptConfigData->AttemptConfigIndex;
//
// Don't validate other attempt in multipath mode if one is success.
//
if (mPrivate->EnableMpio) {
  break;
}
} else {
IScsiSessionAbort (Session);
FreePool (Session);
}

other than one attempt per Nic, other sessions are aborted. Still, all the 
attempts are published in IBFT.
We can observe the issue when different targets are configured on one NIC where 
all the attempts are published in IBFT.
But, the issue disappeared when the aborted attempts are not published in IBFT.

Thanks,
Omkar

-Original Message-----
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Monday, June 04, 2018 2:26 PM
To: Sivaraman Nainar; edk2-devel@lists.01.org
Cc: Omkar K; Madhan B. Santharam
Subject: RE: reg: ISCSI Aborted attempt entry in IBFT Table

Hi Siva,

Per design, the iSCSI multipath I/O will publish all configured attempts to 
IBFT, no matter the connection is success or fail currently.
Did you enable the MPIO when you configure the attempts? 

I am not clear what do you mean "aborted attempt".

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Thursday, May 31, 2018 8:18 PM
To: edk2-devel@lists.01.org
Cc: Omkar K ; Madhan B. Santharam 
Subject: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

Hello all:
Here is the issue which requires clarification.
Issue Synopsis:
When there are more than one iSCSI target configured and Ibft table published 
with the connected and aborted attempt details, all the targets are not seen in 
ESXi and SLES OS. But in Windows it can see the targets connected.
Use case:
Target 1: IP : 192.xx.xx.31 Target 2 : IP : 192.xx.xx.1
NIC 1 configured with attempts Target 1 & Target 2 NIC 2 configured with 
attempts Target 1 Connection

Login

Ibft

Block Device in UEFI Shell

SLES / Esx OS

Windows

NIC1 Target1

Success

Published

Mounted

Target Seen



NIC1 Target2

Success

Published

Mounted

Target Seen



NIC1 Target1
NIC1 Target2
NIC2 Target1

Individual Login success

Published for all attempts (3)

NIC1 Target 1 NIC2 Target 1

None Seen

NIC1 Target 1 NIC2 Target 1


When the attempts which are login success but Aborted by ISCSI Driver are 
present in ibft table SLES and ESX not able to see the targets during 
Installation.
If the ISCSI Driver not adding the ibft entry for the aborted attempts then the 
targets are seen in Esx and SLES.
So it requires clarification that If the driver need to SKIP adding the aborted 
attempt entry to ibft or its OS responsibility to handle the invalid entries in 
ibft.
-Siva
___
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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

2018-06-04 Thread Ye, Ting
Hi Siva,

Per design, the iSCSI multipath I/O will publish all configured attempts to 
IBFT, no matter the connection is success or fail currently.
Did you enable the MPIO when you configure the attempts? 

I am not clear what do you mean "aborted attempt".

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Sivaraman Nainar
Sent: Thursday, May 31, 2018 8:18 PM
To: edk2-devel@lists.01.org
Cc: Omkar K ; Madhan B. Santharam 
Subject: [edk2] reg: ISCSI Aborted attempt entry in IBFT Table

Hello all:
Here is the issue which requires clarification.
Issue Synopsis:
When there are more than one iSCSI target configured and Ibft table published 
with the connected and aborted attempt details, all the targets are not seen in 
ESXi and SLES OS. But in Windows it can see the targets connected.
Use case:
Target 1: IP : 192.xx.xx.31 Target 2 : IP : 192.xx.xx.1
NIC 1 configured with attempts Target 1 & Target 2 NIC 2 configured with 
attempts Target 1 Connection

Login

Ibft

Block Device in UEFI Shell

SLES / Esx OS

Windows

NIC1 Target1

Success

Published

Mounted

Target Seen



NIC1 Target2

Success

Published

Mounted

Target Seen



NIC1 Target1
NIC1 Target2
NIC2 Target1

Individual Login success

Published for all attempts (3)

NIC1 Target 1 NIC2 Target 1

None Seen

NIC1 Target 1 NIC2 Target 1


When the attempts which are login success but Aborted by ISCSI Driver are 
present in ibft table SLES and ESX not able to see the targets during 
Installation.
If the ISCSI Driver not adding the ibft entry for the aborted attempts then the 
targets are seen in Esx and SLES.
So it requires clarification that If the driver need to SKIP adding the aborted 
attempt entry to ibft or its OS responsibility to handle the invalid entries in 
ibft.
-Siva
___
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] CryptoPkg: Remove deprecated function usage in X509GetCommonName()

2018-05-28 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: Long, Qin 
Sent: Thursday, May 24, 2018 4:11 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; michael.tur...@microsoft.com
Subject: [PATCH] CryptoPkg: Remove deprecated function usage in 
X509GetCommonName()

BZ#: https://bugzilla.tianocore.org/show_bug.cgi?id=923

X509_NAME_get_text_by_NID() used in X509GetCommonName() implementation is one 
legacy function which have various limitations. The returned data may be not 
usable  when the target cert contains multicharacter string type like a 
BMPString or a UTF8String.
This patch replaced the legacy function usage with more general
X509_NAME_get_index_by_NID() / X509_NAME_get_entry() APIs for X509 CommonName 
retrieving.

Tests: Validated the commonName retrieving with test certificates
   containing PrintableString or BMPString data.

Cc: Ye Ting 
Cc: Michael Turner 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin 
---
 CryptoPkg/Include/Library/BaseCryptLib.h  |  4 +-
 CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c | 53 ++-
 CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c |  4 +-
 3 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h 
b/CryptoPkg/Include/Library/BaseCryptLib.h
index 027ea09feb..dc6aaf0635 100644
--- a/CryptoPkg/Include/Library/BaseCryptLib.h
+++ b/CryptoPkg/Include/Library/BaseCryptLib.h
@@ -4,7 +4,7 @@
   primitives (Hash Serials, HMAC, RSA, Diffie-Hellman, etc) for UEFI security
   functionality enabling.
 
-Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -2177,7 +2177,7 
@@ X509GetSubjectName (
   @param[in]  Cert Pointer to the DER-encoded X509 certificate.
   @param[in]  CertSize Size of the X509 certificate in bytes.
   @param[out] CommonName   Buffer to contain the retrieved certificate 
common
-   name string. At most CommonNameSize bytes 
will be
+   name string (UTF8). At most 
+ CommonNameSize bytes will be
written and the string will be null 
terminated. May be
NULL in order to determine the size buffer 
needed.
   @param[in,out]  CommonNameSize   The size in bytes of the CommonName buffer 
on input,
diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c 
b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
index 56e66308ae..c137df357f 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
@@ -1,7 +1,7 @@
 /** @file
   X.509 Certificate Handler Wrapper Implementation over OpenSSL.
 
-Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -303,7 +303,7 @@ 
_Exit:
   @param[in]  Cert Pointer to the DER-encoded X509 certificate.
   @param[in]  CertSize Size of the X509 certificate in bytes.
   @param[out] CommonName   Buffer to contain the retrieved certificate 
common
-   name string. At most CommonNameSize bytes 
will be
+   name string (UTF8). At most 
+ CommonNameSize bytes will be
written and the string will be null 
terminated. May be
NULL in order to determine the size buffer 
needed.
   @param[in,out]  CommonNameSize   The size in bytes of the CommonName buffer 
on input,
@@ -332,13 +332,18 @@ X509GetCommonName (
   IN OUT  UINTN*CommonNameSize
   )
 {
-  RETURN_STATUS  ReturnStatus;
-  BOOLEANStatus;
-  X509   *X509Cert;
-  X509_NAME  *X509Name;
-  INTN   Length;
+  RETURN_STATUSReturnStatus;
+  BOOLEAN  Status;
+  X509 *X509Cert;
+  X509_NAME*X509Name;
+  INT32Index;
+  INTN Length;
+  X509_NAME_ENTRY  *Entry;
+  ASN1_STRING  *EntryData;
+  UINT8*UTF8Name;
 
   ReturnStatus = RETURN_INVALID_PARAMETER;
+  UTF8Name = NULL;
 
   //
   // Check input parameters.
@@ -378,8 +383,8 @@ X509GetCommonName (
   //
   // Retrieve the CommonName information from X.509 Subject
   //
-  Length = (INTN) X509_NAME_get_text_by_NID (X509Name, NID_commonName, 
CommonName, (int)(*CommonNameSize));
-  if (Length < 0) {
+  Index = X509_NAME_get_index_by_NID (X509N

Re: [edk2] [Patch] NetworkPkg/NetworkPkg.dsc: Add the instance of library class [SafeIntLib].

2018-05-07 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Friday, May 4, 2018 11:53 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Long, Qin 
<qin.l...@intel.com>; Bi, Dandan <dandan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/NetworkPkg.dsc: Add the instance of library class 
[SafeIntLib].

This patch is to add the instance of library class [SafeIntLib] to fix the 
NetworkPkg build error, which is caused by the commit of 2167c7f7 that the 
TlsLib will always consume SafeIntLib.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Long Qin <qin.l...@intel.com>
Cc: Bi Dandan <dandan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/NetworkPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc index 
471361ce86..dcca5f9fba 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -43,10 +43,11 @@
   TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
 
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
--
2.16.2.windows.1

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


Re: [edk2] [Patch] MdeModulePkg/Mtftp4Dxe: Separate the timer ticking to calculate the packet live time.

2018-03-01 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Friday, March 2, 2018 2:43 PM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan <siyuan...@intel.com>; Wang, Fan <fan.w...@intel.com>; Ye, Ting 
<ting...@intel.com>
Subject: [Patch] MdeModulePkg/Mtftp4Dxe: Separate the timer ticking to 
calculate the packet live time.

From: Fu Siyuan <siyuan...@intel.com>

TPL deadlock issue was enrolled by the commit of 39b0867d. To resolve the 
issue, this patch separated the timer ticking for all the MTFTP clients to 
calculate the packet live time in TPL_NOTIFY level.

Cc: Wang Fan <fan.w...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Driver.c | 34 ++---
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c   |  5 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.h   |  6 ++-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.c| 57 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Support.h| 16 +-
 5 files changed, 97 insertions(+), 21 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c 
b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
index a23d405baa..713cc66dd1 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of Mtftp drivers.
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at  
http://opensource.org/licenses/bsd-license.php
 
@@ -160,15 +160,16 @@ Mtftp4CreateService (
   MtftpSb->Signature  = MTFTP4_SERVICE_SIGNATURE;
   MtftpSb->ServiceBinding = gMtftp4ServiceBindingTemplete;
   MtftpSb->ChildrenNum= 0;
   InitializeListHead (>Children);
 
-  MtftpSb->Timer  = NULL;
-  MtftpSb->TimerToGetMap  = NULL;
-  MtftpSb->Controller = Controller;
-  MtftpSb->Image  = Image;
-  MtftpSb->ConnectUdp = NULL;
+  MtftpSb->Timer= NULL;
+  MtftpSb->TimerNotifyLevel = NULL;
+  MtftpSb->TimerToGetMap= NULL;
+  MtftpSb->Controller   = Controller;
+  MtftpSb->Image= Image;
+  MtftpSb->ConnectUdp   = NULL;
 
   //
   // Create the timer and a udp to be notified when UDP is uninstalled
   //
   Status = gBS->CreateEvent (
@@ -176,12 +177,24 @@ Mtftp4CreateService (
   TPL_CALLBACK,
   Mtftp4OnTimerTick,
   MtftpSb,
   >Timer
   );
+  if (EFI_ERROR (Status)) {
+FreePool (MtftpSb);
+return Status;
+  }
 
+  Status = gBS->CreateEvent (
+  EVT_NOTIFY_SIGNAL | EVT_TIMER,
+  TPL_NOTIFY,
+  Mtftp4OnTimerTickNotifyLevel,
+  MtftpSb,
+  >TimerNotifyLevel
+  );
   if (EFI_ERROR (Status)) {
+gBS->CloseEvent (MtftpSb->Timer);
 FreePool (MtftpSb);
 return Status;
   }
 
   //
@@ -194,10 +207,11 @@ Mtftp4CreateService (
   NULL,
   NULL,
   >TimerToGetMap
   );
   if (EFI_ERROR (Status)) {
+gBS->CloseEvent (MtftpSb->TimerNotifyLevel);
 gBS->CloseEvent (MtftpSb->Timer);
 FreePool (MtftpSb);
 return Status;
   }
 
@@ -209,10 +223,11 @@ Mtftp4CreateService (
   NULL
   );
 
   if (MtftpSb->ConnectUdp == NULL) {
 gBS->CloseEvent (MtftpSb->TimerToGetMap);
+gBS->CloseEvent (MtftpSb->TimerNotifyLevel);
 gBS->CloseEvent (MtftpSb->Timer);
 FreePool (MtftpSb);
 return EFI_DEVICE_ERROR;
   }
 
@@ -232,10 +247,11 @@ Mtftp4CleanService (
   IN MTFTP4_SERVICE *MtftpSb
   )
 {
   UdpIoFreeIo (MtftpSb->ConnectUdp);
   gBS->CloseEvent (MtftpSb->TimerToGetMap);
+  gBS->CloseEvent (MtftpSb->TimerNotifyLevel);
   gBS->CloseEvent (MtftpSb->Timer);
 }
 
 
 /**
@@ -292,10 +308,16 @@ Mtftp4DriverBindingStart (
 
   if (EFI_ERROR (Status)) {
 goto ON_ERROR;
   }
 
+  Status = gBS->SetTimer (MtftpSb->TimerNotifyLevel, TimerPeriodic, 
+ TICKS_PER_SECOND);
+
+  if (EFI_ERROR (Status)) {
+goto ON_ERROR;
+  }
+  
   //
   // Install the Mtftp4ServiceBinding Protocol onto Controller
   //
   Status = gBS->InstallMultipleProtocolInterfaces (
   ,
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c 

Re: [edk2] [Patch] NetworkPkg/HttpBootDxe: Fix the incorrect error message output.

2018-02-28 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Thursday, March 1, 2018 2:30 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [edk2] [Patch] NetworkPkg/HttpBootDxe: Fix the incorrect error message 
output.

For IPv6 case, if one invalid URL returned from DHCP server, HttpBootDxe driver 
could not retrieve the URL host address from DNS server. In such a case, the 
error message should be printed as:
  Error: Could not retrieve the host address from DNS server.
Instead of:
  Error: Could not discover the boot information for DHCP server.
Then, we can still output as following:
  Error: Could not retrieve NBP file size from HTTP server.

Besides, currently implementation in HttpBootLoadFile will always output error 
message even the HTTP process is correct.

This patch is to fix above issue.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c |  1 +
 NetworkPkg/HttpBootDxe/HttpBootImpl.c   | 37 ++---
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index b93e63bb2f..1d1e47008d 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -472,10 +472,11 @@ HttpBootDhcp6ExtractUriInfo (
 }
 
 Status = HttpBootDns (Private, HostNameStr, );
 FreePool (HostNameStr);
 if (EFI_ERROR (Status)) {
+  AsciiPrint ("\n  Error: Could not retrieve the host address from 
+ DNS server.\n");
   goto Error;
 }  
   } 
   
   CopyMem (>ServerIp.v6, , sizeof (EFI_IPv6_ADDRESS)); diff 
--git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 16c1207bf8..a0fd934ec4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -1,9 +1,9 @@
 /** @file
   The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.
 
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP  This program 
and the accompanying materials are licensed and made available under  the terms 
and conditions of the BSD License that accompanies this distribution.  
 The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php.
  
@@ -329,11 +329,11 @@ HttpBootLoadFile (
 //
 // Parse the cached offer to get the boot file URL first.
 //
 Status = HttpBootDiscoverBootInfo (Private);
 if (EFI_ERROR (Status)) {
-  AsciiPrint ("\n  Error: Could not discover the boot information for DHCP 
server.\n");
+  AsciiPrint ("\n  Error: Could not retrieve NBP file size from 
+ HTTP server.\n");
   goto ON_EXIT;
 }
   }
 
   if (!Private->HttpCreated) {
@@ -398,26 +398,29 @@ HttpBootLoadFile (
  ImageType
  );
   
 ON_EXIT:
   HttpBootUninstallCallback (Private);
-
-  if (Status == EFI_ACCESS_DENIED) {
-AsciiPrint ("\n  Error: Could not establish connection with HTTP 
server.\n");
-  } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {
-AsciiPrint ("\n  Error: Buffer size is smaller than the requested 
file.\n");
-  } else if (Status == EFI_OUT_OF_RESOURCES) {
-AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");
-  } else if (Status == EFI_DEVICE_ERROR) {
-AsciiPrint ("\n  Error: Network device error.\n");
-  } else if (Status == EFI_TIMEOUT) {
-AsciiPrint ("\n  Error: Server response timeout.\n");
-  } else if (Status == EFI_ABORTED) {
-AsciiPrint ("\n  Error: Remote boot cancelled.\n");
-  } else if (Status != EFI_BUFFER_TOO_SMALL) {
-AsciiPrint ("\n  Error: Unexpected network error.\n");
+  
+  if (EFI_ERROR (Status)) {
+if (Status == EFI_ACCESS_DENIED) {
+  AsciiPrint ("\n  Error: Could not establish connection with HTTP 
server.\n");
+} else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {
+  AsciiPrint ("\n  Error: Buffer size is smaller than the requested 
file.\n");
+} else if (Status == EFI_OUT_OF_RESOURCES) {
+  AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");
+} else if (Status == EFI_DEVICE_ERROR) {
+  AsciiPrint ("\n  Error: Network device error.\n");
+} else if (Status == EFI_TIMEOUT) {
+  AsciiPrint ("\n  Error: Server response timeout.\n&qu

Re: [edk2] [Patch] NetworkPkg/HttpBootDxe: Correct the parameter check for the usage of HttpBootGetFileFromCache.

2018-02-28 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jiaxin Wu
Sent: Thursday, March 1, 2018 2:30 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [edk2] [Patch] NetworkPkg/HttpBootDxe: Correct the parameter check for 
the usage of HttpBootGetFileFromCache.

The patch is to fix the incorrect parameter check for the 
HttpBootGetFileFromCache().

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index 15e0ab9d69..b93e63bb2f 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -1,9 +1,9 @@
 /** @file
   Implementation of the boot file download function.
 
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP  This program 
and the accompanying materials are licensed and made available under  the terms 
and conditions of the BSD License that accompanies this distribution.  
 The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php.
  
@@ -434,11 +434,11 @@ HttpBootDhcp6ExtractUriInfo (
   goto Error;
 }
   }
   
   //
-  // Extract the HTTP server Ip frome URL. This is used to Check route table 
+  // Extract the HTTP server Ip from URL. This is used to Check route 
+ table
   // whether can send message to HTTP Server Ip through the GateWay.
   //
   Status = HttpUrlGetIp6 (
  Private->BootFileUri,
  Private->BootFileUriParser, @@ -744,23 +744,22 @@ 
HttpBootGetFileFromCache (
   LIST_ENTRY  *Entry2;
   HTTP_BOOT_CACHE_CONTENT *Cache;
   HTTP_BOOT_ENTITY_DATA   *EntityData;
   UINTN   CopyedSize;
   
-  if (Uri == NULL || BufferSize == 0 || Buffer == NULL || ImageType == NULL) {
+  if (Uri == NULL || BufferSize == NULL || Buffer == NULL || ImageType 
+ == NULL) {
 return EFI_INVALID_PARAMETER;
   }
 
   NET_LIST_FOR_EACH (Entry, >CacheList) {
 Cache = NET_LIST_USER_STRUCT (Entry, HTTP_BOOT_CACHE_CONTENT, Link);
 //
 // Compare the URI to see whether we already have a cache for this file.
 //
 if ((Cache->RequestData != NULL) &&
 (Cache->RequestData->Url != NULL) &&
-(StrCmp (Uri, Cache->RequestData->Url) == 0)) 
-{
+(StrCmp (Uri, Cache->RequestData->Url) == 0)) {
   //
   // Hit in cache, record image type.
   //
   *ImageType  = Cache->ImageType;
 
@@ -945,11 +944,11 @@ HttpBootGetBootFile (
   Url = AllocatePool (UrlSize * sizeof (CHAR16));
   if (Url == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
   AsciiStrToUnicodeStrS (Private->BootFileUri, Url, UrlSize);
-  if (!HeaderOnly) {
+  if (!HeaderOnly && Buffer != NULL) {
 Status = HttpBootGetFileFromCache (Private, Url, BufferSize, Buffer, 
ImageType);
 if (Status != EFI_NOT_FOUND) {
   FreePool (Url);
   return Status;
 }
@@ -1127,11 +1126,11 @@ HttpBootGetBootFile (
   Context.Buffer = Buffer;
   Context.BufferSize = *BufferSize;
   Context.Cache  = Cache;
   Context.Private= Private;
   Status = HttpInitMsgParser (
- HeaderOnly? HttpMethodHead : HttpMethodGet,
+ HeaderOnly ? HttpMethodHead : HttpMethodGet,
  ResponseData->Response.StatusCode,
  ResponseData->HeaderCount,
  ResponseData->Headers,
  HttpBootGetBootFileCallback,
  (VOID*) ,
--
2.16.2.windows.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 v2 2/2] NetworkPkg: Read HttpTlsCipherList variable and configure it for HTTPS session.

2018-02-11 Thread Ye, Ting
Hi Jiaxin,

In following code, how about use "gEdkiiHttpTlsCipherListGuid" as the variable 
GUID as to make it consistent with the variable name?

+  Status  = gRT->GetVariable (
+   EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE,
+   ,
+   NULL,
+   ,
+   NULL
+   );

Others are good to me. 
Reviewed-by:  Ye Ting <ting...@intel.com>

Best Regards,
Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Sunday, February 11, 2018 11:15 AM
To: edk2-devel@lists.01.org
Cc: Laszlo Ersek <ler...@redhat.com>; Kinney, Michael D 
<michael.d.kin...@intel.com>; Zimmer, Vincent <vincent.zim...@intel.com>; Yao, 
Jiewen <jiewen@intel.com>; Ye, Ting <ting...@intel.com>; Fu, Siyuan 
<siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [PATCH v2 2/2] NetworkPkg: Read HttpTlsCipherList variable and 
configure it for HTTPS session.

v2:
* Refine the error handling returned from GetVariable.

This patch is to read the HttpTlsCipherList variable and configure it for the 
later HTTPS session.

If the variable is not set by any platform, EFI_NOT_FOUND will be returned from 
GetVariable service. In such a case, the default CipherList created in TlsDxe 
driver will be used.

Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Kinney Michael D <michael.d.kin...@intel.com>
Cc: Zimmer Vincent <vincent.zim...@intel.com>
Cc: Yao Jiewen <jiewen@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpDxe/HttpDriver.h   |  3 +-
 NetworkPkg/HttpDxe/HttpDxe.inf|  3 +-
 NetworkPkg/HttpDxe/HttpsSupport.c | 92 ++-
 3 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpDriver.h b/NetworkPkg/HttpDxe/HttpDriver.h 
index 93a412a..3b7a7a2 100644
--- a/NetworkPkg/HttpDxe/HttpDriver.h
+++ b/NetworkPkg/HttpDxe/HttpDriver.h
@@ -1,9 +1,9 @@
 /** @file
   The header files of the driver binding and service binding protocol for 
HttpDxe driver.
 
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights 
+ reserved.
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at @@ -59,10 +59,11 @@  // Produced Protocols  //  #include 

 
 #include 
+#include 
 
 #include 
 
 //
 // Driver Version
diff --git a/NetworkPkg/HttpDxe/HttpDxe.inf b/NetworkPkg/HttpDxe/HttpDxe.inf 
index 20075f5..56a2472 100644
--- a/NetworkPkg/HttpDxe/HttpDxe.inf
+++ b/NetworkPkg/HttpDxe/HttpDxe.inf
@@ -1,9 +1,9 @@
 ## @file
 #  Implementation of EFI HTTP protocol interfaces.
 #
-#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2018, Intel Corporation. All rights 
+reserved.
 #
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License  #  which 
accompanies this distribution. The full text of the license may be found at  #  
http://opensource.org/licenses/bsd-license.php.
@@ -72,10 +72,11 @@
   gEfiTlsProtocolGuid  ## SOMETIMES_CONSUMES
   gEfiTlsConfigurationProtocolGuid ## SOMETIMES_CONSUMES
 
 [Guids]
   gEfiTlsCaCertificateGuid ## SOMETIMES_CONSUMES  ## 
Variable:L"TlsCaCertificate"
+  gHttpTlsCipherListGuid   ## SOMETIMES_CONSUMES  ## 
Variable:L"HttpTlsCipherList"
 
 [Pcd]
   gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections   ## CONSUMES
   gEfiNetworkPkgTokenSpaceGuid.PcdHttpsAuthenticationMode## 
SOMETIMES_CONSUMES
   gEfiNetworkPkgTokenSpaceGuid.PcdHttpsHostPublicCert## 
SOMETIMES_CONSUMES
diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c 
b/NetworkPkg/HttpDxe/HttpsSupport.c
index 288082a..fbe4087 100644
--- a/NetworkPkg/HttpDxe/HttpsSupport.c
+++ b/NetworkPkg/HttpDxe/HttpsSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Miscellaneous routines specific to Https for HttpDxe driver.
 
-Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP  This program 
and the accompanying materials  are licensed and made available under the terms 
and conditions of the BSD License  which accompanies this distribution.  The 
full text of the license may be found at  
http://opensource.org/licenses/bsd-license.php
@@ -492,10 +492,91 @@ TlsConfigCertificate (
   
   return Status;
 }
 
 /**
+  Read the HttpTl

Re: [edk2] [PATCH] CryptoPkg: Update package version to 0.98

2018-01-21 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Long, Qin 
Sent: Monday, January 22, 2018 3:01 PM
To: Ye, Ting <ting...@intel.com>
Cc: edk2-devel@lists.01.org; Long, Qin <qin.l...@intel.com>
Subject: [PATCH] CryptoPkg: Update package version to 0.98

Update package version of CryptoPkg to 0.98.

Cc: Ting Ye <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.l...@intel.com>
---
 CryptoPkg/CryptoPkg.dec | 4 ++--
 CryptoPkg/CryptoPkg.dsc | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/CryptoPkg/CryptoPkg.dec b/CryptoPkg/CryptoPkg.dec index 
afeb723211..7593ee3c69 100644
--- a/CryptoPkg/CryptoPkg.dec
+++ b/CryptoPkg/CryptoPkg.dec
@@ -4,7 +4,7 @@
 #  This Package provides cryptographic-related libraries for UEFI security 
modules.
 #  It also provides a test application to test libraries.
 #
-#  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2009 - 2018, Intel Corporation. All rights 
+reserved.
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License  #  which 
accompanies this distribution.  The full text of the license may be found at @@ 
-20,7 +20,7 @@
   PACKAGE_NAME   = CryptoPkg
   PACKAGE_UNI_FILE   = CryptoPkg.uni
   PACKAGE_GUID   = 36470E80-36F2-4ba0-8CC8-937C7D9FF888
-  PACKAGE_VERSION= 0.97
+  PACKAGE_VERSION= 0.98
 
 [Includes]
   Include
diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc index 
461f0deeb3..b49e587ba1 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Cryptographic Library Package for UEFI Security Implementation.
 #
-#  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2009 - 2018, Intel Corporation. All rights 
+reserved.
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License  #  which 
accompanies this distribution.  The full text of the license may be found at @@ 
-20,7 +20,7 @@  [Defines]
   PLATFORM_NAME  = CryptoPkg
   PLATFORM_GUID  = E1063286-6C8C-4c25-AEF0-67A9A5B6E6B6
-  PLATFORM_VERSION   = 0.97
+  PLATFORM_VERSION   = 0.98
   DSC_SPECIFICATION  = 0x00010005
   OUTPUT_DIRECTORY   = Build/CryptoPkg
   SUPPORTED_ARCHITECTURES= IA32|X64|IPF|ARM|AARCH64
--
2.15.1.windows.2

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


Re: [edk2] [Patch] NetworkPkg/IScsiDxe: Correct the DnsMode value according the target info.

2017-12-26 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Monday, December 25, 2017 1:30 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Karunakar P 
<karunak...@amiindia.co.in>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/IScsiDxe: Correct the DnsMode value according the 
target info.

This patch is to resolve the issue recorded @ 
https://bugzilla.tianocore.org/show_bug.cgi?id=823.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Karunakar P <karunak...@amiindia.co.in>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
Tested-by: Karunakar P <karunak...@amiindia.co.in>
---
 NetworkPkg/IScsiDxe/IScsiDhcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c b/NetworkPkg/IScsiDxe/IScsiDhcp.c 
index e6f6972..e343523 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp.c
@@ -132,10 +132,11 @@ IScsiDhcpExtractRootPath (
   return EFI_INVALID_PARAMETER;
 }
 CopyMem (>TargetUrl, Field->Str, Field->Len);
 ConfigNvData->TargetUrl[Field->Len + 1] = '\0';
   } else {
+ConfigNvData->DnsMode = FALSE;
 ZeroMem(ConfigNvData->TargetUrl, sizeof (ConfigNvData->TargetUrl));
 Status = IScsiAsciiStrToIp (Field->Str, IpMode, );
 CopyMem (>TargetIp, , sizeof (EFI_IP_ADDRESS));
 
 if (EFI_ERROR (Status)) {
--
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 3/3] NetworkPkg/TcpDxe: Check TCP payload for release version.

2017-12-26 Thread Ye, Ting

Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, December 26, 2017 2:50 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wang, Fan 
<fan.w...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch 3/3] NetworkPkg/TcpDxe: Check TCP payload for release version.

TCP payload check is implemented by TcpVerifySegment(), but all the function 
calls of TcpVerifySegment() are placed in ASSERT(), which is only valid for 
debug version:
  ASSERT (TcpVerifySegment (Nbuf) != 0);

This patch is to enable the check for release version.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Wang Fan <fan.w...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/TcpDxe/TcpInput.c  | 125 +-
 NetworkPkg/TcpDxe/TcpOutput.c |  29 +++---
 2 files changed, 122 insertions(+), 32 deletions(-)

diff --git a/NetworkPkg/TcpDxe/TcpInput.c b/NetworkPkg/TcpDxe/TcpInput.c index 
f8845dc..92a0ab8 100644
--- a/NetworkPkg/TcpDxe/TcpInput.c
+++ b/NetworkPkg/TcpDxe/TcpInput.c
@@ -279,12 +279,15 @@ TcpComputeRtt (
 
   @param[in]  Nbuf The buffer that contains a received TCP segment without 
an IP header.
   @param[in]  Left The sequence number of the window's left edge.
   @param[in]  RightThe sequence number of the window's right edge.
 
+  @retval 0The segment is broken.
+  @retval 1The segment is in good shape.
+
 **/
-VOID
+INTN
 TcpTrimSegment (
   IN NET_BUF   *Nbuf,
   IN TCP_SEQNO Left,
   IN TCP_SEQNO Right
   )
@@ -304,11 +307,11 @@ TcpTrimSegment (
 TCP_CLEAR_FLG (Seg->Flag, TCP_FLG_SYN);
 TCP_CLEAR_FLG (Seg->Flag, TCP_FLG_FIN);
 
 Seg->Seq = Seg->End;
 NetbufTrim (Nbuf, Nbuf->TotalSize, NET_BUF_HEAD);
-return;
+return 1;
   }
 
   //
   // Adjust the buffer header
   //
@@ -357,27 +360,30 @@ TcpTrimSegment (
 if (Drop != 0) {
   NetbufTrim (Nbuf, Drop, NET_BUF_TAIL);
 }
   }
 
-  ASSERT (TcpVerifySegment (Nbuf) != 0);
+  return TcpVerifySegment (Nbuf);
 }
 
 /**
   Trim off the data outside the tcb's receive window.
 
   @param[in]  Tcb  Pointer to the TCP_CB of this TCP instance.
   @param[in]  Nbuf Pointer to the NET_BUF containing the received tcp 
segment.
 
+  @retval 0The segment is broken.
+  @retval 1The segment is in good shape.
+
 **/
-VOID
+INTN
 TcpTrimInWnd (
   IN TCP_CB  *Tcb,
   IN NET_BUF *Nbuf
   )
 {
-  TcpTrimSegment (Nbuf, Tcb->RcvNxt, Tcb->RcvWl2 + Tcb->RcvWnd);
+  return TcpTrimSegment (Nbuf, Tcb->RcvNxt, Tcb->RcvWl2 + Tcb->RcvWnd);
 }
 
 /**
   Process the data and FIN flag, and check whether to deliver
   data to the socket layer.
@@ -419,11 +425,20 @@ TcpDeliverData (
 
   while (Entry != >RcvQue) {
 Nbuf  = NET_LIST_USER_STRUCT (Entry, NET_BUF, List);
 Seg   = TCPSEG_NETBUF (Nbuf);
 
-ASSERT (TcpVerifySegment (Nbuf) != 0);
+if (TcpVerifySegment (Nbuf) == 0) {
+  DEBUG (
+(EFI_D_ERROR,
+"TcpToSendData: discard a broken segment for TCB %p\n",
+Tcb)
+);
+  NetbufFree (Nbuf);
+  return -1;
+}
+
 ASSERT (Nbuf->Tcp == NULL);
 
 if (TCP_SEQ_GT (Seg->Seq, Seq)) {
   break;
 }
@@ -559,12 +574,15 @@ TcpDeliverData (
   Store the data into the reassemble queue.
 
   @param[in, out]  Tcb   Pointer to the TCP_CB of this TCP instance.
   @param[in]   Nbuf  Pointer to the buffer containing the data to be 
queued.
 
+  @retval  0 An error condition occurred.
+  @retval  1 No error occurred to queue data.
+
 **/
-VOID
+INTN
 TcpQueueData (
   IN OUT TCP_CB  *Tcb,
   IN NET_BUF *Nbuf
   )
 {
@@ -586,11 +604,11 @@ TcpQueueData (
   // no out-of-order segments are received.
   //
   if (IsListEmpty (Head)) {
 
 InsertTailList (Head, >List);
-return;
+return 1;
   }
 
   //
   // Find the point to insert the buffer
   //
@@ -613,16 +631,16 @@ TcpQueueData (
 Node = NET_LIST_USER_STRUCT (Prev, NET_BUF, List);
 
 if (TCP_SEQ_LT (Seg->Seq, TCPSEG_NETBUF (Node)->End)) {
 
   if (TCP_SEQ_LEQ (Seg->End, TCPSEG_NETBUF (Node)->End)) {
-
-NetbufFree (Nbuf);
-return;
+return 1;
   }
 
-  TcpTrimSegment (Nbuf, TCPSEG_NETBUF (Node)->End, Seg->End);
+  if (TcpTrimSegment (Nbuf, TCPSEG_NETBUF (Node)->End, Seg->End) == 0) {
+return 0;
+  }
 }
   }
 
   InsertHeadList (Prev, >List);
 
@@ -646,31 +664,38 @@ TcpQueueData (
 if (TCP_SEQ_LT (TCPSEG_NETBUF (Node)->Seq, Seg->End)) {
 
   if (TCP_SEQ_LEQ (TCPSEG_NETBUF (Node)->Seq, Seg->Seq)) {
 
 RemoveEntryList (>List);
-NetbufFree (Nbuf);
-return;
+return 1;
 

Re: [edk2] [PATCH] CryptoPkg/OpensslLib: Update OpenSSL version to 1.1.0g

2017-12-24 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com>


-Original Message-
From: Long, Qin 
Sent: Friday, December 22, 2017 2:28 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>
Subject: [PATCH] CryptoPkg/OpensslLib: Update OpenSSL version to 1.1.0g

Update the supported OpenSSL version to the latest 1.1.0g (02-Nov-2017).
The changes includes:
 - Re-generate the OpensslLib[crypto].inf using process_files.pl script
   to reflect the openssl source changes.
 - Update OpenSSL-HOWTO.txt
 - On Visual Studio Build: adding "/wd4819" to disable one addition build
   warning issue, which was already fixed in OpenSSL-HEAD
   https://github.com/openssl/openssl/pull/4691.
 - On GCC Build: openssl-1.1.0g introduced one additional build warning:
...\openssl\crypto\asn1\x_int64.c:105:32: error: format '%ld' expects
argument of type 'long int', but argument 3 has type 'int64_t
{aka long long int}' [-Werror=format=]
return BIO_printf(out, "%"BIO_PRI64"d\n", **(int64_t **)pval);
^
Adding "-Wno-error=format" to GCC build flag to suppress this warning,
since we have no real printf usage in BaseCryptLib, and BIO_printf()
was already wrappered as the dummy implementation in CryptoPkg.

Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Long Qin <qin.l...@intel.com>
---
 CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt| 10 +-
 CryptoPkg/Library/OpensslLib/OpensslLib.inf   | 14 +-
 CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 14 +-
 CryptoPkg/Library/OpensslLib/buildinf.h   |  2 +-
 4 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt 
b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
index e8b0bab010..d152138129 100644
--- a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
+++ b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
@@ -18,7 +18,7 @@ on the cryptography.
  OpenSSL-Version  
=
   EDKII supports building with the latest release of OpenSSL.
-  The latest official release is OpenSSL-1.1.0e (Released at 2017-Feb-16).
+  The latest official release is OpenSSL-1.1.0g (Released at 2017-Nov-02).
   NOTE: Only latest release version was fully validated.
 And no guarantees on build & functionality if using other versions.
 
@@ -28,13 +28,13 @@ on the cryptography.
 1. Clone the latest official OpenSSL release into the directory
  CryptoPkg/Library/OpensslLib/openssl/
 
-   Use OpenSSL-1.1.0e release as one example:
- (OpenSSL_1_1_0e below is the tag name for the OpenSSL-1.1.0e release)
+   Use OpenSSL-1.1.0g release as one example:
+ (OpenSSL_1_1_0g below is the tag name for the OpenSSL-1.1.0g 
+ release)
  > cd CryptoPkg/Library/OpensslLib
- > git clone -b OpenSSL_1_1_0e https://github.com/openssl/openssl openssl
+ > git clone -b OpenSSL_1_1_0g https://github.com/openssl/openssl 
+ openssl
  or
  > git clone https://github.com/openssl/openssl openssl
- > git checkout OpenSSL_1_1_0e
+ > git checkout OpenSSL_1_1_0g
 Or
 2. Download the latest OpenSSL release package from the official website:
  https://www.openssl.org/source/
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
index 1d15da6660..5302ad7fb5 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
@@ -95,6 +95,7 @@
   $(OPENSSL_PATH)/crypto/asn1/x_algor.c
   $(OPENSSL_PATH)/crypto/asn1/x_bignum.c
   $(OPENSSL_PATH)/crypto/asn1/x_info.c
+  $(OPENSSL_PATH)/crypto/asn1/x_int64.c
   $(OPENSSL_PATH)/crypto/asn1/x_long.c
   $(OPENSSL_PATH)/crypto/asn1/x_pkey.c
   $(OPENSSL_PATH)/crypto/asn1/x_sig.c
@@ -539,10 +540,11 @@
   #   C4389: 'operator' : signed/unsigned mismatch ()
   #   C4702: unreachable code
   #   C4706: assignment within conditional expression
+  #   C4819: The file contains a character that cannot be represented in the 
current code page
   #
-  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4090 /wd4244 /wd4245 /wd4267 /wd4389 /wd4702 /wd4706
-  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4090 /wd4244 /wd4245 /wd4267 /wd4306 /wd4389 /wd4702 /wd4706
-  MSFT:*_*_IPF_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4090 /wd4244 /wd4245 /wd4267 /wd4306 /wd4389 /wd4702 /wd4706
+  MSFT:*_*_IA32_CC_FLAGS   = -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4090 /wd4244 /wd4245 /wd4267 /wd4389 /wd4702 /wd4706 /wd4819
+  MSFT:*_*_X64_CC_FLAGS= -U_WIN32 -U_WIN64 -U_MSC_VER $(OPENSSL_FLAGS) 
/wd4090 /wd4244 /wd4245 /wd4267 /wd4306 /wd4389 /wd4702 /wd4706 /wd4819
+  MSFT:*_*_IPF_CC_FLAGS= -U_WIN32 -U_WIN6

Re: [edk2] [Patch] MdeModulePkg/IpIoLib: add more error handling code to DxeIpIoLib.

2017-12-21 Thread Ye, Ting
Hi Siyuan,

Please add "status =" for calling GetModeData with IP4/IP6.  Others are good to 
me.

+  Ip.Ip6->GetModeData (
+Ip.Ip6,
+,
+NULL,
+NULL
+);

Reviewed-by: Ye Ting <ting...@intel.com> 


Best Regards,
Ting


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu, 
Siyuan
Sent: Wednesday, December 13, 2017 3:07 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wang, Fan <fan.w...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [edk2] [Patch] MdeModulePkg/IpIoLib: add more error handling code to 
DxeIpIoLib.

In DxeIpIo, there are several places not check the returned value of called 
functions.
This patch is to add the error handling to these functions.

Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Wang Fan <fan.w...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 MdeModulePkg/Include/Library/IpIoLib.h   |  4 +-
 MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 83 +---
 2 files changed, 54 insertions(+), 33 deletions(-)

diff --git a/MdeModulePkg/Include/Library/IpIoLib.h 
b/MdeModulePkg/Include/Library/IpIoLib.h
index aab0c68059..a8496f729d 100644
--- a/MdeModulePkg/Include/Library/IpIoLib.h
+++ b/MdeModulePkg/Include/Library/IpIoLib.h
@@ -2,7 +2,7 @@
   This library is only intended to be used by UEFI network stack modules.
   It provides the combined IpIo layer on the EFI IP4 Protocol and EFI IP6 
protocol.
 
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed and made available 
under  the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at @@ -426,7 +426,7 @@ IpIoSend (
   IN IP_IO_IP_INFO  *SenderOPTIONAL,
   IN VOID   *Context   OPTIONAL,
   IN VOID   *NotifyDataOPTIONAL,
-  IN EFI_IP_ADDRESS *Dest,
+  IN EFI_IP_ADDRESS *Dest  OPTIONAL,
   IN IP_IO_OVERRIDE *OverrideData  OPTIONAL
   );
 
diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c 
b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
index abc07fb0ff..6f312cccb2 100644
--- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
+++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
@@ -2,7 +2,7 @@
   IpIo Library.
 
 (C) Copyright 2014 Hewlett-Packard Development Company, L.P. -Copyright 
(c) 2005 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -234,24 +234,25 
@@ IpIoCloseProtocolDestroyIpChild (
   //
   // Close the previously openned IP protocol.
   //
-  gBS->CloseProtocol (
- ChildHandle,
- IpProtocolGuid,
- ImageHandle,
- ControllerHandle
- );
+  Status = gBS->CloseProtocol (
+  ChildHandle,
+  IpProtocolGuid,
+  ImageHandle,
+  ControllerHandle
+  );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
 
   //
   // Destroy the IP child.
   //
-  Status = NetLibDestroyServiceChild (
- ControllerHandle,
- ImageHandle,
- ServiceBindingGuid,
- ChildHandle
- );
-
-  return Status;
+  return NetLibDestroyServiceChild (
+   ControllerHandle,
+   ImageHandle,
+   ServiceBindingGuid,
+   ChildHandle
+   );
 }
 
 /**
@@ -377,8 +378,14 @@ IpIoIcmpv4Handler (
   TrimBytes  = (UINT32) (PayLoadHdr - (UINT8 *) IcmpHdr);
 
   NetbufTrim (Pkt, TrimBytes, TRUE);
-
-  IpIo->PktRcvdNotify (EFI_ICMP_ERROR, IcmpErr, Session, Pkt, 
IpIo->RcvdContext);
+  
+  //
+  // If the input packet has invalid format, and TrimBytes is larger 
+ than  // the packet size, the NetbufTrim might trim the packet to zero.
+  //
+  if (Pkt->TotalSize != 0) {
+IpIo->PktRcvdNotify (EFI_ICMP_ERROR, IcmpErr, Session, Pkt, 
+ IpIo->RcvdContext);  }
 
   return EFI_SUCCESS;
 }
@@ -539,7 +546,13 @@ IpIoIcmpv6Handler (
   
   NetbufTrim (Pkt, TrimBytes, TRUE);
 
-  IpIo->PktRcvdNotify (EFI_ICMP_ERROR, IcmpErr, Session, Pkt, 
IpIo->RcvdContext);
+  //
+  // If the input packet has invalid format, and TrimBytes is larger 
+ than  // the packet size, the NetbufTrim might trim the packet to zero.
+  //
+  if (Pkt->TotalSize != 0) {
+IpIo->PktRcvdNotify (EFI_ICMP_ERROR, IcmpErr, Session, Pkt, 
+ IpIo->RcvdContext);  }
 
   return EFI_SUCCESS;
 }

Re: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Remove redundant code in Ip4Config2InitInstance().

2017-12-21 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu, 
Siyuan
Sent: Wednesday, December 13, 2017 10:24 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wang, Fan <fan.w...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Remove redundant code in 
Ip4Config2InitInstance().

Instance->Dhcp4Event is not necessary to be created in Ip4Config2InitInstance.
Because it will created in Ip4StartAutoConfig() later.

Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Wang Fan <fan.w...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index 26530e3a2b..9925ae9203 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -2034,18 +2034,6 @@ Ip4Config2InitInstance (
   DataItem->SetData  = Ip4Config2SetDnsServer;
   DataItem->Status   = EFI_NOT_FOUND;
 
-  //
-  // Create the event used for DHCP.
-  //
-  Status = gBS->CreateEvent (
-  EVT_NOTIFY_SIGNAL,
-  TPL_CALLBACK,
-  Ip4Config2OnDhcp4Event,
-  Instance,
-  >Dhcp4Event
-  );
-  ASSERT_EFI_ERROR (Status);
-
   Instance->Configured  = TRUE;
 
   //
-- 
2.13.0.windows.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] MdeModulePkg/Ip4Dxe: Clean up IP4 interface if failed to open ARP protocol.

2017-12-20 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu, 
Siyuan
Sent: Wednesday, December 13, 2017 10:16 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wang, Fan <fan.w...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [edk2] [Patch] MdeModulePkg/Ip4Dxe: Clean up IP4 interface if failed 
to open ARP protocol.

This patch fixes a bug in Ip4ConfigProtocol, that new created IP interface is 
not freed if Open ARP protocol failed.

Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Wang Fan <fan.w...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index fc5812e4ab..ac48ad2584 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -727,6 +727,7 @@ Ip4ConfigProtocol (
 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
 );
 if (EFI_ERROR (Status)) {
+  Ip4FreeInterface (IpIf, IpInstance);
   goto ON_ERROR;
 }
   }
--
2.13.0.windows.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] Syntax error in EFI iSCSI Initiator Name Protocol in UEFI2.7 Spec

2017-12-19 Thread Ye, Ting
Hi Karunakar,

Thanks for capturing the issue. We will raise it to spec group soon. Hopefully 
we can fix it in the next version of UEFI specification.

Best Regards,
Ting

From: Karunakar P [mailto:karunak...@amiindia.co.in]
Sent: Tuesday, December 19, 2017 4:29 PM
To: 'edk2-devel@lists.01.org' <edk2-devel@lists.01.org>
Cc: Fu, Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: Syntax error in EFI iSCSI Initiator Name Protocol in UEFI2.7 Spec

Hello All,

There is a typing mistake in EFI_ISCSI_INITIATOR_NAME_PROTOCOL Get() and Set() 
Prototypes

UEFI2.7 16.2 Page 921,922

EFI_ISCSI_INITIATOR_NAME_PROTOCOL. Get()

Summary

Retrieves the current set value of iSCSI Initiator Name.

Prototype

typedef EFI_STATUS

(EFIAPI *EFI_ISCSI_INITIATOR_NAME_GET) {

IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This

IN OUT UINTN *BufferSize

OUT VOID *Buffer

}

EFI_ISCSI_INITIATOR_NAME_PROTOCOL.Set()

Summary

Sets the iSCSI Initiator Name.

Prototype

typedef EFI_STATUS

(EFIAPI *EFI_ISCSI_INITIATOR_NAME_SET) {

IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This

IN OUT UINTN *BufferSize

IN VOID *Buffer

}



The Prototypes should be like below

typedef EFI_STATUS

(EFIAPI *EFI_ISCSI_INITIATOR_NAME_GET) (

IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This

IN OUT UINTN *BufferSize

OUT VOID *Buffer

);


typedef EFI_STATUS

(EFIAPI *EFI_ISCSI_INITIATOR_NAME_SET) (

IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This

IN OUT UINTN *BufferSize

IN VOID *Buffer

);


Thanks,
Karunakar
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.

2017-12-12 Thread Ye, Ting
Hi Jiaxin,

Thanks for the clarification. I agree with your solution to try DHCP process 
when upper layer don't know the media status. However, we might need add some 
comments there to indicate such case, that MediaPresent is TRUE does not mean 
media is available. 
Others are good to me. Reviewed-by: Ye Ting <ting...@intel.com> 

Thanks,
Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Wednesday, December 13, 2017 1:16 PM
To: Ye, Ting <ting...@intel.com>; edk2-devel@lists.01.org
Cc: Fu, Siyuan <siyuan...@intel.com>; Karunakar P <karunak...@amiindia.co.in>
Subject: RE: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before 
starting DHCP process.

Hi Ting,

In such a case, DHCP process should also be trigged since DHCP doesn't have the 
knowledge of media status. We can't return directly since the media may be 
available. what do you think?

Thanks,
Jiaxin



> -Original Message-
> From: Ye, Ting
> Sent: Wednesday, December 13, 2017 11:33 AM
> To: Wu, Jiaxin <jiaxin...@intel.com>; edk2-devel@lists.01.org
> Cc: Fu, Siyuan <siyuan...@intel.com>; Karunakar P 
> <karunak...@amiindia.co.in>
> Subject: RE: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status 
> before starting DHCP process.
> 
> Hi Jiaxin,
> 
> I think the patch need be revised since it does not check the returned 
> status of NetLibDetectMedia.  If NetLibDetectMedia failed to detect 
> the media status due to some error conditions, MediaPresent is still 
> TRUE and DHCP will be trigged later even no media is available.
> 
> Thanks,
> Ting
> 
> 
> -Original Message-
> From: Wu, Jiaxin
> Sent: Friday, December 1, 2017 4:39 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; 
> Karunakar P <karunak...@amiindia.co.in>; Wu, Jiaxin 
> <jiaxin...@intel.com>
> Subject: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before 
> starting DHCP process.
> 
> Cc: Ye Ting <ting...@intel.com>
> Cc: Fu Siyuan <siyuan...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Karunakar P <karunak...@amiindia.co.in>
> Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
> ---
>  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13
> -
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> index 1db4c66..8780414 100644
> --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
> @@ -1,9 +1,9 @@
>  /** @file
>This file implement the EFI_DHCP4_PROTOCOL interface.
> 
> -Copyright (c) 2006 - 2016, Intel Corporation. All rights 
> reserved.
> +Copyright (c) 2006 - 2017, Intel Corporation. All rights 
> +reserved.
>  This program and the accompanying materials  are licensed and made 
> available under the terms and conditions of the BSD License  which 
> accompanies this distribution.  The full text of the license may be 
> found at http://opensource.org/licenses/bsd-license.php
> 
> @@ -778,10 +778,11 @@ EfiDhcp4Start (
>IN EFI_EVENT  CompletionEvent   OPTIONAL
>)
>  {
>DHCP_PROTOCOL *Instance;
>DHCP_SERVICE  *DhcpSb;
> +  BOOLEAN   MediaPresent;
>EFI_STATUSStatus;
>EFI_TPL   OldTpl;
> 
>//
>// First validate the parameters
> @@ -807,10 +808,20 @@ EfiDhcp4Start (
>if ((DhcpSb->DhcpState != Dhcp4Init) && (DhcpSb->DhcpState !=
> Dhcp4InitReboot)) {
>  Status = EFI_ALREADY_STARTED;
>  goto ON_ERROR;
>}
> 
> +  //
> +  // Check Media Satus.
> +  //
> +  MediaPresent = TRUE;
> +  NetLibDetectMedia (DhcpSb->Controller, );  if
> + (!MediaPresent) {
> +Status = EFI_NO_MEDIA;
> +goto ON_ERROR;
> +  }
> +
>DhcpSb->IoStatus = EFI_ALREADY_STARTED;
> 
>if (EFI_ERROR (Status = DhcpInitRequest (DhcpSb))) {
>  goto ON_ERROR;
>}
> --
> 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 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.

2017-12-12 Thread Ye, Ting
Hi Jiaxin,

I think the patch need be revised since it does not check the returned status 
of NetLibDetectMedia.  If NetLibDetectMedia failed to detect the media status 
due to some error conditions, MediaPresent is still TRUE and DHCP will be 
trigged later even no media is available.

Thanks,
Ting


-Original Message-
From: Wu, Jiaxin 
Sent: Friday, December 1, 2017 4:39 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Karunakar P 
<karunak...@amiindia.co.in>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch 1/2] MdeModulePkg/Dhcp4Dxe: Check Media status before starting 
DHCP process.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Karunakar P <karunak...@amiindia.co.in>
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
index 1db4c66..8780414 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
@@ -1,9 +1,9 @@
 /** @file
   This file implement the EFI_DHCP4_PROTOCOL interface.
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at  
http://opensource.org/licenses/bsd-license.php
 
@@ -778,10 +778,11 @@ EfiDhcp4Start (
   IN EFI_EVENT  CompletionEvent   OPTIONAL
   )
 {
   DHCP_PROTOCOL *Instance;
   DHCP_SERVICE  *DhcpSb;
+  BOOLEAN   MediaPresent;
   EFI_STATUSStatus;
   EFI_TPL   OldTpl;
 
   //
   // First validate the parameters
@@ -807,10 +808,20 @@ EfiDhcp4Start (
   if ((DhcpSb->DhcpState != Dhcp4Init) && (DhcpSb->DhcpState != 
Dhcp4InitReboot)) {
 Status = EFI_ALREADY_STARTED;
 goto ON_ERROR;
   }
 
+  //
+  // Check Media Satus.
+  //
+  MediaPresent = TRUE;
+  NetLibDetectMedia (DhcpSb->Controller, );  if 
+ (!MediaPresent) {
+Status = EFI_NO_MEDIA;
+goto ON_ERROR;
+  }
+
   DhcpSb->IoStatus = EFI_ALREADY_STARTED;
 
   if (EFI_ERROR (Status = DhcpInitRequest (DhcpSb))) {
 goto ON_ERROR;
   }
--
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] MdeModulePkg/Ip4Dxe: Cleanup the resource after error happen during Ip4StartAutoConfig().

2017-12-12 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, December 12, 2017 7:44 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wang, Fan 
<fan.w...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch] MdeModulePkg/Ip4Dxe: Cleanup the resource after error happen 
during Ip4StartAutoConfig().

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Wang Fan <fan.w...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c  | 46 +-
 1 file changed, 37 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index 26530e3..f2640b7 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -915,11 +915,10 @@ Ip4StartAutoConfig (
   EFI_DHCP4_MODE_DATADhcp4Mode;
   EFI_DHCP4_PACKET_OPTION*OptionList[1];
   IP4_CONFIG2_DHCP4_OPTION   ParaList;
   EFI_STATUS Status;
  
-
   IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
 
   if (IpSb->State > IP4_SERVICE_UNSTARTED) {
 return EFI_SUCCESS;
   }
@@ -968,24 +967,33 @@ Ip4StartAutoConfig (
   (VOID **) >Dhcp4,
   IpSb->Image,
   IpSb->Controller,
   EFI_OPEN_PROTOCOL_BY_DRIVER
   );
-  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+NetLibDestroyServiceChild (
+  IpSb->Controller,
+  IpSb->Image,
+  ,
+  Instance->Dhcp4Handle
+  );
 
+Instance->Dhcp4Handle = NULL;
+
+return Status;
+  }
 
   //
   // Check the current DHCP status, if the DHCP process has
   // already finished, return now.
   //
   Dhcp4  = Instance->Dhcp4;
   Status = Dhcp4->GetModeData (Dhcp4, );
-
   if (Dhcp4Mode.State == Dhcp4Bound) {
 Ip4Config2OnDhcp4Complete (NULL, Instance);
+
 return EFI_SUCCESS;
-
   }
 
   //
   // Try to start the DHCP process. Use most of the current
   // DHCP configuration to avoid problems if some DHCP client @@ -999,12 
+1007,29 @@ Ip4StartAutoConfig (
   OptionList[0]= 
   Dhcp4Mode.ConfigData.OptionCount = 1;
   Dhcp4Mode.ConfigData.OptionList  = OptionList;
 
   Status = Dhcp4->Configure (Dhcp4, );
-
   if (EFI_ERROR (Status)) {
+gBS->CloseProtocol (
+   Instance->Dhcp4Handle,
+   ,
+   IpSb->Image,
+   IpSb->Controller
+   );
+
+NetLibDestroyServiceChild (
+  IpSb->Controller,
+  IpSb->Image,
+  ,
+  Instance->Dhcp4Handle
+  );
+
+Instance->Dhcp4 = NULL;
+
+Instance->Dhcp4Handle = NULL;
+
 return Status;
   }
   
   //
   // Start the DHCP process
@@ -1014,25 +1039,28 @@ Ip4StartAutoConfig (
   TPL_CALLBACK,
   Ip4Config2OnDhcp4Complete,
   Instance,
   >Dhcp4Event
   );
-
   if (EFI_ERROR (Status)) {
+Ip4Config2DestroyDhcp4 (Instance);
 return Status;
   }
 
   Status = Dhcp4->Start (Dhcp4, Instance->Dhcp4Event);
-
   if (EFI_ERROR (Status)) {
+Ip4Config2DestroyDhcp4 (Instance);
+gBS->CloseEvent (Instance->Dhcp4Event);
+Instance->Dhcp4Event = NULL;
+
 return Status;
   }
  
-  IpSb->State = IP4_SERVICE_STARTED;
+  IpSb->State = IP4_SERVICE_STARTED;
   DispatchDpc ();
+  
   return EFI_SUCCESS;
-
 }
 
 
 
 /**
--
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] MdeModulePkg/Ip4Dxe: return error on memory allocate failure instead of ASSERT.

2017-12-12 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu Siyuan
Sent: Wednesday, December 13, 2017 10:43 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wang, Fan <fan.w...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [edk2] [Patch] MdeModulePkg/Ip4Dxe: return error on memory allocate 
failure instead of ASSERT.

This patch updates the IP4 driver to use error status code instead of ASSERT if 
failed to allocate memory buffer.

Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Wang Fan <fan.w...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c
index c8dc6976d7..694a2d0e1f 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Nv.c
@@ -293,8 +293,12 @@ Ip4Config2IpToStr (
   @param[in]   IpCount   The size of IPv4 address list.
   @param[out]  Str   The string contains several decimal dotted
  IPv4 addresses separated by space.   
+
+  @retval EFI_SUCCESS   Operation is success.
+  @retval EFI_OUT_OF_RESOURCES  Error occurs in allocating memory.
+
 **/
-VOID
+EFI_STATUS
 Ip4Config2IpListToStr (
   IN  EFI_IPv4_ADDRESS  *Ip,
   IN  UINTN IpCount,
@@ -317,7 +321,9 @@ Ip4Config2IpListToStr (
 TempIp = Ip + Index;
 if (TempStr == NULL) {
   TempStr = AllocateZeroPool(2 * IP4_STR_MAX_SIZE);
-  ASSERT(TempStr != NULL);
+  if (TempStr == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
 }
 
 UnicodeSPrint (
@@ -347,6 +353,8 @@ Ip4Config2IpListToStr (
   if (TempStr != NULL) {
 FreePool(TempStr);
   }
+
+  return EFI_SUCCESS;
 }
 
 /**
@@ -518,7 +526,7 @@ Ip4Config2ConvertConfigNvDataToIfrNvData (
   Ip4Config2IpToStr (>StationAddress, IfrNvData->StationAddress);
   Ip4Config2IpToStr (>SubnetMask, IfrNvData->SubnetMask);
   Ip4Config2IpToStr (, IfrNvData->GatewayAddress);
-  Ip4Config2IpListToStr (DnsAddress, DnsCount, IfrNvData->DnsAddress);
+  Status = Ip4Config2IpListToStr (DnsAddress, DnsCount, 
+ IfrNvData->DnsAddress);
 
 Exit:
 
@@ -914,7 +922,10 @@ Ip4FormExtractConfig (
   ConfigRequestHdr = HiiConstructConfigHdr (, 
mIp4Config2StorageName, Private->ChildHandle);
   Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
   ConfigRequest = AllocateZeroPool (Size);
-  ASSERT (ConfigRequest != NULL);
+  if (ConfigRequest == NULL) {
+Status = EFI_OUT_OF_RESOURCES;
+goto Failure;
+  }
   AllocatedRequest = TRUE;
   
   UnicodeSPrint (ConfigRequest, Size, L"%s=0=%016LX", 
ConfigRequestHdr, (UINT64)BufferSize);
--
2.13.0.windows.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] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.

2017-12-11 Thread Ye, Ting
Hi Siyuan,

You might need write a log message for this patch, what do you think? Others 
are good to me.

Reviewed-by: Ye Ting <ting...@intel.com>

Best Regards,
Ting

-Original Message-
From: Fu Siyuan [mailto:siyuan...@intel.com] 
Sent: Tuesday, December 5, 2017 2:34 PM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Ye, Ting <ting...@intel.com>
Subject: [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is 
timeout.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Ye Ting <ting...@intel.com>
---
 MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c 
b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
index 17183e1a6c..2e59b680bf 100644
--- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
+++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.
   It provides the helper routines to access TCP service.
 
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -585,6 
+585,11 @@ TcpIoConnect (
   }
 
   if (!TcpIo->IsConnDone) {
+if (TcpIo->TcpVersion == TCP_VERSION_4) {
+  Tcp4->Cancel (Tcp4, >ConnToken.Tcp4Token.CompletionToken);
+} else {
+  Tcp6->Cancel (Tcp6, >ConnToken.Tcp6Token.CompletionToken);
+}
 Status = EFI_TIMEOUT;
   } else {
 Status = TcpIo->ConnToken.Tcp4Token.CompletionToken.Status;
@@ -655,6 +660,11 @@ TcpIoAccept (
   }
 
   if (!TcpIo->IsListenDone) {
+if (TcpIo->TcpVersion == TCP_VERSION_4) {
+  Tcp4->Cancel (Tcp4, >ListenToken.Tcp4Token.CompletionToken);
+} else {
+  Tcp6->Cancel (Tcp6, >ListenToken.Tcp6Token.CompletionToken);
+}
 Status = EFI_TIMEOUT;
   } else {
 Status = TcpIo->ListenToken.Tcp4Token.CompletionToken.Status;
--
2.13.0.windows.1

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


Re: [edk2] [Patch] MdeModulePkg/TcpIoLib: Check input Timeout before calling CheckEvent() service.

2017-12-11 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu Siyuan [mailto:siyuan...@intel.com] 
Sent: Tuesday, December 5, 2017 2:33 PM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Ye, Ting <ting...@intel.com>
Subject: [Patch] MdeModulePkg/TcpIoLib: Check input Timeout before calling 
CheckEvent() service.

For TcpIoConnect() and TcpIoAccept(), this patch adds the check for Timeout 
event before calling CheckEvent() service so as to avoid the unnecessary 
function call.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Ye Ting <ting...@intel.com>
---
 MdeModulePkg/Include/Library/TcpIoLib.h| 14 +++---
 MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 20 ++--
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/MdeModulePkg/Include/Library/TcpIoLib.h 
b/MdeModulePkg/Include/Library/TcpIoLib.h
index 2871f6747e..22629dbcd5 100644
--- a/MdeModulePkg/Include/Library/TcpIoLib.h
+++ b/MdeModulePkg/Include/Library/TcpIoLib.h
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.
   It provides the helper routines to access TCP service.
 
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -144,7 
+144,7 @@ TcpIoDestroySocket (
   Connect to the other endpoint of the TCP socket.
 
   @param[in, out]  TcpIo The TcpIo wrapping the TCP socket.
-  @param[in]   Timeout   The time to wait for connection done.
+  @param[in]   Timeout   The time to wait for connection done. Set to NULL 
for infinite wait.
   
   @retval EFI_SUCCESSConnect to the other endpoint of the TCP 
socket
  successfully.
@@ -160,14 +160,14 @@ EFI_STATUS
 EFIAPI
 TcpIoConnect (
   IN OUT TCP_IO *TcpIo,
-  IN EFI_EVENT  Timeout
+  IN EFI_EVENT  TimeoutOPTIONAL
   );
 
 /**
   Accept the incomding request from the other endpoint of the TCP socket.
 
   @param[in, out]  TcpIo The TcpIo wrapping the TCP socket.
-  @param[in]   Timeout   The time to wait for connection done.
+  @param[in]   Timeout   The time to wait for connection done. Set to NULL 
for infinite wait.
 
   
   @retval EFI_SUCCESSConnect to the other endpoint of the TCP 
socket
@@ -185,7 +185,7 @@ EFI_STATUS
 EFIAPI
 TcpIoAccept (
   IN OUT TCP_IO *TcpIo,
-  IN EFI_EVENT  Timeout
+  IN EFI_EVENT  TimeoutOPTIONAL
   );
   
 /**
@@ -229,7 +229,7 @@ TcpIoTransmit (
   @param[in]   Packet  The buffer to hold the data copy from the 
socket rx buffer.
   @param[in]   AsyncMode   Is this receive asyncronous or not.
   @param[in]   Timeout The time to wait for receiving the amount of 
data the Packet
-   can hold.
+   can hold. Set to NULL for infinite wait.
 
   @retval EFI_SUCCESSThe required amount of data is received from 
the socket.
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
@@ -246,7 +246,7 @@ TcpIoReceive (
   IN OUT TCP_IO *TcpIo,
   IN NET_BUF*Packet,
   IN BOOLEANAsyncMode,
-  IN EFI_EVENT  Timeout
+  IN EFI_EVENT  Timeout   OPTIONAL
   );
 
 #endif
diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c 
b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
index 17183e1a6c..a7637579f2 100644
--- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
+++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.
   It provides the helper routines to access TCP service.
 
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -530,7 
+530,7 @@ TcpIoDestroySocket (
   Connect to the other endpoint of the TCP socket.
 
   @param[in, out]  TcpIo The TcpIo wrapping the TCP socket.
-  @param[in]   Timeout   The time to wait for connection done.
+  @param[in]   Timeout   The time to wait for connection done. Set to NULL 
for infinite wait.
   
   @retval EFI_SUCCESSConnect to the other endpoint of the TCP 
socket
  successfully.
@@ -546,7 +546,7 @@ EFI_STATUS
 EFIAPI
 TcpIoConnect (

Re: [edk2] [Patch] ShellPkg: Add error message if failed to place receive token in ping command.

2017-11-14 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Wednesday, November 15, 2017 12:10 PM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Ye, Ting <ting...@intel.com>; Ni, Ruiyu 
<ruiyu...@intel.com>
Subject: [Patch] ShellPkg: Add error message if failed to place receive token 
in ping command.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Ruiyu Ni <ruiyu...@intel.com>
---
 ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c | 9 +++--
 .../UefiShellNetwork1CommandsLib.uni | 1 +
 ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c| 9 +++--
 .../UefiShellNetwork2CommandsLib.uni | 1 +
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c 
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
index ca5c22a..10d291c 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
@@ -2,7 +2,7 @@
   The implementation for Ping shell command.
 
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights 
+ reserved.
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 
   This program and the accompanying materials @@ -629,6 +629,7 @@ ON_EXIT:
 Status = Private->ProtocolPointers.Receive (Private->IpProtocol, 
>RxToken);
 
 if (EFI_ERROR (Status)) {
+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_RECEIVE), 
+ gShellNetwork1HiiHandle, Status);
   Private->Status = EFI_ABORTED;
 }
   } else {
@@ -828,7 +829,11 @@ Ping6ReceiveEchoReply (
 
   Private->RxToken.Status = EFI_NOT_READY;
 
-  return (Private->ProtocolPointers.Receive (Private->IpProtocol, 
>RxToken));
+  Status = Private->ProtocolPointers.Receive (Private->IpProtocol, 
+ >RxToken);  if (EFI_ERROR (Status)) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING_RECEIVE), 
+ gShellNetwork1HiiHandle, Status);  }  return Status;
 }
 
 /**
diff --git 
a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni
 
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni
index 70c3465..7a43ad5 100644
--- 
a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1Com
+++ mandsLib.uni
@@ -50,6 +50,7 @@
 #string STR_PING_CONFIG  #language en-US "Config %r\r\n"
 #string STR_PING_GETMODE #language en-US "GetModeData %r\r\n"
 #string STR_PING_GETDATA #language en-US "GetData %r\r\n"
+#string STR_PING_RECEIVE #language en-US "Receive %r\r\n"
 #string STR_PING_SEND_REQUEST#language en-US "Echo request sequence %d 
did not complete successfully.\r\n"
 #string STR_PING_NOSOURCE_INDO   #language en-US "There are no sources in 
%s's multicast domain.\r\n"
 #string STR_PING_NETWORK_ERROR   #language en-US "%H%s%N: Network function 
failed with %r\r\n"
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
index 2961fd7..b784696 100644
--- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ping6.c
@@ -1,7 +1,7 @@
 /** @file
   The implementation for Ping6 application.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights 
+ reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -474,6 +474,7 @@ ON_EXIT:
 Status = Private->Ip6->Receive (Private->Ip6, RxToken);
 
 if (EFI_ERROR (Status)) {
+  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
+ (STR_PING6_IP6_RECEIVE), gShellNetwork2HiiHandle, Status);
   Private->Status = EFI_ABORTED;
 }
   } else {
@@ -658,7 +659,11 @@ Ping6OnReceiveEchoReply (
 
   Private->RxToken.Status = EFI_NOT_READY;
 
-  return Private->Ip6->Receive (Private->Ip6, >RxToken);
+  Status = Private->Ip6->Receive (Private->Ip6, >RxToken);  if 
+ (EFI_ERROR (Status)) {
+ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN 
+ (STR_PING6_IP6_RECEIVE), gShellNetwork2HiiHandle, Status);  }  return 
+ Status;
 }
 
 /**
diff --git 
a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
 
b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
index 2b2327b..

Re: [edk2] [Patch] MdeModulePkg/SNP: remove redundant DEBUG print in SNP Transmit.c

2017-11-14 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Wednesday, November 15, 2017 11:15 AM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Ye, Ting <ting...@intel.com>
Subject: [Patch] MdeModulePkg/SNP: remove redundant DEBUG print in SNP 
Transmit.c

This patch is to remove some redundant DEBUG output in SNP transmit function.
In case of return EFI_NOT_READY in PxeTransmit, the SNP driver is indicate the 
caller that the transmit queue is full, it's a very common situation druing 
transmit, not a critical error. So the patch move the DEBUG lever to EFI_D_NET.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Ye Ting <ting...@intel.com>
---
 MdeModulePkg/Universal/Network/SnpDxe/Transmit.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c 
b/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
index 73461bc..2c7083e 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Transmit.c
@@ -1,7 +1,7 @@
 /** @file
 Implementation of transmitting a packet.
  
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed  and made available 
under the terms and conditions of the BSD License which  accompanies this 
distribution. The full text of the license may be found at @@ -186,7 +186,6 @@ 
PxeTransmit (
   (*Snp->IssueUndi32Command) ((UINT64) (UINTN) >Cdb);
 
   DEBUG ((EFI_D_NET, "\nexit Snp->undi.transmit()  "));
-  DEBUG ((EFI_D_NET, "\nSnp->Cdb.StatCode == %r", Snp->Cdb.StatCode));
 
   //
   // we will unmap the buffers in get_status call, not here @@ -199,19 +198,24 
@@ PxeTransmit (
   case PXE_STATCODE_QUEUE_FULL:
   case PXE_STATCODE_BUSY:
 Status = EFI_NOT_READY;
+DEBUG (
+  (EFI_D_NET,
+  "\nSnp->undi.transmit()  %xh:%xh\n",
+  Snp->Cdb.StatFlags,
+  Snp->Cdb.StatCode)
+  );
 break;
 
   default:
+DEBUG (
+  (EFI_D_ERROR,
+  "\nSnp->undi.transmit()  %xh:%xh\n",
+  Snp->Cdb.StatFlags,
+  Snp->Cdb.StatCode)
+  );
 Status = EFI_DEVICE_ERROR;
   }
 
-  DEBUG (
-(EFI_D_ERROR,
-"\nSnp->undi.transmit()  %xh:%xh\n",
-Snp->Cdb.StatFlags,
-Snp->Cdb.StatCode)
-);
-
   return Status;
 }
 
--
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] NetworkPkg: Fix incorrect SizeofHeaders returned from HttpTcpReceiveHeader().

2017-11-14 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Wednesday, November 15, 2017 10:45 AM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Ye, Ting <ting...@intel.com>; Karunakar P 
<karunak...@amiindia.co.in>
Subject: [Patch] NetworkPkg: Fix incorrect SizeofHeaders returned from 
HttpTcpReceiveHeader().

This patch is to fix a bug that the HttpTcpReceiveHeader() may return incorrect 
SizeofHeaders, which will include some already received message-body.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Karunakar P <karunak...@amiindia.co.in>
---
 NetworkPkg/HttpDxe/HttpProto.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c 
index ab00f3d..1aa1816 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1876,7 +1876,10 @@ HttpTcpReceiveHeader (
   //
   // Check whether we received end of HTTP headers.
   //
-  *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); 
+  *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR);
+  if (*EndofHeader != NULL) {
+*SizeofHeaders = *EndofHeader - *HttpHeaders;
+  }
 };
 
 //
@@ -1976,6 +1979,9 @@ HttpTcpReceiveHeader (
   // Check whether we received end of HTTP headers.
   //
   *EndofHeader = AsciiStrStr (*HttpHeaders, HTTP_END_OF_HDR_STR); 
+  if (*EndofHeader != NULL) {
+*SizeofHeaders = *EndofHeader - *HttpHeaders;
+  }
 };
 
 //
--
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 V2] NetworkPkg: Print error message to screen if error occurs during HTTP boot.

2017-11-14 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Wednesday, November 15, 2017 9:52 AM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Ye, Ting <ting...@intel.com>
Subject: [Patch V2] NetworkPkg: Print error message to screen if error occurs 
during HTTP boot.

V2 update:
Add error message is URI address is not correct.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Ye Ting <ting...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootImpl.c| 21 +
 NetworkPkg/HttpBootDxe/HttpBootSupport.c |  2 ++
 NetworkPkg/HttpDxe/HttpImpl.c|  1 +
 3 files changed, 24 insertions(+)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 06a8a6a..d591db5 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -327,6 +327,7 @@ HttpBootLoadFile (
 //
 Status = HttpBootDiscoverBootInfo (Private);
 if (EFI_ERROR (Status)) {
+  AsciiPrint ("\n  Error: Could not discover the boot information 
+ for DHCP server.\n");
   goto ON_EXIT;
 }
   }
@@ -369,6 +370,7 @@ HttpBootLoadFile (
  >ImageType
  );
   if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
+AsciiPrint ("\n  Error: Could not retrieve NBP file size from 
+ HTTP server.\n");
 goto ON_EXIT;
   }
 }
@@ -394,6 +396,22 @@ HttpBootLoadFile (
   
 ON_EXIT:
   HttpBootUninstallCallback (Private);
+
+  if (Status == EFI_ACCESS_DENIED) {
+AsciiPrint ("\n  Error: Could not establish connection with HTTP 
+ server.\n");  } else if (Status == EFI_BUFFER_TOO_SMALL && Buffer != NULL) {
+AsciiPrint ("\n  Error: Buffer size is smaller than the requested 
+ file.\n");  } else if (Status == EFI_OUT_OF_RESOURCES) {
+AsciiPrint ("\n  Error: Could not allocate I/O buffers.\n");  } 
+ else if (Status == EFI_DEVICE_ERROR) {
+AsciiPrint ("\n  Error: Network device error.\n");  } else if 
+ (Status == EFI_TIMEOUT) {
+AsciiPrint ("\n  Error: Server response timeout.\n");  } else if 
+ (Status == EFI_ABORTED) {
+AsciiPrint ("\n  Error: Remote boot cancelled.\n");  } else if 
+ (Status != EFI_BUFFER_TOO_SMALL) {
+AsciiPrint ("\n  Error: Unexpected network error.\n");  }
   return Status;
 }
 
@@ -555,6 +573,7 @@ HttpBootDxeLoadFile (
   MediaPresent = TRUE;
   NetLibDetectMedia (Private->Controller, );
   if (!MediaPresent) {
+AsciiPrint ("\n  Error: Could not detect network connection.\n");
 return EFI_NO_MEDIA;
   }
   
@@ -595,6 +614,8 @@ HttpBootDxeLoadFile (
 Status = HttpBootRegisterRamDisk (Private, *BufferSize, Buffer, ImageType);
 if (!EFI_ERROR (Status)) {
   Status = EFI_WARN_FILE_SYSTEM;
+} else {
+  AsciiPrint ("\n  Error: Could not register RAM disk to the 
+ system.\n");
 }
   }
 
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index d508e2c..7ca48f3 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -1093,6 +1093,7 @@ HttpBootCheckUriScheme (
   // Return EFI_INVALID_PARAMETER if the URI is not HTTP or HTTPS.
   //
   if ((AsciiStrnCmp (Uri, "http://;, 7) != 0) && (AsciiStrnCmp (Uri, 
"https://;, 8) != 0)) {
+AsciiPrint ("\n  Error: Invalid URI address.\n");
 DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: Invalid Uri.\n"));
 return EFI_INVALID_PARAMETER;
   }
@@ -1101,6 +1102,7 @@ HttpBootCheckUriScheme (
   // HTTP is disabled, return EFI_ACCESS_DENIED if the URI is HTTP.
   //
   if (!PcdGetBool (PcdAllowHttpConnections) && (AsciiStrnCmp (Uri, "http://;, 
7) == 0)) {
+AsciiPrint ("\n  Error: Access forbidden, only HTTPS connection is 
+ allowed.\n");
 DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: HTTP is disabled.\n"));
 return EFI_ACCESS_DENIED;
   }
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index 46d0323..57fa39f 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -523,6 +523,7 @@ EfiHttpRequest (
   
   FreePool (HostNameStr);
   if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "Error: Could not retrieve the host 
+ address from DNS server.\n"));
 goto Error1;
   }
 }
--
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] NetworkPkg/TlsAuthConfigDxe: Remove the extra FreePool

2017-10-19 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Thursday, October 19, 2017 1:58 PM
To: edk2-devel@lists.01.org
Cc: Long, Qin; Ye, Ting; Fu, Siyuan; Wu, Jiaxin
Subject: [Patch] NetworkPkg/TlsAuthConfigDxe: Remove the extra FreePool

Cc: Long Qin <qin.l...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c 
b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c
index 351656f..403afbb 100644
--- a/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c
+++ b/NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.c
@@ -1,9 +1,9 @@
 /** @file
   The DriverEntryPoint for TlsAuthConfigDxe driver.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -126,10 +126,9 @@ TlsAuthConfigDxeDriverEntryPoint (
 
   return EFI_SUCCESS;
 
 ON_ERROR:
   TlsAuthConfigFormUnload (PrivateData);
-  FreePool (PrivateData);
-
+  
   return Status;
 }
 
-- 
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] NetworkPkg: Remove ping6 and ifconfig shell application.

2017-10-18 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Tuesday, October 17, 2017 9:08 PM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin; Ye, Ting
Subject: [Patch] NetworkPkg: Remove ping6 and ifconfig shell application.

Edk2 has duplicated ping6/ifconfig6 implementation in NetworkPkg and ShellPkg.
The usage and parameter format of these 2 versions are exactly same. These two
commands have been added to Shell specification so the copy under
  ShellPkg\Library\UefiShellNetwork2CommandsLib\
will be actively maintained in future.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Ye Ting <ting...@intel.com>
---
 NetworkPkg/Application/IfConfig6/IfConfig6.c   | 1793 
 NetworkPkg/Application/IfConfig6/IfConfig6.h   |   79 -
 NetworkPkg/Application/IfConfig6/IfConfig6.inf |   67 -
 NetworkPkg/Application/IfConfig6/IfConfig6.uni |   23 -
 .../Application/IfConfig6/IfConfig6Extra.uni   |   20 -
 .../Application/IfConfig6/IfConfig6Strings.uni |   92 -
 NetworkPkg/Application/Ping6/Ia32/Tsc.c|   28 -
 NetworkPkg/Application/Ping6/Ipf/Itc.c |   28 -
 NetworkPkg/Application/Ping6/Ping6.c   | 1200 -
 NetworkPkg/Application/Ping6/Ping6.h   |   87 -
 NetworkPkg/Application/Ping6/Ping6.inf |   78 -
 NetworkPkg/Application/Ping6/Ping6.uni |   22 -
 NetworkPkg/Application/Ping6/Ping6Extra.uni|   20 -
 NetworkPkg/Application/Ping6/Ping6Strings.uni  |   53 -
 NetworkPkg/Application/Ping6/X64/Tsc.c |   28 -
 NetworkPkg/NetworkPkg.dsc  |3 -
 16 files changed, 3621 deletions(-)
 delete mode 100644 NetworkPkg/Application/IfConfig6/IfConfig6.c
 delete mode 100644 NetworkPkg/Application/IfConfig6/IfConfig6.h
 delete mode 100644 NetworkPkg/Application/IfConfig6/IfConfig6.inf
 delete mode 100644 NetworkPkg/Application/IfConfig6/IfConfig6.uni
 delete mode 100644 NetworkPkg/Application/IfConfig6/IfConfig6Extra.uni
 delete mode 100644 NetworkPkg/Application/IfConfig6/IfConfig6Strings.uni
 delete mode 100644 NetworkPkg/Application/Ping6/Ia32/Tsc.c
 delete mode 100644 NetworkPkg/Application/Ping6/Ipf/Itc.c
 delete mode 100644 NetworkPkg/Application/Ping6/Ping6.c
 delete mode 100644 NetworkPkg/Application/Ping6/Ping6.h
 delete mode 100644 NetworkPkg/Application/Ping6/Ping6.inf
 delete mode 100644 NetworkPkg/Application/Ping6/Ping6.uni
 delete mode 100644 NetworkPkg/Application/Ping6/Ping6Extra.uni
 delete mode 100644 NetworkPkg/Application/Ping6/Ping6Strings.uni
 delete mode 100644 NetworkPkg/Application/Ping6/X64/Tsc.c

diff --git a/NetworkPkg/Application/IfConfig6/IfConfig6.c 
b/NetworkPkg/Application/IfConfig6/IfConfig6.c
deleted file mode 100644
index 48c3be3552..00
--- a/NetworkPkg/Application/IfConfig6/IfConfig6.c
+++ /dev/null
@@ -1,1793 +0,0 @@
-/** @file
-  The implementation for Shell application IfConfig6.
-
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
-
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD 
License
-  which accompanies this distribution.  The full text of the license may be 
found at
-  http://opensource.org/licenses/bsd-license.php.
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include "IfConfig6.h"
-
-//
-// String token ID of ifconfig6 command help message text.
-//
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringIfconfig6HelpTokenId = 
STRING_TOKEN (STR_IFCONFIG6_HELP);
-
-EFI_HII_HANDLE  mHiiHandle;
-
-SHELL_PARAM_ITEMmIfConfig6CheckList[] = {
-  {
-L"-b",
-TypeFlag
-  },
-  {
-L"-s",
-TypeMaxValue
-  },
-  {
-L"-l",
-TypeValue
-  },
-  {
-L"-r",
-TypeValue
-  },
-  {
-NULL,
-TypeMax
-  },
-};
-
-VAR_CHECK_ITEM  mSetCheckList[] = {
-  {
-   L"auto",
-0x0001,
-0x0001,
-FlagTypeSingle
-  },
-  {
-L"man",
-0x0002,
-0x0001,
-FlagTypeSingle
-  },
-  {
-L"host",
-0x0004,
-0x0002,
-FlagTypeSingle
-  },
-  {
-L"dad",
-0x0008,
-0x0004,
-FlagTypeSingle
-  },
-  {
-L"gw",
-0x0010,
-0x0008,
-FlagTypeSingle
-  },
-  {
-L"dns",
-0x0020,
-0x0010,
-FlagTypeSingle
-  },
-  {
-L"id",
-0x0040,
-0x0020,
-FlagTypeSingle
-  },
-  {
-NULL,
-0x0,
-0x0,
-FlagTypeSkipUnknown
-  },
-};
-
-/**
-  Split a str

Re: [edk2] Different ISCSI behavior when 2 attempts are added

2017-10-09 Thread Ye, Ting
Yes, I agree that it is the implementation's choice. If you need Attempt 1 in 
Case 2&4, try to update "Enabled" to "Enabled for MPIO".

Thanks,
Ting Ye

From: Wu, Jiaxin
Sent: Tuesday, October 10, 2017 11:01 AM
To: Karunakar P <karunak...@amiindia.co.in>; 'edk2-devel@lists.01.org' 
<edk2-devel@lists.01.org>
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>
Subject: RE: Different ISCSI behavior when 2 attempts are added

Hi Karunakar,

I think it's not the bug according the current  iSCSI implementation that the 
first login session will be selected while others are aborted directly. Here, 
IP4 is the first login session.

I didn't find any state that the first attempt should be connected. Ting and 
Siyuan, If anything wrong, please correct me.

Thanks,
Jiaxin

From: Karunakar P [mailto:karunak...@amiindia.co.in]
Sent: Monday, October 9, 2017 10:52 PM
To: 'edk2-devel@lists.01.org' 
<edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>>
Cc: Wu, Jiaxin <jiaxin...@intel.com<mailto:jiaxin...@intel.com>>; Ye, Ting 
<ting...@intel.com<mailto:ting...@intel.com>>; Fu, Siyuan 
<siyuan...@intel.com<mailto:siyuan...@intel.com>>
Subject: Re: Different ISCSI behavior when 2 attempts are added

Hello All,

Found the below behavior when I try for ISCSI connection with 2 Valid attempts.

Case 1:
Attempt 1---Enabled(ISCSI Mode)---IP4Enabled(Initiator 
DHCP)---Disabled(Target DHCP)--->Valid Attempt
Attempt 2---Enabled(ISCSI Mode)---IP6Enabled(Initiator 
DHCP)---Disabled(Target DHCP)--->Valid Attempt
EDK2 RESULT:- Attempt1(IP4) connected and shown in shell ,Attempt2 tried but 
session does not exist

Case 2:
Attempt 1---Enabled(ISCSI Mode)---IP6Enabled(Initiator 
DHCP)---Disabled(Target DHCP)--->Valid Attempt
Attempt 2---Enabled(ISCSI Mode)---IP4Enabled(Initiator 
DHCP)---Disabled(Target DHCP)--->Valid Attempt
EDK2 RESULT:- Attempt2(IP4) connected and shown in shell ,Attempt1 tried but 
session does not exist

Case 3:
Attempt 1---Enabled(ISCSI Mode)---Autoconfigure --->Valid Attempt
Attempt 2---Enabled(ISCSI Mode)---IP6Enabled(Initiator 
DHCP)---Disabled(Target DHCP)--->Valid Attempt
EDK2 RESULT:- Attempt1(IP4) connected and shown in shell ,Attempt2 tried but 
session does not exist

Case 4:
Attempt 1---Enabled(ISCSI Mode)---IP6--->Valid Attempt
Attempt 2---Enabled(ISCSI Mode)---Autoconfigure Enabled(Initiator 
DHCP)---Disabled(Target DHCP)--->Valid Attempt
EDK2 RESULT:- Attempt2(IP4) connected and shown in shell ,Attempt1 tried but 
session does not exist



1.   Case1 & Case3 looks fine as 1st valid attempt connected

2.   But Case2 & Case4 looks bit different, 1St attempt was valid but 
connection success with 2nd attempt

3.   As we found that IScsiIp4 Driver Binding Start is getting call first 
and processing the IP4 attempt first even though it is 2nd attempt

Could you please comment on this whether this is a bug or Not?

Thanks,
Karunakar
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 0/2] Clarify the usage of HttpConfigData in HTTP protocol

2017-09-28 Thread Ye, Ting
Series Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Thursday, September 28, 2017 1:42 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch 0/2] Clarify the usage of HttpConfigData in HTTP protocol

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (2):
  MdePkg/Http.h: Clarify the usage of HttpConfigData in HTTP protocol
  NetworkPkg/HttpDxe: Clarify the usage of HttpConfigData in HTTP
protocol

 MdePkg/Include/Protocol/Http.h | 16 +---  
NetworkPkg/HttpDxe/HttpImpl.c  | 20 +++-  
NetworkPkg/HttpDxe/HttpImpl.h  | 18 ++
 3 files changed, 30 insertions(+), 24 deletions(-)

--
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] NetworkPkg/UefiPxeBcDxe: Fix the redundant condition check

2017-09-28 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Thursday, September 28, 2017 1:49 PM
To: edk2-devel@lists.01.org
Cc: Santhapur Naveen <nave...@amiindia.co.in>; Ye, Ting <ting...@intel.com>; 
Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/UefiPxeBcDxe: Fix the redundant condition check

Cc: Santhapur Naveen <nave...@amiindia.co.in>
Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c 
b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
index 568360d..9f5be15 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Support functions implementation for UefiPxeBc Driver.
 
-  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -422,11 +422,11 @@ PxeBcIcmp6ErrorDpcHandle (
 
   Type = *((UINT8 *) RxData->FragmentTable[0].FragmentBuffer);
 
   if (Type != ICMP_V6_DEST_UNREACHABLE &&
   Type != ICMP_V6_PACKET_TOO_BIG &&
-  Type != ICMP_V6_PACKET_TOO_BIG &&
+  Type != ICMP_V6_TIME_EXCEEDED &&
   Type != ICMP_V6_PARAMETER_PROBLEM) {
 //
 // The type of the receveid packet should be an ICMP6 error message.
 //
 gBS->SignalEvent (RxData->RecycleSignal);
-- 
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 v3 4/5] MdeModulePkg/DxeNetLib: Fix negative value left shift

2017-09-28 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Hao A 
Sent: Thursday, September 28, 2017 12:32 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a...@intel.com>; Shi, Steven <steven@intel.com>; Fu, 
Siyuan <siyuan...@intel.com>; Ye, Ting <ting...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>; Long, Qin <qin.l...@intel.com>; Zeng, Star 
<star.z...@intel.com>; Dong, Eric <eric.d...@intel.com>; Paolo Bonzini 
<pbonz...@redhat.com>
Subject: [PATCH v3 4/5] MdeModulePkg/DxeNetLib: Fix negative value left shift

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=698

Within function NetRandomInitSeed(), left shift a negative value is used
in:
"~Time.Hour << 24"

which involves undefined behavior.

Since Time.Hour is of type UINT8 (range from 0 to 23), hence ~Time.Hour will be 
a negative value (of type int, signed).

According to the C11 spec, Section 6.5.7:
> 4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
>   bits are filled with zeros. If E1 has an unsigned type, the value
>   of the result is E1 * 2^E2 , reduced modulo one more than the
>   maximum value representable in the result type. If E1 has a signed
>   type and nonnegative value, and E1 * 2^E2 is representable in the
>   result type, then that is the resulting value; otherwise, the
>   behavior is undefined.

This commit will remove the '~' operator before 'Time.Hour', since it seems 
like an implementation choice for generating the seed.

Cc: Steven Shi <steven@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Qin Long <qin.l...@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a...@intel.com>
---
 MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c 
b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index 7cd7e3aca0..1ee77fe036 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -872,7 +872,7 @@ NetRandomInitSeed (
   UINT64MonotonicCount;
 
   gRT->GetTime (, NULL);
-  Seed = (~Time.Hour << 24 | Time.Day << 16 | Time.Minute << 8 | Time.Second);
+  Seed = (Time.Hour << 24 | Time.Day << 16 | Time.Minute << 8 | 
+ Time.Second);
   Seed ^= Time.Nanosecond;
   Seed ^= Time.Year << 7;
 
--
2.12.0.windows.1

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


Re: [edk2] Linux CentOS 7.3 can get DHCP IPv4 IP address with configuring DHCP server as per RFC3021

2017-09-25 Thread Ye, Ting
Hi Karunakar,

May I ask whether the CentOS can get IP address from BIOS or from DHCP server? 
I am confused about your question.

Thanks,
Ting


From: Karunakar P [mailto:karunak...@amiindia.co.in]
Sent: Monday, September 25, 2017 3:02 PM
To: 'edk2-devel@lists.01.org' <edk2-devel@lists.01.org>
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Ye, 
Ting <ting...@intel.com>
Subject: Re: Linux CentOS 7.3 can get DHCP IPv4 IP address with configuring 
DHCP server as per RFC3021

Hello All,

It is known that current EDKII doesn't support RFC3021, We could see the 
following behavior which is PXE boot fails whereas Cent OS can get IP address 
from the same BIOS.


[Configuration Used]

DHCP server setting under Ubuntu:
1. /etc/dhcp/dhcpd.conf

# RFC3021-Using 31-bit perfixes on IPv4 Point-to-Point Links
subnet 192.168.1.0 netmask 255.255.255.254 {
range 192.168.1.1 192.168.1.1;
next-server 192.168.1.0;
filename "EFI/BOOT/BOOTAA64.EFI";
option subnet-mask 255.255.255.254;
option routers 192.168.1.0;
}

2. /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.0
netmask 255.255.255.254
network 192.168.1.0


If the DHCP server and network interface are set up above configuration. Below 
are my test results and questions


1.   CentOS  7.3 (pre-installed) was able to retrieve IP through DHCP when 
they connect HDD to the SUT where PXE is failing.

2.   Could you please suggest what could be the reason behind this?


Thanks,
karunakar
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v3] CryptoPkg: Add new API to retrieve commonName of X.509 certificate

2017-09-20 Thread Ye, Ting
Hi Qin,

I think we might add OPTIONAL attribute to CommonName, as NULL is an valid 
input for this API.
In function description, I think we need update below statement to "if *** and 
*CommonNameSize is 0."

 "If CommonName is not NULL and CommonNameSize is 0."

Others are good to me.

Reviewed-by: Ye Ting <ting...@intel.com>

Best Regards,
Ting

-Original Message-
From: Long, Qin 
Sent: Thursday, September 21, 2017 10:48 AM
To: ler...@redhat.com; Ye, Ting <ting...@intel.com>; Zhang, Chao B 
<chao.b.zh...@intel.com>
Cc: edk2-devel@lists.01.org
Subject: [PATCH v3] CryptoPkg: Add new API to retrieve commonName of X.509 
certificate

v3: Add extra CommonNameSize check since OpenSSL didn't check this
input parameter. (One openssl issue was filed to address this risk:
https://github.com/openssl/openssl/issues/4392)
v2: Update function interface to return RETURN_STATUS to represent
different error cases.

Add one new API (X509GetCommonName()) to retrieve the subject commonName string 
from one X.509 certificate.

Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Ting Ye <ting...@intel.com>
Cc: Chao Zhang <chao.b.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.l...@intel.com>
---
 CryptoPkg/Application/Cryptest/RsaVerify2.c|  32 --
 CryptoPkg/Include/Library/BaseCryptLib.h   |  35 +++
 CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c  | 109 +
 CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c  |  32 ++
 .../Pk/CryptX509Null.c |  34 ++-
 5 files changed, 234 insertions(+), 8 deletions(-)

diff --git a/CryptoPkg/Application/Cryptest/RsaVerify2.c 
b/CryptoPkg/Application/Cryptest/RsaVerify2.c
index 98b5aad900..9db43d6eef 100644
--- a/CryptoPkg/Application/Cryptest/RsaVerify2.c
+++ b/CryptoPkg/Application/Cryptest/RsaVerify2.c
@@ -204,13 +204,17 @@ ValidateCryptRsa2 (
   VOID
   )
 {
-  BOOLEAN  Status;
-  VOID *RsaPrivKey;
-  VOID *RsaPubKey;
-  UINT8*Signature;
-  UINTNSigSize;
-  UINT8*Subject;
-  UINTNSubjectSize;
+  BOOLEANStatus;
+  VOID   *RsaPrivKey;
+  VOID   *RsaPubKey;
+  UINT8  *Signature;
+  UINTN  SigSize;
+  UINT8  *Subject;
+  UINTN  SubjectSize;
+  RETURN_STATUS  ReturnStatus;
+  CHAR8  CommonName[64];
+  CHAR16 CommonNameUnicode[64];
+  UINTN  CommonNameSize;
 
   Print (L"\nUEFI-OpenSSL RSA Key Retrieving Testing: ");
 
@@ -286,6 +290,20 @@ ValidateCryptRsa2 (
 Print (L"[Pass]");
   }
 
+  //
+  // Get CommonName from X509 Certificate Subject  //  CommonNameSize = 
+ 64;  ZeroMem (CommonName, CommonNameSize);  ReturnStatus = 
+ X509GetCommonName (TestCert, sizeof (TestCert), CommonName, 
+ );  if (RETURN_ERROR (ReturnStatus)) {
+Print (L"\n  - Retrieving Common Name - [Fail]");
+return EFI_ABORTED;
+  } else {
+AsciiStrToUnicodeStrS (CommonName, CommonNameUnicode, CommonNameSize);
+Print (L"\n  - Retrieving Common Name = \"%s\" (Size = %d)", 
+ CommonNameUnicode, CommonNameSize);  }
+
   //
   // X509 Certificate Verification.
   //
diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h 
b/CryptoPkg/Include/Library/BaseCryptLib.h
index 9c5ffcd9cf..2366a0218d 100644
--- a/CryptoPkg/Include/Library/BaseCryptLib.h
+++ b/CryptoPkg/Include/Library/BaseCryptLib.h
@@ -2171,6 +2171,41 @@ X509GetSubjectName (
   IN OUT  UINTN*SubjectSize
   );
 
+/**
+  Retrieve the common name (CN) string from one X.509 certificate.
+
+  @param[in]  Cert Pointer to the DER-encoded X509 certificate.
+  @param[in]  CertSize Size of the X509 certificate in bytes.
+  @param[out] CommonName   Buffer to contain the retrieved certificate 
common
+   name string. At most CommonNameSize bytes 
will be
+   written and the string will be null 
terminated. May be
+   NULL in order to determine the size buffer 
needed.
+  @param[in,out]  CommonNameSize   The size in bytes of the CommonName buffer 
on input,
+   and the size of buffer returned CommonName 
on output.
+   If CommonName is NULL then the amount of 
space needed
+   in buffer (including the final null) is 
returned.
+
+  @retval RETURN_SUCCESS   The certificate CommonName retrieved 
successfully.
+  @retval RETURN_INVALID_PARAMETER If Cert is NULL.
+   If CommonNameSize is NULL.
+   If CommonName is not NULL and 
CommonNameSize is 0.
+   If Certificate is invalid.
+  @retval RETURN_NOT_FOUND If no CommonName entry exists.
+  @retval RETURN_BUFFER_TOO_SMAL

Re: [edk2] Check Ipv6 Support for ISCSI attempt page

2017-09-17 Thread Ye, Ting
Hi Karunakar,

Thanks for capturing this. We agree that it's reasonable to add similar check 
to HTTP and ISCSI. Could you please help to file a bugzilla tracker for this?

Thanks,
Ting Ye

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Karunakar P
Sent: Friday, September 15, 2017 5:37 PM
To: 'edk2-devel@lists.01.org' 
Subject: Re: [edk2] Check Ipv6 Support for ISCSI attempt page

Hello all,



We have a Broadcom NIC card which doesn't support IPv6 (Ipv6Supported flag is 
0).



1) But the HTTPv6 boot options are shown.

Unlike in PXE (PxeBcCheckIpv6Support()), the HTTP drivers in edk2 do not have a 
condition check whether the card supports IPv6 or not.



2) If the card doesn't support IPv6, then for ISCSI attempt page also, Internet 
Protocol should suppress IPv6



Could you please provide your comments on this?



Thank you

Karunakar

___
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 0/2] Fix bug in IP driver for IpSec protocol notify

2017-09-06 Thread Ye, Ting
Looks good to me. Series Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu Siyuan
Sent: Monday, September 4, 2017 4:07 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch 0/2] Fix bug in IP driver for IpSec protocol notify

Fu Siyuan (2):
  MdeModulePkg/Ip4Dxe: fix a bug in IP4 driver for IpSec protocol
notify.
  NetworkPkg/Ip6Dxe: fix a bug in IP6 driver for IpSec protocol notify.

 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 14 +++---  
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Input.c  | 10 ++
 NetworkPkg/Ip6Dxe/Ip6Driver.c | 18 --
 NetworkPkg/Ip6Dxe/Ip6Input.c  | 14 ++
 4 files changed, 27 insertions(+), 29 deletions(-)

--
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] RFC 3021-Using 31-bit prefixes on IPv4 Point-to-Point Links /31

2017-09-03 Thread Ye, Ting
Hi Naveen,

No, we don't support RFC3021 "using 31-bit prefixes on IPv4 Point-to-Point 
Links". 
I don't think there is any plan to implement this. Do you have real use case 
that need such feature?

Best Regards,
Ting Ye

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Thursday, August 31, 2017 6:42 PM
To: edk2-devel@lists.01.org
Subject: [edk2] RFC 3021-Using 31-bit prefixes on IPv4 Point-to-Point Links /31

Hello all,

Does EDK2 NetworkPkg support RFC 3021-Using 31-bit prefixes on IPv4 
Point-to-Point Links /31 for PXE boot?
I don't think it is. Please confirm.
If not, does edk2 has any plans to implements this?

Thank you
Naveen
___
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] iSCSI behavior

2017-08-30 Thread Ye, Ting
There is no such document available. It is an implementation choice only.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Wednesday, August 30, 2017 4:47 PM
To: Ye, Ting <ting...@intel.com>; edk2-devel@lists.01.org
Subject: Re: [edk2] iSCSI behavior

Hi Ting,

Thank you for your confirmation.
I would like to know if there are any specification document(s) available so 
that I can refer them on need.

Thank you
Naveen

-Original Message-
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Wednesday, August 30, 2017 1:30 PM
To: Santhapur Naveen; edk2-devel@lists.01.org
Subject: RE: iSCSI behavior

Hi Naveen,

For 1) Yes.
2) Yes, it is valid in current implementation.

Yes, IPv6 source address should be configured separately. It could be through 
manual or auto configuration.

Thanks,
Ting Ye

-Original Message-
From: Santhapur Naveen [mailto:nave...@amiindia.co.in] 
Sent: Tuesday, August 29, 2017 8:22 PM
To: Ye, Ting <ting...@intel.com>; edk2-devel@lists.01.org
Subject: RE: iSCSI behavior

Hi Ting,

Thanks for your reply. I got your point but my question(s) are
1) I agree that if I add two attempts for the same NIC, there will be a warning 
popup. But my question is whether the second attempt also be tried for 
connection if first attempt fails to connect?
2) Is it valid to add two attempts where both are 'Enable for MPIO' for the 
same NIC?

I'm not clear about IPv6, you mean to say we need to configure an IPv6 address 
apart from adding the Attempt?

Thank you
Naveen

-Original Message-----
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Tuesday, August 29, 2017 2:01 PM
To: Santhapur Naveen; edk2-devel@lists.01.org
Subject: RE: iSCSI behavior

Hi Naveen,

For 1), if you configure two attempts with iSCSI Mode "Enabled", you will 
receive an warning that you have configured two attempts using same NIC. 
If you configure two attempts with iSCSI Mode "Enabled for MPIO", it is valid, 
and if the first attempt failed, the second attempt will be tried.

For 2), Enabled for MPIO means you have enabled multi path I/O in iSCSI for 
supporting failover.

For 3 and 4), iSCSI does not allow configuring one new IPv6 address using iSCSI 
menu so Attempt #1 does not show initiator address.
Instead, iSCSI driver will let IPv6 driver to perform source address selection 
according to the configured iSCSI target IP address. You need assign IPv6 
source address using ifconfig6 or autoconfiguration before using iSCSI on IPv6 
stack.

Thanks,
Ting Ye


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Tuesday, August 29, 2017 2:46 PM
To: edk2-devel@lists.01.org
Subject: [edk2] iSCSI behavior

Hello all,

I've some questions regarding iSCSI. Please help me out.


1.   If I have added two attempts and are enabled for the same MAC, if the 
first attempt fails to connect, will the second attempt be tried?

2.   If answer to the above is YES, then what's the difference between 
ISCSI Modes 'Enabled' and 'Enable for MPIO'?

3.   In our observation, we've found that the behavior is not same when two 
attempts are added for IPv4 and IPv6.

4.   Are there any standard set of test procedures for ISCSI behavior?

The following is the conflict
Case 1:
Attempt#1--Enabled for MPIO--IPv6-DHCP Attempt#2--Enabled for 
MPIO--IPv6-DHCP

Actual behavior: Attempt#2 doesn't show any initiator IPv6 address.

Case 2:
Attempt 1--Enabled for MPIO--IPv4-DHCP Attempt 2--Enabled for 
MPIO--IPv4-DHCP

Actual behavior: Attempt#2 shows Initiator IPv4 address.

Please provide your suggestions.

Thank you
Naveen
___
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
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] iSCSI behavior

2017-08-30 Thread Ye, Ting
Hi Naveen,

For 1) Yes.
2) Yes, it is valid in current implementation.

Yes, IPv6 source address should be configured separately. It could be through 
manual or auto configuration.

Thanks,
Ting Ye

-Original Message-
From: Santhapur Naveen [mailto:nave...@amiindia.co.in] 
Sent: Tuesday, August 29, 2017 8:22 PM
To: Ye, Ting <ting...@intel.com>; edk2-devel@lists.01.org
Subject: RE: iSCSI behavior

Hi Ting,

Thanks for your reply. I got your point but my question(s) are
1) I agree that if I add two attempts for the same NIC, there will be a warning 
popup. But my question is whether the second attempt also be tried for 
connection if first attempt fails to connect?
2) Is it valid to add two attempts where both are 'Enable for MPIO' for the 
same NIC?

I'm not clear about IPv6, you mean to say we need to configure an IPv6 address 
apart from adding the Attempt?

Thank you
Naveen

-Original Message-
From: Ye, Ting [mailto:ting...@intel.com] 
Sent: Tuesday, August 29, 2017 2:01 PM
To: Santhapur Naveen; edk2-devel@lists.01.org
Subject: RE: iSCSI behavior

Hi Naveen,

For 1), if you configure two attempts with iSCSI Mode "Enabled", you will 
receive an warning that you have configured two attempts using same NIC. 
If you configure two attempts with iSCSI Mode "Enabled for MPIO", it is valid, 
and if the first attempt failed, the second attempt will be tried.

For 2), Enabled for MPIO means you have enabled multi path I/O in iSCSI for 
supporting failover.

For 3 and 4), iSCSI does not allow configuring one new IPv6 address using iSCSI 
menu so Attempt #1 does not show initiator address.
Instead, iSCSI driver will let IPv6 driver to perform source address selection 
according to the configured iSCSI target IP address. You need assign IPv6 
source address using ifconfig6 or autoconfiguration before using iSCSI on IPv6 
stack.

Thanks,
Ting Ye


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Tuesday, August 29, 2017 2:46 PM
To: edk2-devel@lists.01.org
Subject: [edk2] iSCSI behavior

Hello all,

I've some questions regarding iSCSI. Please help me out.


1.   If I have added two attempts and are enabled for the same MAC, if the 
first attempt fails to connect, will the second attempt be tried?

2.   If answer to the above is YES, then what's the difference between 
ISCSI Modes 'Enabled' and 'Enable for MPIO'?

3.   In our observation, we've found that the behavior is not same when two 
attempts are added for IPv4 and IPv6.

4.   Are there any standard set of test procedures for ISCSI behavior?

The following is the conflict
Case 1:
Attempt#1--Enabled for MPIO--IPv6-DHCP Attempt#2--Enabled for 
MPIO--IPv6-DHCP

Actual behavior: Attempt#2 doesn't show any initiator IPv6 address.

Case 2:
Attempt 1--Enabled for MPIO--IPv4-DHCP Attempt 2--Enabled for 
MPIO--IPv4-DHCP

Actual behavior: Attempt#2 shows Initiator IPv4 address.

Please provide your suggestions.

Thank you
Naveen
___
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] iSCSI behavior

2017-08-29 Thread Ye, Ting
Hi Naveen,

For 1), if you configure two attempts with iSCSI Mode "Enabled", you will 
receive an warning that you have configured two attempts using same NIC. 
If you configure two attempts with iSCSI Mode "Enabled for MPIO", it is valid, 
and if the first attempt failed, the second attempt will be tried.

For 2), Enabled for MPIO means you have enabled multi path I/O in iSCSI for 
supporting failover.

For 3 and 4), iSCSI does not allow configuring one new IPv6 address using iSCSI 
menu so Attempt #1 does not show initiator address.
Instead, iSCSI driver will let IPv6 driver to perform source address selection 
according to the configured iSCSI target IP address. You need assign IPv6 
source address using ifconfig6 or autoconfiguration before using iSCSI on IPv6 
stack.

Thanks,
Ting Ye


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Tuesday, August 29, 2017 2:46 PM
To: edk2-devel@lists.01.org
Subject: [edk2] iSCSI behavior

Hello all,

I've some questions regarding iSCSI. Please help me out.


1.   If I have added two attempts and are enabled for the same MAC, if the 
first attempt fails to connect, will the second attempt be tried?

2.   If answer to the above is YES, then what's the difference between 
ISCSI Modes 'Enabled' and 'Enable for MPIO'?

3.   In our observation, we've found that the behavior is not same when two 
attempts are added for IPv4 and IPv6.

4.   Are there any standard set of test procedures for ISCSI behavior?

The following is the conflict
Case 1:
Attempt#1--Enabled for MPIO--IPv6-DHCP Attempt#2--Enabled for 
MPIO--IPv6-DHCP

Actual behavior: Attempt#2 doesn't show any initiator IPv6 address.

Case 2:
Attempt 1--Enabled for MPIO--IPv4-DHCP Attempt 2--Enabled for 
MPIO--IPv4-DHCP

Actual behavior: Attempt#2 shows Initiator IPv4 address.

Please provide your suggestions.

Thank you
Naveen
___
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] Iscsi Specification Document

2017-08-23 Thread Ye, Ting
UEFI iSCSI is RFC3720 compatible. It is not updated yet.

Thanks,
Ting Ye

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Blibbet
Sent: Thursday, August 24, 2017 5:23 AM
To: edk2-devel@lists.01.org
Subject: Re: [edk2] Iscsi Specification Document

On 08/23/2017 02:04 AM, Karunakar P wrote:
> Do we have any specific Document for Iscsi?
> Any document that describes the standard iscsi behavior.

I'm not aware of any 'design specification', that may be hoping for too much.

http://uefi.org/uefi points to 4 [i]SCSI-related URLs:

[RFC 3720] Internet Small Computer Systems Interface (iSCSI)

[RFC 4173] Bootstrapping Clients using the Internet Small Computer System 
Interface (iSCSI) Protocol

iSCSI Boot Firmware Table (iBFT)
http://www.microsoft.com/whdc/system/platform/firmware/ibft.mspx

SCSI Block Commands:
 http://www.t10.org

However this may be the best doc for UEFI iSCSI:
https://github.com/tianocore/edk2/search?utf8=%E2%9C%93=iscsi=

BTW, iSCSI is up to RFC 7143 these years, RFC 3720 is now OBSOLETE. I wonder if 
UEFI's iSCSI is RFC 7143-compatiable?
https://tools.ietf.org/html/rfc7143

HTH,
Thanks,
Lee Fisher
___
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] NetworkPkg/Ip6Dxe: Fix the bug when checking the DataSize

2017-08-16 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Wednesday, August 16, 2017 2:19 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/Ip6Dxe: Fix the bug when checking the DataSize

During setting the DnsServer, the DataSize check is incorrect.
This patch is to fix the issue.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c 
b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
index 61418e2..f4b9374 100644
--- a/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
+++ b/NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c
@@ -1464,11 +1464,11 @@ Ip6ConfigSetDnsServer (
   OldDns = NULL;
   NewDns = NULL;
   Item   = NULL;
   Tmp= NULL;
 
-  if ((DataSize == 0) && (DataSize % sizeof (EFI_IPv6_ADDRESS) != 0)) {
+  if ((DataSize != 0) && (DataSize % sizeof (EFI_IPv6_ADDRESS) != 0)) {
 return EFI_BAD_BUFFER_SIZE;
   }
 
   if (Instance->Policy != Ip6ConfigPolicyManual) {
 return EFI_WRITE_PROTECTED;
-- 
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 v3][Patch 2/4] MdePkg/UefiDevicePathLib: Add DevPathFromTextDns and DevPathToTextDns libraries

2017-08-13 Thread Ye, Ting
Hi Jiaxin,

Shall we check the return value of CreateDeviceNode in DevPathFromTextDns to 
make sure we don't use NULL pointer? 
I see many internal functions DevPathFromText** in DevicePathFromText.c NOT 
check this. Any particular reason we don't need this?

Thanks,
Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Thursday, August 03, 2017 8:20 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [PATCH v3][Patch 2/4] MdePkg/UefiDevicePathLib: Add DevPathFromTextDns 
and DevPathToTextDns libraries

V3:
* Fix the bug in DevPathFromTextDns()

V2:
* Add no IP instance case check.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
Reviewed-by: Fu Siyuan <siyuan...@intel.com>
---
 .../Library/UefiDevicePathLib/DevicePathFromText.c | 90 ++
 .../Library/UefiDevicePathLib/DevicePathToText.c   | 46 +++
 2 files changed, 136 insertions(+)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index f50c11c..0fb703b 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -2723,10 +2723,99 @@ DevPathFromTextBluetoothLE (
 );
   return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp;  }
 
 /**
+  Converts a text device path node to DNS device path structure.
+
+  @param TextDeviceNode  The input Text device path node.
+
+  @return A pointer to the newly-created DNS device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextDns (
+  IN CHAR16 *TextDeviceNode
+  )
+{
+  CHAR16*DeviceNodeStr;
+  CHAR16*DeviceNodeStrPtr;
+  UINT32DnsServerIpCount;
+  UINT16DnsDeviceNodeLength;
+  DNS_DEVICE_PATH   *DnsDeviceNode;
+  UINT32DnsServerIpIndex;
+  CHAR16*DnsServerIp;
+
+
+  //
+  // Count the DNS server address number.
+  //
+  DeviceNodeStr = UefiDevicePathLibStrDuplicate (TextDeviceNode);  if 
+ (DeviceNodeStr == NULL) {
+return NULL;
+  }
+
+  DeviceNodeStrPtr = DeviceNodeStr;
+  
+  DnsServerIpCount = 0;
+  while (DeviceNodeStrPtr != NULL && *DeviceNodeStrPtr != L'\0') {
+GetNextParamStr ();
+DnsServerIpCount ++;
+  }
+
+  FreePool (DeviceNodeStr);
+  DeviceNodeStr = NULL;
+
+  //
+  // One or more instances of the DNS server address in EFI_IP_ADDRESS,  
+ // otherwise, NULL will be returned.
+  //
+  if (DnsServerIpCount == 0) {
+return NULL;
+  }
+
+  //
+  // Create the DNS DeviceNode.
+  //
+  DnsDeviceNodeLength = (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof 
(UINT8) + DnsServerIpCount * sizeof (EFI_IP_ADDRESS));
+  DnsDeviceNode   = (DNS_DEVICE_PATH *) CreateDeviceNode (
+  MESSAGING_DEVICE_PATH,
+  MSG_DNS_DP,
+  DnsDeviceNodeLength
+  );
+
+  //
+  // Confirm the DNS server address is IPv4 or IPv6 type.
+  //
+  DeviceNodeStrPtr = TextDeviceNode;
+  while (!IS_NULL (*DeviceNodeStrPtr)) {
+if (*DeviceNodeStrPtr == L'.') {
+  DnsDeviceNode->IsIPv6 = 0x00;
+  break;
+}
+
+if (*DeviceNodeStrPtr == L':') {
+  DnsDeviceNode->IsIPv6 = 0x01;
+  break;
+}
+
+DeviceNodeStrPtr++;
+  }
+
+  for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; 
DnsServerIpIndex++) {
+DnsServerIp = GetNextParamStr ();
+if (DnsDeviceNode->IsIPv6 == 0x00) {
+  StrToIpv4Address (DnsServerIp,  NULL, 
&(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v4), NULL);
+} else {
+  StrToIpv6Address (DnsServerIp, NULL, 
&(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v6), NULL);
+}
+  }
+  
+  return (EFI_DEVICE_PATH_PROTOCOL *) DnsDeviceNode; }
+
+/**
   Converts a text device path node to URI device path structure.
 
   @param TextDeviceNode  The input Text device path node.
 
   @return A pointer to the newly-created URI device path structure.
@@ -3395,10 +3484,11 @@ GLOBAL_REMOVE_IF_UNREFERENCED 
DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
   {L"UsbTestAndMeasurement",   DevPathFromTextUsbTestAndMeasurement   },
   {L"UsbWwid", DevPathFromTextUsbWwid },
   {L"Unit",DevPathFromTextUnit},
   {L"iSCSI",   DevPathFromTextiSCSI   },
   {L"Vlan",DevPathFromTextVlan},
+  {L"Dns", DevPathFromTextDns },
   {L"Uri", DevPathFromTextUri },
   {L"Bluetoot

Re: [edk2] [Patch v2] NetworkPkg/HttpDxe: Handle the HttpVersionUnsupported in the HttpConfigData

2017-08-11 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Friday, August 11, 2017 9:13 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Jin, Eric <eric@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch v2] NetworkPkg/HttpDxe: Handle the HttpVersionUnsupported in 
the HttpConfigData

v2:
* Refine the patch by changing the '==' to '>='.

Cc: Ye Ting <ting...@intel.com>
Cc: Jin Eric <eric@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index e0fecac..c104b61 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -149,10 +149,14 @@ EfiHttpConfigure (
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
   ASSERT (HttpInstance != NULL && HttpInstance->Service != NULL);
 
   if (HttpConfigData != NULL) {
 
+if (HttpConfigData->HttpVersion >= HttpVersionUnsupported) {
+  return EFI_UNSUPPORTED;
+}
+
 //
 // Now configure this HTTP instance.
 //
 if (HttpInstance->State != HTTP_STATE_UNCONFIGED) {
   return EFI_ALREADY_STARTED;
--
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] NetworkPkg/HttpBootDxe: Refine the coding style.

2017-08-10 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, August 08, 2017 3:25 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Bi, Dandan <dandan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/HttpBootDxe: Refine the coding style.

Cc: Ye Ting <ting...@intel.com>
Cc: Bi Dandan <dandan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootSupport.c | 2 +-  
NetworkPkg/HttpBootDxe/HttpBootSupport.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index 4e78cf3..d508e2c 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -1329,11 +1329,11 @@ HttpBootRegisterRamDisk (
 
 **/
 BOOLEAN
 HttpBootIsHttpRedirectStatusCode (
   IN   EFI_HTTP_STATUS_CODEStatusCode
- )
+  )
 {
   if (StatusCode == HTTP_STATUS_301_MOVED_PERMANENTLY ||
   StatusCode == HTTP_STATUS_302_FOUND ||
   StatusCode == HTTP_STATUS_307_TEMPORARY_REDIRECT ||
   StatusCode == HTTP_STATUS_308_PERMANENT_REDIRECT) { diff --git 
a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index c10b2cf..9b7acd9 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
@@ -455,7 +455,7 @@ HttpBootRegisterRamDisk (
 
 **/
 BOOLEAN
 HttpBootIsHttpRedirectStatusCode (
   IN   EFI_HTTP_STATUS_CODEStatusCode
- );
+  );
 #endif
--
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 0/3] Support Ip4Config2/Ip6Config.SetData interface to clear specific configuration

2017-08-10 Thread Ye, Ting
Series Reviewed-by: Ye Ting <ting...@intel.com>


-Original Message-
From: Wu, Jiaxin 
Sent: Wednesday, July 26, 2017 2:28 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch 0/3] Support Ip4Config2/Ip6Config.SetData interface to clear 
specific configuration

UEFI Spec 2.7 adds the clarification on SetData interface usage to clear 
specific individual data types. The series patches are used to support this 
feature.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (3):
  MdePkg: Update the comments of Ip4Config2/Ip6Config Protocol
  MdeModulePkg/Ip4Dxe: Support SetData interface to clear specific
configuration
  NetworkPkg/Ip6Dxe: Support SetData interface to clear specific
configuration

 .../Universal/Network/Ip4Dxe/Ip4Config2Impl.c  | 285 ++---
 MdePkg/Include/Protocol/Ip4Config2.h   |  17 +-
 MdePkg/Include/Protocol/Ip6Config.h|  15 +-
 NetworkPkg/Ip6Dxe/Ip6ConfigImpl.c  | 692 -
 4 files changed, 610 insertions(+), 399 deletions(-)

--
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] NetworkPkg/HttpDxe: Support HTTP Patch method

2017-08-03 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Wednesday, August 02, 2017 4:01 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/HttpDxe: Support HTTP Patch method

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index 8a9e573..e0fecac 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -274,14 +274,15 @@ EfiHttpRequest (
   }
 
   Request = HttpMsg->Data.Request;
 
   //
-  // Only support GET, HEAD, PUT and POST method in current implementation.
+  // Only support GET, HEAD, PATCH, PUT and POST method in current 
implementation.
   //
   if ((Request != NULL) && (Request->Method != HttpMethodGet) &&
-  (Request->Method != HttpMethodHead) && (Request->Method != 
HttpMethodPut) && (Request->Method != HttpMethodPost)) {
+  (Request->Method != HttpMethodHead) && (Request->Method != 
HttpMethodPut) && 
+  (Request->Method != HttpMethodPost) && (Request->Method != 
+ HttpMethodPatch)) {
 return EFI_UNSUPPORTED;
   }
 
   HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (This);
   ASSERT (HttpInstance != NULL);
@@ -297,18 +298,20 @@ EfiHttpRequest (
 return EFI_NOT_STARTED;
   }
 
   if (Request == NULL) {
 //
-// Request would be NULL only for PUT/POST operation (in the current 
implementation)
+// Request would be NULL only for PUT/POST/PATCH operation (in the 
+ current implementation)
 //
-if ((HttpInstance->Method != HttpMethodPut) && (HttpInstance->Method != 
HttpMethodPost)) {
+if ((HttpInstance->Method != HttpMethodPut) && 
+(HttpInstance->Method != HttpMethodPost) && 
+(HttpInstance->Method != HttpMethodPatch)) {
   return EFI_INVALID_PARAMETER;
 }
 
 //
-// For PUT/POST, we need to have the TCP already configured. Bail out if 
it is not!
+// For PUT/POST/PATCH, we need to have the TCP already configured. Bail 
out if it is not!
 //
 if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED) {
   return EFI_INVALID_PARAMETER;
 }
 
@@ -615,11 +618,11 @@ EfiHttpRequest (
 
   ASSERT (RequestMsg != NULL);
 
   //
   // Every request we insert a TxToken and a response call would remove the 
TxToken.
-  // In cases of PUT/POST, after an initial request-response pair, we would do 
a
+  // In cases of PUT/POST/PATCH, after an initial request-response 
+ pair, we would do a
   // continuous request without a response call. So, in such cases, where 
Request
   // structure is NULL, we would not insert a TxToken.
   //
   if (Request != NULL) {
 Status = NetMapInsertTail (>TxTokens, Token, Wrap); @@ 
-,11 +1114,11 @@ HttpResponseWorker (
 
 Status = EFI_NOT_READY;
 ValueInItem = NULL;
 
 //
-// In cases of PUT/POST, after an initial request-response pair, we would 
do a
+// In cases of PUT/POST/PATCH, after an initial request-response 
+ pair, we would do a
 // continuous request without a response call. So, we would not do an 
insert of
 // TxToken. After we have sent the complete file, we will call a response 
to get
 // a final response from server. In such a case, we would not have any 
TxTokens.
 // Hence, check that case before doing a NetMapRemoveHead.
 //
--
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] NetworkPkg: iSCSI should allow to set 6 or 12 length of ISID keyword.

2017-08-03 Thread Ye, Ting
Hi Siyuan,

I would suggest to add more info to below error message, such as below:

Error! Only last 3 bytes are configurable, please input 6  hex numbers for last 
3 bytes only or 12 hex numbers for full SSID!

+  L"Error! Only last 3 bytes are configurable, please input 6 or 12 hex 
numbers!\n"

Others are good to me.

Reviewed-by: Ye Ting <ting...@intel.com> 

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Fu Siyuan
Sent: Thursday, August 03, 2017 2:41 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [edk2] [Patch] NetworkPkg: iSCSI should allow to set 6 or 12 length of 
ISID keyword.

The last 3 bytes of ISID should be able to changed by setting the keyword with 
a value with length 6 (only last 3 bytes) or 12 (full ISID) according to the 
keyword definition in UEFI configuration namespace website.

Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiConfig.c  | 8 ++--
 NetworkPkg/IScsiDxe/IScsiConfigStrings.uni | 1 +
 NetworkPkg/IScsiDxe/IScsiMisc.c| 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index a588403..4bc9b8f 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -205,11 +205,11 @@ IScsiParseIsIdFromString (
 
   IsIdStr = (CHAR16 *) String;
 
-  if (StrLen (IsIdStr) != 6) {
+  if (StrLen (IsIdStr) != 6 && StrLen (IsIdStr) != 12) {
 UnicodeSPrint (
   PortString,
   (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
-  L"Error! Input is incorrect, please input 6 hex numbers!\n"
+  L"Error! Only last 3 bytes are configurable, please input 6 or 12 hex 
numbers!\n"
   );
 
 CreatePopUp (
@@ -222,6 +222,10 @@ IScsiParseIsIdFromString (
 return EFI_INVALID_PARAMETER;
   }
 
+  if (StrLen (IsIdStr) == 12) {
+IsIdStr += 6;
+  }
+
   for (Index = 3; Index < 6; Index++) {
 CopyMem (TempStr, IsIdStr, sizeof (TempStr));
 TempStr[2] = L'\0';
diff --git a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni 
b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
index 7952258..10583f8 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
+++ b/NetworkPkg/IScsiDxe/IScsiConfigStrings.uni
@@ -99,3 +99,4 @@
 #language x-UEFI-ns 
"iSCSIDisplayAttemptList"
 #string STR_ISCSI_ATTEMPT_ORDER #language en-US "New Attempt Order"
 #language x-UEFI-ns "iSCSIAttemptOrder"
+#string STR_ISCSI_ISID_HELP #language en-US "The iSCSI ISID. 
Default value are derived from MAC address. Only last 3 bytes are configurable."
diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c 
index 2c93590..e20fe91 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -952,7 +952,7 @@ IScsiCreateKeywords (
   CONFIGURATION_VARSTORE_ID,
   (UINT16) (ATTEMPT_ISID_VAR_OFFSET + sizeof (KEYWORD_STR) * (Index - 1)),
   StringToken,
-  StringToken,
+  STRING_TOKEN (STR_ISCSI_ISID_HELP),
   0,
   0,
   ISID_CONFIGURABLE_MIN_LEN,
--
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] NetworkPkg: Display HTTP redirection info to the screen if need.

2017-08-03 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Thursday, July 27, 2017 11:44 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch] NetworkPkg: Display HTTP redirection info to the screen if 
need.

HTTP defines a set of status code for redirecting a request to a different URI 
in Section 6.4 of RFC7231 and also RFC7583. This patch updates the HTTP boot 
driver to display the redirection info to the screen so the user would have 
chance to know new URI address of the HTTP boot image.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootDxe.h |  4 
 NetworkPkg/HttpBootDxe/HttpBootImpl.c| 21 -
 NetworkPkg/HttpBootDxe/HttpBootSupport.c | 25 -  
NetworkPkg/HttpBootDxe/HttpBootSupport.h | 13 +
 4 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.h 
b/NetworkPkg/HttpBootDxe/HttpBootDxe.h
index 8d89b3e..4632ee2 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDxe.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.h
@@ -179,6 +179,10 @@ struct _HTTP_BOOT_PRIVATE_DATA {
   UINT32Id;
   EFI_HTTP_BOOT_CALLBACK_PROTOCOL   *HttpBootCallback;
   EFI_HTTP_BOOT_CALLBACK_PROTOCOL   LoadFileCallback;
+
+  //
+  // Data for the default HTTP Boot callback protocol  //
   UINT64FileSize;
   UINT64ReceivedSize;
   UINT32Percentage;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 63cf396..5cfb0f4 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -1,7 +1,7 @@
 /** @file
   The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.
 
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP  This program 
and the accompanying materials are licensed and made available under  the terms 
and conditions of the BSD License that accompanies this distribution.  
@@ -665,6 +665,25 @@ HttpBootCallback (
   case HttpBootHttpResponse:
 if (Data != NULL) {
   HttpMessage = (EFI_HTTP_MESSAGE *) Data;
+  
+  if (HttpMessage->Data.Response != NULL) {
+if (HttpBootIsHttpRedirectStatusCode 
(HttpMessage->Data.Response->StatusCode)) {
+  //
+  // Server indicates the resource has been redirected to a different 
URL
+  // according to the section 6.4 of RFC7231 and the RFC 7538.
+  // Display the redirect information on the screen.
+  //
+  HttpHeader = HttpFindHeader (
+ HttpMessage->HeaderCount,
+ HttpMessage->Headers,
+ HTTP_HEADER_LOCATION
+ );
+  if (HttpHeader != NULL) {
+Print (L"\n  HTTP ERROR: Resource Redirected.\n  New Location: 
%a\n", HttpHeader->FieldValue);
+  }
+}
+  }
+  
   HttpHeader = HttpFindHeader (
  HttpMessage->HeaderCount,
  HttpMessage->Headers, diff --git 
a/NetworkPkg/HttpBootDxe/HttpBootSupport.c 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
index 5024f2e..6d4edfc 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c
@@ -1034,7 +1034,8 @@ HttpIoRecvResponse (
 HttpIo->IsRxDone = FALSE;
   }
 
-  if (!EFI_ERROR (HttpIo->RspToken.Status) && HttpIo->Callback != NULL) {
+  if ((HttpIo->Callback != NULL) && 
+  (HttpIo->RspToken.Status == EFI_SUCCESS || 
+ HttpIo->RspToken.Status == EFI_HTTP_ERROR)) {
 Status = HttpIo->Callback (
HttpIoResponse,
HttpIo->RspToken.Message, @@ -1319,3 +1320,25 @@ 
HttpBootRegisterRamDisk (
   return Status;
 }
 
+/**
+  Indicate if the HTTP status code indicates a redirection.
+  
+  @param[in]  StatusCode  HTTP status code from server.
+
+  @return TRUE if it's redirection.
+
+**/
+BOOLEAN
+HttpBootIsHttpRedirectStatusCode (
+  IN   EFI_HTTP_STATUS_CODEStatusCode
+ )
+{
+  if (StatusCode == HTTP_STATUS_301_MOVED_PERMANENTLY ||
+  StatusCode == HTTP_STATUS_302_FOUND ||
+  StatusCode == HTTP_STATUS_307_TEMPORARY_REDIRECT ||
+  StatusCode == HTTP_STATUS_308_PERMANENT_REDIRECT) {
+return TRUE;
+  }
+
+  return FALSE;
+}
diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h 
b/NetworkPkg/HttpBootDxe/HttpBootSupport.h
index f2b1846..c10b2cf 100644
--- a/NetworkPkg/HttpBootDxe

Re: [edk2] [Patch 0/3] Fix spelling typo in EFI_HTTP_STATUS_CODE

2017-07-26 Thread Ye, Ting
Series Reviewed-by: Ye Ting <ting...@intel.com>

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, July 25, 2017 9:12 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch 0/3] Fix spelling typo in EFI_HTTP_STATUS_CODE

"HTTP_STATUS_300_MULTIPLE_CHIOCES"
This should instead be:
"HTTP_STATUS_300_MULTIPLE_CHOICES"

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>

Jiaxin Wu (3):
  MdePkg/Http.h: Fix spelling typo in EFI_HTTP_STATUS_CODE
  MdeModulePkg/DxeHttpLib: Fix spelling typo in EFI_HTTP_STATUS_CODE
  NetworkPkg/HttpBootDxe: Fix spelling typo in EFI_HTTP_STATUS_CODE

 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 2 +-
 MdePkg/Include/Protocol/Http.h   | 2 +-
 NetworkPkg/HttpBootDxe/HttpBootSupport.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
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: Add UEFI 2.7 defined GUID and structure for KMS protocol.

2017-07-19 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Wednesday, July 19, 2017 2:25 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch] MdePkg: Add UEFI 2.7 defined GUID and structure for KMS 
protocol.

Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 MdePkg/Include/Protocol/Kms.h | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Protocol/Kms.h b/MdePkg/Include/Protocol/Kms.h 
index da27096..1d2dcc6 100644
--- a/MdePkg/Include/Protocol/Kms.h
+++ b/MdePkg/Include/Protocol/Kms.h
@@ -8,7 +8,7 @@
   server over the network, or to a Hardware Security Module (HSM) attached to 
the system it
   runs on, or anything else that is capable of providing the key management 
service.
 
-  Copyright (c) 2011, Intel Corporation. All rights reserved.
+  Copyright (c) 2011 - 2017, Intel Corporation. All rights 
+ reserved.
   This program and the accompanying materials are licensed and made available 
under
   the terms and conditions of the BSD License that accompanies this 
distribution.
   The full text of the license may be found at @@ -80,6 +80,10 @@ typedef 
struct _EFI_KMS_PROTOCOL EFI_KMS_PROTOCOL;
   { \
 0xb9237513, 0x6c44, 0x4411, {0xa9, 0x90, 0x21, 0xe5, 0x56, 0xe0, 0x5a, 
0xde } \
   }
+#define EFI_KMS_FORMAT_GENERIC_DYNAMIC_GUID \
+  { \
+0x2156e996, 0x66de, 0x4b27, {0x9c, 0xc9, 0xb0, 0x9f, 0xac, 0x4d, 
+0x2, 0xbe } \
+  }
 ///@}
 
 ///
@@ -177,6 +181,17 @@ typedef struct _EFI_KMS_PROTOCOL EFI_KMS_PROTOCOL;
 
 typedef struct {
   ///
+  /// Length in bytes of the KeyData.
+  ///
+  UINT32KeySize;
+  ///
+  /// The data of the key.
+  ///
+  UINT8 KeyData[1];
+} EFI_KMS_FORMAT_GENERIC_DYNAMIC;
+
+typedef struct {
+  ///
   /// The size in bytes for the client identifier.
   ///
   UINT16ClientIdSize;
--
1.9.5.msysgit.1

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


Re: [edk2] iSCSI Setup in Linux

2017-07-07 Thread Ye, Ting
Hi Naveen,

May I know which Linux OS are you using to run iSCSI target? I think there are 
different iSCSI targets available in Linux.

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Thursday, July 06, 2017 4:45 PM
To: edk2-devel@lists.01.org
Subject: [edk2] iSCSI Setup in Linux

Hi all,

Is there any document explaining the iscsi target configuration in linux OSes.
I've googled and most of the links are not working for me.
Is there's any open document available, would someone point me the url?

Thank you
Naveen
___
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] IPv6 Stateless autoconfiguration

2017-06-30 Thread Ye, Ting
Hi Naveen,

Yes, EDKII supports IPv6 stateless address autoconfiguration defined in 
RFC4862.  It includes two parts:
- generating link-local address
- generating global address via stateless address autoconfiguration.

The later part requires an IPv6 router to send Router Advertisement with valid 
prefix information options periodically to UEFI client.

In EDKII, we can't assume that the network environment has an IPv6 router 
correctly configured and an IPv6 stateless address is available. 
And both HTTP boot and PXE boot over IPv6 stack defined in UEFI spec include a 
step that getting IPv6 address and other DHCP options from DHCP server.
So, current implementation gets IPv6 address from DHCPv6 service.

Thanks,
Ting 


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Friday, June 30, 2017 1:46 PM
To: edk2-devel@lists.01.org
Subject: [edk2] IPv6 Stateless autoconfiguration

Hello all,

I have some queries for which the answers are needed from the experts here. 
Please help in answering them.

Does edk2 support IPv6 stateless address autoconfiguration as mentioned in 
RFC4862.
If yes, then why do we have to configure the dhcpv6 service in such a way that 
it provides IPv6 address also for HTTPv6/PXEv6 boot?

Thank you
Naveen
___
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] NetworkPkg: Fix GCC build issue.

2017-06-22 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Friday, June 23, 2017 9:00 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch] NetworkPkg: Fix GCC build issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootImpl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c 
b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 56f5babeb4..63cf3960a9 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -630,6 +630,7 @@ EFI_LOAD_FILE_PROTOCOL  gHttpBootDxeLoadFile = {
   @retval EFI_ABORTED Tells the HTTP Boot driver to abort the 
current HTTP Boot process.
 **/
 EFI_STATUS
+EFIAPI
 HttpBootCallback (
   IN EFI_HTTP_BOOT_CALLBACK_PROTOCOL *This,
   IN EFI_HTTP_BOOT_CALLBACK_DATA_TYPEDataType,
-- 
2.13.0.windows.1

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


Re: [edk2] [Patch V3] NetworkPkg/HttpBootDxe: Add HTTP Boot Callback protocol support.

2017-06-21 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Fu, Siyuan 
Sent: Tuesday, June 20, 2017 9:23 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com>
Subject: [Patch V3] NetworkPkg/HttpBootDxe: Add HTTP Boot Callback protocol 
support.

V3 update:
Fix X64 build error.

V2 update:
Correct the file size print for IA32.

This patch updates the HTTP Boot driver to install a default HTTP Callback 
protocol if the platform doesn't provide one. This callback implementation will 
print the boot file download progress in percentage format.

Cc: Ye Ting <ting...@intel.com>
Cc: Wu Jiaxin <jiaxin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootClient.c  |  67 +-
 NetworkPkg/HttpBootDxe/HttpBootClient.h  |   4 +-
 NetworkPkg/HttpBootDxe/HttpBootDhcp4.c   |  26 +++-
 NetworkPkg/HttpBootDxe/HttpBootDhcp6.c   | 106 +--
 NetworkPkg/HttpBootDxe/HttpBootDxe.h |  14 ++
 NetworkPkg/HttpBootDxe/HttpBootDxe.inf   |   3 +-
 NetworkPkg/HttpBootDxe/HttpBootImpl.c| 221 +--
 NetworkPkg/HttpBootDxe/HttpBootImpl.h|   2 +
 NetworkPkg/HttpBootDxe/HttpBootSupport.c |  29   
NetworkPkg/HttpBootDxe/HttpBootSupport.h |  34 +
 10 files changed, 446 insertions(+), 60 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c 
b/NetworkPkg/HttpBootDxe/HttpBootClient.c
index 99db3d5..68f5a49 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c
@@ -233,7 +233,6 @@ HttpBootDhcp4ExtractUriInfo (
   //
   // All boot informations are valid here.
   //
-  AsciiPrint ("\n  URI: %a", Private->BootFileUri);
 
   //
   // Update the device path to include the IP and boot URI information.
@@ -401,7 +400,7 @@ HttpBootDhcp6ExtractUriInfo (
   //
   // All boot informations are valid here.
   //
-  AsciiPrint ("\n  URI: %a", Private->BootFileUri);
+
   //
   // Update the device path to include the IP and boot URI information.
   //
@@ -452,6 +451,40 @@ HttpBootDiscoverBootInfo (  }
 
 /**
+  HttpIo Callback function which will be invoked when specified 
HTTP_IO_CALLBACK_EVENT happened.
+
+  @param[in]EventType  Indicate the Event type that occurs in the 
current callback.
+  @param[in]MessageHTTP message which will be send to, or just 
received from HTTP server.
+  @param[in]ContextThe Callback Context pointer.
+  
+  @retval EFI_SUCCESS  Tells the HttpIo to continue the HTTP process.
+  @retval Others   Tells the HttpIo to abort the current HTTP 
process.
+**/
+EFI_STATUS
+EFIAPI
+HttpBootHttpIoCallback (
+  IN  HTTP_IO_CALLBACK_EVENTEventType,
+  IN  EFI_HTTP_MESSAGE  *Message,
+  IN  VOID  *Context
+  )
+{
+  HTTP_BOOT_PRIVATE_DATA   *Private;
+  EFI_STATUS   Status;
+  Private = (HTTP_BOOT_PRIVATE_DATA *) Context;
+  if (Private->HttpBootCallback != NULL) {
+Status = Private->HttpBootCallback->Callback (
+   Private->HttpBootCallback,
+   EventType == HttpIoRequest ? HttpBootHttpRequest : 
HttpBootHttpResponse,
+   EventType == HttpIoRequest ? FALSE : TRUE,
+   sizeof (EFI_HTTP_MESSAGE),
+   (VOID *) Message
+   );
+return Status;
+  }
+  return EFI_SUCCESS;
+}
+
+/**
   Create a HttpIo instance for the file download.
 
   @param[in]PrivateThe pointer to the driver's private data.
@@ -490,6 +523,8 @@ HttpBootCreateHttpIo (
  Private->Controller,
  Private->UsingIpv6 ? IP_VERSION_6 : IP_VERSION_4,
  ,
+ HttpBootHttpIoCallback,
+ (VOID *) Private,
  >HttpIo
  );
   if (EFI_ERROR (Status)) {
@@ -686,6 +721,8 @@ HttpBootGetBootFileCallback (  {
   HTTP_BOOT_CALLBACK_DATA  *CallbackData;
   HTTP_BOOT_ENTITY_DATA*NewEntityData;
+  EFI_STATUS   Status;
+  EFI_HTTP_BOOT_CALLBACK_PROTOCOL   *HttpBootCallback;
 
   //
   // We only care about the entity data.
@@ -695,6 +732,19 @@ HttpBootGetBootFileCallback (
   }
 
   CallbackData = (HTTP_BOOT_CALLBACK_DATA *) Context;
+  HttpBootCallback = CallbackData->Private->HttpBootCallback;
+  if (HttpBootCallback != NULL) {
+Status = HttpBootCallback->Callback (
+   HttpBootCallback,
+   HttpBootHttpEntityBody,
+   TRUE,
+   (UINT32)Length,
+   Data
+   );
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+  }
   //
   // Copy data if caller has provided a buffer.
   //
@@ -977,6 +1027,7 @@ HttpBootGetBootFile (
   Context.Buffer = Buffer;
   Context.BufferSize = *BufferSize;
   Context.Cache  = Cache;
+  Context.Private= Priva

Re: [edk2] [Patch] MdePkg: update head files to meet UEFI 2.7

2017-06-07 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com>

-Original Message-
From: Wang, Fan 
Sent: Tuesday, June 06, 2017 6:52 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wang, Fan 
<fan.w...@intel.com>
Subject: [Patch] MdePkg: update head files to meet UEFI 2.7

This patch is used to update supplicant.h and wifi2.h to meet UEFI 2.7 
definition. Add EfiSupplicant80211PMK field in EFI_SUPPLICANT_DATA_TYPE and 
change **NetworkDesc to NetworkDesc[1] in EFI_80211_GET_NETWORKS_RESULT.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.w...@intel.com>
---
 MdePkg/Include/Protocol/Supplicant.h | 6 +-
 MdePkg/Include/Protocol/WiFi2.h  | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/Protocol/Supplicant.h 
b/MdePkg/Include/Protocol/Supplicant.h
index 37e4c7e..2d7eed6 100644
--- a/MdePkg/Include/Protocol/Supplicant.h
+++ b/MdePkg/Include/Protocol/Supplicant.h
@@ -1,9 +1,9 @@
 /** @file
   This file defines the EFI Supplicant Protocol.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2017, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution. The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php
 
@@ -150,10 +150,14 @@ typedef enum {
   //
   // 802.11 Integrity GTK. The corresponding Data is of type
   // EFI_SUPPLICANT_GTK_LIST.
   //
   EfiSupplicant80211IGTK,
+  //
+  // 802.11 PMK. The corresponding Data is 32 bytes pairwise master key.
+  //
+  EfiSupplicant80211PMK,
   EfiSupplicantDataTypeMaximum
 } EFI_SUPPLICANT_DATA_TYPE;
 
 ///
 /// EFI_80211_LINK_STATE
diff --git a/MdePkg/Include/Protocol/WiFi2.h b/MdePkg/Include/Protocol/WiFi2.h 
index fc4da5c..e370059 100644
--- a/MdePkg/Include/Protocol/WiFi2.h
+++ b/MdePkg/Include/Protocol/WiFi2.h
@@ -1,9 +1,9 @@
 /** @file
   This file defines the EFI Wireless MAC Connection II Protocol.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2017, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution. The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php
 
@@ -200,11 +200,11 @@ typedef struct {
   UINT8 NumOfNetworkDesc;
   //
   // The NetworkDesc is a pointer to an array of EFI_80211_NETWORK_DESCRIPTION
   // instances. It is caller's responsibility to free this buffer.
   //
-  EFI_80211_NETWORK_DESCRIPTION **NetworkDesc;
+  EFI_80211_NETWORK_DESCRIPTION NetworkDesc[1];
 } EFI_80211_GET_NETWORKS_RESULT;
 
 ///
 /// EFI_80211_GET_NETWORKS_TOKEN
 ///
--
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 1/2] MdeModulePkg/UefiPxeBcDxe: Fix the PXE BootMenu selection issue

2017-06-05 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 


-Original Message-
From: Wu, Jiaxin 
Sent: Monday, May 22, 2017 3:36 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch 1/2] MdeModulePkg/UefiPxeBcDxe: Fix the PXE BootMenu selection 
issue

Currently implementation doesn't accept the input during the user is trying to 
select the PXE BootMenu from option 43. This path is to fix that problem.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
index f0720e5..c5f3437 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c
@@ -1,10 +1,10 @@
 /** @file
   Support for PxeBc dhcp functions.
 
 Copyright (c) 2013, Red Hat, Inc.
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at  
http://opensource.org/licenses/bsd-license.php
 
@@ -1843,11 +1843,11 @@ PxeBcSelectBootMenu (
   CHAR8  Blank[70];
   PXEBC_BOOT_MENU_ENTRY  *MenuItem;
   PXEBC_BOOT_MENU_ENTRY  *MenuArray[PXEBC_MAX_MENU_NUM];
 
   Finish  = FALSE;
-  Select  = 1;
+  Select  = 0;
   Index   = 0;
   *Type   = 0;
 
   if (Private->PxeBc.Mode->ProxyOfferReceived) {
 
@@ -1912,11 +1912,11 @@ PxeBcSelectBootMenu (
 
 while (gST->ConIn->ReadKeyStroke (gST->ConIn, ) == EFI_NOT_READY) 
{
   gBS->Stall (10 * TICKS_PER_MS);
 }
 
-if (InputKey.ScanCode != 0) {
+if (InputKey.ScanCode == 0) {
   switch (InputKey.UnicodeChar) {
   case CTRL ('c'):
 InputKey.ScanCode = SCAN_ESC;
 break;
 
--
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 2/2] MdeModulePkg/UefiPxeBcDxe: Refine the PXE boot displayed information

2017-06-05 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Monday, May 22, 2017 3:36 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch 2/2] MdeModulePkg/UefiPxeBcDxe: Refine the PXE boot displayed 
information

This path is to refine the PXE boot displayed information so as to in line with 
NetworkPkg/UefiPxeBcDxe driver.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 18 ++
 .../Universal/Network/UefiPxeBcDxe/PxeBcSupport.c  | 22 +- 
 .../Universal/Network/UefiPxeBcDxe/PxeBcSupport.h  | 16 +++-
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
index 259568e..6d4f33f 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c
@@ -336,10 +336,12 @@ EfiPxeBcStart (
 // IPv6 is not supported now.
 //
 return EFI_UNSUPPORTED;
   }
 
+  AsciiPrint ("\n>>Start PXE over IPv4");
+
   //
   // Configure the udp4 instance to let it receive data
   //
   Status = Private->Udp4Read->Configure (
Private->Udp4Read, @@ -665,10 +667,15 @@ 
EfiPxeBcDhcp (
   // Check the selected offer to see whether BINL is required, if no or BINL is
   // finished, set the various Mode members.
   //
   Status = PxeBcCheckSelectedOffer (Private);
 
+  AsciiPrint ("\n  Station IP address is ");
+
+  PxeBcShowIp4Addr (>StationIp.v4);  AsciiPrint ("\n");
+
 ON_EXIT:
   if (EFI_ERROR (Status)) {
 Dhcp4->Stop (Dhcp4);
 Dhcp4->Configure (Dhcp4, NULL);
   } else {
@@ -2738,10 +2745,18 @@ DiscoverBootFile (
   );
   }
 
   Private->FileSize = (UINTN) *BufferSize;
 
+  //
+  // Display all the information: boot server address, boot file name and boot 
file size.
+  //
+  AsciiPrint ("\n  Server IP address is ");  PxeBcShowIp4Addr 
+ (>ServerIp.v4);  AsciiPrint ("\n  NBP filename is %a", 
+ Private->BootFileName);  AsciiPrint ("\n  NBP filesize is %d Bytes", 
+ Private->FileSize);
+
   return Status;
 }
 
 /**
   Causes the driver to load a specified file.
@@ -2853,10 +2868,11 @@ EfiPxeLoadFile (
 Status  = DiscoverBootFile (Private, , Buffer);
 
 if (sizeof (UINTN) < sizeof (UINT64) && (TmpBufSize > 0x)) {
   Status = EFI_DEVICE_ERROR;
 } else if (TmpBufSize > 0 && *BufferSize >= (UINTN) TmpBufSize && Buffer 
!= NULL) {
+  AsciiPrint ("\n Downloading NBP file...\n");
   *BufferSize = (UINTN) TmpBufSize;
   Status = PxeBc->Mtftp (
 PxeBc,
 EFI_PXE_BASE_CODE_TFTP_READ_FILE,
 Buffer,
@@ -2877,10 +2893,11 @@ EfiPxeLoadFile (
 Status  = EFI_BUFFER_TOO_SMALL;
   } else {
 //
 // Download the file.
 //
+AsciiPrint ("\n Downloading NBP file...\n");
 TmpBufSize = (UINT64) (*BufferSize);
 Status = PxeBc->Mtftp (
   PxeBc,
   EFI_PXE_BASE_CODE_TFTP_READ_FILE,
   Buffer,
@@ -2911,10 +2928,11 @@ EfiPxeLoadFile (
 
   //
   // Check download status
   //
   if (Status == EFI_SUCCESS) {
+AsciiPrint ("\n  NBP file downloaded successfully.\n");
 //
 // The DHCP4 can have only one configured child instance so we need to stop
 // reset the DHCP4 child before we return. Otherwise the other programs 
which 
 // also need to use DHCP4 will be impacted.
 // The functionality of PXE Base Code protocol will not be stopped, diff 
--git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c 
b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
index 0779056..c1cabca 100644
--- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
+++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c
@@ -1,9 +1,9 @@
 /** @file
   Support routines for PxeBc.
 
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at  
http://opensource.org/licenses/bsd-license.php
 
@@ -112,10 +112,30 @@ PxeBcConfigureUdpWriteInstance (
   }
 
   return Status;
 }
 
+/**
+  This function is to display the IPv4 address.
+
+  @param[in]

Re: [edk2] [PATCH v2] MdeModulePkg/DxeHttpLib: Fix potential memory leaks

2017-06-05 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Tuesday, May 23, 2017 10:11 AM
To: Paulo Alcantara <pca...@gmail.com>; edk2-devel@lists.01.org
Cc: Dong, Eric <eric.d...@intel.com>; Zeng, Star <star.z...@intel.com>
Subject: RE: [edk2] [PATCH v2] MdeModulePkg/DxeHttpLib: Fix potential memory 
leaks

Reviewed-by: Wu Jiaxin <jiaxin...@intel.com>


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Paulo Alcantara
> Sent: Monday, May 22, 2017 7:52 PM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.d...@intel.com>; Zeng, Star <star.z...@intel.com>
> Subject: [edk2] [PATCH v2] MdeModulePkg/DxeHttpLib: Fix potential 
> memory leaks
> 
> Cc: Star Zeng <star.z...@intel.com>
> Cc: Eric Dong <eric.d...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Paulo Alcantara <pca...@gmail.com>
> ---
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 15 ---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> index 8421caa..2929238 100644
> --- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> +++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
> @@ -523,6 +523,7 @@ HttpUrlGetHostName (
>   
>   );
>if (EFI_ERROR (Status)) {
> +FreePool (Name);
>  return Status;
>}
> 
> @@ -582,6 +583,7 @@ HttpUrlGetIp4 (
>   
>   );
>if (EFI_ERROR (Status)) {
> +FreePool (Ip4String);
>  return Status;
>}
> 
> @@ -657,6 +659,7 @@ HttpUrlGetIp6 (
>   
>   );
>if (EFI_ERROR (Status)) {
> +FreePool (Ip6String);
>  return Status;
>}
> 
> @@ -722,14 +725,15 @@ HttpUrlGetPort (
>   
>   );
>if (EFI_ERROR (Status)) {
> -return Status;
> +goto ON_EXIT;
>}
> 
>PortString[ResultLength] = '\0';
> 
>while (Index < ResultLength) {
>  if (!NET_IS_DIGIT (PortString[Index])) {
> -  return EFI_INVALID_PARAMETER;
> +  Status = EFI_INVALID_PARAMETER;
> +  goto ON_EXIT;
>  }
>  Index ++;
>}
> @@ -737,10 +741,14 @@ HttpUrlGetPort (
>Status =  AsciiStrDecimalToUintnS (Url + Parser-
> >FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, );
> 
>if (Data > HTTP_URI_PORT_MAX_NUM) {
> -return EFI_INVALID_PARAMETER;
> +Status = EFI_INVALID_PARAMETER;
> +goto ON_EXIT;
>}
> 
>*Port = (UINT16) Data;
> +
> +ON_EXIT:
> +  FreePool (PortString);
>return Status;
>  }
> 
> @@ -795,6 +803,7 @@ HttpUrlGetPath (
>   
>   );
>if (EFI_ERROR (Status)) {
> +FreePool (PathStr);
>  return Status;
>}
> 
> --
> 2.9.4
> 
> ___
> 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] Pressing ESC from "PXE windows Boot manager" causes ASSERT

2017-05-23 Thread Ye, Ting
Hi Karunakar,

Sorry I did not find your attached files. Would you please send them again? 
Besides that, do you mind telling us which code base are you using for PXE 
boot?  Are you using some revision of EDKII main trunk or UDK release?

Thanks,
Ting

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Karunakar P
Sent: Wednesday, May 24, 2017 12:20 PM
To: edk2-devel@lists.01.org
Subject: [edk2] Pressing ESC from "PXE windows Boot manager" causes ASSERT

Hi All,

We have facing an issue with PXE boot.
[Issue]
When ESC is pressed from Windows Boot manager during PXE boot (IPv4 or IPv6) 
system Hangs with following ASSERT

ASSERT [DxeCore] \MdeModulePkg\Core\Dxe\Mem\Pool.c : CR has Bad Signature

[Reproduction Steps]
1. Perform UEFI PXEv4 or UEFI PXEv6 boot 2. It will start PXE boot over IPv4/6 
and Downloads NBP file successfully.
   Attached the Screenshot for the same(ScreenShot1.jpg)

   It will Displays the info like "Press ENTER for network boot service"
   Attached Screensho(ScreenShot2.jpg)

3. Press ENTER and then press ESC immediately to see the Windows Boot Manager 
Menu
   It will list the available Operating Systems
   Attached the screenshot(ScreenShot3.png)

4. Press ESC to come back to Setup or next Boot option

[Result]
System hangs with ASSERT

[Expected Result]
On pressing ESC from Windows Boot Manager, it should come back to setup/Next 
boot option in boot order

Note:
We have PXE server configured in Windows Server 2012 R2.

Please look into it.


Thanks,
karunakar
___
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] CryptoPkg/BaseCryptLib: Add NULL pointer checks in DH and P7Verify

2017-05-19 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Long, Qin 
Sent: Friday, May 19, 2017 3:27 PM
To: Ye, Ting <ting...@intel.com>; Wu, Hao A <hao.a...@intel.com>; 
edk2-devel@lists.01.org
Cc: Long, Qin <qin.l...@intel.com>
Subject: [PATCH] CryptoPkg/BaseCryptLib: Add NULL pointer checks in DH and 
P7Verify

Add more NULL pointer checks before using them in DhGenerateKey and 
Pkcs7GetCertificatesList functions to eliminate possible dereferenced pointer 
issue.

Cc: Ting Ye <ting...@intel.com>
Cc: Hao Wu <hao.a...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.l...@intel.com>
---
 CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c  |  4 +++-
 CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c | 10 +++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c 
b/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c
index f44684f907..391efd5c14 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c
@@ -232,7 +232,9 @@ DhGenerateKey (
   return FALSE;
 }
 
-BN_bn2bin (DhPubKey, PublicKey);
+if (PublicKey != NULL) {
+  BN_bn2bin (DhPubKey, PublicKey);
+}
 *PublicKeySize = Size;
   }
 
diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c 
b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c
index 45d5df5e11..d564591cb7 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c
@@ -558,7 +558,9 @@ Pkcs7GetCertificatesList (
 }
   }
   CtxUntrusted = X509_STORE_CTX_get0_untrusted (CertCtx);
-  (VOID)sk_X509_delete_ptr (CtxUntrusted, Signer);
+  if (CtxUntrusted != NULL) {
+(VOID)sk_X509_delete_ptr (CtxUntrusted, Signer);  }
 
   //
   // Build certificates stack chained from Signer's certificate.
@@ -711,8 +713,10 @@ _Error:
   }
   sk_X509_free (Signers);
 
-  X509_STORE_CTX_cleanup (CertCtx);
-  X509_STORE_CTX_free (CertCtx);
+  if (CertCtx != NULL) {
+X509_STORE_CTX_cleanup (CertCtx);
+X509_STORE_CTX_free (CertCtx);
+  }
 
   if (SingleCert != NULL) {
 free (SingleCert);
--
2.12.2.windows.2

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


Re: [edk2] [Patch] NetworkPkg/IScsiDxe: Switch IP4 configuration policy to Static before DHCP

2017-05-10 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com> 

-Original Message-
From: Wu, Jiaxin 
Sent: Wednesday, May 10, 2017 11:33 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin 
<jiaxin...@intel.com>
Subject: [Patch] NetworkPkg/IScsiDxe: Switch IP4 configuration policy to Static 
before DHCP

DHCP4 service allows only one of its children to be configured in the active 
state. If the DHCP4 D.O.R.A started by IP4 auto configuration and has not been 
completed, the Dhcp4 state machine will not be in the right state for the iSCSI 
to start a new round D.O.R.A. So, we need to switch it's policy to static.

Cc: Ye Ting <ting...@intel.com>
Cc: Fu Siyuan <siyuan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin...@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiDhcp.c | 61 +
 1 file changed, 61 insertions(+)

diff --git a/NetworkPkg/IScsiDxe/IScsiDhcp.c b/NetworkPkg/IScsiDxe/IScsiDhcp.c 
index 43ae50b..6587a05 100644
--- a/NetworkPkg/IScsiDxe/IScsiDhcp.c
+++ b/NetworkPkg/IScsiDxe/IScsiDhcp.c
@@ -369,10 +369,54 @@ IScsiParseDhcpAck (
   FreePool (OptionList);
 
   return Status;
 }
 
+/**
+  This function will switch the IP4 configuration policy to Static.
+
+  @param[in]  Ip4Config2  Pointer to the IP4 configuration protocol.
+
+  @retval EFI_SUCCESS The policy is already configured to static.
+  @retval Others  Other error as indicated.
+
+**/
+EFI_STATUS
+IScsiSetIp4Policy (
+  IN EFI_IP4_CONFIG2_PROTOCOL*Ip4Config2
+  )
+{
+  EFI_IP4_CONFIG2_POLICY  Policy;
+  EFI_STATUS  Status;
+  UINTN   DataSize;
+
+  DataSize = sizeof (EFI_IP4_CONFIG2_POLICY);  Status = 
+ Ip4Config2->GetData (
+ Ip4Config2,
+ Ip4Config2DataTypePolicy,
+ ,
+ 
+ );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  if (Policy != Ip4Config2PolicyStatic) {
+Policy = Ip4Config2PolicyStatic;
+Status= Ip4Config2->SetData (
+  Ip4Config2,
+  Ip4Config2DataTypePolicy,
+  sizeof (EFI_IP4_CONFIG2_POLICY),
+  
+  );
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+  }
+
+  return EFI_SUCCESS;
+}
 
 /**
   Parse the DHCP ACK to get the address configuration and DNS information.
 
   @param[in]   ImageThe handle of the driver image.
@@ -391,18 +435,20 @@ IScsiDoDhcp (
   IN EFI_HANDLE  Controller,
   IN OUT ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData
   )
 {
   EFI_HANDLEDhcp4Handle;
+  EFI_IP4_CONFIG2_PROTOCOL  *Ip4Config2;
   EFI_DHCP4_PROTOCOL*Dhcp4;
   EFI_STATUSStatus;
   EFI_DHCP4_PACKET_OPTION   *ParaList;
   EFI_DHCP4_CONFIG_DATA Dhcp4ConfigData;
   ISCSI_SESSION_CONFIG_NVDATA   *NvData;
   BOOLEAN   MediaPresent;
 
   Dhcp4Handle = NULL;
+  Ip4Config2  = NULL;
   Dhcp4   = NULL;
   ParaList= NULL;
 
   //
   // Check media status before doing DHCP.
@@ -412,10 +458,25 @@ IScsiDoDhcp (
   if (!MediaPresent) {
 return EFI_NO_MEDIA;
   }
 
   //
+  // DHCP4 service allows only one of its children to be configured in  
+ // the active state, If the DHCP4 D.O.R.A started by IP4 auto  // 
+ configuration and has not been completed, the Dhcp4 state machine  // 
+ will not be in the right state for the iSCSI to start a new round D.O.R.A.
+  // So, we need to switch it's policy to static.
+  //
+  Status = gBS->HandleProtocol (Controller, 
+ , (VOID **) );  if (!EFI_ERROR 
(Status)) {
+Status = IScsiSetIp4Policy (Ip4Config2);
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+  }
+
+  //
   // Create a DHCP4 child instance and get the protocol.
   //
   Status = NetLibCreateServiceChild (
  Controller,
  Image,
--
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 V2] MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used.

2017-05-04 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com>  

-Original Message-
From: Fu, Siyuan 
Sent: Friday, May 05, 2017 11:01 AM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Andrey Tepin <ate...@kraftway.ru>; Ye, 
Ting <ting...@intel.com>
Subject: [Patch V2] MdeModulePkg: Addressing TCP Window Retraction when window 
scale factor is used.

The RFC1323 which defines the TCP window scale option has been obsoleted by 
RFC7323.
This patch is to follow the RFC7323 to address the TCP window retraction 
problem when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot 
and iSCSI file read/write.

Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Andrey Tepin <ate...@kraftway.ru>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c  |  5 +--
 .../Universal/Network/Tcp4Dxe/Tcp4Output.c | 41 +-
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h |  8 -
 3 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
index 1a7c41a..892d19b 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
@@ -1,7 +1,7 @@
 /** @file
   Misc support routines for tcp.
 
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -78,7 +78,8 @@ 
TcpInitTcbLocal (
   // First window size is never scaled
   //
   Tcb->RcvWndScale  = 0;
-
+  Tcb->RetxmitSeqMax = 0;
+  
   Tcb->ProbeTimerOn = FALSE;
 }
 
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c
index 0eec8f0..ed71f97 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c
@@ -1,7 +1,7 @@
 /** @file
   TCP output process routines.
 
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -671,17 +671,38 
@@ TcpRetransmit (
   // 2. must in the current send window
   // 3. will not change the boundaries of queued segments.
   //
-  if (TCP_SEQ_LT (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
-DEBUG ((EFI_D_WARN, "TcpRetransmit: retransmission cancelled "
-  "because send window too small for TCB %p\n", Tcb));
+  if ((Tcb->SndWndScale != 0) &&
+  (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_GT (Tcb->SndWl2 + 
Tcb->SndWnd + (1 << Tcb->SndWndScale), Seq))) {
+//
+// Handle the Window Retraction if TCP window scale is enabled according 
to RFC7323:
+//   On first retransmission, or if the sequence number is out of
+//   window by less than 2^Rcv.Wind.Shift, then do normal
+//   retransmission(s) without regard to the receiver window as long
+//   as the original segment was in window when it was sent.
+//
+Len = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
+DEBUG (
+  (EFI_D_WARN,
+  "TcpRetransmit: retransmission without regard to the receiver window for 
TCB %p\n",
+  Tcb)
+  );
+
+  } else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
+Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
+
+  } else {
+DEBUG (
+  (EFI_D_WARN,
+  "TcpRetransmit: retransmission cancelled because send window too small 
for TCB %p\n",
+  Tcb)
+  );
 
 return 0;
   }
+  
+  Len = MIN (Len, Tcb->SndMss);
 
-  Len   = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
-  Len   = MIN (Len, Tcb->SndMss);
-
-  Nbuf  = TcpGetSegmentSndQue (Tcb, Seq, Len);
+  Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
   if (Nbuf == NULL) {
 return -1;
   }
@@ -691,6 +712,10 @@ TcpRetransmit (
   if (TcpTransmitSegment (Tcb, Nbuf) != 0) {
 goto OnError;
   }
+  
+  if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) {
+Tcb->RetxmitSeqMax = Seq;
+  }
 
   //
   // The retransmitted buffer may be on the SndQue, diff --git 
a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h 
b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h
index 01d6034..49d8a1d 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Pr

Re: [edk2] [Patch V2] NetworkPkg: Addressing TCP Window Retraction when window scale factor is used.

2017-05-04 Thread Ye, Ting
Reviewed-by: Ye Ting <ting...@intel.com>


-Original Message-
From: Fu, Siyuan 
Sent: Friday, May 05, 2017 9:56 AM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin...@intel.com>; Andrey Tepin <ate...@kraftway.ru>; Ye, 
Ting <ting...@intel.com>
Subject: [Patch V2] NetworkPkg: Addressing TCP Window Retraction when window 
scale factor is used.

The RFC1323 which defines the TCP window scale option has been obsoleted by 
RFC7323.
This patch is to follow the RFC7323 to address the TCP window retraction 
problem when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot 
and iSCSI file read/write.

Cc: Wu Jiaxin <jiaxin...@intel.com>
Cc: Andrey Tepin <ate...@kraftway.ru>
Cc: Ye Ting <ting...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan...@intel.com>
---
 NetworkPkg/TcpDxe/TcpMisc.c   |  3 ++-
 NetworkPkg/TcpDxe/TcpOutput.c | 33 -  
NetworkPkg/TcpDxe/TcpProto.h  |  8 +++-
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/TcpDxe/TcpMisc.c b/NetworkPkg/TcpDxe/TcpMisc.c index 
a8592c9..4435036 100644
--- a/NetworkPkg/TcpDxe/TcpMisc.c
+++ b/NetworkPkg/TcpDxe/TcpMisc.c
@@ -2,7 +2,7 @@
   Misc support routines for TCP driver.
 
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights 
+ reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -86,6 +86,7 @@ TcpInitTcbLocal (
   // First window size is never scaled
   //
   Tcb->RcvWndScale  = 0;
+  Tcb->RetxmitSeqMax = 0;
 
   Tcb->ProbeTimerOn = FALSE;
 }
diff --git a/NetworkPkg/TcpDxe/TcpOutput.c b/NetworkPkg/TcpDxe/TcpOutput.c 
index a46cb60..f3dacf3 100644
--- a/NetworkPkg/TcpDxe/TcpOutput.c
+++ b/NetworkPkg/TcpDxe/TcpOutput.c
@@ -1,7 +1,7 @@
 /** @file
   TCP output process routines.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights 
+ reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -664,7 +664,27 @@ TcpRetransmit (
   // 2. Must in the current send window
   // 3. Will not change the boundaries of queued segments.
   //
-  if (TCP_SEQ_LT (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
+  
+  if ((Tcb->SndWndScale != 0) &&
+  (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_GT (Tcb->SndWl2 + 
Tcb->SndWnd + (1 << Tcb->SndWndScale), Seq))) {
+//
+// Handle the Window Retraction if TCP window scale is enabled according 
to RFC7323:
+//   On first retransmission, or if the sequence number is out of
+//   window by less than 2^Rcv.Wind.Shift, then do normal
+//   retransmission(s) without regard to the receiver window as long
+//   as the original segment was in window when it was sent.
+//
+Len = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
+DEBUG (
+  (EFI_D_WARN,
+  "TcpRetransmit: retransmission without regard to the receiver window for 
TCB %p\n",
+  Tcb)
+  );
+
+  } else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
+Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
+
+  } else {
 DEBUG (
   (EFI_D_WARN,
   "TcpRetransmit: retransmission cancelled because send window too small 
for TCB %p\n", @@ -674,10 +694,9 @@ TcpRetransmit (
 return 0;
   }
 
-  Len   = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
-  Len   = MIN (Len, Tcb->SndMss);
+  Len = MIN (Len, Tcb->SndMss);
 
-  Nbuf  = TcpGetSegmentSndQue (Tcb, Seq, Len);
+  Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
   if (Nbuf == NULL) {
 return -1;
   }
@@ -688,6 +707,10 @@ TcpRetransmit (
 goto OnError;
   }
 
+  if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) {
+Tcb->RetxmitSeqMax = Seq;
+  }
+
   //
   // The retransmitted buffer may be on the SndQue,
   // trim TCP head because all the buffers on SndQue diff --git 
a/NetworkPkg/TcpDxe/TcpProto.h b/NetworkPkg/TcpDxe/TcpProto.h index 
ee35134..81397d7 100644
--- a/NetworkPkg/TcpDxe/TcpProto.h
+++ b/NetworkPkg/TcpDxe/TcpProto.h
@@ -1,7 +1,7 @@
 /** @file
   TCP protocol header file.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights 
+ reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -316,6 +316,12 @@ struct _TCP_CONTROL_BLOCK {
   TCP_SEQNO LossRecover;  ///< Recover point for retxmit.
 
   //
+  // RFC7323
+  // Addressing Window Retraction for TCP Window S

  1   2   3   4   >