[edk2] [Patch 2/2] NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.

Jiaxin Wu posted 2 patches 7 years ago
[edk2] [Patch 2/2] NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
Posted by Jiaxin Wu 7 years ago
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Karunakar P <karunakarp@amiindia.co.in>
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
index d8c0ad0..1107865 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
@@ -1,9 +1,9 @@
 /** @file
   This EFI_DHCP6_PROTOCOL interface implementation.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 
   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.
@@ -74,10 +74,11 @@ EfiDhcp6Start (
 {
   EFI_STATUS                   Status;
   EFI_TPL                      OldTpl;
   DHCP6_INSTANCE               *Instance;
   DHCP6_SERVICE                *Service;
+  BOOLEAN                      MediaPresent;
 
   if (This == NULL) {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -99,10 +100,21 @@ EfiDhcp6Start (
   if (Instance->IaCb.Ia->State != Dhcp6Init) {
     return EFI_ALREADY_STARTED;
   }
 
   OldTpl           = gBS->RaiseTPL (TPL_CALLBACK);
+
+  //
+  // Check Media Satus.
+  //
+  MediaPresent = TRUE;
+  NetLibDetectMedia (Service->Controller, &MediaPresent);
+  if (!MediaPresent) {
+    Status = EFI_NO_MEDIA;
+    goto ON_ERROR;
+  }
+
   Instance->UdpSts = EFI_ALREADY_STARTED;
 
   //
   // Send the solicit message to start S.A.R.R process.
   //
-- 
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] NetworkPkg/Dhcp6Dxe: Check Media status before starting DHCP process.
Posted by Fu, Siyuan 7 years ago

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>



> -----Original Message-----
> From: Wu, Jiaxin
> Sent: Friday, December 1, 2017 4:39 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>;
> Karunakar P <karunakarp@amiindia.co.in>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [Patch 2/2] NetworkPkg/Dhcp6Dxe: Check Media status before
> starting DHCP process.
> 
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Karunakar P <karunakarp@amiindia.co.in>
> Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
> ---
>  NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> index d8c0ad0..1107865 100644
> --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Impl.c
> @@ -1,9 +1,9 @@
>  /** @file
>    This EFI_DHCP6_PROTOCOL interface implementation.
> 
> -  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>    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.
> @@ -74,10 +74,11 @@ EfiDhcp6Start (
>  {
>    EFI_STATUS                   Status;
>    EFI_TPL                      OldTpl;
>    DHCP6_INSTANCE               *Instance;
>    DHCP6_SERVICE                *Service;
> +  BOOLEAN                      MediaPresent;
> 
>    if (This == NULL) {
>      return EFI_INVALID_PARAMETER;
>    }
> 
> @@ -99,10 +100,21 @@ EfiDhcp6Start (
>    if (Instance->IaCb.Ia->State != Dhcp6Init) {
>      return EFI_ALREADY_STARTED;
>    }
> 
>    OldTpl           = gBS->RaiseTPL (TPL_CALLBACK);
> +
> +  //
> +  // Check Media Satus.
> +  //
> +  MediaPresent = TRUE;
> +  NetLibDetectMedia (Service->Controller, &MediaPresent);
> +  if (!MediaPresent) {
> +    Status = EFI_NO_MEDIA;
> +    goto ON_ERROR;
> +  }
> +
>    Instance->UdpSts = EFI_ALREADY_STARTED;
> 
>    //
>    // Send the solicit message to start S.A.R.R process.
>    //
> --
> 1.9.5.msysgit.1

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