]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
Adopt new IPv4/IPv6 device path for network modules.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiProto.c
index 23bda4335809b1df91e74d26ce8773658d80f679..331f9d8d22a5261a6ea151d595f2aa64a0c5d5ee 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   The implementation of iSCSI protocol based on RFC3720.\r
 \r
-Copyright (c) 2004 - 2010, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2011, 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
@@ -302,6 +302,11 @@ IScsiSessionLogin (
     return EFI_NO_MEDIA;\r
   }\r
 \r
+  //\r
+  // Set session identifier\r
+  //\r
+  CopyMem (Session->Isid, Session->ConfigData.NvData.IsId, 6);\r
+\r
   //\r
   // Create a connection for the session.\r
   //\r
@@ -687,6 +692,14 @@ IScsiProcessLoginRsp (
   LoginRsp->MaxCmdSN  = NTOHL (LoginRsp->MaxCmdSN);\r
 \r
   if ((Conn->CurrentStage == ISCSI_SECURITY_NEGOTIATION) && (Conn->CHAPStep == ISCSI_CHAP_INITIAL)) {\r
+    //\r
+    // If the Login Request is a leading Login Request, the target MUST use\r
+    // the value presented in CmdSN as the target value for ExpCmdSN.\r
+    //\r
+    if ((Session->State == SESSION_STATE_FREE) && (Session->CmdSN != LoginRsp->ExpCmdSN)) {\r
+      return EFI_PROTOCOL_ERROR;\r
+    }\r
+\r
     //\r
     // It's the initial Login Response, initialize the local ExpStatSN, MaxCmdSN\r
     // and ExpCmdSN.\r
@@ -2681,21 +2694,10 @@ IScsiSessionInit (
   IN BOOLEAN            Recovery\r
   )\r
 {\r
-  UINT32  Random;\r
-\r
   if (!Recovery) {\r
     Session->Signature  = ISCSI_SESSION_SIGNATURE;\r
     Session->State      = SESSION_STATE_FREE;\r
 \r
-    Random              = NET_RANDOM (NetRandomInitSeed ());\r
-\r
-    Session->Isid[0]    = ISID_BYTE_0;\r
-    Session->Isid[1]    = ISID_BYTE_1;\r
-    Session->Isid[2]    = ISID_BYTE_2;\r
-    Session->Isid[3]    = ISID_BYTE_3;\r
-    Session->Isid[4]    = (UINT8) Random;\r
-    Session->Isid[5]    = (UINT8) (Random >> 8);\r
-\r
     InitializeListHead (&Session->Conns);\r
     InitializeListHead (&Session->TcbList);\r
   }\r