Re: [edk2] [Patch 4/4] ShellPkg: Revert git 'd6cf1af9' fix

2016-02-29 Thread Fu, Siyuan
Reviewed-by: Fu Siyuan <siyuan...@intel.com>



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Jiaxin Wu
> Sent: Thursday, February 25, 2016 12:22 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>
> Subject: [edk2] [Patch 4/4] ShellPkg: Revert git 'd6cf1af9' fix
> 
> 'd6cf1af9' is associated with '3d0a49ad' commit. So, this patch is
> used to respond the revert for '3d0a49ad' to adapt the Ipv4 config
> policy update.
> 
> Cc: Subramanian Sriram <srira...@hpe.com>
> Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahm...@hpe.com>
> Cc: Ye Ting <ting...@intel.com>
> Cc: Fu Siyuan <siyuan...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu <jiaxin...@intel.com>
> ---
>  .../UefiShellNetwork1CommandsLib/Ifconfig.c| 119 
> +++--
>  1 file changed, 15 insertions(+), 104 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> index f8dbc88..f02281d 100644
> --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
> @@ -1,10 +1,10 @@
>  /** @file
>The implementation for Shell command ifconfig based on IP4Config2
> protocol.
> 
>(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
> -  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> +  Copyright (c) 2006 - 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.
> @@ -271,90 +271,10 @@ IfConfigManualAddressNotify (
>)
>  {
>*((BOOLEAN *) Context) = TRUE;
>  }
> 
> -
> -/**
> -  Create an IP child, use it to start the auto configuration, then destroy 
> it.
> -
> -  @param[in] Controller   The controller which has the service installed.
> -  @param[in] ImageThe image handle used to open service.
> -
> -  @retval EFI_SUCCESS The configuration is done.
> -**/
> -EFI_STATUS
> -EFIAPI
> -IfConfigStartIp4(
> -  IN  EFI_HANDLEController,
> -  IN  EFI_HANDLEImage
> -  )
> -{
> -  EFI_IP4_PROTOCOL  *Ip4;
> -  EFI_HANDLEIp4Handle;
> -  EFI_IP4_CONFIG_DATA   Ip4ConfigData;
> -  EFI_STATUSStatus;
> -
> -  //
> -  // Get the Ip4ServiceBinding Protocol
> -  //
> -  Ip4Handle = NULL;
> -  Ip4   = NULL;
> -
> -  Status = NetLibCreateServiceChild (
> - Controller,
> - Image,
> - ,
> - 
> - );
> -
> -  if (EFI_ERROR (Status)) {
> -return Status;
> -  }
> -
> -  Status = gBS->OpenProtocol (
> - Ip4Handle,
> - ,
> - (VOID **) ,
> - Controller,
> - Image,
> - EFI_OPEN_PROTOCOL_GET_PROTOCOL
> - );
> -
> -  if (EFI_ERROR (Status)) {
> -goto ON_EXIT;
> -  }
> -
> -  Ip4ConfigData.DefaultProtocol  = EFI_IP_PROTO_ICMP;
> -  Ip4ConfigData.AcceptAnyProtocol= FALSE;
> -  Ip4ConfigData.AcceptIcmpErrors = FALSE;
> -  Ip4ConfigData.AcceptBroadcast  = FALSE;
> -  Ip4ConfigData.AcceptPromiscuous= FALSE;
> -  Ip4ConfigData.UseDefaultAddress= TRUE;
> -  ZeroMem (, sizeof (EFI_IPv4_ADDRESS));
> -  ZeroMem (, sizeof (EFI_IPv4_ADDRESS));
> -  Ip4ConfigData.TypeOfService= 0;
> -  Ip4ConfigData.TimeToLive   = 1;
> -  Ip4ConfigData.DoNotFragment= FALSE;
> -  Ip4ConfigData.RawData  = FALSE;
> -  Ip4ConfigData.ReceiveTimeout   = 0;
> -  Ip4ConfigData.TransmitTimeout  = 0;
> -
> -  Ip4->Configure (Ip4, );
> -
> -ON_EXIT:
> -  NetLibDestroyServiceChild (
> -Controller,
> -Image,
> -,
> -Ip4Handle
> -);
> -
> -  return Status;
> -}
> -
> -
>  /**
>Print MAC address.
> 
>@param[in]NodeThe pointer of MAC address buffer.
>@param[in]SizeThe size of MAC address buffer.
> @@ -972,33 +892,24 @@ IfConfigSetInterfaceInfo (
> 
>  //
>  // Process valid variables.
>  //
>  if (StrCmp(VarArg->Arg, L"dhcp") == 0

[edk2] [Patch 4/4] ShellPkg: Revert git 'd6cf1af9' fix

2016-02-24 Thread Jiaxin Wu
'd6cf1af9' is associated with '3d0a49ad' commit. So, this patch is
used to respond the revert for '3d0a49ad' to adapt the Ipv4 config 
policy update.

Cc: Subramanian Sriram 
Cc: El-Haj-Mahmoud Samer 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 .../UefiShellNetwork1CommandsLib/Ifconfig.c| 119 +++--
 1 file changed, 15 insertions(+), 104 deletions(-)

diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c 
b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
index f8dbc88..f02281d 100644
--- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
+++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
@@ -1,10 +1,10 @@
 /** @file
   The implementation for Shell command ifconfig based on IP4Config2 protocol.
 
   (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 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.
@@ -271,90 +271,10 @@ IfConfigManualAddressNotify (
   )
 {
   *((BOOLEAN *) Context) = TRUE;
 }
 
-
-/**
-  Create an IP child, use it to start the auto configuration, then destroy it.
-
-  @param[in] Controller   The controller which has the service installed.
-  @param[in] ImageThe image handle used to open service.
-
-  @retval EFI_SUCCESS The configuration is done.
-**/
-EFI_STATUS
-EFIAPI
-IfConfigStartIp4(
-  IN  EFI_HANDLEController,
-  IN  EFI_HANDLEImage
-  )
-{
-  EFI_IP4_PROTOCOL  *Ip4;
-  EFI_HANDLEIp4Handle;
-  EFI_IP4_CONFIG_DATA   Ip4ConfigData;
-  EFI_STATUSStatus;
-
-  //
-  // Get the Ip4ServiceBinding Protocol
-  //
-  Ip4Handle = NULL;
-  Ip4   = NULL;
-
-  Status = NetLibCreateServiceChild (
- Controller,
- Image,
- ,
- 
- );
-
-  if (EFI_ERROR (Status)) {
-return Status;
-  }
-
-  Status = gBS->OpenProtocol (
- Ip4Handle,
- ,
- (VOID **) ,
- Controller,
- Image,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
-  if (EFI_ERROR (Status)) {
-goto ON_EXIT;
-  }
-
-  Ip4ConfigData.DefaultProtocol  = EFI_IP_PROTO_ICMP;
-  Ip4ConfigData.AcceptAnyProtocol= FALSE;
-  Ip4ConfigData.AcceptIcmpErrors = FALSE;
-  Ip4ConfigData.AcceptBroadcast  = FALSE;
-  Ip4ConfigData.AcceptPromiscuous= FALSE;
-  Ip4ConfigData.UseDefaultAddress= TRUE;
-  ZeroMem (, sizeof (EFI_IPv4_ADDRESS));
-  ZeroMem (, sizeof (EFI_IPv4_ADDRESS));
-  Ip4ConfigData.TypeOfService= 0;
-  Ip4ConfigData.TimeToLive   = 1;
-  Ip4ConfigData.DoNotFragment= FALSE;
-  Ip4ConfigData.RawData  = FALSE;
-  Ip4ConfigData.ReceiveTimeout   = 0;
-  Ip4ConfigData.TransmitTimeout  = 0;
-
-  Ip4->Configure (Ip4, );
-  
-ON_EXIT: 
-  NetLibDestroyServiceChild (
-Controller,
-Image,
-,
-Ip4Handle
-);
-  
-  return Status;
-}
-
-
 /**
   Print MAC address.
 
   @param[in]NodeThe pointer of MAC address buffer.
   @param[in]SizeThe size of MAC address buffer.
@@ -972,33 +892,24 @@ IfConfigSetInterfaceInfo (
 
 //
 // Process valid variables.
 //
 if (StrCmp(VarArg->Arg, L"dhcp") == 0) {
-  if (IfCb->Policy == Ip4Config2PolicyDhcp) {
-Status = IfConfigStartIp4 (IfCb->NicHandle, gImageHandle);
-if (EFI_ERROR(Status)) {
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), 
gShellNetwork1HiiHandle, L"ifconfig");
-  ShellStatus = SHELL_ACCESS_DENIED;
-  goto ON_EXIT;
-}
-  } else {
-//
-// Set dhcp config policy
-//
-Policy = Ip4Config2PolicyDhcp;
-Status = IfCb->IfCfg->SetData (
-IfCb->IfCfg,
-Ip4Config2DataTypePolicy,
-sizeof (EFI_IP4_CONFIG2_POLICY),
-
-);
-if (EFI_ERROR(Status)) {
-  ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), 
gShellNetwork1HiiHandle, L"ifconfig");
-  ShellStatus = SHELL_ACCESS_DENIED;
-  goto ON_EXIT;
-}
+  //
+  // Set dhcp config policy
+  //
+  Policy = Ip4Config2PolicyDhcp;
+  Status = IfCb->IfCfg->SetData (
+