[edk2] [Patch v3 2/3] NetworkPkg/IScsiDxe: Clean the previous ConfigData when switching the IP mode.

Jiaxin Wu posted 3 patches 7 years, 2 months ago
[edk2] [Patch v3 2/3] NetworkPkg/IScsiDxe: Clean the previous ConfigData when switching the IP mode.
Posted by Jiaxin Wu 7 years, 2 months ago
Cc: Karunakar P <karunakarp@amiindia.co.in>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 52e51d6..f20f590 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -3590,13 +3590,20 @@ IScsiFormCallback (
 
     case KEY_IP_MODE:
       switch (Value->u8) {
       case IP_MODE_IP6:
       case IP_MODE_IP4:
+        ZeroMem (IfrNvData->LocalIp, sizeof (IfrNvData->LocalIp));
+        ZeroMem (IfrNvData->SubnetMask, sizeof (IfrNvData->SubnetMask));
+        ZeroMem (IfrNvData->Gateway, sizeof (IfrNvData->Gateway));
         ZeroMem (IfrNvData->TargetIp, sizeof (IfrNvData->TargetIp));
         Private->Current->AutoConfigureMode = 0;
-
+        ZeroMem (&Private->Current->SessionConfigData.LocalIp, sizeof (EFI_IP_ADDRESS));
+        ZeroMem (&Private->Current->SessionConfigData.SubnetMask, sizeof (EFI_IPv4_ADDRESS));
+        ZeroMem (&Private->Current->SessionConfigData.Gateway, sizeof (EFI_IP_ADDRESS));
+        ZeroMem (&Private->Current->SessionConfigData.TargetIp, sizeof (EFI_IP_ADDRESS));
+        
         break;
       }
 
       break;
 
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel