]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiDhcp6.c
NetworkPkg/IScsiDxe: reformat IScsiHexToBin() leading comment block
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiDhcp6.c
index 06c634c3cda4f6dbe28442535bf6ca09714b836c..691650b7334fdd70883c0c18cfea08d7cb6e12c1 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   iSCSI DHCP6 related configuration routines.\r
 \r
-Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -47,7 +41,7 @@ IScsiDhcp6ExtractRootPath (
   UINT8                       Index;\r
   ISCSI_SESSION_CONFIG_NVDATA *ConfigNvData;\r
   EFI_IP_ADDRESS              Ip;\r
-  UINT8                       IpMode;  \r
+  UINT8                       IpMode;\r
 \r
   ConfigNvData = &ConfigData->SessionConfigData;\r
   ConfigNvData->DnsMode = FALSE;\r
@@ -156,7 +150,7 @@ IScsiDhcp6ExtractRootPath (
   //\r
   // Get the IP address of the target.\r
   //\r
-  Field   = &Fields[RP_FIELD_IDX_SERVERNAME];  \r
+  Field   = &Fields[RP_FIELD_IDX_SERVERNAME];\r
   if (ConfigNvData->IpMode < IP_MODE_AUTOCONFIG) {\r
     IpMode = ConfigNvData->IpMode;\r
   } else {\r
@@ -167,7 +161,7 @@ IScsiDhcp6ExtractRootPath (
   // Server name is expressed as domain name, just save it.\r
   //\r
   if (ConfigNvData->DnsMode) {\r
-    if (Field->Len > sizeof (ConfigNvData->TargetUrl)) {\r
+    if ((Field->Len + 2) > sizeof (ConfigNvData->TargetUrl)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
     CopyMem (&ConfigNvData->TargetUrl, Field->Str, Field->Len);\r
@@ -238,11 +232,11 @@ ON_EXIT:
 }\r
 \r
 /**\r
-  EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol \r
+  EFI_DHCP6_INFO_CALLBACK is provided by the consumer of the EFI DHCPv6 Protocol\r
   instance to intercept events that occurs in the DHCPv6 Information Request\r
   exchange process.\r
 \r
-  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance that \r
+  @param[in]  This              Pointer to the EFI_DHCP6_PROTOCOL instance that\r
                                 is used to configure this  callback function.\r
   @param[in]  Context           Pointer to the context that is initialized in\r
                                 the EFI_DHCP6_PROTOCOL.InfoRequest().\r
@@ -276,10 +270,10 @@ IScsiDhcp6ParseReply (
   EFI_DHCP6_PACKET_OPTION     **OptionList;\r
   ISCSI_ATTEMPT_CONFIG_NVDATA *ConfigData;\r
   UINT16                      ParaLen;\r
\r
+\r
   OptionCount = 0;\r
   BootFileOpt = NULL;\r
-  \r
+\r
   Status      = This->Parse (This, Packet, &OptionCount, NULL);\r
   if (Status != EFI_BUFFER_TOO_SMALL) {\r
     return EFI_NOT_READY;\r
@@ -353,7 +347,7 @@ IScsiDhcp6ParseReply (
     Status = EFI_UNSUPPORTED;\r
     goto Exit;\r
   }\r
-  \r
+\r
   //\r
   // Get iSCSI root path from Boot File Uniform Resource Locator (URL) Option\r
   //\r
@@ -401,14 +395,15 @@ IScsiDoDhcp6 (
   EFI_DHCP6_PACKET_OPTION   *Oro;\r
   EFI_DHCP6_RETRANSMISSION  InfoReqReXmit;\r
   EFI_EVENT                 Timer;\r
-  BOOLEAN                   MediaPresent;\r
+  EFI_STATUS                MediaStatus;\r
 \r
   //\r
   // Check media status before doing DHCP.\r
   //\r
-  MediaPresent = TRUE;\r
-  NetLibDetectMedia (Controller, &MediaPresent);\r
-  if (!MediaPresent) {\r
+  MediaStatus = EFI_SUCCESS;\r
+  NetLibDetectMediaWaitTimeout (Controller, ISCSI_CHECK_MEDIA_GET_DHCP_WAITING_TIME, &MediaStatus);\r
+  if (MediaStatus != EFI_SUCCESS) {\r
+    AsciiPrint ("\n  Error: Could not detect network connection.\n");\r
     return EFI_NO_MEDIA;\r
   }\r
 \r
@@ -523,7 +518,7 @@ ON_EXIT:
 \r
   if (Oro != NULL) {\r
     FreePool (Oro);\r
-  }  \r
+  }\r
 \r
   if (Timer != NULL) {\r
     gBS->CloseEvent (Timer);\r