From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id D541F7803CD for ; Thu, 14 Dec 2023 23:42:48 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cCo/hvRSjAzH2a2/6hv0HZOaj0gzvK4DGupLRAUk+Dk=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1702597367; v=1; b=Qm/CSuW6zn4Oh02K1sqTqPn0V1HM2ULBIXvCJ0gZrKVE9xmMe6Eu5/ktypf6oALm3sfBGHsq ELBDknPoTctdPe4pGbSZ2N1jdhkbb7rNmCzwBsUGHAwmVY9JF2maUSlL5QtK802QvqgLQPtVGYW RTjYnM7k4YW4Rd51X2D1pQi0= X-Received: by 127.0.0.2 with SMTP id lzD2YY7687511xl94gQqsrEZ; Thu, 14 Dec 2023 15:42:47 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.79]) by mx.groups.io with SMTP id smtpd.web11.45339.1702597366809552047 for ; Thu, 14 Dec 2023 15:42:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qiis0FaltzTSZCNPHJ2L96Vgo/TZyEXbXlUBapP6E//e4214pu/OS4G2HNigKBlXHuP1uYLvawT7bs4zMdyw/UtwJEYm2uuCrBz35R4YcIhrkrPqrv9Osp+4QlOgrXTihsSYS0kih+pG+0jOTLtewG1sKhPr+V0kTNwIwKpz9LXoIgXH/3iRjLaFDX0ZztonC4wzneuyMGEzjvOCQ19ZRYK/zFjmkC/aezbqun1sIMASqW+1ghq8L4kEymW75eS1fbR4v5rGwONkqb5Aizfhtn97ROEhgFNjh7slKlD5YT4QhBx1Os/oLnEtVsAtNHdySi13Khbmn2oxxWSRNKXzlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZeKqaC+VAydDXDrVSN13FPDHB3RXQOq7HzduJF2K7jw=; b=b6bJ6qtOwhkim3bPb9g6VwOhwmyY2DF1dyoLkaojNvyyqB1DunlnQQFg8PJTbbbOG3O8usmmkDA6hZb2yf3Xt72WIb/ZdFnCX3gXX1SGUsWlNIr303d/S21HyvxhuAB+4/ugYpUxuXEJ1gzvbKX9YVFBQV0eVJUytzRa5ytviXVUp4eNpb988YyDG44qZzuc9BATHe7IRl5qc921j/LCJdOJ9WiQeFrxzbPXCD+MkvQHR7wKh0xD8cyB4byRH3BT5v5soPC6K1WujkP9JNqWOOXCNOI29yam/f78hUhCIRXhlxiZesOXP58I7SvQx2UNq6MudydprPEWndl+5gkZEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) X-Received: from BL1PR13CA0422.namprd13.prod.outlook.com (2603:10b6:208:2c3::7) by SA1PR12MB7102.namprd12.prod.outlook.com (2603:10b6:806:29f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.28; Thu, 14 Dec 2023 23:42:43 +0000 X-Received: from BL02EPF0001A102.namprd05.prod.outlook.com (2603:10b6:208:2c3:cafe::ee) by BL1PR13CA0422.outlook.office365.com (2603:10b6:208:2c3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.10 via Frontend Transport; Thu, 14 Dec 2023 23:42:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.160) by BL02EPF0001A102.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Thu, 14 Dec 2023 23:42:43 +0000 X-Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 14 Dec 2023 15:42:25 -0800 X-Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 14 Dec 2023 15:42:25 -0800 X-Received: from ashishsingha-lnx.nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Thu, 14 Dec 2023 15:42:24 -0800 From: "Ashish Singhal via groups.io" To: , , , CC: Ashish Singhal Subject: [edk2-devel] [PATCH] NetworkPkg/Ip4Dxe: Fix Reset To Default Date: Thu, 14 Dec 2023 16:42:18 -0700 Message-ID: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A102:EE_|SA1PR12MB7102:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a558518-ca07-42e0-c8ca-08dbfcfe5e08 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Ti2Rcg5MER8MmvAl6WsQ+P3h+xcMrDE2LCrdBy15UGCyEb2rrYC6cT10vV4g16D9prTwvGL/VEOtIuvZ0q87YSf6TqckcwzBQ1gflaxYhlmumR5aQRrBKRERY6Mv8FXI3d5+5qRUZmBc2oFRkr0BT42zXr81SQRWyMaEELi5YBwcVfoKusCXHWQyyUztT3N0lIzOY1AYLLdWqExqVUUT7K/rvYqEIR2oOg4dTxEKCILJ0zqCLoBEzlIobauBe3r5LxewkvmyBhJCkwTiXPZIaYcZup6EwlzDSeqWcgct78Bhf+aMSGnnZgAUjJ1nUn7Z90RsK4y4cj3UvXM3Hr9nB/ea6IOgQJcKluv0NYlcqJBtvJPuOAVZPKrZF3DEIxvDOklT9ers/A5nNBkd3Q8F040/i5bFpN4KLfONnDbNfulylhYC8VYuGFTcjrQo3nf/68Gjoo1EzfagY521aLOyHO/u0PrNxvvq/dIAVzbHKnqbl+6bPsO64R2FHkgEbR7f7Z9aDfhT/eaqeI4ILgOQvQdjkxzC/Hv9ByRRbvqAIf2jvy2+O0+nm2syItzL1Pn9lBGIvx1ZE5AAbPqV0pzAFXN6zkO5wEy8L583LJr4paRFXJBztEzvUFKKcmAmNL92YxzpUpUy4QM0h1DNSsdZivlLHT6fs6n9hCEy8caYRtnz6zxBP0v9J0ICZhfNsU8ZtmOmPFcXqftxUve3IfLKaIDFTJdRiOXjBN1WelLpP9k= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 23:42:43.0708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a558518-ca07-42e0-c8ca-08dbfcfe5e08 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A102.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7102 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashishsingha@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: IUnWxrypFX0pd2kcX3hMEibCx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="Qm/CSuW6"; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Exercising reset to default does not reset the settings. Add handler code for the case where configuration is disabled. Signed-off-by: Ashish Singhal --- NetworkPkg/Ip4Dxe/Ip4Config2Nv.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c b/NetworkPkg/Ip4Dxe/Ip4Config= 2Nv.c index e0b6a4d4a9..dac5817b7c 100644 --- a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c +++ b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c @@ -586,6 +586,31 @@ Ip4Config2ConvertIfrNvDataToConfigNvData ( } =20 if (IfrFormNvData->Configure !=3D TRUE) { + if (Ip4NvData->DnsAddress !=3D NULL) { + FreePool (Ip4NvData->DnsAddress); + Ip4NvData->DnsAddress =3D NULL; + Ip4NvData->DnsAddressCount =3D 0; + } + + if (Ip4NvData->GatewayAddress !=3D NULL) { + FreePool (Ip4NvData->GatewayAddress); + Ip4NvData->GatewayAddress =3D NULL; + Ip4NvData->GatewayAddressCount =3D 0; + } + + if (Ip4NvData->ManualAddress !=3D NULL) { + FreePool (Ip4NvData->ManualAddress); + Ip4NvData->ManualAddress =3D NULL; + Ip4NvData->ManualAddressCount =3D 0; + } + + Ip4NvData->Policy =3D Ip4Config2PolicyDhcp; + Status =3D Ip4Cfg2->SetData ( + Ip4Cfg2, + Ip4Config2DataTypePolicy, + sizeof (EFI_IP4_CONFIG2_POLICY), + &Ip4NvData->Policy + ); return EFI_SUCCESS; } =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112572): https://edk2.groups.io/g/devel/message/112572 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-