summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/IScsiDxe
diff options
context:
space:
mode:
authorfanwang2 <fan.wang@intel.com>2015-07-26 08:04:04 +0000
committerjljusten <jljusten@Edk2>2015-07-26 08:04:04 +0000
commit7b0b36063352649c25843d67e79710c2c6f95051 (patch)
tree4da1e5b5eb629092e4d32512f7f23400115bdcf2 /MdeModulePkg/Universal/Network/IScsiDxe
parent42f0586d61bc9c7efa47207b71ac52053484c472 (diff)
downloadedk2-7b0b36063352649c25843d67e79710c2c6f95051.zip
edk2-7b0b36063352649c25843d67e79710c2c6f95051.tar.gz
edk2-7b0b36063352649c25843d67e79710c2c6f95051.tar.bz2
MdeModulePkg: Add old IPv4_DEVICE_PATH support for new IScsiDxe
GatewayIpAddress and SubnetMask do not exist in old IPv4_DEVICE_PATH, this will lead new IScsiDxe to error if IPv4_DEVICE_PATH in system is not updated. Following UEFI2.5 spec of IPv4_DEVICE_PATH do a check before accessing fields only defined in new version, add a judgement here to make old IPv4_DEVICE_PATH and new IScsiDxe can cowork. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: fanwang2 <fan.wang@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> [lersek@redhat.com: rewrapped commit message] Signed-off-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18057 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/IScsiDxe')
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c27
-rw-r--r--MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h7
2 files changed, 24 insertions, 10 deletions
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
index 61c407e..621fbc0 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
@@ -814,15 +814,24 @@ IScsiGetTcpConnDevicePath (
DPathNode->Ipv4.StaticIpAddress =
(BOOLEAN) (!Session->ConfigData.NvData.InitiatorInfoFromDhcp);
- IP4_COPY_ADDRESS (
- &DPathNode->Ipv4.GatewayIpAddress,
- &Session->ConfigData.NvData.Gateway
- );
-
- IP4_COPY_ADDRESS (
- &DPathNode->Ipv4.SubnetMask,
- &Session->ConfigData.NvData.SubnetMask
- );
+ //
+ // Add a judgement here to support previous versions of IPv4_DEVICE_PATH.
+ // In previous versions of IPv4_DEVICE_PATH, GatewayIpAddress and SubnetMask
+ // do not exist.
+ // In new version of IPv4_DEVICE_PATH, structcure length is 27.
+ //
+ if (DevicePathNodeLength (&DPathNode->Ipv4) == IPv4_NODE_LEN_NEW_VERSIONS) {
+
+ IP4_COPY_ADDRESS (
+ &DPathNode->Ipv4.GatewayIpAddress,
+ &Session->ConfigData.NvData.Gateway
+ );
+
+ IP4_COPY_ADDRESS (
+ &DPathNode->Ipv4.SubnetMask,
+ &Session->ConfigData.NvData.SubnetMask
+ );
+ }
break;
}
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h
index 052a90f..0bb7da0 100644
--- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h
+++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.h
@@ -1,7 +1,7 @@
/** @file
Miscellaneous definitions for iSCSI driver.
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2015, 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
@@ -19,6 +19,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
typedef struct _ISCSI_SESSION_CONFIG_DATA ISCSI_SESSION_CONFIG_DATA;
+///
+/// IPv4 Device Path Node Length
+///
+#define IPv4_NODE_LEN_NEW_VERSIONS 27
+
#pragma pack(1)
typedef struct {
BOOLEAN Enabled;