/** @file\r
Miscellaneous routines for iSCSI driver.\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
for (Index = 0; Index < 4; Index++) {\r
\r
if ((Lun[2 * Index] | Lun[2 * Index + 1]) == 0) {\r
- StrCpy (TempStr, L"0-");\r
+ CopyMem(TempStr, L"0-", sizeof (L"0-"));\r
} else {\r
TempStr[0] = (CHAR16) IScsiHexString[Lun[2 * Index] >> 4];\r
TempStr[1] = (CHAR16) IScsiHexString[Lun[2 * Index] & 0x0F];\r
DPathNode->Ipv4.StaticIpAddress = \r
(BOOLEAN) (!Session->ConfigData.NvData.InitiatorInfoFromDhcp);\r
\r
- IP4_COPY_ADDRESS (\r
- &DPathNode->Ipv4.GatewayIpAddress,\r
- &Session->ConfigData.NvData.Gateway\r
- );\r
+ //\r
+ // Add a judgement here to support previous versions of IPv4_DEVICE_PATH.\r
+ // In previous versions of IPv4_DEVICE_PATH, GatewayIpAddress and SubnetMask\r
+ // do not exist.\r
+ // In new version of IPv4_DEVICE_PATH, structcure length is 27.\r
+ //\r
+ if (DevicePathNodeLength (&DPathNode->Ipv4) == IP4_NODE_LEN_NEW_VERSIONS) { \r
+\r
+ IP4_COPY_ADDRESS (\r
+ &DPathNode->Ipv4.GatewayIpAddress,\r
+ &Session->ConfigData.NvData.Gateway\r
+ );\r
\r
- IP4_COPY_ADDRESS (\r
- &DPathNode->Ipv4.SubnetMask,\r
- &Session->ConfigData.NvData.SubnetMask\r
- );\r
+ IP4_COPY_ADDRESS (\r
+ &DPathNode->Ipv4.SubnetMask,\r
+ &Session->ConfigData.NvData.SubnetMask\r
+ );\r
+ }\r
\r
break;\r
}\r