Thanks Saloni. PR for getting this merged is available at 
https://github.com/tianocore/edk2/pull/5150

Thanks
Ashish

________________________________
From: Kasbekar, Saloni <saloni.kasbe...@intel.com>
Sent: Saturday, January 6, 2024 1:31 AM
To: Ashish Singhal <ashishsin...@nvidia.com>; devel@edk2.groups.io 
<devel@edk2.groups.io>; Clark-williams, Zachary 
<zachary.clark-willi...@intel.com>; Jeff Brasen <jbra...@nvidia.com>
Subject: RE: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default

External email: Use caution opening links or attachments


Yes, SetData does reset the previous configuration.



Reviewed-by: Saloni Kasbekar <saloni.kasbe...@intel.com>



Thanks,

Saloni



From: Ashish Singhal <ashishsin...@nvidia.com>
Sent: Friday, January 5, 2024 2:34 AM
To: Kasbekar, Saloni <saloni.kasbe...@intel.com>; devel@edk2.groups.io; 
Clark-williams, Zachary <zachary.clark-willi...@intel.com>; Jeff Brasen 
<jbra...@nvidia.com>
Subject: Re: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default



I do not recommend doing that. Setting policy via SetData does enough to wipe 
out any previous manual configuration and that is the goal for reset to default.

________________________________

From: Kasbekar, Saloni 
<saloni.kasbe...@intel.com<mailto:saloni.kasbe...@intel.com>>
Sent: Friday, January 5, 2024 2:30 AM
To: Ashish Singhal <ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
<devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Clark-williams, Zachary 
<zachary.clark-willi...@intel.com<mailto:zachary.clark-willi...@intel.com>>; 
Jeff Brasen <jbra...@nvidia.com<mailto:jbra...@nvidia.com>>
Subject: RE: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default



External email: Use caution opening links or attachments



Makes sense. Should we also set IfrNvData->DhcpEnable = TRUE when updating the 
Policy then?



From: Ashish Singhal <ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>
Sent: Wednesday, January 3, 2024 8:52 AM
To: Kasbekar, Saloni 
<saloni.kasbe...@intel.com<mailto:saloni.kasbe...@intel.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Clark-williams, Zachary 
<zachary.clark-willi...@intel.com<mailto:zachary.clark-willi...@intel.com>>; 
Jeff Brasen <jbra...@nvidia.com<mailto:jbra...@nvidia.com>>
Subject: Re: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default



Hello Saloni,



Thanks for the feedback. After the reset, or when we disable configure from 
menu, GetData returns policy to static as the enum value is 0. However, setting 
value as static does not have any benefit as it forces to reuse the old network 
settings. Using DHCP really mimics the reset behavior that we see without any 
configuration done manually.



Thanks

Ashish



________________________________

From: Kasbekar, Saloni 
<saloni.kasbe...@intel.com<mailto:saloni.kasbe...@intel.com>>
Sent: Tuesday, January 2, 2024 1:47 PM
To: Ashish Singhal <ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
<devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Clark-williams, Zachary 
<zachary.clark-willi...@intel.com<mailto:zachary.clark-willi...@intel.com>>; 
Jeff Brasen <jbra...@nvidia.com<mailto:jbra...@nvidia.com>>
Subject: RE: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default



External email: Use caution opening links or attachments



Hi Ashish,



+    Ip4NvData->Policy = Ip4Config2PolicyDhcp;

+    Status            = Ip4Cfg2->SetData (

+                                   Ip4Cfg2,

+                                   Ip4Config2DataTypePolicy,

+                                   sizeof (EFI_IP4_CONFIG2_POLICY),

+                                   &Ip4NvData->Policy

+                                   );



Here we’re assuming IfrFormNvData->DhcpEnable is TRUE. Should we check it 
before setting the policy and calling SetData()?



Thanks,

Saloni





From: Ashish Singhal <ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>
Sent: Monday, January 1, 2024 8:48 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Kasbekar, Saloni 
<saloni.kasbe...@intel.com<mailto:saloni.kasbe...@intel.com>>; Clark-williams, 
Zachary 
<zachary.clark-willi...@intel.com<mailto:zachary.clark-willi...@intel.com>>; 
Jeff Brasen <jbra...@nvidia.com<mailto:jbra...@nvidia.com>>
Subject: Re: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default



Hello,



Checking again for some feedback on this.



Thanks

Ashish



________________________________

From: Ashish Singhal <ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>
Sent: Thursday, December 14, 2023 4:42 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
<devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; 
saloni.kasbe...@intel.com<mailto:saloni.kasbe...@intel.com> 
<saloni.kasbe...@intel.com<mailto:saloni.kasbe...@intel.com>>; 
zachary.clark-willi...@intel.com<mailto:zachary.clark-willi...@intel.com> 
<zachary.clark-willi...@intel.com<mailto:zachary.clark-willi...@intel.com>>; 
Jeff Brasen <jbra...@nvidia.com<mailto:jbra...@nvidia.com>>
Cc: Ashish Singhal <ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>
Subject: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default



Exercising reset to default does not reset the settings.
Add handler code for the case where configuration is
disabled.

Signed-off-by: Ashish Singhal 
<ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>
---
 NetworkPkg/Ip4Dxe/Ip4Config2Nv.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
index e0b6a4d4a9..dac5817b7c 100644
--- a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
+++ b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
@@ -586,6 +586,31 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
   }

   if (IfrFormNvData->Configure != TRUE) {
+    if (Ip4NvData->DnsAddress != NULL) {
+      FreePool (Ip4NvData->DnsAddress);
+      Ip4NvData->DnsAddress      = NULL;
+      Ip4NvData->DnsAddressCount = 0;
+    }
+
+    if (Ip4NvData->GatewayAddress != NULL) {
+      FreePool (Ip4NvData->GatewayAddress);
+      Ip4NvData->GatewayAddress      = NULL;
+      Ip4NvData->GatewayAddressCount = 0;
+    }
+
+    if (Ip4NvData->ManualAddress != NULL) {
+      FreePool (Ip4NvData->ManualAddress);
+      Ip4NvData->ManualAddress      = NULL;
+      Ip4NvData->ManualAddressCount = 0;
+    }
+
+    Ip4NvData->Policy = Ip4Config2PolicyDhcp;
+    Status            = Ip4Cfg2->SetData (
+                                   Ip4Cfg2,
+                                   Ip4Config2DataTypePolicy,
+                                   sizeof (EFI_IP4_CONFIG2_POLICY),
+                                   &Ip4NvData->Policy
+                                   );
     return EFI_SUCCESS;
   }

--
2.17.1

Hello,

Hello Saloni,

Thanks


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113322): https://edk2.groups.io/g/devel/message/113322
Mute This Topic: https://groups.io/mt/103181314/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to