From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from IMSVA.IN.MEGATRENDS.COM (IMSVA.IN.MEGATRENDS.COM [14.98.235.2]) by mx.groups.io with SMTP id smtpd.web12.13171.1597334364584653283 for ; Thu, 13 Aug 2020 08:59:26 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=SPF record not found (domain: amiindia.co.in, ip: 14.98.235.2, mailfrom: sivaramann@amiindia.co.in) Received: from IMSVA.IN.MEGATRENDS.COM (IMSVA.IN.MEGATRENDS.COM [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6A6B82047; Thu, 13 Aug 2020 21:38:03 +0530 (IST) Received: from IMSVA.IN.MEGATRENDS.COM (IMSVA.IN.MEGATRENDS.COM [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DCE382046; Thu, 13 Aug 2020 21:38:03 +0530 (IST) Received: from webmail.amiindia.co.in (venus2.in.megatrends.com [10.0.0.7]) by IMSVA.IN.MEGATRENDS.COM (Postfix) with ESMTPS; Thu, 13 Aug 2020 21:38:03 +0530 (IST) Received: from VENUS1.in.megatrends.com ([fe80::951:7975:6ecf:eae5]) by Venus2.in.megatrends.com ([fe80::2002:4a07:4f17:c09b%14]) with mapi id 14.03.0248.002; Thu, 13 Aug 2020 21:29:18 +0530 From: "Sivaraman Nainar" To: "devel@edk2.groups.io" CC: "liming.gao@intel.com" , "jiaxin.wu@intel.com" Subject: Re: [edk2-devel] [Patch ] Static IP based HTTP Support Thread-Topic: [edk2-devel] [Patch ] Static IP based HTTP Support Thread-Index: AdZxijA8JYBo1e3bS8Wil97qYQElsg== Date: Thu, 13 Aug 2020 15:59:17 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.3.114] MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-ERS: 10.0.0.7-127.5.254.253 X-TM-AS-Product-Ver: IMSVA-9.1.0.1817-8.6.0.1013-25602.000 X-TM-AS-Result: No--27.302-5.0-31-10 X-imss-scan-details: No--27.302-5.0-31-10;No--27.302-5.0-31-10 X-TMASE-Version: IMSVA-9.1.0.1817-8.6.1013-25602.000 X-TMASE-Result: 10--27.302200-10.000000 X-TMASE-MatchedRID: jFqw+1pFnMyPnoiNOctH6S34IE4ZChe2ce/io1zKJlVECRGf4WzgkwSZ 5qOGnBM5dgs5SMUif05O/3/I/qqDG2qLs+uf/K4tx64UvlSkg3EsCc2iFTIxreD3XFrJfgvzY7b tfej9JsJmvsBHIjfhBm9tI2zyG2WT6s9vzsjN66aSvRb8EMdYRQOEln4wHqO8lBIvfA0qYytH5f h+PjKkyYu4hNdqgEVR7QbJzp6OI9S79isbN6HBSuwOy/qtohQhoiKTb964zHWnMb4m7aAqt4ydm by1eQX73BcUES5Ulj/RDgsX03IjN3oO58JrXBYHSHCU59h5KrHAmOfzKotTouIs2fxDr5gAhqJx i9IzezLwrXGvRcVEPSg66hFKLZ11Pk3Ltq0ik9wqsMfMfrOZRULrW+7TQci/fL8fHUCAmuvUS1l JP19jmcKRiXfaKYmpR69NcRAj+73Uu3synNQKJD8Ckw9b/GFeQ8iUCoDj8MSLun01yTNk6+5bKn 8hkYr8qE8PBl4H4BAObt0SH5YPyXT3K3VineCfJ2be3zx+/IUwOZho397SVjs61woVLQQELUReL vdYkFoTMlvPl7zCUtU8UEpS9hR4rtKweE8yi779xyC38S1f/W15iJF8eE6r2pSaXhW9wNjY9WsI cnwuFsv6MCwxKZxR2n9CCGN71i7GKV71XusNlUmSRRbSc9s3qb3/o5s+OcMaVuuTY4OGg3eMMcL 7BX2wWOGJiDeupLqvoC/yQrpICigawIgP9cfl8Otj0KvfR1mSiza26cvwNEFwIhIhpx6TcuMonE kf7PE1pZVQKcZLt80KSMVpCcnMuvDufoyKk2vmp6HAZCXfn30tCKdnhB58r10pknZXGJo0W+uki BuuSB8AKgKWeNGhPlsV5xqJyLjiRhduhvElsqX8y2tPBLhQksu0nweKE+jkFaE70ijxgrPibEAS psuo2wIy4jcXSH9YTLVODODYPQ== X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0-0 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_B4DE137BDB63634BAC03BD9DE765F19702B4B34FECVENUS1inmegat_" --_000_B4DE137BDB63634BAC03BD9DE765F19702B4B34FECVENUS1inmegat_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2888 *** NetworkPkg\HttpBootDxe\HttpBootClient.c 2020-05-07 22:54:46= .000000000 +05-30 --- NetworkPkg\HttpBootDxe\HttpBootClient.c 2020-08-09 21:03:01.000000000 += 05-30 *************** *** 1,6 **** --- 1,13 ---- + //*********************************************************************** + //* * + //* Copyright (c) 1985-2020, American Megatrends International LLC. * + //* * + //* All rights reserved. Subject to AMI licensing agreement. * + //* * + //*********************************************************************** /** @file Implementation of the boot file download function. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent *************** *** 45,57 **** Node->Ipv4.Header.Type =3D MESSAGING_DEVICE_PATH; Node->Ipv4.Header.SubType =3D MSG_IPv4_DP; SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH)); CopyMem (&Node->Ipv4.LocalIpAddress, &Private->StationIp, sizeof (EFI= _IPv4_ADDRESS)); Node->Ipv4.RemotePort =3D Private->Port; Node->Ipv4.Protocol =3D EFI_IP_PROTO_TCP; ! Node->Ipv4.StaticIpAddress =3D FALSE; CopyMem (&Node->Ipv4.GatewayIpAddress, &Private->GatewayIp, sizeof (E= FI_IPv4_ADDRESS)); CopyMem (&Node->Ipv4.SubnetMask, &Private->SubnetMask, sizeof (EFI_IP= v4_ADDRESS)); } else { Node =3D AllocateZeroPool (sizeof (IPv6_DEVICE_PATH)); if (Node =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; --- 52,67 ---- Node->Ipv4.Header.Type =3D MESSAGING_DEVICE_PATH; Node->Ipv4.Header.SubType =3D MSG_IPv4_DP; SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH)); CopyMem (&Node->Ipv4.LocalIpAddress, &Private->StationIp, sizeof (EFI= _IPv4_ADDRESS)); Node->Ipv4.RemotePort =3D Private->Port; Node->Ipv4.Protocol =3D EFI_IP_PROTO_TCP; ! if (Private->UsingStatic) ! Node->Ipv4.StaticIpAddress =3DTRUE; ! else ! Node->Ipv4.StaticIpAddress =3D FALSE; CopyMem (&Node->Ipv4.GatewayIpAddress, &Private->GatewayIp, sizeof (E= FI_IPv4_ADDRESS)); CopyMem (&Node->Ipv4.SubnetMask, &Private->SubnetMask, sizeof (EFI_IP= v4_ADDRESS)); } else { Node =3D AllocateZeroPool (sizeof (IPv6_DEVICE_PATH)); if (Node =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; *************** *** 325,374 **** EFI_DHCP6_PACKET_OPTION *Option; EFI_IPv6_ADDRESS IpAddr; CHAR8 *HostName; UINTN HostNameSize; CHAR16 *HostNameStr; EFI_STATUS Status; ! ASSERT (Private !=3D NULL); ! ASSERT (Private->SelectIndex !=3D 0); ! SelectIndex =3D Private->SelectIndex - 1; ! ASSERT (SelectIndex < HTTP_BOOT_OFFER_MAX_NUM); ! DnsServerIndex =3D 0; Status =3D EFI_SUCCESS; HostName =3D NULL; // // SelectOffer contains the IP address configuration and name server co= nfiguration. // HttpOffer contains the boot file URL. // ! SelectOffer =3D &Private->OfferBuffer[SelectIndex].Dhcp6; ! if (Private->FilePathUri =3D=3D NULL) { ! // ! // In Corporate environment, we need a HttpOffer. ! // ! if ((SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpUri) || ! (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpUriDns) || ! (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpNameUriDns)) { ! HttpOffer =3D SelectOffer; ! } else { ! ASSERT (Private->SelectProxyType !=3D HttpOfferTypeMax); ! ProxyIndex =3D Private->OfferIndex[Private->SelectProxyType][0]; ! HttpOffer =3D &Private->OfferBuffer[ProxyIndex].Dhcp6; ! } ! Private->BootFileUriParser =3D HttpOffer->UriParser; ! Private->BootFileUri =3D (CHAR8*) HttpOffer->OptList[HTTP_BOOT_DHCP6_= IDX_BOOT_FILE_URL]->Data; ! } else { ! // ! // In Home environment the BootFileUri comes from the FilePath. ! // ! Private->BootFileUriParser =3D Private->FilePathUriParser; ! Private->BootFileUri =3D Private->FilePathUri; ! } ! // // Check the URI scheme. // Status =3D HttpBootCheckUriScheme (Private->BootFileUri); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n", Status)); --- 335,397 ---- EFI_DHCP6_PACKET_OPTION *Option; EFI_IPv6_ADDRESS IpAddr; CHAR8 *HostName; UINTN HostNameSize; CHAR16 *HostNameStr; EFI_STATUS Status; ! EFI_IPv6_ADDRESS *Dns; ! UINTN DataSize; ! ASSERT (Private !=3D NULL); ! if (!Private->UsingStatic){ ! ASSERT (Private->SelectIndex !=3D 0); ! SelectIndex =3D Private->SelectIndex - 1; ! ASSERT (SelectIndex < HTTP_BOOT_OFFER_MAX_NUM); ! } DnsServerIndex =3D 0; + DataSize =3D 0; Status =3D EFI_SUCCESS; HostName =3D NULL; + Dns =3D NULL; + if (Private->UsingStatic){ + //Static HttpBoot supports Home Environment Only. + // In Home environment the BootFileUri comes from the FilePath. + // + Private->BootFileUriParser =3D Private->FilePathUriParser; + Private->BootFileUri =3D Private->FilePathUri; + }else{ + Dns =3D NULL; // // SelectOffer contains the IP address configuration and name server co= nfiguration. // HttpOffer contains the boot file URL. // ! SelectOffer =3D &Private->OfferBuffer[SelectIndex].Dhcp6; ! if (Private->FilePathUri =3D=3D NULL ) { ! // ! // In Corporate environment, we need a HttpOffer. ! // ! if ((SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpUri) || ! (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpUriDns) || ! (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpNameUriDns)) = { ! HttpOffer =3D SelectOffer; ! } else { ! ASSERT (Private->SelectProxyType !=3D HttpOfferTypeMax); ! ProxyIndex =3D Private->OfferIndex[Private->SelectProxyType][0]= ; ! HttpOffer =3D &Private->OfferBuffer[ProxyIndex].Dhcp6; ! } ! Private->BootFileUriParser =3D HttpOffer->UriParser; ! Private->BootFileUri =3D (CHAR8*) HttpOffer->OptList[HTTP_BOOT_DH= CP6_IDX_BOOT_FILE_URL]->Data; ! } else { ! // ! // In Home environment the BootFileUri comes from the FilePath. ! // ! Private->BootFileUriParser =3D Private->FilePathUriParser; ! Private->BootFileUri =3D Private->FilePathUri; ! } ! } // // Check the URI scheme. // Status =3D HttpBootCheckUriScheme (Private->BootFileUri); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n", Status)); *************** *** 391,403 **** // // Register the IPv6 gateway address to the network device. // Status =3D HttpBootSetIp6Gateway (Private); if (EFI_ERROR (Status)) { return Status; ! } if ((SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpNameUriDns) || (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpDns) || (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpUriDns)) { Option =3D SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER]; ASSERT (Option !=3D NULL); --- 414,450 ---- // // Register the IPv6 gateway address to the network device. // Status =3D HttpBootSetIp6Gateway (Private); if (EFI_ERROR (Status)) { return Status; ! } ! if (Private->UsingStatic){ ! if( Private->DnsServerIp !=3D NULL ){ ! // ! // Configure the default DNS server if server assigned. ! // ! ! DataSize =3D Private->DnsServerCount * sizeof (EFI_IPv6_ADDRESS= ); ! Dns =3D AllocateZeroPool(DataSize); ! for (DnsServerIndex =3D 0;DnsServerIndex < Private->DnsServerCo= unt;DnsServerIndex++) ! CopyMem(&Dns[DnsServerIndex],&Private->DnsServerIp[DnsServe= rIndex].v6,sizeof(EFI_IPv6_ADDRESS)); ! Status =3D HttpBootSetIp6Dns ( ! Private, ! DataSize, ! Dns ! ); ! FreePool(Dns); ! if (EFI_ERROR (Status)) { ! goto Error; ! } ! } ! ! goto StaticBoot; ! } ! if ((SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpNameUriDns) || (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpDns) || (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpUriDns)) { Option =3D SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER]; ASSERT (Option !=3D NULL); *************** *** 430,441 **** --- 477,489 ---- } // // Extract the HTTP server Ip from URL. This is used to Check route tab= le // whether can send message to HTTP Server Ip through the GateWay. // + StaticBoot: Status =3D HttpUrlGetIp6 ( Private->BootFileUri, Private->BootFileUriParser, &IpAddr ); *************** *** 523,546 **** EFI_STATUS HttpBootDiscoverBootInfo ( IN OUT HTTP_BOOT_PRIVATE_DATA *Private ) { EFI_STATUS Status; // // Start D.O.R.A/S.A.R.R exchange to acquire station ip address and // other Http boot information. // Status =3D HttpBootDhcp (Private); if (EFI_ERROR (Status)) { return Status; } if (!Private->UsingIpv6) { ! Status =3D HttpBootDhcp4ExtractUriInfo (Private); } else { Status =3D HttpBootDhcp6ExtractUriInfo (Private); } return Status; } --- 571,639 ---- EFI_STATUS HttpBootDiscoverBootInfo ( IN OUT HTTP_BOOT_PRIVATE_DATA *Private ) { EFI_STATUS Status; + EFI_IPv4_ADDRESS *Dns; + UINTN DataSize =3D 0; + UINT8 DnsServerIndex =3D 0; + Dns =3D NULL; // // Start D.O.R.A/S.A.R.R exchange to acquire station ip address and // other Http boot information. // Status =3D HttpBootDhcp (Private); if (EFI_ERROR (Status)) { return Status; } if (!Private->UsingIpv6) { ! if (!Private->UsingStatic){ ! Status =3D HttpBootDhcp4ExtractUriInfo (Private); ! } ! else{ ! Private->BootFileUriParser =3D Private->FilePathUriParser; ! Private->BootFileUri =3D Private->FilePathUri; ! ! if (Private->DnsServerIp !=3D NULL){ ! DataSize =3D Private->DnsServerCount * sizeof(EFI_IPv4_ADDRES= S); ! Dns =3D AllocateZeroPool(DataSize); ! for (DnsServerIndex =3D 0;DnsServerIndex < Private->DnsServer= Count;DnsServerIndex++) ! CopyMem(&Dns[DnsServerIndex],&(Private->DnsServerIp[DnsSe= rverIndex].v4),sizeof(EFI_IPv4_ADDRESS)); ! ! Status =3D HttpBootRegisterIp4Dns ( ! Private, ! DataSize, ! Dns ! ); ! ! FreePool (Dns); ! if (EFI_ERROR (Status)) { ! FreePool (Private->DnsServerIp); ! Private->DnsServerIp =3D NULL; ! return Status; ! } ! } ! // ! // Extract the port from URL, and use default HTTP port 80 if not= provided. ! // ! Status =3D HttpUrlGetPort ( ! Private->BootFileUri, ! Private->BootFileUriParser, ! &Private->Port ! ); ! if (EFI_ERROR (Status) || Private->Port =3D=3D 0) { ! Private ->Port =3D 80; ! } ! // ! // Update the device path to include the IP and boot URI informat= ion. ! // ! Status =3D HttpBootUpdateDevicePath (Private); ! } } else { Status =3D HttpBootDhcp6ExtractUriInfo (Private); } return Status; } *** NetworkPkg\HttpBootDxe\HttpBootConfig.c 2020-05-07 22:54:46.= 000000000 +05-30 --- NetworkPkg\HttpBootDxe\HttpBootConfig.c 2020-08-04 15:28:= 06.000000000 +05-30 *************** *** 1,6 **** --- 1,13 ---- + //*********************************************************************** + //* * + //* Copyright (c) 1985-2020, American Megatrends International LLC. * + //* * + //* All rights reserved. Subject to AMI licensing agreement. * + //* * + //*********************************************************************** /** @file Helper functions for configuring or getting the parameters relating to = HTTP Boot. Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent *************** *** 36,72 **** EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; UINTN Length; CHAR8 AsciiUri[URI_STR_MAX_SIZE]; EFI_STATUS Status; UINTN Index; EFI_BOOT_MANAGER_LOAD_OPTION NewOption; ! NewDevicePath =3D NULL; Node =3D NULL; TmpDevicePath =3D NULL; if (StrLen (Description) =3D=3D 0) { return EFI_INVALID_PARAMETER; } // // Convert the scheme to all lower case. // for (Index =3D 0; Index < StrLen (Uri); Index++) { ! if (Uri[Index] =3D=3D L':') { ! break; ! } if (Uri[Index] >=3D L'A' && Uri[Index] <=3D L'Z') { Uri[Index] -=3D (CHAR16)(L'A' - L'a'); } } // ! // Only accept empty URI, or http and https URI. // ! if ((StrLen (Uri) !=3D 0) && (StrnCmp (Uri, L"http://", 7) !=3D 0) && (= StrnCmp (Uri, L"https://", 8) !=3D 0)) { return EFI_INVALID_PARAMETER; } // // Create a new device path by appending the IP node and URI node to // the driver's parent device path --- 43,93 ---- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; UINTN Length; CHAR8 AsciiUri[URI_STR_MAX_SIZE]; EFI_STATUS Status; UINTN Index; EFI_BOOT_MANAGER_LOAD_OPTION NewOption; ! EFI_IP_ADDRESS LocalIp; ! EFI_IP_ADDRESS SubnetMask; ! EFI_IP_ADDRESS GatewayIp; ! CHAR16 DebugString[URI_STR_MAX_SIZE]; ! CHAR8 *AsciiUri2; ! ! AsciiUri2 =3D NULL; NewDevicePath =3D NULL; Node =3D NULL; TmpDevicePath =3D NULL; if (StrLen (Description) =3D=3D 0) { return EFI_INVALID_PARAMETER; } // // Convert the scheme to all lower case. // for (Index =3D 0; Index < StrLen (Uri); Index++) { ! if (Uri[Index] =3D=3D L'/' && Uri[Index + 1] =3D=3D L'/') { ! break; ! } ! if (Uri[Index] >=3D L'A' && Uri[Index] <=3D L'Z') { Uri[Index] -=3D (CHAR16)(L'A' - L'a'); } } // ! // Only accept empty URI, or http , https URI and Static URI. // ! ! if ((StrLen (Uri) !=3D 0) && StrStr(Uri,L"static")){ ! Private->UsingStatic =3D TRUE; ! } ! else{ ! Private->UsingStatic =3D FALSE; ! } ! if ((StrLen (Uri) !=3D 0) && (StrnCmp (Uri, L"http://", 7) !=3D 0) && (= StrnCmp (Uri, L"https://", 8) !=3D 0)&& EFI_ERROR(HttpBootCheckStaticUri(Ur= i)) { return EFI_INVALID_PARAMETER; } // // Create a new device path by appending the IP node and URI node to // the driver's parent device path *************** *** 77,107 **** --- 98,159 ---- Status =3D EFI_OUT_OF_RESOURCES; goto ON_EXIT; } Node->Ipv4.Header.Type =3D MESSAGING_DEVICE_PATH; Node->Ipv4.Header.SubType =3D MSG_IPv4_DP; SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH)); + if (Private->UsingStatic){ + Status =3D VerifyIpv4Address(Uri,&LocalIp,&SubnetMask,&GatewayIp,= DebugString); + if (EFI_ERROR(Status)) + return Status; + CopyMem (&Node->Ipv4.LocalIpAddress, &LocalIp.v4, sizeof (EFI_IPv= 4_ADDRESS)); + Node->Ipv4.RemotePort =3D Private->Port; + Node->Ipv4.Protocol =3D EFI_IP_PROTO_TCP; + Node->Ipv4.StaticIpAddress =3D TRUE; + CopyMem (&Node->Ipv4.GatewayIpAddress, &GatewayIp.v4, sizeof (EFI= _IPv4_ADDRESS)); + CopyMem (&Node->Ipv4.SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4= _ADDRESS)); + } } else { Node =3D AllocateZeroPool (sizeof (IPv6_DEVICE_PATH)); if (Node =3D=3D NULL) { Status =3D EFI_OUT_OF_RESOURCES; goto ON_EXIT; } Node->Ipv6.Header.Type =3D MESSAGING_DEVICE_PATH; Node->Ipv6.Header.SubType =3D MSG_IPv6_DP; SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH)); + if (Private->UsingStatic){ + Status =3D VerifyIpv6Address (Uri,&LocalIp,&GatewayIp,DebugString= ); + if (EFI_ERROR(Status)) + return Status; + Node->Ipv6.PrefixLength =3D IP6_PREFIX_LENGTH; + Node->Ipv6.RemotePort =3D Private->Port; + Node->Ipv6.Protocol =3D EFI_IP_PROTO_TCP; + Node->Ipv6.IpAddressOrigin =3D 0x03; + CopyMem (&Node->Ipv6.LocalIpAddress, &LocalIp.v6 , sizeof (EFI_IP= v6_ADDRESS)); + CopyMem (&Node->Ipv6.GatewayIpAddress, &GatewayIp.v6, sizeof (EFI= _IPv6_ADDRESS)); + } } TmpDevicePath =3D AppendDevicePathNode (Private->ParentDevicePath, (EFI= _DEVICE_PATH_PROTOCOL*) Node); FreePool (Node); if (TmpDevicePath =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } // // Update the URI node with the input boot file URI. // UnicodeStrToAsciiStrS (Uri, AsciiUri, sizeof (AsciiUri)); + //Extract Bootfile uri from Static Uri. + if ((Private->UsingStatic && (AsciiStrStr(AsciiUri,"dns") =3D=3D NULL)= )||( AsciiStrStr(AsciiUri,"dhcp"))){ + AsciiUri2 =3D AsciiStrStr (AsciiUri ,"http"); + if (AsciiUri2 !=3D NULL){ + for (Index =3D0;AsciiUri2[Index] !=3D ')' && AsciiUri2[Index] != =3D '\0' ;Index++); + AsciiUri2[Index] =3D '\0'; + AsciiStrCpy(AsciiUri,AsciiUri2); + } + } Length =3D sizeof (EFI_DEVICE_PATH_PROTOCOL) + AsciiStrSize (AsciiUri); Node =3D AllocatePool (Length); if (Node =3D=3D NULL) { Status =3D EFI_OUT_OF_RESOURCES; FreePool (TmpDevicePath); goto ON_EXIT; *************** *** 483,494 **** --- 535,551 ---- return EFI_OUT_OF_RESOURCES; } UnicodeStrToAsciiStrS (Uri, AsciiUri, UriLen); Status =3D HttpBootCheckUriScheme (AsciiUri); + if (Status =3D=3D EFI_INVALID_PARAMETER){ + Status =3D HttpBootCheckStaticUri(Uri); + if (Status =3D=3D EFI_UNSUPPORTED) + return EFI_INVALID_PARAMETER; + } if (Status =3D=3D EFI_INVALID_PARAMETER) { DEBUG ((EFI_D_ERROR, "HttpBootFormCallback: %r.\n", Status)); CreatePopUp ( *** NetworkPkg\HttpBootDxe\HttpBootDxe.h 2020-05-07 22:54:46.000000000 +05-= 30 --- NetworkPkg\HttpBootDxe\HttpBootDxe.h 2020-08-09 21:00:21.000000000 +0= 5-30 *************** *** 1,6 **** --- 1,13 ---- + //*********************************************************************** + //* * + //* Copyright (c) 1985-2020, American Megatrends International LLC. * + //* * + //* All rights reserved. Subject to AMI licensing agreement. * + //* * + //*********************************************************************** /** @file UEFI HTTP boot driver's private data structure and interfaces declarati= on. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent *************** *** 254,265 **** --- 261,273 ---- UINT32 SelectIndex; UINT32 SelectProxyType; HTTP_BOOT_DHCP_PACKET_CACHE OfferBuffer[HTTP_BOOT_OFFER_M= AX_NUM]; UINT32 OfferNum; UINT32 OfferCount[HttpOfferTypeMax]; UINT32 OfferIndex[HttpOfferTypeMax][= HTTP_BOOT_OFFER_MAX_NUM]; + BOOLEAN UsingStatic; }; #define HTTP_BOOT_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'B',= 'P', 'D') #define HTTP_BOOT_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('H', 'B',= 'V', 'N') #define HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE(a) CR (a, HTTP_BOOT_PRIVAT= E_DATA, LoadFile, HTTP_BOOT_PRIVATE_DATA_SIGNATURE) #define HTTP_BOOT_PRIVATE_DATA_FROM_ID(a) CR (a, HTTP_BOOT_PRIVAT= E_DATA, Id, HTTP_BOOT_PRIVATE_DATA_SIGNATURE) *************** *** 518,524 **** --- 526,665 ---- HttpBootIp6DxeDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL ); + /** + Configure Static Ip Address using Ipconfig2 Protocol + + @param[in] Private Pointer to HTTP boot driver private dat= a. + **/ + EFI_STATUS + StaticHttpBoot(HTTP_BOOT_PRIVATE_DATA *Private); + /** + Get the IPv4 Address and Ipv6 Address from the Input Devicepath. + + + @param[in] FilePath Pointer to the device path which contains= IPV4 and IPV6 path node. + + @retval EFI_SUCCESS The IPV4 Address and IPV6 Address succes= sfully assigned to Private variable + EFI_INVALID_PARAMETER If FilePath is Null + EFI_NOT_FOUND If IPV4Address can't be found + **/ + EFI_STATUS + HttpBootParseIpAddress ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN HTTP_BOOT_PRIVATE_DATA *Private + ); + /****** + Get the IPv6Address,GatewayIp6Address using Http Uri given by user, + IPV6(LocalIp6Address,Tcp,static or dhcp,gatewayip6Address)/Dns(IP1,IP2,= ...,IPn)/Uri(_http://DomainName/xxx.efi) + + @param[in] Buffer URI string of the boot file. + @param[out] LocalIp Ipv6 LocalIp Address is updated sta= tically based on Uri + @param[out] GatewayIp Ipv6 GatewayIp is updated statical= ly based on Uri + @Param[out] String The Error Message. + + @retval EFI_SUCCESS IP Address is translated from Strin= g. + @retval EFI_INVALID_PARAMETER Url is not supported= http and https + EFI_UNSUPPORTED If IP Address is Invalid and Static= Uri is invalid + *******/ + EFI_STATUS + VerifyIpv6Address ( + IN CHAR16 *Buffer, + OUT EFI_IP_ADDRESS *LocalIp, + OUT EFI_IP_ADDRESS *GatewayIp, + OUT CHAR16 *String + ); + /********* + Get the IPv4Address,subnetMask,GatewayIp using Http Uri given by user, + IPV4(ClientAddress,protocol,static or Dhcp,gatewayip,subnetMask)/Dns(Dn= sIP1,DnsIP2...,IPn)/Uri(_http://DomainName/xxx.efi) + + @param[in] Uri The URI string of the boot file. + @param[out] LocalIP Ipv4 LocalP is updated staticall= y based on Uri + @param[out] SubnetMask Ipv4 SubnetMask is updated statically= based on Uri + @param[out] GatewayIp Ipv4 GatewayIp is updated statically= based on Uri + @Param[out] String The Error Message. + + @retval EFI_SUCCESS IP Address is translated from String. + @retval EFI_INVALID_PARAMETER Url is not supported http and https + EFI_UNSUPPORTED If IP Addrress and static Uri is inva= lid + ********/ + EFI_STATUS + VerifyIpv4Address ( + IN CHAR16 *Buffer, + OUT EFI_IP_ADDRESS *LocalIp, + OUT EFI_IP_ADDRESS *SubnetMask, + OUT EFI_IP_ADDRESS *GatewayIp, + OUT CHAR16 = *String + ); + /****** + This function checks static Uri given by user. + + @param[in] Buffer The URI string of the boot file. + + @retval EFI_SUCCESS Uri and static IP address are valid. + EFI_UNSUPPORTED Static Uri is invalid Format. + EFI_INVALID_PARAMETER Url is not support= ed http and https. + *******/ + EFI_STATUS + HttpBootCheckStaticUri(IN CHAR16 *Uri); + /** + Configure Static IPv6 Address using Ip6config Protocol + + @param[in] Private Pointer to HTTP boot driver private dat= a. + **/ + EFI_STATUS StaticHttpIPv6Boot (HTTP_BOOT_PRIVATE_DATA *Private); + + /** + This function will register the IPv4 gateway address to the network dev= ice. + + @param[in] Private The pointer to HTTP_BOOT_PRIVATE_DATA. + + @retval EFI_SUCCESS The new IP configuration has been confi= gured successfully. + @retval Others Failed to configure the address. + + **/ + EFI_STATUS + HttpBootRegisterIp4Gateway ( + IN HTTP_BOOT_PRIVATE_DATA *Private + ); + /** + This function will switch the IP4 configuration policy to Static. + + @param[in] Private Pointer to HTTP boot driver private dat= a. + + @retval EFI_SUCCESS The policy is already configured to sta= tic. + @retval Others Other error as indicated.. + + **/ + EFI_STATUS + HttpBootSetIp4Policy ( + IN HTTP_BOOT_PRIVATE_DATA *Private + ); + /** + Checks the HttpBoot Mode is static or Dhcp from the Input Devicepath. + And Update Private variable private->usingstatic + + + @param[in] FilePath Pointer to the device path which contains= a IPV4 and IPv6 device path node. + + @retval EFI_SUCCESS The IPV4 Address and IPv6 Address are s= uccessfully assigned to Private variable + EFI_INVALID_PARAMETER If FilePath is Null + **/ + EFI_STATUS + HttpBootCheckBootType (IN EFI_DEVICE_PATH_PROTOCOL *FilePath,IN H= TTP_BOOT_PRIVATE_DATA *Private); + /** + Get the IPv4 and IPv6 Dns Address from Input Uri + + + @param[in] Uri Input Uri from Filepath + @param[in] UsingIPv6 Specifies the type of IP addresses. + @param[in] Private The pointer to the driver's private data= . + + @retval EFI_SUCCESS The IPV4 Address and IPv6 Address are s= uccessfully assigned to HTTP boot driver private data. + EFI_INVALID_PARAMETER If Uri is not a valid Static Devicepath= URI + **/ + EFI_STATUS + HttpBootParseDnsIp(IN CHAR8 *Uri,BOOLEAN UsingIpv6,IN HTTP_BOOT_PRIVATE_= DATA *Private); #endif *** NetworkPkg\HttpBootDxe\HttpBootDxe.inf 2020-05-07 22:54:46= .000000000 +05-30 --- NetworkPkg\HttpBootDxe\HttpBootDxe.inf 2020-07-24 16:19:43.000000000 +0= 5-30 *************** *** 1,6 **** --- 1,15 ---- + + #*********************************************************************** + #* * + #* Copyright (c) 1985-2020, American Megatrends International LLC. * + #* * + #* All rights reserved. Subject to AMI licensing agreement. * + #* * + #*********************************************************************** + ## @file # This modules produce the Load File Protocol for UEFI HTTP boot. # # Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # *************** *** 38,49 **** --- 47,59 ---- HttpBootSupport.h HttpBootSupport.c HttpBootClient.h HttpBootClient.c HttpBootConfigVfr.vfr HttpBootConfigStrings.uni + HttpBootStatic.c [LibraryClasses] UefiDriverEntryPoint UefiBootServicesTableLib MemoryAllocationLib BaseLib *** NetworkPkg\HttpBootDxe\HttpBootImpl.c 2020-05-07 22:54:4= 6.000000000 +05-30 --- NetworkPkg\HttpBootDxe\HttpBootImpl.c 2020-08-09 20:08:53.000000000 += 05-30 *************** *** 1,6 **** --- 1,14 ---- + //*********************************************************************** + //* * + //* Copyright (c) 1985-2020, American Megatrends International LLC. * + //* * + //* All rights reserved. Subject to AMI licensing agreement. * + //* * + //*********************************************************************** + /** @file The implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent *************** *** 119,139 **** Uri =3D NULL; if (Private =3D=3D NULL || FilePath =3D=3D NULL) { return EFI_INVALID_PARAMETER; } ! // // Check the URI in the input FilePath, in order to see whether it is // required to boot from a new specified boot file. // Status =3D HttpBootParseFilePath (FilePath, &Uri); if (EFI_ERROR (Status)) { return EFI_INVALID_PARAMETER; ! } // // Check whether we need to stop and restart the HTTP boot driver. // if (Private->Started) { // --- 127,158 ---- Uri =3D NULL; if (Private =3D=3D NULL || FilePath =3D=3D NULL) { return EFI_INVALID_PARAMETER; } ! // ! // Check If HttpBoot get IP Address from user as statically or from dh= cp in the input FilePath, // + Status =3D HttpBootCheckBootType(FilePath,Private); + if (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; + } // Check the URI in the input FilePath, in order to see whether it is // required to boot from a new specified boot file. // Status =3D HttpBootParseFilePath (FilePath, &Uri); if (EFI_ERROR (Status)) { return EFI_INVALID_PARAMETER; ! } ! ! if (Private->UsingStatic){ ! Status =3D HttpBootParseDnsIp(Uri,UsingIpv6,Private); ! if (EFI_ERROR(Status)) ! return Status; ! } // // Check whether we need to stop and restart the HTTP boot driver. // if (Private->Started) { // *************** *** 161,173 **** if (Uri !=3D NULL) { FreePool (Uri); } return EFI_ALREADY_STARTED; } } ! // // Detect whether using ipv6 or not, and set it to the private data. // if (UsingIpv6 && Private->Ip6Nic !=3D NULL) { Private->UsingIpv6 =3D TRUE; } else if (!UsingIpv6 && Private->Ip4Nic !=3D NULL) { --- 180,201 ---- if (Uri !=3D NULL) { FreePool (Uri); } return EFI_ALREADY_STARTED; } } ! ! //Check the IP Address in the input FilePath and ! //update the Ip Address to Private Data ! // ! if (Private->UsingStatic){ ! Status =3D HttpBootParseIpAddress (FilePath,Private); ! if (EFI_ERROR (Status)) { ! return Status; ! } ! } // // Detect whether using ipv6 or not, and set it to the private data. // if (UsingIpv6 && Private->Ip6Nic !=3D NULL) { Private->UsingIpv6 =3D TRUE; } else if (!UsingIpv6 && Private->Ip4Nic !=3D NULL) { *************** *** 196,215 **** --- 224,245 ---- } } // // Init the content of cached DHCP offer list. // + if(!Private->UsingStatic){ ZeroMem (Private->OfferBuffer, sizeof (Private->OfferBuffer)); if (!Private->UsingIpv6) { for (Index =3D 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) { Private->OfferBuffer[Index].Dhcp4.Packet.Offer.Size =3D HTTP_CACHED= _DHCP4_PACKET_MAX_SIZE; } } else { for (Index =3D 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index++) { Private->OfferBuffer[Index].Dhcp6.Packet.Offer.Size =3D HTTP_CACHED= _DHCP6_PACKET_MAX_SIZE; + } } } if (Private->UsingIpv6) { // // Set Ip6 policy to Automatic to start the Ip6 router discovery. *************** *** 252,274 **** return EFI_NOT_STARTED; } Status =3D EFI_DEVICE_ERROR; if (!Private->UsingIpv6) { ! // // Start D.O.R.A process to get a IPv4 address and other boot informa= tion. // ! Status =3D HttpBootDhcp4Dora (Private); } else { ! // // Start S.A.R.R process to get a IPv6 address and other boot informa= tion. // ! Status =3D HttpBootDhcp6Sarr (Private); ! } ! return Status; } /** Attempt to download the boot file through HTTP message exchange. --- 282,332 ---- return EFI_NOT_STARTED; } Status =3D EFI_DEVICE_ERROR; if (!Private->UsingIpv6) { ! ! if (!Private->UsingStatic) { ! // // Start D.O.R.A process to get a IPv4 address and other boot informa= tion. // ! Status =3D HttpBootDhcp4Dora (Private); ! }else{ ! Status =3D HttpBootSetIp4Policy (Private); ! if (EFI_ERROR (Status)) { ! return Status; ! } ! Status =3D StaticHttpBoot(Private); ! if (EFI_ERROR (Status)) { ! return Status; ! } ! Status =3D HttpBootRegisterIp4Gateway (Private); ! if (EFI_ERROR (Status)) { ! return Status; ! } ! ! AsciiPrint ("\n Station IP address is "); ! HttpBootShowIp4Addr (&Private->StationIp.v4); ! AsciiPrint ("\n"); ! } ! } else { ! ! if (!Private->UsingStatic){ ! // // Start S.A.R.R process to get a IPv6 address and other boot informa= tion. // ! Status =3D HttpBootDhcp6Sarr (Private); ! }else{ ! Status =3D StaticHttpIPv6Boot (Private); ! AsciiPrint ("\n Station IPv6 address is "); ! HttpBootShowIp6Addr (&Private->StationIp.v6); ! AsciiPrint ("\n"); ! } ! } return Status; } /** Attempt to download the boot file through HTTP message exchange. *** --- NetworkPkg\HttpBootDxe\HttpBootStatic.c 2020-08-09 21:00:09.000000000 += 05-30 *************** *** 0 **** --- 1,650 ---- + //*********************************************************************** + //* * + //* Copyright (c) 1985-2020, American Megatrends International LLC. * + //* * + //* All rights reserved. Subject to AMI licensing agreement. * + //* * + //*********************************************************************** + + /** @file HttpBootStatic.c + Provides the Static Http Boot related functions . + + Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + **/ + + + #include "HttpBootDxe.h" + #include + + + /** + Get the IPv4 and IPv6 Address from the Input Devicepath. + + + @param[in] FilePath Pointer to the device path which contains= a IPV4 and IPV6 device path node. + + @retval EFI_SUCCESS The IPV4 Address and IPv6 Address are s= uccessfully assigned to Private variable + EFI_INVALID_PARAMETER If FilePath is Null + **/ + EFI_STATUS + HttpBootParseIpAddress ( + IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN HTTP_BOOT_PRIVATE_DATA *Private + ) + { + EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; + EFI_DEV_PATH *Node; + + if (FilePath =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + ZeroMem (&Private->StationIp, sizeof (EFI_IP_ADDRESS)); + ZeroMem (&Private->SubnetMask, sizeof (EFI_IP_ADDRESS)); + ZeroMem (&Private->GatewayIp, sizeof (EFI_IP_ADDRESS)); + // + // Extract the IPV4 address from the FilePath + // + + TempDevicePath =3D FilePath; + while (!IsDevicePathEnd (TempDevicePath)) { + + if ((DevicePathType (TempDevicePath) =3D=3D MESSAGING_DEVICE_PATH) && + (DevicePathSubType (TempDevicePath) =3D=3D MSG_IPv4_DP)) { + Node =3D ( EFI_DEV_PATH *)TempDevicePath; + + CopyMem (&Private->StationIp.v4, &Node->Ipv4.LocalIpAddress, sizeof= (EFI_IPv4_ADDRESS)); + CopyMem (&Private->SubnetMask.v4, &Node->Ipv4.SubnetMask , sizeof (= EFI_IPv4_ADDRESS)); + CopyMem (&Private->GatewayIp.v4, &Node->Ipv4.GatewayIpAddress, size= of (EFI_IPv4_ADDRESS)); + } + else if ((DevicePathType (TempDevicePath) =3D=3D MESSAGING_DEVICE_PATH= ) && + (DevicePathSubType (TempDevicePath) =3D=3D MSG_IPv6_DP)) = { + Node =3D (EFI_DEV_PATH *)TempDevicePath ; + + CopyMem (&Private ->StationIp.v6,&Node ->Ipv6.LocalIpAddress,siz= eof (EFI_IPv6_ADDRESS)); + CopyMem (&Private ->GatewayIp.v6,&Node ->Ipv6.GatewayIpAddress,s= izeof (EFI_IPv6_ADDRESS)); + } + + TempDevicePath =3D NextDevicePathNode (TempDevicePath); + } + + return EFI_SUCCESS; + } + + /** + The notify function of create event when performing a manual config. + + @param[in] Event The event this notify function registered to= . + @param[in] Context Pointer to the context data registered to th= e event. + + **/ + VOID + EFIAPI + IfConfigManualAddressNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) + { + *((BOOLEAN *) Context) =3D TRUE; + } + /** + Configure Static Ip Address using Ip4config2 Protocol + + @param[in] Private Pointer to HTTP boot driver private dat= a. + **/ + EFI_STATUS + StaticHttpBoot (HTTP_BOOT_PRIVATE_DATA *Private) + { + EFI_EVENT MappedEvt; + BOOLEAN IsAddressOk; + EFI_IP4_CONFIG2_POLICY Policy; + EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress; + EFI_STATUS Status; + UINTN DataSize ; + EFI_IP4_CONFIG2_PROTOCOL *IfCfg ; + EFI_EVENT TimeOutEvt ; + // + // Create events & timers for asynchronous settings. + // + CopyMem (&ManualAddress.Address , &Private->StationIp.v4, sizeof (EFI= _IPv4_ADDRESS)); + CopyMem (&ManualAddress.SubnetMask , &Private ->SubnetMask.v4, sizeof= (EFI_IPv4_ADDRESS)); + + + Status =3D gBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + NULL, + NULL, + &TimeOutEvt + ); + if (EFI_ERROR(Status)) + return Status; + + Status =3D gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + IfConfigManualAddressNotify, + &IsAddressOk, + &MappedEvt + ); + if (EFI_ERROR(Status)) + return Status; + + IfCfg =3D Private->Ip4Config2; + Status =3D IfCfg->RegisterDataNotify ( + IfCfg, + Ip4Config2DataTypeManualAddress, + MappedEvt + ); + if (EFI_ERROR(Status)) + return Status; + Policy =3D Ip4Config2PolicyStatic; + Status =3D IfCfg->SetData ( + IfCfg, + Ip4Config2DataTypePolicy, + sizeof (EFI_IP4_CONFIG2_POLICY), + &Policy + ); + + if (EFI_ERROR(Status)) + return Status; + DataSize =3D sizeof (EFI_IP4_CONFIG2_MANUAL_ADDRESS); + + Status =3D IfCfg->SetData ( + IfCfg, + Ip4Config2DataTypeManualAddress, + DataSize, + &ManualAddress + ); + if (Status =3D=3D EFI_NOT_READY) { + gBS->SetTimer (TimeOutEvt, TimerRelative, 50000000); + while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) { + if (IsAddressOk) { + Status =3D EFI_SUCCESS; + break; + } + } + } + + Status =3D IfCfg->UnregisterDataNotify ( + IfCfg, + Ip4Config2DataTypeManualAddress, + MappedEvt + ); + + return Status; + } + + /** + The notify function of create event when performing a manual config. + + @param[in] Event The event this notify function registered to= . + @param[in] Context Pointer to the context data registered to th= e event. + + **/ + VOID + EFIAPI + IfConfig6ManualAddressNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) + { + *((BOOLEAN *) Context) =3D TRUE; + } + /** + Configure Static Ipv6 Address using Ip6config Protocol + + @param[in] Private Pointer to HTTP boot driver private dat= a. + **/ + + EFI_STATUS + StaticHttpIPv6Boot (HTTP_BOOT_PRIVATE_DATA *Private) + { + EFI_STATUS Status; + EFI_IP6_CONFIG_PROTOCOL *IfCfg; + EFI_IP6_CONFIG_MANUAL_ADDRESS CfgManAddr; + UINT32 CurDadXmits; + UINTN CurDadXmitsLen; + EFI_IP6_CONFIG_POLICY Policy; + EFI_EVENT TimeOutEvt; + EFI_EVENT MappedEvt; + BOOLEAN IsAddressOk; + + // Set static host ip6 address list. + // This is a asynchronous process. + // + CopyMem (&CfgManAddr.Address,&Private->StationIp.v6,sizeof(EF= I_IPv6_ADDRESS)); + CfgManAddr.PrefixLength =3D IP6_PREFIX_LENGTH; + CfgManAddr.IsAnycast =3D FALSE ; + + IsAddressOk =3D FALSE; + IfCfg =3D Private->Ip6Config; + Status =3D gBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + NULL, + NULL, + &TimeOutEvt + ); + if (EFI_ERROR(Status)) + return Status; + + Status =3D gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + IfConfig6ManualAddressNotify, + &IsAddressOk, + &MappedEvt + ); + if (EFI_ERROR(Status)) + return Status; + + Status =3D IfCfg->RegisterDataNotify ( + IfCfg, + Ip6ConfigDataTypeManualAddress, + MappedEvt + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Policy =3D Ip6ConfigPolicyManual; + Status =3D IfCfg->SetData ( + IfCfg, + Ip6ConfigDataTypePolicy, + sizeof (EFI_IP6_CONFIG_POLICY), + &Policy + ); + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } + + Status =3D IfCfg->SetData ( + IfCfg, + Ip6ConfigDataTypeManualAddress, + sizeof(EFI_IP6_CONFIG_MANUAL_ADDRESS), + &CfgManAddr + ); + + + if (Status =3D=3D EFI_NOT_READY) { + // + // Get current dad transmits count. + // + CurDadXmitsLen =3D sizeof (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRA= NSMITS); + Status =3D IfCfg->GetData ( + IfCfg, + Ip6ConfigDataTypeDupAddrDetectTransmits, + &CurDadXmitsLen, + &CurDadXmits + ); + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } + + gBS->SetTimer (TimeOutEvt, TimerRelative, 50000000 + 10000000= * CurDadXmits); + + while (EFI_ERROR (gBS->CheckEvent (TimeOutEvt))) { + if (IsAddressOk) { + Status =3D EFI_SUCCESS; + break; + } + } + } + + Status =3D IfCfg->SetData ( + IfCfg, + Ip6ConfigDataTypeGateway, + sizeof(EFI_IPv6_ADDRESS), + &Private->GatewayIp.v6 + ); + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } + + ON_EXIT: + + Status =3D IfCfg->UnregisterDataNotify ( + IfCfg, + Ip6ConfigDataTypeManualAddress, + MappedEvt + ); + + if (EFI_ERROR (Status)) { + return Status; + } + return Status; + + } + /********* + Get the IPv4Address,subnetMask,GatewayIp using Http Uri given by user, + IPV4(ClientAddress,protocol,static or Dhcp ,gatewayip,subnetMask)/Dns(D= nsIP1,DnsIP2...,IPn)/Uri(_http://DomainName/xxx.efi) + + @param[in] Uri The URI string of the boot file. + @param[out] LocalIP Ipv4 LocalP is updated staticall= y based on Uri + @param[out] SubnetMask Ipv4 SubnetMask is updated statically= based on Uri + @param[out] GatewayIp Ipv4 GatewayIp is updated statically= based on Uri + @Param[out] String The Error Message. + + @retval EFI_SUCCESS IP Address is translated from String. + @retval EFI_INVALID_PARAMETER Url is not supported http and https + EFI_UNSUPPORTED If IP Addrress and static Uri is inva= lid + ********/ + EFI_STATUS + VerifyIpv4Address ( + IN CHAR16 *Buffer, + OUT EFI_IP_ADDRESS *LocalIp, + OUT EFI_IP_ADDRESS *SubnetMask, + OUT EFI_IP_ADDRESS *GatewayIp, + OUT CHAR16 *String + ) + { + CHAR16 *EndPointer; + RETURN_STATUS Status; + EFI_IPv4_ADDRESS Dns; + CHAR8 AsciiUri[URI_STR_MAX_SIZE]; + + if (StrnCmp (Buffer ,L"ipv4(",5)){ + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!"); + return EFI_UNSUPPORTED; + } + Buffer +=3DStrLen(L"ipv4("); + Status =3D StrToIpv4Address (Buffer, &EndPointer,&LocalIp->v4,NULL); + if (RETURN_ERROR (Status)){ + StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid LocalIP address!"); + return EFI_UNSUPPORTED; + } + Buffer =3D EndPointer; + if (StrnCmp(Buffer,L",tcp,static,",12 ) && StrnCmp(Buffer,L",tcp,dhcp= ,",10 )){ + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!"); + return EFI_UNSUPPORTED; + } + if (StrnCmp(Buffer,L",tcp,dhcp,",10)) + Buffer +=3DStrLen(L",tcp,static,"); + else + Buffer +=3DStrLen(L",tcp,dhcp,"); + + Status =3D StrToIpv4Address (Buffer,&EndPointer, &GatewayIp->v4,NULL)= ; + if (RETURN_ERROR(Status)) { + StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid GatewayIP Address!"); + return EFI_UNSUPPORTED; + } + Buffer =3D EndPointer + 1; + Status =3D StrToIpv4Address (Buffer,&EndPointer, &SubnetMask->v4,NULL= ); + if (RETURN_ERROR(Status)) { + StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid SubnetMask Address!")= ; + return EFI_UNSUPPORTED; + } + Buffer =3D EndPointer; + if (StrnCmp(Buffer,L")/uri(",6) && StrnCmp(Buffer,L")/dns(",6)){ + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!"); + return EFI_UNSUPPORTED; + } + if (!StrnCmp(Buffer,L")/dns(",6)) + { + Buffer +=3D StrLen(L")/dns("); + do{ + Status =3D StrToIpv4Address (Buffer,&EndPointer, &Dns,NULL); + if (RETURN_ERROR(Status)) { + StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid DnsServerIP Ad= dress!"); + return EFI_UNSUPPORTED; + } + Buffer =3D EndPointer +1; + }while(*EndPointer =3D=3D L','); + } + if (!StrnCmp (Buffer,L"}/uri(",6)){ + Buffer +=3DStrLen(L")/uri("); + UnicodeStrToAsciiStrS (Buffer, AsciiUri, URI_STR_MAX_SIZE); + Status =3D HttpBootCheckUriScheme (AsciiUri); + return Status; + } + + return EFI_SUCCESS; + } + + /****** + Get the IPv6Address,GatewayIp6Address using Http Uri given by user, + IPV6(LocalIp6Address,Tcp,static or dhcp,gatewayip6Address)/Dns(IP1,IP2,= ...,IPn)/Uri(_http://DomainName/xxx.efi) + + @param[in] Buffer URI string of the boot file. + @param[out] LocalIp Ipv6 LocalIp Address is updated sta= tically based on Uri + @param[out] GatewayIp Ipv6 GatewayIp is updated statical= ly based on Uri + @Param[out] String The Error Message. + + @retval EFI_SUCCESS IP Address is translated from Strin= g. + @retval EFI_INVALID_PARAMETER Url is not supported= http and https + EFI_UNSUPPORTED If IP Address is Invalid and Static= Uri is invalid + *******/ + EFI_STATUS + VerifyIpv6Address ( + IN CHAR16 *Buffer, + OUT EFI_IP_ADDRESS *LocalIp, + OUT EFI_IP_ADDRESS *GatewayIp, + OUT CHAR16 *String + ) + { + + CHAR16 *EndPointer; + RETURN_STATUS Status; + EFI_IPv6_ADDRESS Dns; + CHAR8 AsciiUri[URI_STR_MAX_SIZE]; + + if (StrnCmp (Buffer ,L"ipv6(",5)){ + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!"); + return EFI_UNSUPPORTED; + } + Buffer +=3D StrLen (L"ipv6("); + Status =3D StrToIpv6Address (Buffer, &EndPointer,&LocalIp->v6,NULL); + if (RETURN_ERROR (Status)){ + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid LocalIP address!"); + return EFI_UNSUPPORTED; + } + Buffer =3D EndPointer; + if (StrnCmp(Buffer,L",tcp,static,",12) && StrnCmp(Buffer,L",tcp,dhcp,= ",10)){ + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!"); + return EFI_UNSUPPORTED; + } + if (StrnCmp(Buffer,L",tcp,dhcp,",10)) + Buffer +=3DStrLen(L",tcp,static,"); + else + Buffer +=3DStrLen(L",tcp,dhcp,"); + + Status =3D StrToIpv6Address (Buffer,&EndPointer, &GatewayIp->v6,NULL)= ; + if (RETURN_ERROR (Status) ) { + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid GatewayIP Address!"); + return EFI_UNSUPPORTED; + } + Buffer =3D EndPointer; + if (StrnCmp(Buffer,L")/uri(",6) && StrnCmp(Buffer,L")/dns(",6)){ + StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri Format!"); + return EFI_UNSUPPORTED; + } + if (!StrnCmp(Buffer,L")/dns(",6)) + { + Buffer +=3D StrLen(L")/dns("); + do{ + Status =3D StrToIpv6Address (Buffer,&EndPointer, &Dns,NULL); + if (RETURN_ERROR(Status)) { + StrCpyS (String ,URI_STR_MAX_SIZE,L"Invalid DnsServerIP Ad= dress!"); + return EFI_UNSUPPORTED; + } + Buffer =3D EndPointer +1; + }while(*EndPointer =3D=3D L','); + } + if (!StrnCmp (Buffer,L"}/uri(",6)){ + Buffer +=3DStrLen(L")/uri("); + UnicodeStrToAsciiStrS (Buffer, AsciiUri, URI_STR_MAX_SIZE); + Status =3D HttpBootCheckUriScheme (AsciiUri); + return Status; + } + return EFI_SUCCESS; + } + /****** + This function checks static Uri given by user and returns BOOLEAN(TRUE:va= lid Uri,FALSE:Invalid Uri) + + @param[in] Buffer The URI string of the boot file. + + @retval SUCCESS Uri and static IP address are valid. + EFI_UNSUPPORTED Static Uri is invalid Format. + EFI_INVALID_PARAMETER Url is not supported h= ttp and https + *******/ + EFI_STATUS + HttpBootCheckStaticUri(IN CHAR16 *Uri) + { + EFI_STATUS Status; + EFI_INPUT_KEY Key; + EFI_IP_ADDRESS LocalIp; + EFI_IP_ADDRESS SubnetMask; + EFI_IP_ADDRESS GatewayIp; + CHAR16 ErrorMessage[URI_STR_MAX_SIZE]; + UINTN Index =3D 0; + + if (StrLen (Uri) =3D=3D 0) + return EFI_INVALID_PARAMETER; + + for (Index =3D 0; Index < StrLen (Uri); Index++) { + if (Uri[Index] =3D=3D L'/' && Uri[Index + 1] =3D=3D L'/') { + break; + } + if (Uri[Index] >=3D L'A' && Uri[Index] <=3D L'Z') { + Uri[Index] -=3D (CHAR16)(L'A' - L'a'); + } + } + if (StrnCmp (Uri,L"ipv4(",5) =3D=3D 0){ + Status =3D VerifyIpv4Address (Uri,&LocalIp,&SubnetMask,&GatewayIp= ,ErrorMessage); + if (EFI_ERROR(Status)){ + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + ErrorMessage, + NULL + ); + return Status; + } + }else if (StrnCmp (Uri,L"ipv6(",5) =3D=3D 0){ + Status =3D VerifyIpv6Address (Uri,&LocalIp,&GatewayIp,ErrorMessag= e); + if (EFI_ERROR(Status)){ + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + ErrorMessage, + NULL + ); + return Status; + } + }else if ((StrnCmp(Uri, L"http://", 7) !=3D 0) && (StrnCmp(Uri, L"ht= tps://", 8) !=3D 0)){ + CreatePopUp ( + EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, + &Key, + L"Invalid Uri", + NULL + ); + return EFI_UNSUPPORTED; + } + return EFI_SUCCESS ; + } + /** + Checks the HttpBoot Mode is static or Dhcp from the Input Devicepath. + And Update Private Variable Private->UsingStatic + + + @param[in] FilePath Pointer to the device path which contains= a IPV4 and IPv6 device path node. + + @retval EFI_SUCCESS The IPV4 Address and IPv6 Address are s= uccessfully assigned to Private variable + EFI_INVALID_PARAMETER If FilePath is Null + **/ + EFI_STATUS + HttpBootCheckBootType (IN EFI_DEVICE_PATH_PROTOCOL *FilePath,IN H= TTP_BOOT_PRIVATE_DATA *Private) + { + EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; + EFI_DEV_PATH *Node; + + if (FilePath =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + TempDevicePath =3D FilePath; + while (!IsDevicePathEnd (TempDevicePath)) { + if ((DevicePathType (TempDevicePath) =3D=3D MESSAGING_DEVICE_PATH= )){ + if (DevicePathSubType (TempDevicePath) =3D=3D MSG_IPv4_DP){ + Node =3D (EFI_DEV_PATH *)TempDevicePath ; + Private->UsingStatic =3D Node->Ipv4.StaticIpAddress ; + }else if (DevicePathSubType (TempDevicePath) =3D=3D MSG_IPv6_= DP){ + Node =3D (EFI_DEV_PATH *)TempDevicePath ; + Private->UsingStatic =3D(Node->Ipv6.IpAddressOrigin =3D= =3D 0x03) ? TRUE : FALSE; + } + } + TempDevicePath =3D NextDevicePathNode (TempDevicePath); + } + + return EFI_SUCCESS; + } + /** + Get the IPv4 and IPv6 Dns Address from Input Uri + + + @param[in] Uri Input Uri from Filepath + @param[in] UsingIPv6 Specifies the type of IP addresses. + @param[in] Private The pointer to the driver's private data= . + + @retval EFI_SUCCESS The IPV4 Address and IPv6 Address are s= uccessfully assigned to HTTP boot driver private data. + EFI_INVALID_PARAMETER If Uri is not a valid Static Devicepath= URI + **/ + EFI_STATUS + HttpBootParseDnsIp(IN CHAR8 *Uri,BOOLEAN UsingIpv6,IN HTTP_BOOT_PRIVATE= _DATA *Private) + { + EFI_STATUS Status; + CHAR16 Uri2[URI_STR_MAX_SIZE]; + UINT32 Index =3D 0; + UINTN UriStrLength =3D 0; + CHAR16 *EndPointer; + CHAR16 *Buffer; + UINTN DataSize =3D 0; + + if (Uri =3D=3D NULL) + return EFI_SUCCESS; + AsciiStrToUnicodeStrS(Uri,Uri2,URI_STR_MAX_SIZE); + UriStrLength =3D AsciiStrLen(Uri) + 1; + Status =3D HttpBootCheckStaticUri(Uri2); + if (EFI_ERROR(Status)) + return Status; + if (Buffer =3D StrStr(Uri2,L"dns(")) + { + Buffer +=3D 4; + DataSize =3D sizeof(EFI_IP_ADDRESS) ; + Private->DnsServerIp =3D AllocateZeroPool(DataSize); + if (UsingIpv6) + Status =3D StrToIpv6Address (Buffer,&EndPointer,&Private->Dns= ServerIp[Index++].v6,NULL); + else + Status =3D StrToIpv4Address (Buffer,&EndPointer,&Private->Dns= ServerIp[Index++].v4,NULL); + if (EFI_ERROR(Status)){ + FreePool(Private->DnsServerIp); + Private->DnsServerIp =3D NULL; + return Status; + } + while(*EndPointer =3D=3D L','){ + Private->DnsServerIp =3D ReallocatePool(DataSize,DataSize + s= izeof(EFI_IP_ADDRESS),Private->DnsServerIp); + if (UsingIpv6) + Status =3D StrToIpv6Address (Buffer,&EndPointer,&Private-= >DnsServerIp[Index++].v6,NULL); + else + Status =3D StrToIpv4Address (Buffer,&EndPointer,&Private-= >DnsServerIp[Index++].v4,NULL); + if (EFI_ERROR(Status)){ + FreePool(Private->DnsServerIp); + Private->DnsServerIp =3D NULL; + return Status; + } + Buffer =3D EndPointer + 1; + }while(*EndPointer =3D=3D L','); + Private->DnsServerCount =3D Index; + if (Buffer =3D StrStr(Uri2,L"http")){ + for (Index =3D0;Buffer[Index] !=3D L')' && Buffer[Index] !=3D L'\= 0' ;Index++); + Buffer[Index] =3D L'\0'; + } + UnicodeStrToAsciiStrS(Buffer,Uri,UriStrLength); + } + return EFI_SUCCESS; + } + --_000_B4DE137BDB63634BAC03BD9DE765F19702B4B34FECVENUS1inmegat_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2888

 

*** NetworkPkg\HttpBoo= tDxe\HttpBootClient.c         =     2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBoo= tDxe\HttpBootClient.c 2020-08-09 21:03:01.000000000 +05-30

***************

*** 1,6 ****

--- 1,13 ----

+ //**************= *********************************************************=

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*   = Copyright (c) 1985-2020, American Megatrends International LLC.  = *

+ //*  &= nbsp;           &nbs= p;             =             &nb= sp;            =             &nb= sp;   *

+ //*  &= nbsp;   All rights reserved. Subject to AMI licensing agreement.&= nbsp;      *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //**************= *********************************************************=

  /** @file<= /o:p>

    Imp= lementation of the boot file download function.

 

  Copyright = (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

  (C) Copyright 2= 016 Hewlett Packard Enterprise Development LP<BR>

  SPDX-License-Id= entifier: BSD-2-Clause-Patent

***************

*** 45,57 ****

   &nbs= p;  Node->Ipv4.Header.Type    =3D MESSAGING_DEVICE_P= ATH;

   &nbs= p;  Node->Ipv4.Header.SubType =3D MSG_IPv4_DP;

   &nbs= p;  SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));

   &nbs= p;  CopyMem (&Node->Ipv4.LocalIpAddress, &Private->Stati= onIp, sizeof (EFI_IPv4_ADDRESS));

   &nbs= p;  Node->Ipv4.RemotePort      =3D Private= ->Port;

   &nbs= p;  Node->Ipv4.Protocol        = =3D EFI_IP_PROTO_TCP;

!   &nb= sp; Node->Ipv4.StaticIpAddress =3D FALSE;

   &nbs= p;  CopyMem (&Node->Ipv4.GatewayIpAddress, &Private->Gat= ewayIp, sizeof (EFI_IPv4_ADDRESS));

   &nbs= p;  CopyMem (&Node->Ipv4.SubnetMask, &Private->SubnetMas= k, sizeof (EFI_IPv4_ADDRESS));

    } e= lse {

   &nbs= p;  Node =3D AllocateZeroPool (sizeof (IPv6_DEVICE_PATH));<= /span>

   &nbs= p;  if (Node =3D=3D NULL) {

   &nbs= p;    return EFI_OUT_OF_RESOURCES;

--- 52,67 ----

   &nbs= p;  Node->Ipv4.Header.Type    =3D MESSAGING_DEVICE_P= ATH;

   &nbs= p;  Node->Ipv4.Header.SubType =3D MSG_IPv4_DP;

   &nbs= p;  SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));

   &nbs= p;  CopyMem (&Node->Ipv4.LocalIpAddress, &Private->Stati= onIp, sizeof (EFI_IPv4_ADDRESS));

   &nbs= p;  Node->Ipv4.RemotePort      =3D Private= ->Port;

   &nbs= p;  Node->Ipv4.Protocol        = =3D EFI_IP_PROTO_TCP;

!   &nb= sp; if (Private->UsingStatic)

!   &nb= sp;     Node->Ipv4.StaticIpAddress =3DTRUE;

!   &nb= sp; else

!   &nb= sp;     Node->Ipv4.StaticIpAddress =3D FALSE;

   &nbs= p;  CopyMem (&Node->Ipv4.GatewayIpAddress, &Private->Gat= ewayIp, sizeof (EFI_IPv4_ADDRESS));

   &nbs= p;  CopyMem (&Node->Ipv4.SubnetMask, &Private->SubnetMas= k, sizeof (EFI_IPv4_ADDRESS));

   } el= se {

   &nbs= p;  Node =3D AllocateZeroPool (sizeof (IPv6_DEVICE_PATH));<= /span>

   &nbs= p;  if (Node =3D=3D NULL) {

   &nbs= p;    return EFI_OUT_OF_RESOURCES;

***************

*** 325,374 ****<= /o:p>

    EFI= _DHCP6_PACKET_OPTION         *Optio= n;

    EFI= _IPv6_ADDRESS          &n= bsp;     IpAddr;

    CHA= R8            &= nbsp;           &nbs= p;  *HostName;

    UIN= TN            &= nbsp;           &nbs= p;  HostNameSize;

    CHA= R16            =             &nb= sp; *HostNameStr;

    EFI= _STATUS           &n= bsp;          Status;

!

   &nbs= p;ASSERT (Private !=3D NULL);

!   ASSERT (= Private->SelectIndex !=3D 0);

!   SelectIn= dex =3D Private->SelectIndex - 1;

!   ASSERT (= SelectIndex < HTTP_BOOT_OFFER_MAX_NUM);

!

   &nbs= p;DnsServerIndex =3D 0;

 

   &nbs= p;Status   =3D EFI_SUCCESS;

    Hos= tName =3D NULL;

    //<= o:p>

    // = SelectOffer contains the IP address configuration and name server configura= tion.

    // = HttpOffer contains the boot file URL.

    //<= o:p>

!   SelectOf= fer =3D &Private->OfferBuffer[SelectIndex].Dhcp6;<= /p>

!   if (Priv= ate->FilePathUri =3D=3D NULL) {

!   &nb= sp; //

!   &nb= sp; // In Corporate environment, we need a HttpOffer.

!   &nb= sp; //

!   &nb= sp; if ((SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpUri) ||

!   &nb= sp;     (SelectOffer->OfferType =3D=3D HttpOfferType= DhcpIpUriDns) ||

!   &nb= sp;     (SelectOffer->OfferType =3D=3D HttpOfferType= DhcpNameUriDns)) {

!   &nb= sp;   HttpOffer =3D SelectOffer;

!   &nb= sp; } else {

!   &nb= sp;   ASSERT (Private->SelectProxyType !=3D HttpOfferTypeMax);=

!   &nb= sp;   ProxyIndex =3D Private->OfferIndex[Private->SelectPro= xyType][0];

!   &nb= sp;   HttpOffer =3D &Private->OfferBuffer[ProxyIndex].Dhcp= 6;

!   &nb= sp; }

!    &n= bsp;Private->BootFileUriParser =3D HttpOffer->UriParser;

!   &nb= sp; Private->BootFileUri =3D (CHAR8*) HttpOffer->OptList[HTTP_BOOT_DH= CP6_IDX_BOOT_FILE_URL]->Data;

!   } else {=

!   &nb= sp; //

!   &nb= sp; // In Home environment the BootFileUri comes from the FilePath.

!   &nb= sp; //

!   &nb= sp; Private->BootFileUriParser =3D Private->FilePathUriParser;

!   &nb= sp; Private->BootFileUri =3D Private->FilePathUri;<= /p>

!   }

!

   &nbs= p;//

    // = Check the URI scheme.

    //<= o:p>

    Sta= tus =3D HttpBootCheckUriScheme (Private->BootFileUri);=

    if = (EFI_ERROR (Status)) {

   &nbs= p;  DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n"= ;, Status));

--- 335,397 ----<= /o:p>

    EFI= _DHCP6_PACKET_OPTION         *Optio= n;

    EFI= _IPv6_ADDRESS          &n= bsp;     IpAddr;

    CHA= R8            &= nbsp;           &nbs= p;  *HostName;

    UIN= TN            &= nbsp;            &nb= sp; HostNameSize;

    CHA= R16            =             &nb= sp; *HostNameStr;

    EFI= _STATUS           &n= bsp;          Status;

!   EFI_IPv6= _ADDRESS           &= nbsp;    *Dns;

!   UINTN&nb= sp;            =             &nb= sp; DataSize;

   &nbs= p;ASSERT (Private !=3D NULL);

!   if (!Pri= vate->UsingStatic){

!   &nb= sp;   ASSERT (Private->SelectIndex !=3D 0);<= /p>

!   &nb= sp;   SelectIndex =3D Private->SelectIndex - 1;

!   &nb= sp;   ASSERT (SelectIndex < HTTP_BOOT_OFFER_MAX_NUM);

!   }

    Dns= ServerIndex =3D 0;

+   Data= Size =3D 0;

 

   &nbs= p;Status   =3D EFI_SUCCESS;

    Hos= tName =3D NULL;

+   Dns = =3D NULL;

+   if (= Private->UsingStatic){

+   &nbs= p;             = //Static HttpBoot supports Home Environment Only.

+   = ;      // In Home environment the BootFileUri come= s from the FilePath.

+   = ;      //

+   = ;      Private->BootFileUriParser =3D Private-&= gt;FilePathUriParser;

+   = ;      Private->BootFileUri =3D Private->Fil= ePathUri;

+   }els= e{

+   = ;      Dns =3D NULL;

    //<= o:p>

    // = SelectOffer contains the IP address configuration and name server configura= tion.

    // = HttpOffer contains the boot file URL.

    //<= o:p>

!   &nb= sp;   SelectOffer =3D &Private->OfferBuffer[SelectIndex].D= hcp6;

!   &nb= sp;   if (Private->FilePathUri =3D=3D NULL ) {

!   &nb= sp;     //

!   &nb= sp;     // In Corporate environment, we need a HttpOffe= r.

!   &nb= sp;     //

!   &nb= sp;     if ((SelectOffer->OfferType =3D=3D HttpOffer= TypeDhcpIpUri) ||

!   &nb= sp;         (SelectOffer->OfferT= ype =3D=3D HttpOfferTypeDhcpIpUriDns) ||

!   &nb= sp;         (SelectOffer->OfferT= ype =3D=3D HttpOfferTypeDhcpNameUriDns)) {

!   &nb= sp;       HttpOffer =3D SelectOffer;

!   &nb= sp;     } else {

!   &nb= sp;       ASSERT (Private->SelectProxyType= !=3D HttpOfferTypeMax);

!   &nb= sp;       ProxyIndex =3D Private->OfferInd= ex[Private->SelectProxyType][0];

!   &nb= sp;       HttpOffer =3D &Private->Offe= rBuffer[ProxyIndex].Dhcp6;

!   &nb= sp;     }

!   &nb= sp;     Private->BootFileUriParser =3D HttpOffer->= ;UriParser;

!   &nb= sp;     Private->BootFileUri =3D (CHAR8*) HttpOffer-= >OptList[HTTP_BOOT_DHCP6_IDX_BOOT_FILE_URL]->Data;<= /p>

!   &nb= sp;   } else {

!   &nb= sp;     //

!   &nb= sp;     // In Home environment the BootFileUri comes fr= om the FilePath.

!   &nb= sp;     //

!   &nb= sp;     Private->BootFileUriParser =3D Private->F= ilePathUriParser;

!   &nb= sp;     Private->BootFileUri =3D Private->FilePat= hUri;

!   &nb= sp;   }

!   }

    //<= o:p>

    // = Check the URI scheme.

    //<= o:p>

    Sta= tus =3D HttpBootCheckUriScheme (Private->BootFileUri);=

    if = (EFI_ERROR (Status)) {

   &nbs= p;  DEBUG ((EFI_D_ERROR, "HttpBootDhcp6ExtractUriInfo: %r.\n"= ;, Status));

***************

*** 391,403 ****<= /o:p>

    //<= o:p>

    // = Register the IPv6 gateway address to the network device.<= /p>

    //<= o:p>

    Sta= tus =3D HttpBootSetIp6Gateway (Private);

    if = (EFI_ERROR (Status)) {

   &nbs= p;  return Status;

!   }

 

   &nbs= p;if ((SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpNameUriDns) ||

   &nbs= p;    (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpDns= ) ||

   &nbs= p;    (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpU= riDns)) {

   &nbs= p;  Option =3D SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER]= ;

   &nbs= p;  ASSERT (Option !=3D NULL);

--- 414,450 ----<= /o:p>

    //<= o:p>

    // = Register the IPv6 gateway address to the network device.<= /p>

    //<= o:p>

    Sta= tus =3D HttpBootSetIp6Gateway (Private);

    if = (EFI_ERROR (Status)) {

   &nbs= p;  return Status;

!   } <= /o:p>

!   if (Priv= ate->UsingStatic){

!   &nb= sp;      if( Private->DnsServerIp !=3D NULL ){<= o:p>

!   &nb= sp;   //

!   &nb= sp;   // Configure the default DNS server if server assigned.

!   &nb= sp;   //

!

!   &nb= sp;       DataSize =3D Private->DnsServerC= ount * sizeof (EFI_IPv6_ADDRESS);

!   &nb= sp;       Dns =3D AllocateZeroPool(DataSize);=

!   &nb= sp;       for (DnsServerIndex =3D 0;DnsServer= Index < Private->DnsServerCount;DnsServerIndex++)<= /span>

!   &nb= sp;           CopyMem(&am= p;Dns[DnsServerIndex],&Private->DnsServerIp[DnsServerIndex].v6,sizeo= f(EFI_IPv6_ADDRESS));        

!   &nb= sp;       Status =3D HttpBootSetIp6Dns (=

!   &nb= sp;            =       Private,

!   &nb= sp;            =       DataSize,

!   &nb= sp;            =       Dns

!   &nb= sp;            =       );

!   &nb= sp;       FreePool(Dns);

!   &nb= sp;       if (EFI_ERROR (Status)) {

!   &nb= sp;           goto Error;=

!   &nb= sp;       }

!   &nb= sp;     }

!

!   &nb= sp;   goto StaticBoot;

!   }

!

  

   &nbs= p;if ((SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpNameUriDns) ||

   &nbs= p;    (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpDns= ) ||

   &nbs= p;    (SelectOffer->OfferType =3D=3D HttpOfferTypeDhcpIpU= riDns)) {

   &nbs= p;  Option =3D SelectOffer->OptList[HTTP_BOOT_DHCP6_IDX_DNS_SERVER]= ;

   &nbs= p;  ASSERT (Option !=3D NULL);

***************

*** 430,441 ****<= /o:p>

--- 477,489 ----<= /o:p>

    }

 

   &nbs= p;//

    // = Extract the HTTP server Ip from URL. This is used to Check route table=

    // = whether can send message to HTTP Server Ip through the GateWay.<= /span>

    //<= o:p>

+   Stat= icBoot:

    Sta= tus =3D HttpUrlGetIp6 (

   &nbs= p;           Private->= BootFileUri,

   &nbs= p;           Private->= BootFileUriParser,

   &nbs= p;           &IpAddr<= o:p>

   &nbs= p;           );

 

***************

*** 523,546 ****<= /o:p>

  EFI_STATUS=

  HttpBootDiscove= rBootInfo (

    IN = OUT HTTP_BOOT_PRIVATE_DATA   *Private

    )

  {

    EFI= _STATUS           &n= bsp;  Status;

 

   &nbs= p;//

    // = Start D.O.R.A/S.A.R.R exchange to acquire station ip address and=

    // = other Http boot information.

    //<= o:p>

    Sta= tus =3D HttpBootDhcp (Private);

    if = (EFI_ERROR (Status)) {

   &nbs= p;  return Status;

    }

 

   &nbs= p;if (!Private->UsingIpv6) {

!   &nb= sp; Status =3D HttpBootDhcp4ExtractUriInfo (Private);

    } e= lse {

   &nbs= p;  Status =3D HttpBootDhcp6ExtractUriInfo (Private);

    }

 

   &nbs= p;return Status;

  }

--- 571,639 ----<= /o:p>

  EFI_STATUS=

  HttpBootDiscove= rBootInfo (

    IN = OUT HTTP_BOOT_PRIVATE_DATA   *Private

    )

  {

    EFI= _STATUS           &n= bsp;  Status;

+   EFI_= IPv4_ADDRESS        *Dns;

+   UINT= N            &n= bsp;      DataSize =3D 0;

+   UINT= 8            &n= bsp;      DnsServerIndex =3D 0;<= /p>

 

+   Dns = =3D NULL;

    //<= o:p>

    // = Start D.O.R.A/S.A.R.R exchange to acquire station ip address and=

    // = other Http boot information.

    //<= o:p>

    Sta= tus =3D HttpBootDhcp (Private);

    if = (EFI_ERROR (Status)) {

   &nbs= p;  return Status;

    }

 

   &nbs= p;if (!Private->UsingIpv6) {

!   &nb= sp;   if (!Private->UsingStatic){

!   &nb= sp;       Status =3D HttpBootDhcp4ExtractUriI= nfo (Private);

!   &nb= sp;   }

!   &nb= sp;   else{

!   &nb= sp;     Private->BootFileUriParser =3D Private->F= ilePathUriParser;

!   &nb= sp;     Private->BootFileUri =3D Private->FilePat= hUri;

!   &nb= sp;    

!   &nb= sp;     if (Private->DnsServerIp !=3D NULL){

!   &nb= sp;         DataSize =3D Private-&g= t;DnsServerCount * sizeof(EFI_IPv4_ADDRESS);

!   &nb= sp;         Dns =3D AllocateZeroPoo= l(DataSize);

!   &nb= sp;         for (DnsServerIndex =3D= 0;DnsServerIndex < Private->DnsServerCount;DnsServerIndex++)=

!   &nb= sp;            = CopyMem(&Dns[DnsServerIndex],&(Private->DnsServerIp[DnsServerIn= dex].v4),sizeof(EFI_IPv4_ADDRESS));

!   &nb= sp;        

!   &nb= sp;         Status =3D HttpBootRegi= sterIp4Dns (

!   &nb= sp;            =         Private,

!   &nb= sp;            =         DataSize,

!   &nb= sp;             = ;       Dns

!   &nb= sp;            =         );

!   &nb= sp;        

!   &nb= sp;         FreePool (Dns);

!   &nb= sp;         if (EFI_ERROR (Status))= {

!   &nb= sp;           FreePool (P= rivate->DnsServerIp);

!   &nb= sp;           Private->= ;DnsServerIp =3D NULL;

!   &nb= sp;           return Stat= us;

!   &nb= sp;         }

!   &nb= sp;     }

!   &nb= sp;     //

!   &nb= sp;     // Extract the port from URL, and use default H= TTP port 80 if not provided.

!   &nb= sp;     //

!   &nb= sp;     Status =3D HttpUrlGetPort (

!   &nb= sp;            =       Private->BootFileUri,

!   &nb= sp;            =       Private->BootFileUriParser,

!   &nb= sp;            =       &Private->Port

!   &nb= sp;            =       );

!   &nb= sp;     if (EFI_ERROR (Status) || Private->Port =3D= =3D 0) {

!   &nb= sp;         Private ->Port =3D 8= 0;

!   &nb= sp;     }

!   &nb= sp;     //

!   &nb= sp;     // Update the device path to include the IP and= boot URI information.

!   &nb= sp;     //

!   &nb= sp;     Status =3D HttpBootUpdateDevicePath (Private);<= o:p>

!   &nb= sp;   }

    } e= lse {

   &nbs= p;  Status =3D HttpBootDhcp6ExtractUriInfo (Private);

    }

 

   &nbs= p;return Status;

  }

*** NetworkPkg\HttpBoo= tDxe\HttpBootConfig.c         =    2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBoo= tDxe\HttpBootConfig.c         =       2020-08-04 15:28:06.000000000 +05-30

***************

*** 1,6 ****

--- 1,13 ----

+ //**************= *********************************************************=

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*   = Copyright (c) 1985-2020, American Megatrends International LLC.  = *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*  &= nbsp;   All rights reserved. Subject to AMI licensing agreement.&= nbsp;      *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //**************= *********************************************************=

  /** @file<= /o:p>

    Hel= per functions for configuring or getting the parameters relating to HTTP Bo= ot.

 

  Copyright = (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>

  SPDX-License-Id= entifier: BSD-2-Clause-Patent

 

***************

*** 36,72 ****

    EFI= _DEVICE_PATH_PROTOCOL          = ;*NewDevicePath;

    UIN= TN            &= nbsp;           &nbs= p;    Length;

    CHA= R8            &= nbsp;           &nbs= p;    AsciiUri[URI_STR_MAX_SIZE];

    EFI= _STATUS           &n= bsp;            Stat= us;

    UIN= TN            &= nbsp;           &nbs= p;    Index;

    EFI= _BOOT_MANAGER_LOAD_OPTION      NewOption;

!

   &nbs= p;NewDevicePath =3D NULL;

    Nod= e          =3D NULL;

    Tmp= DevicePath =3D NULL;

 

   &nbs= p;if (StrLen (Description) =3D=3D 0) {

   &nbs= p;  return EFI_INVALID_PARAMETER;

    }

 

   &nbs= p;//

    // = Convert the scheme to all lower case.

    //<= o:p>

    for= (Index =3D 0; Index < StrLen (Uri); Index++) {

!   &nb= sp; if (Uri[Index] =3D=3D L':') {

!   &nb= sp;   break;

!   &nb= sp; }

   &nbs= p;  if (Uri[Index] >=3D L'A' && Uri[Index] <=3D L'Z') {<= o:p>

   &nbs= p;    Uri[Index] -=3D (CHAR16)(L'A' - L'a');

   &nbs= p;  }

    }

 

   &nbs= p;//

!   // Only = accept empty URI, or http and https URI.

    //<= o:p>

!   if ((Str= Len (Uri) !=3D 0) && (StrnCmp (Uri, L"http://", 7) !=3D 0= ) && (StrnCmp (Uri, L"https://", 8) !=3D 0)) {=

   &nbs= p;  return EFI_INVALID_PARAMETER;

    }

 

   &nbs= p;//

    // = Create a new device path by appending the IP node and URI node to

    // = the driver's parent device path

--- 43,93 ----

    EFI= _DEVICE_PATH_PROTOCOL         = *NewDevicePath;

    UIN= TN            &= nbsp;           &nbs= p;    Length;

    CHA= R8            &= nbsp;            &nb= sp;   AsciiUri[URI_STR_MAX_SIZE];

    EFI= _STATUS           &n= bsp;            Stat= us;

    UIN= TN            &= nbsp;           &nbs= p;    Index;

    EFI= _BOOT_MANAGER_LOAD_OPTION      NewOption;

!   EFI_IP_A= DDRESS           &nb= sp;        LocalIp;

!   EFI_IP_A= DDRESS           &nb= sp;        SubnetMask;=

!   EFI_IP_A= DDRESS           &nb= sp;        GatewayIp;<= /p>

!   CHAR16&n= bsp;            = ;            &n= bsp;  DebugString[URI_STR_MAX_SIZE];

!   CHAR8&nb= sp;            =             &nb= sp;   *AsciiUri2;

!  

!   AsciiUri= 2     =3D NULL;

    New= DevicePath =3D NULL;

    Nod= e          =3D NULL;

    Tmp= DevicePath =3D NULL;

 

   &nbs= p;if (StrLen (Description) =3D=3D 0) {

   &nbs= p;  return EFI_INVALID_PARAMETER;

    }

 

   &nbs= p;//

    // = Convert the scheme to all lower case.

    //<= o:p>

    for= (Index =3D 0; Index < StrLen (Uri); Index++) {

!   &nb= sp;   if (Uri[Index] =3D=3D L'/' && Uri[Index + 1] = =3D=3D L'/') {

!   &nb= sp;     break;

!   &nb= sp;   }

!

   &nbs= p;  if (Uri[Index] >=3D L'A' && Uri[Index] <=3D L'Z= ') {

   &nbs= p;    Uri[Index] -=3D (CHAR16)(L'A' - L'a');

   &nbs= p;  }

    }

 

   &nbs= p;//

!   // Only = accept empty URI, or http , https URI and Static URI.

    //<= o:p>

!

!   if ((Str= Len (Uri) !=3D 0) && StrStr(Uri,L"static")){

!   &nb= sp;   Private->UsingStatic =3D TRUE;

!   }

!   else{

!   &nb= sp;   Private->UsingStatic =3D FALSE;

!   }

!   if ((Str= Len (Uri) !=3D 0) && (StrnCmp (Uri, L"http://", 7) !=3D 0= ) && (StrnCmp (Uri, L"https://", 8) !=3D 0)&& EFI= _ERROR(HttpBootCheckStaticUri(Uri)) {

   &nbs= p;  return EFI_INVALID_PARAMETER;

    }

 

   &nbs= p;//

    // = Create a new device path by appending the IP node and URI node to

    // = the driver's parent device path

***************

*** 77,107 ****

--- 98,159 ----

   &nbs= p;    Status =3D EFI_OUT_OF_RESOURCES;

   &nbs= p;    goto ON_EXIT;

   &nbs= p;  }

   &nbs= p;  Node->Ipv4.Header.Type    =3D MESSAGING_DEVICE_P= ATH;

   &nbs= p;  Node->Ipv4.Header.SubType =3D MSG_IPv4_DP;

   &nbs= p;  SetDevicePathNodeLength (Node, sizeof (IPv4_DEVICE_PATH));

+   = ;  if (Private->UsingStatic){

+   = ;      Status =3D VerifyIpv4Address(Uri,&Local= Ip,&SubnetMask,&GatewayIp,DebugString);

+   = ;      if (EFI_ERROR(Status))

+   = ;          return Status;=

+   = ;      CopyMem (&Node->Ipv4.LocalIpAddress,= &LocalIp.v4, sizeof (EFI_IPv4_ADDRESS));

+   = ;      Node->Ipv4.RemotePort   &= nbsp;  =3D Private->Port;

+   = ;      Node->Ipv4.Protocol   &nb= sp;    =3D EFI_IP_PROTO_TCP;

+   = ;      Node->Ipv4.StaticIpAddress =3D TRUE;

+   = ;      CopyMem (&Node->Ipv4.GatewayIpAddres= s, &GatewayIp.v4, sizeof (EFI_IPv4_ADDRESS));

+   = ;      CopyMem (&Node->Ipv4.SubnetMask, &am= p;SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));

+   = ;  }

    } e= lse {

   &nbs= p;  Node =3D AllocateZeroPool (sizeof (IPv6_DEVICE_PATH));<= /span>

   &nbs= p;  if (Node =3D=3D NULL) {

   &nbs= p;    Status =3D EFI_OUT_OF_RESOURCES;

   &nbs= p;    goto ON_EXIT;

   &nbs= p;  }

   &nbs= p;  Node->Ipv6.Header.Type     =3D MESSAGING_DE= VICE_PATH;

   &nbs= p;  Node->Ipv6.Header.SubType  =3D MSG_IPv6_DP;

   &nbs= p;  SetDevicePathNodeLength (Node, sizeof (IPv6_DEVICE_PATH));

+   = ;  if (Private->UsingStatic){

+   = ;      Status =3D VerifyIpv6Address (Uri,&Loca= lIp,&GatewayIp,DebugString);

+   = ;      if (EFI_ERROR(Status))

+   = ;          return Status;=

+   = ;      Node->Ipv6.PrefixLength   = ; =3D IP6_PREFIX_LENGTH;

+   = ;      Node->Ipv6.RemotePort   &= nbsp;  =3D Private->Port;

+   = ;      Node->Ipv6.Protocol   &nb= sp;    =3D EFI_IP_PROTO_TCP;

+   = ;      Node->Ipv6.IpAddressOrigin =3D 0x03;

+   = ;      CopyMem (&Node->Ipv6.LocalIpAddress,= &LocalIp.v6 , sizeof (EFI_IPv6_ADDRESS));

+   = ;      CopyMem (&Node->Ipv6.GatewayIpAddres= s, &GatewayIp.v6, sizeof (EFI_IPv6_ADDRESS));

+   = ;  }

    }

    Tmp= DevicePath =3D AppendDevicePathNode (Private->ParentDevicePath, (EFI_DEV= ICE_PATH_PROTOCOL*) Node);

    Fre= ePool (Node);

    if = (TmpDevicePath =3D=3D NULL) {

   &nbs= p;  return EFI_OUT_OF_RESOURCES;

    }

    //<= o:p>

    // = Update the URI node with the input boot file URI.

    //<= o:p>

    Uni= codeStrToAsciiStrS (Uri, AsciiUri, sizeof (AsciiUri));

+   //Ex= tract Bootfile uri from Static Uri.

+   if (= (Private->UsingStatic  && (AsciiStrStr(AsciiUri,"dns&q= uot;) =3D=3D NULL))||( AsciiStrStr(AsciiUri,"dhcp"))){=

+   = ;  AsciiUri2 =3D AsciiStrStr (AsciiUri ,"http");<= /span>

+   = ;  if (AsciiUri2 !=3D NULL){

+   = ;      for (Index =3D0;AsciiUri2[Index] !=3D ')' &= amp;& AsciiUri2[Index] !=3D '\0'  ;Index++);

+   = ;      AsciiUri2[Index] =3D '\0';

+   = ;      AsciiStrCpy(AsciiUri,AsciiUri2);=

+   = ; }

+   }

    Len= gth =3D sizeof (EFI_DEVICE_PATH_PROTOCOL) + AsciiStrSize (AsciiUri);

    Nod= e =3D AllocatePool (Length);

    if = (Node =3D=3D NULL) {

   &nbs= p;  Status =3D EFI_OUT_OF_RESOURCES;

   &nbs= p;  FreePool (TmpDevicePath);

   &nbs= p;  goto ON_EXIT;

***************

*** 483,494 ****<= /o:p>

--- 535,551 ----<= /o:p>

   &nbs= p;      return EFI_OUT_OF_RESOURCES;

   &nbs= p;    }

 

   &nbs= p;    UnicodeStrToAsciiStrS (Uri, AsciiUri, UriLen);

 

   &nbs= p;    Status =3D HttpBootCheckUriScheme (AsciiUri);

+   = ;    if (Status =3D=3D EFI_INVALID_PARAMETER){

+   = ;        Status =3D HttpBootCheckStaticU= ri(Uri);

+   = ;        if (Status =3D=3D EFI_UNSUPPORT= ED)

+   = ;            return = EFI_INVALID_PARAMETER;

+   = ;    }

 

   &nbs= p;    if (Status =3D=3D EFI_INVALID_PARAMETER) {

 

   &nbs= p;      DEBUG ((EFI_D_ERROR, "HttpBootFo= rmCallback: %r.\n", Status));

 

   &nbs= p;      CreatePopUp (

*** NetworkPkg\HttpBoo= tDxe\HttpBootDxe.h 2020-05-07 22:54:46.000000000 +05-30

--- NetworkPkg\HttpBoo= tDxe\HttpBootDxe.h   2020-08-09 21:00:21.000000000 +05-30

***************

*** 1,6 ****

--- 1,13 ----

+ //**************= *********************************************************=

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*   = Copyright (c) 1985-2020, American Megatrends International LLC.  = *

+ //*  &= nbsp;           &nbs= p;             =             &nb= sp;            =             &nb= sp;   *

+ //*  &= nbsp;   All rights reserved. Subject to AMI licensing agreement.&= nbsp;      *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //**************= *********************************************************=

  /** @file<= /o:p>

    UEF= I HTTP boot driver's private data structure and interfaces declaration.

 

  Copyright = (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

  (C) Copyright 2= 016 Hewlett Packard Enterprise Development LP<BR>

  SPDX-License-Id= entifier: BSD-2-Clause-Patent

***************

*** 254,265 ****<= /o:p>

--- 261,273 ----<= /o:p>

    UIN= T32            =             &nb= sp;           SelectIndex= ;

    UIN= T32            =             &nb= sp;           SelectProxy= Type;

    HTT= P_BOOT_DHCP_PACKET_CACHE         &n= bsp;     OfferBuffer[HTTP_BOOT_OFFER_MAX_NUM];

    UIN= T32            =             &nb= sp;           OfferNum;

    UIN= T32            =             &nb= sp;           OfferCount[= HttpOfferTypeMax];

    UIN= T32            =             &nb= sp;           OfferIndex[= HttpOfferTypeMax][HTTP_BOOT_OFFER_MAX_NUM];

+   BOOL= EAN            =             &nb= sp;          UsingStatic;=

  };

 

  #define HT= TP_BOOT_PRIVATE_DATA_SIGNATURE       &nb= sp;  SIGNATURE_32 ('H', 'B', 'P', 'D')

  #define HTTP_BO= OT_VIRTUAL_NIC_SIGNATURE        &nb= sp;  SIGNATURE_32 ('H', 'B', 'V', 'N')

  #define HTTP_BO= OT_PRIVATE_DATA_FROM_LOADFILE(a)   CR (a, HTTP_BOOT_PRIVATE_DATA,= LoadFile, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)

  #define HTTP_BO= OT_PRIVATE_DATA_FROM_ID(a)         = CR (a, HTTP_BOOT_PRIVATE_DATA, Id, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)

***************

*** 518,524 ****<= /o:p>

--- 526,665 ----<= /o:p>

  HttpBootIp6DxeD= riverBindingStop (

    IN = EFI_DRIVER_BINDING_PROTOCOL  *This,

    IN = EFI_HANDLE           = ;        ControllerHandle,

    IN = UINTN           &nbs= p;            Number= OfChildren,

    IN = EFI_HANDLE           = ;        *ChildHandleBuffer OPTIONAL

    );<= o:p>

+ /**

+   Conf= igure Static Ip Address using Ipconfig2 Protocol

+

+   @par= am[in]  Private         &= nbsp;   Pointer to HTTP boot driver private data.

+ **/

+ EFI_STATUS =

+ StaticHttpBoot(H= TTP_BOOT_PRIVATE_DATA        *Private);<= o:p>

+ /**

+   Get = the IPv4 Address and Ipv6 Address   from the Input Devicepath.

+

+

+   @par= am[in]   FilePath        = Pointer to the device path which contains IPV4 and IPV6 path node.

+

+   @ret= val EFI_SUCCESS          =   The IPV4 Address and IPV6 Address successfully assigned to Private v= ariable 

+   = ;        EFI_INVALID_PARAMETER &nbs= p; If FilePath is Null

+   = ;        EFI_NOT_FOUND   =        If IPV4Address can't be found

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootParseIpA= ddress (

+   IN&n= bsp;    EFI_DEVICE_PATH_PROTOCOL     *Fi= lePath,

+   IN H= TTP_BOOT_PRIVATE_DATA         *Priv= ate

+   );

+ /******

+   Get = the IPv6Address,GatewayIp6Address using Http Uri given by user,<= /span>

+   IPV6= (LocalIp6Address,Tcp,static or dhcp,gatewayip6Address)/Dns(IP1,IP2,...,IPn)= /Uri(_http://DomainName/xxx.efi)

+

+   @par= am[in]  Buffer         &n= bsp;        URI string of the boot file.=

+   @par= am[out] LocalIp          =        Ipv6 LocalIp Address is updated static= ally based on Uri

+   @par= am[out] GatewayIp         &nbs= p;     Ipv6  GatewayIp is updated statically based= on Uri

+   @Par= am[out] String          &= nbsp;       The Error Message.

+  

+   @ret= val EFI_SUCCESS          =        IP Address is translated from String.<= o:p>

+   @ret= val EFI_INVALID_PARAMETER         &= nbsp;            Url= is not supported http and https

+   = ;        EFI_UNSUPPORTED  &nbs= p;          If IP Address is I= nvalid and Static Uri is invalid

+ *******/

+ EFI_STATUS<= /o:p>

+ VerifyIpv6Addres= s (

+   = ;    IN   CHAR16     &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;   *Buffer,

+   = ;    OUT  EFI_IP_ADDRESS      =     *LocalIp,

+   = ;    OUT  EFI_IP_ADDRESS      =     *GatewayIp,

+   = ;    OUT  CHAR16       &n= bsp;            = ;            &n= bsp;           *String&nb= sp;

+   &nbs= p;           );

+ /*********<= /o:p>

+   Get = the IPv4Address,subnetMask,GatewayIp using Http Uri given by user,

+   IPV4= (ClientAddress,protocol,static or Dhcp,gatewayip,subnetMask)/Dns(DnsIP1,Dns= IP2...,IPn)/Uri(_http://DomainName/xxx.efi)

+

+   @par= am[in]  Uri          = ;         The URI string of the boo= t file.

+   @par= am[out] LocalIP           = ;         Ipv4 LocalP is updated st= atically based on Uri

+   @par= am[out] SubnetMask         &nb= sp;  Ipv4 SubnetMask is updated statically based on Uri

+   @par= am[out] GatewayIp         &nbs= p;   Ipv4  GatewayIp is updated statically based on Uri=

+   @Par= am[out] String          &= nbsp;     The Error Message.

+  

+   @ret= val EFI_SUCCESS          =      IP Address is translated from String.

+   @ret= val EFI_INVALID_PARAMETER     Url is not supported http= and https

+   = ;        EFI_UNSUPPORTED  &nbs= p;        If IP Addrress and static Uri = is invalid

+ ********/

+ EFI_STATUS<= /o:p>

+ VerifyIpv4Addres= s (

+   = ;      IN   CHAR16    &nb= sp;            =             &nb= sp;            =    *Buffer,

+   &nbs= p;            &= nbsp;            OUT=   EFI_IP_ADDRESS     *LocalIp,

+   = ;      OUT  EFI_IP_ADDRESS    =    *SubnetMask,

+   = ;      OUT  EFI_IP_ADDRESS    =    *GatewayIp,

+   = ;      OUT  CHAR16    &nb= sp;            =             &nb= sp;            =             &nb= sp;  *String

+   &nbs= p;            &= nbsp;            );<= o:p>

+ /******

+ This function ch= ecks static Uri given by user.

+

+ @param[in] = Buffer           &n= bsp;   The URI string of the boot file.

+

+ @retval EFI_SUCC= ESS            =     Uri and static IP address are valid.

+   = ;      EFI_UNSUPPORTED    &nbs= p;       Static Uri is invalid Format.

+   &nbs= p;            &= nbsp;            EFI= _INVALID_PARAMETER      Url is not supported http = and https.

+ *******/

+ EFI_STATUS =

+ HttpBootCheckSta= ticUri(IN CHAR16 *Uri);

+ /**

+   Conf= igure Static IPv6 Address using Ip6config Protocol

+

+   @par= am[in]  Private         &= nbsp;   Pointer to HTTP boot driver private data.

+ **/

+ EFI_STATUS Stati= cHttpIPv6Boot (HTTP_BOOT_PRIVATE_DATA      &n= bsp; *Private);

+

+ /**

+   This= function will register the IPv4 gateway address to the network device.

+

+   @par= am[in]  Private         &= nbsp;   The pointer to HTTP_BOOT_PRIVATE_DATA.<= /p>

+

+   @ret= val     EFI_SUCCESS      =    The new IP configuration has been configured successfully.

+   @ret= val     Others       = ;       Failed to configure the address.=

+

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootRegister= Ip4Gateway (

+   IN H= TTP_BOOT_PRIVATE_DATA         *Priv= ate

+   );

+ /**

+   This= function will switch the IP4 configuration policy to Static.

+

+   @par= am[in]  Private         &= nbsp;   Pointer to HTTP boot driver private data.

+

+   @ret= val     EFI_SUCCESS      =    The policy is already configured to static.<= /p>

+   @ret= val     Others       = ;       Other error as indicated..=

+

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootSetIp4Po= licy (

+   IN H= TTP_BOOT_PRIVATE_DATA         *Priv= ate

+   );

+ /**

+   Chec= ks the HttpBoot Mode is static or Dhcp  from the Input Devicepath.

+   And = Update Private variable private->usingstatic

+

+

+   @par= am[in]   FilePath        = Pointer to the device path which contains a IPV4 and IPv6 device path node= .

+

+   @ret= val EFI_SUCCESS          =   The IPV4 Address  and IPv6 Address are successfully assigned to= Private variable 

+   = ;        EFI_INVALID_PARAMETER &nbs= p; If FilePath is Null

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootCheckBoo= tType (IN     EFI_DEVICE_PATH_PROTOCOL   = ;  *FilePath,IN HTTP_BOOT_PRIVATE_DATA     &n= bsp;   *Private);

+ /**

+   Get = the IPv4 and IPv6 Dns Address from Input Uri

+

+

+   @par= am[in]   Uri         = ;      Input Uri from Filepath

+   @par= am[in]   UsingIPv6        = ; Specifies the type of IP addresses.

+   @par= am[in]   Private        &= nbsp;  The pointer to the driver's private data.

+

+   @ret= val EFI_SUCCESS          =   The IPV4 Address  and IPv6 Address are successfully assigned to= HTTP boot driver private data.

+   = ;        EFI_INVALID_PARAMETER &nbs= p; If Uri is not a valid Static Devicepath URI

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootParseDns= Ip(IN CHAR8  *Uri,BOOLEAN UsingIpv6,IN HTTP_BOOT_PRIVATE_DATA &nb= sp;       *Private);

  #endif

*** NetworkPkg\HttpBoo= tDxe\HttpBootDxe.inf         &= nbsp;    2020-05-07 22:54:46.000000000 +05-30=

--- NetworkPkg\HttpBoo= tDxe\HttpBootDxe.inf 2020-07-24 16:19:43.000000000 +05-30

***************

*** 1,6 ****

--- 1,15 ----

+

+ #***************= ********************************************************<= /p>

+ #*  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;            = ;    *

+ #*   C= opyright (c) 1985-2020, American Megatrends International LLC.   = *

+ #*  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;            = ;    *

+ #*  &n= bsp;   All rights reserved. Subject to AMI licensing agreement.&n= bsp;      *

+ #*  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;            = ;    *

+ #***************= ********************************************************<= /p>

+

  ## @file

  #  This mo= dules produce the Load File Protocol for UEFI HTTP boot.<= /p>

  #

  #  Copyrig= ht (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR><= /o:p>

  #  SPDX-Li= cense-Identifier: BSD-2-Clause-Patent

  #

***************

*** 38,49 ****

--- 47,59 ----

    Htt= pBootSupport.h

    Htt= pBootSupport.c

    Htt= pBootClient.h

    Htt= pBootClient.c

    Htt= pBootConfigVfr.vfr

    Htt= pBootConfigStrings.uni

+   Http= BootStatic.c

 

  [LibraryCl= asses]

    Uef= iDriverEntryPoint

    Uef= iBootServicesTableLib

    Mem= oryAllocationLib

    Bas= eLib

*** NetworkPkg\HttpBoo= tDxe\HttpBootImpl.c         &n= bsp;      2020-05-07 22:54:46.000000000 +05-30=

--- NetworkPkg\HttpBoo= tDxe\HttpBootImpl.c   2020-08-09 20:08:53.000000000 +05-30

***************

*** 1,6 ****

--- 1,14 ----

+ //**************= *********************************************************=

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*   = Copyright (c) 1985-2020, American Megatrends International LLC.  = *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*  &= nbsp;   All rights reserved. Subject to AMI licensing agreement.&= nbsp;      *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //**************= *********************************************************=

+

  /** @file<= o:p>

    The= implementation of EFI_LOAD_FILE_PROTOCOL for UEFI HTTP boot.

 

  Copyright = (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>

  (C) Copyright 2= 016 Hewlett Packard Enterprise Development LP<BR>

  SPDX-License-Id= entifier: BSD-2-Clause-Patent

***************

*** 119,139 ****<= /o:p>

 

   &nbs= p;Uri =3D NULL;

 

   &nbs= p;if (Private =3D=3D NULL || FilePath =3D=3D NULL) {

   &nbs= p;  return EFI_INVALID_PARAMETER;

    }

!

   &nbs= p;//

    // = Check the URI in the input FilePath, in order to see whether it is

    // = required to boot from a new specified boot file.

    //<= o:p>

    Sta= tus =3D HttpBootParseFilePath (FilePath, &Uri);

    if = (EFI_ERROR (Status)) {

   &nbs= p;  return EFI_INVALID_PARAMETER;

!   }

 

   &nbs= p;//

    // = Check whether we need to stop and restart the HTTP boot driver.<= /span>

    //<= o:p>

    if = (Private->Started) {

   &nbs= p;  //

--- 127,158 ----<= /o:p>

 

   &nbs= p;Uri =3D NULL;

 

   &nbs= p;if (Private =3D=3D NULL || FilePath =3D=3D NULL) {

   &nbs= p;  return EFI_INVALID_PARAMETER;

    }

!   //<= /o:p>

!   // Check=   If HttpBoot get IP Address from user as statically or from dhcp in t= he input FilePath,

    //<= o:p>

+   Stat= us =3D HttpBootCheckBootType(FilePath,Private);

+   if (= EFI_ERROR (Status)) {

+   &nbs= p;         return EFI_INVALID_PARAM= ETER;

+   }

    // = Check the URI in the input FilePath, in order to see whether it is

    // = required to boot from a new specified boot file.

    //<= o:p>

    Sta= tus =3D HttpBootParseFilePath (FilePath, &Uri);

    if = (EFI_ERROR (Status)) {

   &nbs= p;  return EFI_INVALID_PARAMETER;

!   }

!  

!   if (Priv= ate->UsingStatic){

!   &nb= sp;     Status =3D HttpBootParseDnsIp(Uri,UsingIpv6,Pri= vate);

!   &nb= sp;     if (EFI_ERROR(Status))

!   &nb= sp;         return Status;

!   &nb= sp; }

 

   &nbs= p;//

    // = Check whether we need to stop and restart the HTTP boot driver.<= /span>

   //

    if = (Private->Started) {

   &nbs= p;  //

***************

*** 161,173 ****<= /o:p>

   &nbs= p;    if (Uri !=3D NULL) {

   &nbs= p;      FreePool (Uri);

   &nbs= p;    }

   &nbs= p;    return EFI_ALREADY_STARTED;

   &nbs= p;  }

    }

!

   &nbs= p;//

    // = Detect whether using ipv6 or not, and set it to the private data.

    //<= o:p>

    if = (UsingIpv6 && Private->Ip6Nic !=3D NULL) {

   &nbs= p;  Private->UsingIpv6 =3D TRUE;

    } e= lse if (!UsingIpv6 && Private->Ip4Nic !=3D NULL) {

--- 180,201 ----<= /o:p>

   &nbs= p;    if (Uri !=3D NULL) {

   &nbs= p;      FreePool (Uri);

   &nbs= p;    }

   &nbs= p;    return EFI_ALREADY_STARTED;

   &nbs= p;  }

    }

!  

!   //Check = the IP Address in the input FilePath and

!   //update= the Ip Address to Private Data

!   //<= /o:p>

!   if (Priv= ate->UsingStatic){

!   &nb= sp;   Status =3D HttpBootParseIpAddress (FilePath,Private);

!   &nb= sp;   if (EFI_ERROR (Status)) {

!   &nb= sp;       return Status;

!   &nb= sp;   }

!   }

    //<= o:p>

    // = Detect whether using ipv6 or not, and set it to the private data.

    //<= o:p>

    if = (UsingIpv6 && Private->Ip6Nic !=3D NULL) {

   &nbs= p;  Private->UsingIpv6 =3D TRUE;

    } e= lse if (!UsingIpv6 && Private->Ip4Nic !=3D NULL) {

***************

*** 196,215 ****<= /o:p>

--- 224,245 ----<= /o:p>

   &nbs= p;  }

    }

 

   &nbs= p;//

    // = Init the content of cached DHCP offer list.

    //<= o:p>

+ if(!Private->= UsingStatic){

   &nbs= p;ZeroMem (Private->OfferBuffer, sizeof (Private->OfferBuffer));=

    if = (!Private->UsingIpv6) {

   &nbs= p;  for (Index =3D 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index+&#= 43;) {

   &nbs= p;    Private->OfferBuffer[Index].Dhcp4.Packet.Offer.Size= =3D HTTP_CACHED_DHCP4_PACKET_MAX_SIZE;

   &nbs= p;  }

    } e= lse {

   &nbs= p;  for (Index =3D 0; Index < HTTP_BOOT_OFFER_MAX_NUM; Index+&#= 43;) {

   &nbs= p;    Private->OfferBuffer[Index].Dhcp6.Packet.Offer.Size= =3D HTTP_CACHED_DHCP6_PACKET_MAX_SIZE;

+   = ;  }

   &nbs= p;  }

    }

 

   &nbs= p;if (Private->UsingIpv6) {

   &nbs= p;  //

   &nbs= p;  // Set Ip6 policy to Automatic to start the Ip6 router discovery.<= o:p>

***************

*** 252,274 ****<= /o:p>

   &nbs= p;  return EFI_NOT_STARTED;

    }

 

   &nbs= p;Status =3D EFI_DEVICE_ERROR;

 

   &nbs= p;if (!Private->UsingIpv6) {

!   &nb= sp; //

   &nbs= p;  // Start D.O.R.A process to get a IPv4 address and other boot info= rmation.

   &nbs= p;  //

!   &nb= sp; Status =3D HttpBootDhcp4Dora (Private);

    } e= lse {

!   &nb= sp;  //

   &nbs= p;  // Start S.A.R.R process to get a IPv6 address and other boot info= rmation.

   &nbs= p;  //

!   &nb= sp; Status =3D HttpBootDhcp6Sarr (Private);

!   }

!

   &nbs= p;return Status;

  }

 

  /**

    Att= empt to download the boot file through HTTP message exchange.

 

--- 282,332 ----<= /o:p>

   &nbs= p;  return EFI_NOT_STARTED;

    }

 

   &nbs= p;Status =3D EFI_DEVICE_ERROR;

 

   &nbs= p;if (!Private->UsingIpv6) {

!   

!   &nb= sp; if (!Private->UsingStatic) {

!    &n= bsp;          //

   &nbs= p;  // Start D.O.R.A process to get a IPv4 address and other boot info= rmation.

   &nbs= p;  //

!   &nb= sp;     Status =3D HttpBootDhcp4Dora (Private);

!    }e= lse{

!   &nb= sp;   Status =3D HttpBootSetIp4Policy (Private);

!   &nb= sp;   if (EFI_ERROR (Status)) {

!   &nb= sp;     return Status;

!   &nb= sp;   }

!   &nb= sp;   Status =3D StaticHttpBoot(Private);

!   &nb= sp;   if (EFI_ERROR (Status)) {

!   &nb= sp;       return Status;

!   &nb= sp;    }

!   &nb= sp;   Status =3D HttpBootRegisterIp4Gateway (Private);=

!   &nb= sp;   if (EFI_ERROR (Status)) {

!   &nb= sp;       return Status;

!   &nb= sp;    }

!

!   &nb= sp;   AsciiPrint ("\n  Station IP address is ");

!   &nb= sp;   HttpBootShowIp4Addr (&Private->StationIp.v4);

!   &nb= sp;   AsciiPrint ("\n");

!   &nb= sp; }

!   &nb= sp;

   &nbs= p;} else {

!   &nb= sp; 

!   &nb= sp; if (!Private->UsingStatic){

!    &n= bsp;         //

   &nbs= p;  // Start S.A.R.R process to get a IPv6 address and other boot info= rmation.

   &nbs= p;  //

!   &nb= sp;     Status =3D HttpBootDhcp6Sarr (Private);

!   &nb= sp; }else{

!   &nb= sp;     Status =3D StaticHttpIPv6Boot (Private);

!   &nb= sp;     AsciiPrint ("\n  Station IPv6 address= is ");

!   &nb= sp;     HttpBootShowIp6Addr (&Private->StationIp= .v6);

!   &nb= sp;     AsciiPrint ("\n");<= /p>

!   &nb= sp; }

!   }

    ret= urn Status;

  }

 

  /**

    Att= empt to download the boot file through HTTP message exchange.

 

*** =

--- NetworkPkg\HttpBoo= tDxe\HttpBootStatic.c 2020-08-09 21:00:09.000000000 +05-30

***************

*** 0 ****<= /span>

--- 1,650 ----

+ //**************= *********************************************************=

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*   = Copyright (c) 1985-2020, American Megatrends International LLC.  = *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //*  &= nbsp;   All rights reserved. Subject to AMI licensing agreement.&= nbsp;      *

+ //*  &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    *

+ //**************= *********************************************************=

+

+ /** @file HttpBo= otStatic.c  

+ Provides the Sta= tic Http Boot related functions .

+

+ Copyright (c) 20= 15 - 2018, Intel Corporation. All rights reserved.<BR>

+ (C) Copyright 20= 16 Hewlett Packard Enterprise Development LP<BR>

+ SPDX-License-Ide= ntifier: BSD-2-Clause-Patent

+

+ **/

+

+

+ #include "H= ttpBootDxe.h"

+ #include <Lib= rary/UefiBootManagerLib.h>

+

+

+ /**

+   Get = the IPv4 and IPv6 Address  from the Input Devicepath.

+

+

+   @par= am[in]   FilePath        = Pointer to the device path which contains a IPV4 and IPV6 device path node= .

+

+   @ret= val EFI_SUCCESS          =   The IPV4 Address  and IPv6 Address are successfully assigned to= Private variable 

+   = ;        EFI_INVALID_PARAMETER &nbs= p; If FilePath is Null

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootParseIpA= ddress (

+   IN&n= bsp;    EFI_DEVICE_PATH_PROTOCOL     *Fi= lePath,

+   IN H= TTP_BOOT_PRIVATE_DATA         *Priv= ate

+   )

+ {

+   EFI_= DEVICE_PATH_PROTOCOL  *TempDevicePath;

+   EFI_= DEV_PATH           &= nbsp;          *Node;

+

+   if (= FilePath =3D=3D NULL) {

+   = ;  return EFI_INVALID_PARAMETER;

+   }

+   = ;

+   Zero= Mem (&Private->StationIp, sizeof (EFI_IP_ADDRESS));

+   Zero= Mem (&Private->SubnetMask,  sizeof (EFI_IP_ADDRESS));

+   Zero= Mem (&Private->GatewayIp, sizeof (EFI_IP_ADDRESS));

+   //

+   // E= xtract the IPV4 address from the FilePath

+   //

+  

+   Temp= DevicePath =3D FilePath;

+   whil= e (!IsDevicePathEnd (TempDevicePath)) {

+   = ;   

+   = ; if ((DevicePathType (TempDevicePath) =3D=3D MESSAGING_DEVICE_PATH) &&= amp;

+   = ;         (DevicePathSubType (TempD= evicePath) =3D=3D MSG_IPv4_DP)) {

+   = ;    Node =3D ( EFI_DEV_PATH *)TempDevicePath;

+   = ;   

+   = ;    CopyMem (&Private->StationIp.v4, &Node->I= pv4.LocalIpAddress, sizeof (EFI_IPv4_ADDRESS));

+   = ;    CopyMem (&Private->SubnetMask.v4, &Node->= Ipv4.SubnetMask , sizeof (EFI_IPv4_ADDRESS));

+   = ;    CopyMem (&Private->GatewayIp.v4, &Node->I= pv4.GatewayIpAddress, sizeof (EFI_IPv4_ADDRESS));

+   = ; }

+   = ; else if ((DevicePathType (TempDevicePath) =3D=3D MESSAGING_DEVICE_PATH) &= amp;&

+   = ;            &n= bsp; (DevicePathSubType (TempDevicePath) =3D=3D MSG_IPv6_DP)) {<= /span>

+   = ;       Node =3D (EFI_DEV_PATH *)TempDevicePa= th ;

+   = ;       CopyMem (&Private ->StationIp.= v6,&Node ->Ipv6.LocalIpAddress,sizeof (EFI_IPv6_ADDRESS));

+   = ;       CopyMem (&Private ->GatewayIp.= v6,&Node ->Ipv6.GatewayIpAddress,sizeof (EFI_IPv6_ADDRESS));

+   = ;   }

+   = ;

+   = ;  TempDevicePath =3D NextDevicePathNode (TempDevicePath);<= /span>

+   }

+

+   retu= rn EFI_SUCCESS;

+ }

+

+ /**

+   The = notify function of create event when performing a manual config.=

+

+   @par= am[in]    Event        Th= e event this notify function registered to.

+   @par= am[in]    Context      Pointer to t= he context data registered to the event.

+

+ **/

+ VOID<= /span>

+ EFIAPI

+ IfConfigManualAd= dressNotify (

+   IN E= FI_EVENT    Event,

+   IN V= OID         *Context

+   )

+ {

+   = ;  *((BOOLEAN *) Context) =3D TRUE;

+ }

+ /**

+   Conf= igure Static Ip Address using Ip4config2 Protocol

+

+   @par= am[in]  Private         &= nbsp;   Pointer to HTTP boot driver private data.

+ **/

+ EFI_STATUS =

+ StaticHttpBoot (= HTTP_BOOT_PRIVATE_DATA        *Private)<= o:p>

+ {

+   = ;  EFI_EVENT         &nbs= p;            &= nbsp; MappedEvt;

+   = ;  BOOLEAN          =             &nb= sp;   IsAddressOk;

+   = ;  EFI_IP4_CONFIG2_POLICY       &nb= sp;   Policy;

+   = ;  EFI_IP4_CONFIG2_MANUAL_ADDRESS   ManualAddress;

+   = ;  EFI_STATUS         &nb= sp;            = Status;

+   = ;  UINTN          &n= bsp;            = ;     DataSize ;

+   = ;  EFI_IP4_CONFIG2_PROTOCOL       &= nbsp; *IfCfg ;

+   &nbs= p; EFI_EVENT         &nbs= p;            &= nbsp; TimeOutEvt ;

+   = ;  //

+   = ;  // Create events & timers for asynchronous settings.=

+   = ;  //

+   = ;  CopyMem (&ManualAddress.Address , &Private->StationIp.v4= , sizeof (EFI_IPv4_ADDRESS));

+   = ;  CopyMem (&ManualAddress.SubnetMask , &Private ->SubnetMa= sk.v4, sizeof (EFI_IPv4_ADDRESS));

+

+   = ; 

+   = ;  Status =3D gBS->CreateEvent (

+   = ;            &n= bsp;     EVT_TIMER,

+   = ;            &n= bsp;     TPL_CALLBACK,

+   = ;            &n= bsp;     NULL,

+   = ;            &n= bsp;     NULL,

+   = ;            &n= bsp;     &TimeOutEvt

+   = ;            &n= bsp;     );

+   = ;  if (EFI_ERROR(Status))

+   = ;      return Status;

+   = ; 

+   = ;  Status =3D gBS->CreateEvent (

+   = ;            &n= bsp; EVT_NOTIFY_SIGNAL,

+   = ;            &n= bsp; TPL_NOTIFY,

+   = ;            &n= bsp; IfConfigManualAddressNotify,

+   = ;            &n= bsp; &IsAddressOk,

+   = ;            &n= bsp; &MappedEvt

+   = ;            &n= bsp; );

+   = ;  if (EFI_ERROR(Status))

+   = ;      return Status;

+

+   = ;  IfCfg  =3D Private->Ip4Config2; 

+   = ;  Status =3D IfCfg->RegisterDataNotify (

+   = ;            &n= bsp;            &nbs= p;IfCfg,

+   = ;            &n= bsp;            = ; Ip4Config2DataTypeManualAddress,

+   = ;            &n= bsp;            = ; MappedEvt

+   = ;            &n= bsp;            = ; );

+   = ;  if (EFI_ERROR(Status))

+   = ;      return Status;

+   = ;  Policy =3D Ip4Config2PolicyStatic;

+   = ;  Status =3D IfCfg->SetData (

+   = ;            &n= bsp;            = ; IfCfg,

+   = ;            &n= bsp;            = ; Ip4Config2DataTypePolicy,

+   = ;            &n= bsp;            = ; sizeof (EFI_IP4_CONFIG2_POLICY),

+   = ;            &n= bsp;            = ; &Policy

+   = ;            &n= bsp;            = ; );

+   &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;            &= nbsp;           &nbs= p;    

+ if (EFI_ERROR(St= atus))

+   = ;      return Status;

+   = ;  DataSize =3D sizeof (EFI_IP4_CONFIG2_MANUAL_ADDRESS);

+   = ; 

+   = ;  Status =3D IfCfg->SetData (

+   = ;            &n= bsp;           IfCfg,

+   = ;            &n= bsp;           Ip4Config2= DataTypeManualAddress,

+   = ;             &= nbsp;          DataSize,<= o:p>

+   = ;            &n= bsp;           &Manua= lAddress

+   = ;            &n= bsp;           );

+   = ;  if (Status =3D=3D EFI_NOT_READY) {

+   = ;      gBS->SetTimer (TimeOutEvt, TimerRelative= , 50000000);

+   = ;      while (EFI_ERROR (gBS->CheckEvent (TimeO= utEvt))) {

+   = ;          if (IsAddressOk) {<= o:p>

+   = ;            &n= bsp; Status =3D EFI_SUCCESS;

+   = ;            &n= bsp; break;

+   = ;    }

+   = ;  }

+   = ;  }

+

+   = ;  Status =3D IfCfg->UnregisterDataNotify (

+   = ;            &n= bsp;  IfCfg,

+   = ;            &n= bsp;  Ip4Config2DataTypeManualAddress,

+   &nbs= p;            &= nbsp; MappedEvt

+   = ;            &n= bsp;  );

+   = ; 

+   = ;  return Status;

+ }  &nb= sp;            =     

+

+ /**

+   The = notify function of create event when performing a manual config.=

+

+   @par= am[in]    Event        Th= e event this notify function registered to.

+   @par= am[in]    Context      Pointer to t= he context data registered to the event.

+

+ **/

+ VOID<= /span>

+ EFIAPI

+ IfConfig6ManualA= ddressNotify (

+   IN E= FI_EVENT    Event,

+   IN V= OID         *Context

+   )

+ {

+   *((B= OOLEAN *) Context) =3D TRUE;

+ }

+ /**

+   Conf= igure Static Ipv6 Address using Ip6config Protocol

+

+   @par= am[in]  Private         &= nbsp;   Pointer to HTTP boot driver private data.

+ **/

+

+ EFI_STATUS =

+ StaticHttpIPv6Bo= ot (HTTP_BOOT_PRIVATE_DATA        *Priva= te)

+ {

+   = ;  EFI_STATUS         &nb= sp;            = Status;

+   = ;  EFI_IP6_CONFIG_PROTOCOL       &n= bsp;  *IfCfg;

+   &nbs= p;         EFI_IP6_CONFIG_MANUAL_AD= DRESS    CfgManAddr;

+   &nbs= p;         UINT32   =             &nb= sp;           CurDadXmits= ;

+   &nbs= p;         UINTN   &= nbsp;           &nbs= p;            CurDad= XmitsLen;

+   &nbs= p;         EFI_IP6_CONFIG_POLICY&nb= sp;           Policy;

+   &nbs= p;         EFI_EVENT  &nb= sp;            =          TimeOutEvt;

+   &nbs= p;         EFI_EVENT  &nb= sp;            =          MappedEvt;

+   &nbs= p;         BOOLEAN   = ;            &n= bsp;          IsAddressOk;

+   = ; 

+   &nbs= p;          // Set static host= ip6 address list.

+   &nbs= p;          //   Thi= s is a asynchronous process.

+   &nbs= p;          //

+   &nbs= p;         CopyMem (&CfgManAddr= .Address,&Private->StationIp.v6,sizeof(EFI_IPv6_ADDRESS));

+   &nbs= p;         CfgManAddr.PrefixLength = =3D IP6_PREFIX_LENGTH;

+   &nbs= p;         CfgManAddr.IsAnycast =3D= FALSE ;

+   &nbs= p;        

+   &nbs= p;         IsAddressOk =3D FALSE;

+   &nbs= p;         IfCfg  =3D Private-= >Ip6Config;

+   &nbs= p;         Status =3D gBS->Creat= eEvent (

+   &nbs= p;             =             &nb= sp;EVT_TIMER,

+   &nbs= p;             =             &nb= sp;TPL_CALLBACK,

+   &nbs= p;             =             &nb= sp;NULL,

+   &nbs= p;             =             &nb= sp;NULL,

+   &nbs= p;             =             &nb= sp;&TimeOutEvt

+   &nbs= p;             =             &nb= sp;);

+   &nbs= p;         if (EFI_ERROR(Status))

+   &nbs= p;             =             return S= tatus;

+   = ;  

+   = ;  Status =3D gBS->CreateEvent (

+   = ;            &n= bsp;  EVT_NOTIFY_SIGNAL,

+   = ;            &n= bsp;  TPL_NOTIFY,

+   = ;            &n= bsp;  IfConfig6ManualAddressNotify,

+   = ;            &n= bsp;  &IsAddressOk,

+   = ;            &n= bsp;  &MappedEvt

+   = ;            &n= bsp;  );

+   = ;  if (EFI_ERROR(Status))

+   = ;          return Status;

+

+   &nbs= p;         Status =3D IfCfg->Reg= isterDataNotify (

+   &nbs= p;             =             &nb= sp;    IfCfg,

+   &nbs= p;             =             &nb= sp;    Ip6ConfigDataTypeManualAddress,

+   &nbs= p;             =             &nb= sp;    MappedEvt

+   &nbs= p;             =             &nb= sp;    );

+   &nbs= p;         if (EFI_ERROR (Status)) = {

+   &nbs= p;            &= nbsp;            ret= urn Status;

+   &nbs= p;         }

+   &nbs= p;        

+   &nbs= p;         Policy =3D Ip6ConfigPoli= cyManual;

+   &nbs= p;         Status =3D IfCfg->Set= Data (

+   &nbs= p;             =             &nb= sp;    IfCfg,

+   &nbs= p;             =             &nb= sp;    Ip6ConfigDataTypePolicy,

+   &nbs= p;             =             &nb= sp;    sizeof (EFI_IP6_CONFIG_POLICY),

+   &nbs= p;             =             &nb= sp;    &Policy

+   &nbs= p;             =             &nb= sp;    );

+   &nbs= p;         if (EFI_ERROR (Status)) = {

+   &nbs= p;          goto ON_EXIT;=

+   &nbs= p;             =   }

+   = ;      

+   &nbs= p;         Status =3D IfCfg->Set= Data (

+   &nbs= p;             =             &nb= sp;    IfCfg,

+   &nbs= p;             =             &nb= sp;    Ip6ConfigDataTypeManualAddress,

+   &nbs= p;             =             &nb= sp;    sizeof(EFI_IP6_CONFIG_MANUAL_ADDRESS),

+   &nbs= p;             =             &nb= sp;    &CfgManAddr

+   &nbs= p;             =             &nb= sp;    );

+   = ;      

+

+   &nbs= p;         if (Status =3D=3D EFI_NO= T_READY) {

+   &nbs= p;         //

+   &nbs= p;         // Get current dad trans= mits count.

+   &nbs= p;         //

+   &nbs= p;         CurDadXmitsLen =3D sizeo= f (EFI_IP6_CONFIG_DUP_ADDR_DETECT_TRANSMITS);

+   &nbs= p;         Status =3D IfCfg->Get= Data (

+   &nbs= p;             =           IfCfg,

+   &nbs= p;             =           Ip6ConfigDataTy= peDupAddrDetectTransmits,

+   &nbs= p;             =           &CurDadXmit= sLen,

+   &nbs= p;             =           &CurDadXmit= s

+   &nbs= p;             =           );

+   &nbs= p;         if (EFI_ERROR (Status)) = {

+   &nbs= p;           goto ON_EXIT= ;

+   &nbs= p;         }

+

+   &nbs= p;         gBS->SetTimer (TimeOu= tEvt, TimerRelative, 50000000 + 10000000 * CurDadXmits);

+

+   &nbs= p;         while (EFI_ERROR (gBS-&g= t;CheckEvent (TimeOutEvt))) {

+   &nbs= p;            &= nbsp;            if = (IsAddressOk) {

+   &nbs= p;             =             Status = =3D EFI_SUCCESS;

+   &nbs= p;            &= nbsp;            bre= ak;

+   &nbs= p;            &= nbsp;            }

+   &nbs= p;         }

+   &nbs= p;         }

+

+   &nbs= p;         Status =3D IfCfg->Set= Data (

+   &nbs= p;             =             &nb= sp;       IfCfg,

+   &nbs= p;             =             &nb= sp;       Ip6ConfigDataTypeGateway,=

+   &nbs= p;             =             &nb= sp;       sizeof(EFI_IPv6_ADDRESS),=

+   &nbs= p;             =             &nb= sp;       &Private->GatewayIp.v6<= o:p>

+   &nbs= p;             =             &nb= sp;       );

+   &nbs= p;         if (EFI_ERROR (Status)) = {

+   &nbs= p;            &= nbsp;            got= o ON_EXIT;

+   &nbs= p;         }

+

+ ON_EXIT:

+

+   &nbs= p;         Status =3D IfCfg->Unr= egisterDataNotify (

+   &nbs= p;             =        IfCfg,

+   &nbs= p;             =         Ip6ConfigDataTypeManualAddr= ess,

+   &nbs= p;             =         MappedEvt=

+   &nbs= p;             =         );

+

+   &nbs= p;         if (EFI_ERROR (Status)) = {

+   &nbs= p;            &= nbsp;            ret= urn Status;

+   &nbs= p;         }

+   &nbs= p;         return Status;

+   = ;          

+ }

+ /*********<= /o:p>

+   Get = the IPv4Address,subnetMask,GatewayIp using Http Uri given by user,

+   IPV4= (ClientAddress,protocol,static or Dhcp ,gatewayip,subnetMask)/Dns(DnsIP1,Dn= sIP2...,IPn)/Uri(_http://DomainName/xxx.efi)

+

+   @par= am[in]  Uri          = ;         The URI string of the boo= t file.

+   @par= am[out] LocalIP           = ;         Ipv4 LocalP is updated st= atically based on Uri

+   @par= am[out] SubnetMask         &nb= sp;  Ipv4 SubnetMask is updated statically based on Uri

+   @par= am[out] GatewayIp         &nbs= p;   Ipv4  GatewayIp is updated statically based on Uri=

+   @Par= am[out] String          &= nbsp;     The Error Message.

+  

+   @ret= val EFI_SUCCESS          =      IP Address is translated from String.

+   @ret= val EFI_INVALID_PARAMETER     Url is not supported http= and https

+   = ;        EFI_UNSUPPORTED  &nbs= p;        If IP Addrress and static Uri = is invalid

+ ********/

+ EFI_STATUS<= /o:p>

+ VerifyIpv4Addres= s (

+   = ;      IN   CHAR16   &nbs= p;         *Buffer,

+   = ;      OUT  EFI_IP_ADDRESS   &= nbsp; *LocalIp,

+   = ;      OUT  EFI_IP_ADDRESS   &= nbsp; *SubnetMask,

+   = ;      OUT  EFI_IP_ADDRESS   &= nbsp; *GatewayIp,

+   = ;      OUT  CHAR16    &nb= sp;        *String

+   = ;      )

+ {

+   = ;  CHAR16          &= nbsp;           &nbs= p; *EndPointer;

+   = ;  RETURN_STATUS         =          Status;<= /p>

+   = ;  EFI_IPv4_ADDRESS        &nb= sp;      Dns;

+   = ;  CHAR8          &n= bsp;            = ;  AsciiUri[URI_STR_MAX_SIZE];

+   = ; 

+   = ;  if (StrnCmp (Buffer ,L"ipv4(",5)){

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE, L"I= nvalid Uri Format!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  Buffer +=3DStrLen(L"ipv4(");

+   = ;  Status =3D StrToIpv4Address (Buffer, &EndPointer,&LocalIp-&= gt;v4,NULL);

+   = ;  if (RETURN_ERROR (Status)){

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE,L"In= valid LocalIP address!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  Buffer =3D EndPointer;

+   = ;  if (StrnCmp(Buffer,L",tcp,static,",12 ) && StrnCm= p(Buffer,L",tcp,dhcp,",10 )){

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE, L"I= nvalid Uri Format!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  if (StrnCmp(Buffer,L",tcp,dhcp,",10))

+   = ;      Buffer +=3DStrLen(L",tcp,static,&q= uot;);

+   = ;  else

+   = ;      Buffer +=3DStrLen(L",tcp,dhcp,&quo= t;);

+   = ; 

+   = ;  Status =3D StrToIpv4Address (Buffer,&EndPointer, &GatewayIp= ->v4,NULL);

+   = ;  if (RETURN_ERROR(Status)) {

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE,L"In= valid GatewayIP Address!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  Buffer =3D EndPointer + 1;

+   = ;  Status =3D StrToIpv4Address (Buffer,&EndPointer, &SubnetMas= k->v4,NULL);

+   = ;  if (RETURN_ERROR(Status)) {

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE,L"In= valid SubnetMask Address!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  Buffer =3D EndPointer;

+   = ;  if (StrnCmp(Buffer,L")/uri(",6) && StrnCmp(Buffer= ,L")/dns(",6)){

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE, L"I= nvalid Uri Format!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  if (!StrnCmp(Buffer,L")/dns(",6))

+   = ;  {

+   = ;      Buffer +=3D StrLen(L")/dns(")= ;

+   = ;      do{

+   = ;          Status  =3D St= rToIpv4Address (Buffer,&EndPointer, &Dns,NULL);

+   = ;          if (RETURN_ERROR(St= atus)) {

+   = ;             S= trCpyS (String ,URI_STR_MAX_SIZE,L"Invalid DnsServerIP Address!")= ;

+   = ;             r= eturn EFI_UNSUPPORTED;

+   = ;           }<= /span>

+   = ;          Buffer =3D EndPoint= er +1;

+   = ;      }while(*EndPointer =3D=3D L',');  = ;

+   = ;  }

+   = ;  if (!StrnCmp (Buffer,L"}/uri(",6)){

+   = ;      Buffer +=3DStrLen(L")/uri(");=

+   = ;      UnicodeStrToAsciiStrS (Buffer, AsciiUri, UR= I_STR_MAX_SIZE);

+   = ;      Status =3D HttpBootCheckUriScheme (AsciiUri= );

+   = ;      return Status;

+   = ;  }

+   = ;     

+   = ;  return EFI_SUCCESS;

+ }

+

+ /******

+   Get = the IPv6Address,GatewayIp6Address using Http Uri given by user,<= /span>

+   IPV6= (LocalIp6Address,Tcp,static or dhcp,gatewayip6Address)/Dns(IP1,IP2,...,IPn)= /Uri(_http://DomainName/xxx.efi)

+

+   @par= am[in]  Buffer         &n= bsp;        URI string of the boot file.=

+   @par= am[out] LocalIp          =        Ipv6 LocalIp Address is updated static= ally based on Uri

+   @par= am[out] GatewayIp         &nbs= p;     Ipv6  GatewayIp is updated statically based= on Uri

+   @Par= am[out] String          &= nbsp;       The Error Message.

+  

+   @ret= val EFI_SUCCESS          =        IP Address is translated from String.<= o:p>

+   @ret= val EFI_INVALID_PARAMETER         &= nbsp;            Url= is not supported http and https

+   = ;        EFI_UNSUPPORTED  &nbs= p;          If IP Address is I= nvalid and Static Uri is invalid

+ *******/

+ EFI_STATUS<= /o:p>

+ VerifyIpv6Addres= s (

+   = ;    IN   CHAR16      &nb= sp;            =             &nb= sp;            =    *Buffer,

+   = ;    OUT  EFI_IP_ADDRESS      =    *LocalIp,

+   = ;    OUT  EFI_IP_ADDRESS      =    *GatewayIp,

+   = ;    OUT  CHAR16       &n= bsp;            = ;            &n= bsp;          *String 

+   &nbs= p;           )=

+ {

+   = ; 

+   = ;  CHAR16          &= nbsp;           &nbs= p; *EndPointer;

+   = ;  RETURN_STATUS         =          Status;<= /p>

+   = ;  EFI_IPv6_ADDRESS        &nb= sp;        Dns;

+   = ;  CHAR8          &n= bsp;            = ;  AsciiUri[URI_STR_MAX_SIZE];

+   = ; 

+   = ;  if (StrnCmp (Buffer ,L"ipv6(",5)){

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE, L"I= nvalid Uri Format!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  Buffer +=3D StrLen (L"ipv6(");

+   = ;  Status =3D StrToIpv6Address (Buffer, &EndPointer,&LocalIp-&= gt;v6,NULL);

+   = ;  if (RETURN_ERROR (Status)){

+   = ;    StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Local= IP address!");

+   = ;    return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  Buffer =3D EndPointer;

+   = ;  if (StrnCmp(Buffer,L",tcp,static,",12) && StrnCmp= (Buffer,L",tcp,dhcp,",10)){

+   = ;    StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Uri F= ormat!");

+   = ;    return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  if (StrnCmp(Buffer,L",tcp,dhcp,",10))

+   = ;      Buffer +=3DStrLen(L",tcp,static,&q= uot;);

+   = ;  else

+   = ;      Buffer +=3DStrLen(L",tcp,dhcp,&quo= t;);

+   = ; 

+   = ;  Status =3D StrToIpv6Address (Buffer,&EndPointer, &GatewayIp= ->v6,NULL);

+   = ;  if (RETURN_ERROR (Status) ) {

+   = ;    StrCpyS (String ,URI_STR_MAX_SIZE, L"Invalid Gatew= ayIP Address!");

+   = ;    return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  Buffer =3D EndPointer;

+   = ;  if (StrnCmp(Buffer,L")/uri(",6) && StrnCmp(Buffer= ,L")/dns(",6)){

+   = ;      StrCpyS (String ,URI_STR_MAX_SIZE, L"I= nvalid Uri Format!");

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  if (!StrnCmp(Buffer,L")/dns(",6))

+   = ;  {

+   = ;      Buffer +=3D StrLen(L")/dns(")= ;

+   = ;      do{

+   = ;          Status  =3D St= rToIpv6Address (Buffer,&EndPointer, &Dns,NULL);

+   = ;          if (RETURN_ERROR(St= atus)) {

+   = ;             S= trCpyS (String ,URI_STR_MAX_SIZE,L"Invalid DnsServerIP Address!")= ;

+   = ;             r= eturn EFI_UNSUPPORTED;

+   = ;           }<= /span>

+   = ;          Buffer =3D EndPoint= er +1;

+   = ;      }while(*EndPointer =3D=3D L',');  = ;

+   = ;  }

+   = ;  if (!StrnCmp (Buffer,L"}/uri(",6)){

+   = ;      Buffer +=3DStrLen(L")/uri(");=

+   = ;      UnicodeStrToAsciiStrS (Buffer, AsciiUri, UR= I_STR_MAX_SIZE);

+   = ;      Status =3D HttpBootCheckUriScheme (AsciiUri= );

+   = ;      return Status;

+   = ;  }

+   = ;  return EFI_SUCCESS;

+ }

+ /******

+ This function ch= ecks static Uri given by user and returns BOOLEAN(TRUE:valid Uri,FALSE:Inva= lid Uri)

+

+ @param[in] = Buffer           &n= bsp;   The URI string of the boot file.

+

+ @retval SUCCESS&= nbsp;  Uri and static IP address are valid.

+   = ;      EFI_UNSUPPORTED Static Uri is invalid Forma= t.

+   &nbs= p;            &= nbsp;            EFI= _INVALID_PARAMETER  Url is not supported http and https

+ *******/

+ EFI_STATUS<= /o:p>

+ HttpBootCheckSta= ticUri(IN CHAR16 *Uri)

+ {

+   = ;  EFI_STATUS         &nb= sp;            Statu= s;

+   = ;  EFI_INPUT_KEY         =           Key;

+   = ;  EFI_IP_ADDRESS         = ;         LocalIp;

+   = ;  EFI_IP_ADDRESS         = ;         SubnetMask;

+   = ;  EFI_IP_ADDRESS         = ;         GatewayIp;

+   = ;  CHAR16          &= nbsp;           &nbs= p;   ErrorMessage[URI_STR_MAX_SIZE];

+   = ;  UINTN          &n= bsp;            = ;    Index =3D 0;

+   = ; 

+   = ;  if (StrLen (Uri) =3D=3D 0)

+   = ;      return EFI_INVALID_PARAMETER;

+   = ;   

+   = ;  for (Index =3D 0; Index < StrLen (Uri); Index++) {<= /o:p>

+   = ;      if (Uri[Index] =3D=3D L'/' && Uri[I= ndex + 1] =3D=3D L'/') {

+   = ;        break;

+   = ;      }

+   = ;    if (Uri[Index] >=3D L'A' && Uri[Index] <= =3D L'Z') {

+   = ;      Uri[Index] -=3D (CHAR16)(L'A' - L'a');=

+   = ;    }

+   = ;  }

+   = ;  if (StrnCmp (Uri,L"ipv4(",5) =3D=3D 0){=

+   = ;      Status =3D VerifyIpv4Address (Uri,&Loca= lIp,&SubnetMask,&GatewayIp,ErrorMessage);

+   = ;      if (EFI_ERROR(Status)){

+   = ;         CreatePopUp (<= /span>

+   = ;             E= FI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

+   = ;             &= amp;Key,

+   = ;             E= rrorMessage,

+   = ;             N= ULL

+   = ;             )= ;

+   = ;         return Status;=

+   = ;     }

+   = ;  }else if (StrnCmp (Uri,L"ipv6(",5) =3D=3D 0){<= /span>

+   = ;      Status =3D VerifyIpv6Address (Uri,&Loca= lIp,&GatewayIp,ErrorMessage);

+   = ;      if (EFI_ERROR(Status)){

+   = ;          CreatePopUp (<= /o:p>

+   = ;             E= FI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

+   = ;             &= amp;Key,

+   = ;             E= rrorMessage,

+   = ;             N= ULL

+   = ;             )= ;

+   = ;          return Status;=

+   = ;      }

+   = ;  }else  if ((StrnCmp(Uri, L"http://", 7) !=3D 0) &= ;& (StrnCmp(Uri, L"https://", 8) !=3D 0)){<= /p>

+   = ;      CreatePopUp (

+   = ;             E= FI_LIGHTGRAY | EFI_BACKGROUND_BLUE,

+   = ;             &= amp;Key,

+   = ;             L= "Invalid Uri",

+   = ;             N= ULL

+   = ;             )= ;

+   = ;      return EFI_UNSUPPORTED;

+   = ;  }

+   = ;  return EFI_SUCCESS ;

+ }

+ /**

+   Chec= ks the HttpBoot Mode is static or Dhcp  from the Input Devicepath.

+   And = Update Private Variable Private->UsingStatic

+

+

+   @par= am[in]   FilePath        = Pointer to the device path which contains a IPV4 and IPv6 device path node= .

+

+   @ret= val EFI_SUCCESS          =   The IPV4 Address  and IPv6 Address are successfully assigned to= Private variable 

+   = ;        EFI_INVALID_PARAMETER &nbs= p; If FilePath is Null

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootCheckBoo= tType (IN     EFI_DEVICE_PATH_PROTOCOL   = ;  *FilePath,IN HTTP_BOOT_PRIVATE_DATA     &n= bsp;   *Private)

+ {

+   = ;  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;

+   = ;  EFI_DEV_PATH         &= nbsp;            *No= de;

+

+   = ;    if (FilePath =3D=3D NULL) {

+   = ;      return EFI_INVALID_PARAMETER;

+   = ;    }

+   = ;   

+   = ;    TempDevicePath =3D FilePath;

+   = ;    while (!IsDevicePathEnd (TempDevicePath)) {<= /span>

+   = ;      if ((DevicePathType (TempDevicePath) =3D=3D= MESSAGING_DEVICE_PATH)){

+   = ;          if (DevicePathSubTy= pe (TempDevicePath) =3D=3D MSG_IPv4_DP){

+   = ;            &n= bsp; Node =3D (EFI_DEV_PATH *)TempDevicePath ;

+   = ;            &n= bsp; Private->UsingStatic =3D Node->Ipv4.StaticIpAddress ;=

+   = ;          }else if (DevicePat= hSubType (TempDevicePath) =3D=3D MSG_IPv6_DP){

+   = ;            &n= bsp; Node =3D (EFI_DEV_PATH *)TempDevicePath ;

+   = ;            &n= bsp; Private->UsingStatic =3D(Node->Ipv6.IpAddressOrigin =3D=3D 0x03)= ? TRUE : FALSE;

+   = ;          }=

+   = ;      }

+   = ;      TempDevicePath =3D NextDevicePathNode (Temp= DevicePath);

+   = ;    }

+

+   = ;    return EFI_SUCCESS;

+ }

+ /**

+   Get = the IPv4 and IPv6 Dns Address from Input Uri

+

+

+   @par= am[in]   Uri         = ;      Input Uri from Filepath

+   @par= am[in]   UsingIPv6        = ; Specifies the type of IP addresses.

+   @par= am[in]   Private        &= nbsp;  The pointer to the driver's private data.

+

+   @ret= val EFI_SUCCESS          =   The IPV4 Address  and IPv6 Address are successfully assigned to= HTTP boot driver private data.

+   = ;        EFI_INVALID_PARAMETER &nbs= p; If Uri is not a valid Static Devicepath URI

+ **/

+ EFI_STATUS<= /o:p>

+ HttpBootParseDns= Ip(IN CHAR8  *Uri,BOOLEAN  UsingIpv6,IN HTTP_BOOT_PRIVATE_DATA&nb= sp;        *Private)

+ {

+   = ;  EFI_STATUS         &nb= sp; Status;

+   = ;  CHAR16          &= nbsp;    Uri2[URI_STR_MAX_SIZE];

+   = ;  UINT32          &= nbsp;    Index =3D 0;

+   = ;  UINTN          &n= bsp;     UriStrLength =3D 0;

+   = ;  CHAR16          &= nbsp;   *EndPointer;

+   = ;  CHAR16          &= nbsp;   *Buffer;

+   = ;  UINTN          &n= bsp;     DataSize =3D 0;

+   = ; 

+   = ;  if (Uri =3D=3D NULL)

+   = ;      return EFI_SUCCESS;

+   = ;  AsciiStrToUnicodeStrS(Uri,Uri2,URI_STR_MAX_SIZE);=

+   = ;  UriStrLength =3D AsciiStrLen(Uri) + 1;

+   = ;  Status =3D HttpBootCheckStaticUri(Uri2);

+   = ;  if (EFI_ERROR(Status))

+   = ;      return Status;

+   = ;  if (Buffer =3D StrStr(Uri2,L"dns("))

+   = ;  {

+   = ;      Buffer +=3D 4;

+   = ;      DataSize =3D sizeof(EFI_IP_ADDRESS) ;<= /o:p>

+   = ;      Private->DnsServerIp =3D AllocateZeroPoo= l(DataSize);

+   = ;      if (UsingIpv6)

+   = ;          Status =3D StrToIpv= 6Address (Buffer,&EndPointer,&Private->DnsServerIp[Index+= 3;].v6,NULL);

+   = ;      else

+   = ;          Status =3D StrToIpv= 4Address (Buffer,&EndPointer,&Private->DnsServerIp[Index+= 3;].v4,NULL);

+   = ;      if (EFI_ERROR(Status)){

+   = ;          FreePool(Private-&g= t;DnsServerIp);

+   = ;          Private->DnsServ= erIp =3D NULL;

+   = ;          return Status;=

+   = ;      }

+   = ;      while(*EndPointer =3D=3D L','){<= /span>

+   = ;          Private->DnsServ= erIp =3D ReallocatePool(DataSize,DataSize + sizeof(EFI_IP_ADDRESS),Priv= ate->DnsServerIp);

+   = ;          if (UsingIpv6)=

+   = ;            &n= bsp; Status =3D StrToIpv6Address (Buffer,&EndPointer,&Private->D= nsServerIp[Index++].v6,NULL);

+   = ;          else

+   = ;            &n= bsp; Status =3D StrToIpv4Address (Buffer,&EndPointer,&Private->D= nsServerIp[Index++].v4,NULL);

+   = ;          if (EFI_ERROR(Statu= s)){

+   = ;            &n= bsp; FreePool(Private->DnsServerIp);

+   = ;            &n= bsp; Private->DnsServerIp =3D NULL;

+   = ;             &= nbsp;return Status;

+   = ;          }=

+   = ;          Buffer =3D EndPoint= er + 1;

+   = ;      }while(*EndPointer =3D=3D L',');=

+   = ;  Private->DnsServerCount =3D Index;

+   = ;  if (Buffer =3D StrStr(Uri2,L"http")){

+   = ;      for (Index =3D0;Buffer[Index] !=3D L')' &am= p;& Buffer[Index] !=3D L'\0'  ;Index++);=

+   = ;      Buffer[Index] =3D L'\0';<= /p>

+   = ;  }

+   = ;  UnicodeStrToAsciiStrS(Buffer,Uri,UriStrLength);

+   = ;  }

+   = ;  return EFI_SUCCESS;

+ }

+

--_000_B4DE137BDB63634BAC03BD9DE765F19702B4B34FECVENUS1inmegat_--