diff options
author | Zhang, Lubo <lubo.zhang@intel.com> | 2017-03-09 16:17:56 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-03-15 15:02:02 +0800 |
commit | df077b3e07098f252a061d3e0a926f6696d24936 (patch) | |
tree | 7a37023a48dc1a8f80fd85fa500506067b3757bf /NetworkPkg | |
parent | 2d67f2bae32040c77af8097a8ef1be272cb00e28 (diff) | |
download | edk2-df077b3e07098f252a061d3e0a926f6696d24936.zip edk2-df077b3e07098f252a061d3e0a926f6696d24936.tar.gz edk2-df077b3e07098f252a061d3e0a926f6696d24936.tar.bz2 |
NetworkPkg: Fix potential bug if the iSCSI use dns protocol.
Since we use the Attempt and index as the attempt variable name instead of
the MAC address plus index, we need to update this to check the whether
the Controller handle is configured to use DNS protocol
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiMisc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index 7b4044f..2c93590 100644 --- a/NetworkPkg/IScsiDxe/IScsiMisc.c +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c @@ -1778,7 +1778,7 @@ IScsiDhcpIsConfigured ( }
/**
- Check wheather the Controller handle is configured to use DNS protocol.
+ Check whether the Controller handle is configured to use DNS protocol.
@param[in] Controller The handle of the controller.
@@ -1799,6 +1799,7 @@ IScsiDnsIsConfigured ( EFI_MAC_ADDRESS MacAddr;
UINTN HwAddressSize;
UINT16 VlanId;
+ CHAR16 AttemptMacString[ISCSI_MAX_MAC_STRING_LEN];
CHAR16 MacString[ISCSI_MAX_MAC_STRING_LEN];
CHAR16 AttemptName[ISCSI_NAME_IFR_MAX_SIZE];
@@ -1828,10 +1829,10 @@ IScsiDnsIsConfigured ( UnicodeSPrint (
AttemptName,
(UINTN) 128,
- L"%s%d",
- MacString,
+ L"Attempt %d",
(UINTN) AttemptConfigOrder[Index]
);
+
Status = GetVariable2 (
AttemptName,
&gEfiIScsiInitiatorNameProtocolGuid,
@@ -1844,7 +1845,9 @@ IScsiDnsIsConfigured ( ASSERT (AttemptConfigOrder[Index] == AttemptTmp->AttemptConfigIndex);
- if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED) {
+ AsciiStrToUnicodeStrS (AttemptTmp->MacString, AttemptMacString, sizeof (AttemptMacString) / sizeof (AttemptMacString[0]));
+
+ if (AttemptTmp->SessionConfigData.Enabled == ISCSI_DISABLED || StrCmp (MacString, AttemptMacString)) {
FreePool (AttemptTmp);
continue;
}
|