NetworkPkg/IScsiDxe/IScsiMisc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
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>
---
NetworkPkg/IScsiDxe/IScsiMisc.c | 11 +++++++----
1 file 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
@@ -1776,11 +1776,11 @@ IScsiDhcpIsConfigured (
FreePool (AttemptConfigOrder);
return FALSE;
}
/**
- 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.
@retval TRUE The handle of the controller need the Dns protocol.
@retval FALSE The handle of the controller does not need the Dns protocol.
@@ -1797,10 +1797,11 @@ IScsiDnsIsConfigured (
UINTN Index;
EFI_STATUS Status;
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];
AttemptConfigOrder = IScsiGetVariableAndSize (
L"AttemptOrder",
@@ -1826,14 +1827,14 @@ IScsiDnsIsConfigured (
for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) {
UnicodeSPrint (
AttemptName,
(UINTN) 128,
- L"%s%d",
- MacString,
+ L"Attempt %d",
(UINTN) AttemptConfigOrder[Index]
);
+
Status = GetVariable2 (
AttemptName,
&gEfiIScsiInitiatorNameProtocolGuid,
(VOID**)&AttemptTmp,
NULL
@@ -1842,11 +1843,13 @@ IScsiDnsIsConfigured (
continue;
}
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;
}
if (AttemptTmp->SessionConfigData.DnsMode) {
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> > -----Original Message----- > From: Zhang, Lubo > Sent: Thursday, March 9, 2017 4:18 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, > Jiaxin <jiaxin.wu@intel.com> > Subject: [patch] 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> > --- > NetworkPkg/IScsiDxe/IScsiMisc.c | 11 +++++++---- > 1 file 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 > @@ -1776,11 +1776,11 @@ IScsiDhcpIsConfigured ( > FreePool (AttemptConfigOrder); > return FALSE; > } > > /** > - 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. > > @retval TRUE The handle of the controller need the Dns protocol. > @retval FALSE The handle of the controller does not need the Dns > protocol. > @@ -1797,10 +1797,11 @@ IScsiDnsIsConfigured ( > UINTN Index; > EFI_STATUS Status; > 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]; > > AttemptConfigOrder = IScsiGetVariableAndSize ( > L"AttemptOrder", > @@ -1826,14 +1827,14 @@ IScsiDnsIsConfigured ( > > for (Index = 0; Index < AttemptConfigOrderSize / sizeof (UINT8); Index++) { > UnicodeSPrint ( > AttemptName, > (UINTN) 128, > - L"%s%d", > - MacString, > + L"Attempt %d", > (UINTN) AttemptConfigOrder[Index] > ); > + > Status = GetVariable2 ( > AttemptName, > &gEfiIScsiInitiatorNameProtocolGuid, > (VOID**)&AttemptTmp, > NULL > @@ -1842,11 +1843,13 @@ IScsiDnsIsConfigured ( > continue; > } > > 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; > } > > if (AttemptTmp->SessionConfigData.DnsMode) { > -- > 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.