]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/IScsiDxe/IScsiConfig.c
NetworkPkg: Check whether the iSCSI initiator name is null.
[mirror_edk2.git] / NetworkPkg / IScsiDxe / IScsiConfig.c
index c6b48c651bbf28f13a43c97b32faf8e200abc1f8..5cb11572bb75ff57a57787cbd9024c23ae1f4a4f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Helper functions for configuring or getting the parameters relating to iSCSI.\r
 \r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, 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
@@ -2160,6 +2160,25 @@ IScsiFormCallback (
   if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
     switch (QuestionId) {\r
     case KEY_ADD_ATTEMPT:\r
+      //\r
+      // Check whether iSCSI initiator name is configured already.\r
+      //\r
+      mPrivate->InitiatorNameLength = ISCSI_NAME_MAX_SIZE;\r
+      Status = gIScsiInitiatorName.Get (\r
+                                     &gIScsiInitiatorName,\r
+                                     &mPrivate->InitiatorNameLength,\r
+                                     mPrivate->InitiatorName\r
+                                     );\r
+      if (EFI_ERROR (Status)) {\r
+        CreatePopUp (\r
+          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+          &Key,\r
+          L"Error: please configure iSCSI initiator name first!",\r
+          NULL\r
+          );        \r
+        break;\r
+      }\r
+      \r
       Status = IScsiConfigAddAttempt ();\r
       break;\r
 \r