public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Saloni Kasbekar" <saloni.kasbekar@intel.com>
To: Ashish Singhal <ashishsingha@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Clark-williams, Zachary" <zachary.clark-williams@intel.com>,
	Jeff Brasen <jbrasen@nvidia.com>
Subject: Re: [edk2-devel] [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default
Date: Tue, 2 Jan 2024 20:47:14 +0000	[thread overview]
Message-ID: <BY5PR11MB38613B690221345C87EC3525F161A@BY5PR11MB3861.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BY5PR12MB554486CA83CC10DA0FFFAF65BA62A@BY5PR12MB5544.namprd12.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 3649 bytes --]

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 <ashishsingha@nvidia.com>
Sent: Monday, January 1, 2024 8:48 AM
To: devel@edk2.groups.io; Kasbekar, Saloni <saloni.kasbekar@intel.com>; Clark-williams, Zachary <zachary.clark-williams@intel.com>; Jeff Brasen <jbrasen@nvidia.com>
Subject: Re: [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default

Hello,

Checking again for some feedback on this.

Thanks
Ashish

________________________________
From: Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@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.kasbekar@intel.com<mailto:saloni.kasbekar@intel.com> <saloni.kasbekar@intel.com<mailto:saloni.kasbekar@intel.com>>; zachary.clark-williams@intel.com<mailto:zachary.clark-williams@intel.com> <zachary.clark-williams@intel.com<mailto:zachary.clark-williams@intel.com>>; Jeff Brasen <jbrasen@nvidia.com<mailto:jbrasen@nvidia.com>>
Cc: Ashish Singhal <ashishsingha@nvidia.com<mailto:ashishsingha@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 <ashishsingha@nvidia.com<mailto:ashishsingha@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,


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113041): https://edk2.groups.io/g/devel/message/113041
Mute This Topic: https://groups.io/mt/103181314/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 10769 bytes --]

  reply	other threads:[~2024-01-02 20:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 23:42 [edk2-devel] [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default Ashish Singhal via groups.io
2024-01-01 16:47 ` Ashish Singhal via groups.io
2024-01-02 20:47   ` Saloni Kasbekar [this message]
2024-01-03 16:51     ` Ashish Singhal via groups.io
2024-01-04 21:00       ` Saloni Kasbekar
2024-01-05 10:34         ` Ashish Singhal via groups.io
2024-01-05 20:01           ` Saloni Kasbekar
2024-01-06  0:23             ` Ashish Singhal via groups.io
2024-01-17 14:07               ` Ashish Singhal via groups.io
2024-01-17 17:27                 ` Saloni Kasbekar
2024-01-18 23:27                   ` Michael D Kinney
2024-01-19  1:53                     ` Ashish Singhal via groups.io
2024-01-19  1:54                       ` Ashish Singhal via groups.io
2024-01-19  3:38                         ` Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY5PR11MB38613B690221345C87EC3525F161A@BY5PR11MB3861.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox