From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id ACFD6220D4BE3 for ; Tue, 14 Nov 2017 21:52:37 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Nov 2017 21:56:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,398,1505804400"; d="scan'208";a="2808162" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 14 Nov 2017 21:56:45 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 14 Nov 2017 21:56:45 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 14 Nov 2017 21:56:45 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Wed, 15 Nov 2017 13:56:13 +0800 From: "Wu, Jiaxin" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" Thread-Topic: [Patch V2] NetworkPkg: Print error message to screen if error occurs during HTTP boot. Thread-Index: AQHTXbRVVyb/dkV55kK/d4sjY+pgSqMU8XHw Date: Wed, 15 Nov 2017 05:56:13 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741634706E@SHSMSX103.ccr.corp.intel.com> References: <20171115015151.16588-1-siyuan.fu@intel.com> In-Reply-To: <20171115015151.16588-1-siyuan.fu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODJjODczNDAtMDM0NC00MjY1LWJhNDgtNGM0NTUzMWJmMDg0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InhRcDZadFBOWnBOTDdDUmlvN1BwYWxOK1VFNUhUSFJZTHRFM1VIa09VcWM9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch V2] NetworkPkg: Print error message to screen if error occurs during HTTP boot. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Nov 2017 05:52:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin > -----Original Message----- > From: Fu, Siyuan > Sent: Wednesday, November 15, 2017 9:52 AM > To: edk2-devel@lists.01.org > Cc: Wu, Jiaxin ; Ye, Ting > Subject: [Patch V2] NetworkPkg: Print error message to screen if error oc= curs > during HTTP boot. >=20 > V2 update: > Add error message is URI address is not correct. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan > Cc: Wu Jiaxin > Cc: Ye Ting > --- > NetworkPkg/HttpBootDxe/HttpBootImpl.c | 21 > +++++++++++++++++++++ > NetworkPkg/HttpBootDxe/HttpBootSupport.c | 2 ++ > NetworkPkg/HttpDxe/HttpImpl.c | 1 + > 3 files changed, 24 insertions(+) >=20 > diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c > b/NetworkPkg/HttpBootDxe/HttpBootImpl.c > index 06a8a6a..d591db5 100644 > --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c > +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c > @@ -327,6 +327,7 @@ HttpBootLoadFile ( > // > Status =3D HttpBootDiscoverBootInfo (Private); > if (EFI_ERROR (Status)) { > + AsciiPrint ("\n Error: Could not discover the boot information fo= r DHCP > server.\n"); > goto ON_EXIT; > } > } > @@ -369,6 +370,7 @@ HttpBootLoadFile ( > &Private->ImageType > ); > if (EFI_ERROR (Status) && Status !=3D EFI_BUFFER_TOO_SMALL) { > + AsciiPrint ("\n Error: Could not retrieve NBP file size from HT= TP > server.\n"); > goto ON_EXIT; > } > } > @@ -394,6 +396,22 @@ HttpBootLoadFile ( >=20 > ON_EXIT: > HttpBootUninstallCallback (Private); > + > + if (Status =3D=3D EFI_ACCESS_DENIED) { > + AsciiPrint ("\n Error: Could not establish connection with HTTP ser= ver.\n"); > + } else if (Status =3D=3D EFI_BUFFER_TOO_SMALL && Buffer !=3D NULL) { > + AsciiPrint ("\n Error: Buffer size is smaller than the requested fi= le.\n"); > + } else if (Status =3D=3D EFI_OUT_OF_RESOURCES) { > + AsciiPrint ("\n Error: Could not allocate I/O buffers.\n"); > + } else if (Status =3D=3D EFI_DEVICE_ERROR) { > + AsciiPrint ("\n Error: Network device error.\n"); > + } else if (Status =3D=3D EFI_TIMEOUT) { > + AsciiPrint ("\n Error: Server response timeout.\n"); > + } else if (Status =3D=3D EFI_ABORTED) { > + AsciiPrint ("\n Error: Remote boot cancelled.\n"); > + } else if (Status !=3D EFI_BUFFER_TOO_SMALL) { > + AsciiPrint ("\n Error: Unexpected network error.\n"); > + } > return Status; > } >=20 > @@ -555,6 +573,7 @@ HttpBootDxeLoadFile ( > MediaPresent =3D TRUE; > NetLibDetectMedia (Private->Controller, &MediaPresent); > if (!MediaPresent) { > + AsciiPrint ("\n Error: Could not detect network connection.\n"); > return EFI_NO_MEDIA; > } >=20 > @@ -595,6 +614,8 @@ HttpBootDxeLoadFile ( > Status =3D HttpBootRegisterRamDisk (Private, *BufferSize, Buffer, > ImageType); > if (!EFI_ERROR (Status)) { > Status =3D EFI_WARN_FILE_SYSTEM; > + } else { > + AsciiPrint ("\n Error: Could not register RAM disk to the system.= \n"); > } > } >=20 > diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c > b/NetworkPkg/HttpBootDxe/HttpBootSupport.c > index d508e2c..7ca48f3 100644 > --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c > +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c > @@ -1093,6 +1093,7 @@ HttpBootCheckUriScheme ( > // Return EFI_INVALID_PARAMETER if the URI is not HTTP or HTTPS. > // > if ((AsciiStrnCmp (Uri, "http://", 7) !=3D 0) && (AsciiStrnCmp (Uri, "= https://", > 8) !=3D 0)) { > + AsciiPrint ("\n Error: Invalid URI address.\n"); > DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: Invalid Uri.\n")); > return EFI_INVALID_PARAMETER; > } > @@ -1101,6 +1102,7 @@ HttpBootCheckUriScheme ( > // HTTP is disabled, return EFI_ACCESS_DENIED if the URI is HTTP. > // > if (!PcdGetBool (PcdAllowHttpConnections) && (AsciiStrnCmp (Uri, > "http://", 7) =3D=3D 0)) { > + AsciiPrint ("\n Error: Access forbidden, only HTTPS connection is > allowed.\n"); > DEBUG ((EFI_D_ERROR, "HttpBootCheckUriScheme: HTTP is disabled.\n"))= ; > return EFI_ACCESS_DENIED; > } > diff --git a/NetworkPkg/HttpDxe/HttpImpl.c > b/NetworkPkg/HttpDxe/HttpImpl.c > index 46d0323..57fa39f 100644 > --- a/NetworkPkg/HttpDxe/HttpImpl.c > +++ b/NetworkPkg/HttpDxe/HttpImpl.c > @@ -523,6 +523,7 @@ EfiHttpRequest ( >=20 > FreePool (HostNameStr); > if (EFI_ERROR (Status)) { > + DEBUG ((EFI_D_ERROR, "Error: Could not retrieve the host address > from DNS server.\n")); > goto Error1; > } > } > -- > 1.9.5.msysgit.1