summaryrefslogtreecommitdiffstats
path: root/NetworkPkg
Commit message (Collapse)AuthorAgeFilesLines
* NetworkPkg: fix ASSERT_EFI_ERROR() typosLaszlo Ersek2016-06-301-1/+1
| | | | | | | | | | | | | | | | | | | A number of code locations use ASSERT_EFI_ERROR (BooleanExpression) instead of ASSERT (BooleanExpression) Fix them. Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
* NetworkPkg: Stop the HTTP Boot service after the boot image download complete.Fu Siyuan2016-06-301-1/+5
| | | | | | | | | | | | | | | | After boot image has been downloaded, the HTTP boot driver leaves the service in the started state, with an active TCP child. This may cause some problems: 1. The HTTP session may become unavaiable after a while, then a following HTTP Boot will fail. 2. An active TCP child will send RST to any incoming TCP message, which may break other driver which tries to setup a TCP connection. The HTTP boot driver doesn't provide any interface to the boot loader, so it's unnecessary to keep the service running after a boot image is downloaded. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Avoid potential NULL pointer dereferenceJiaxin Wu2016-06-275-14/+194
| | | | | | | | | | | | | | The commit of 6b16c9e7 removes ASSERT and use error handling in IpSecDxe driver, but may cause the potential NULL pointer dereference. So, this patch is used to avoid NULL pointer dereference. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Refine codes related to Dhcpv4 and Dhcpv6 configuration.Zhang Lubo2016-06-2320-418/+155
| | | | | | | | | | | | | | | | | v2: *Since we have redefined the name of arch types in Dhcp.h for http boot, it need to change corresponding codes. Add a new head file Dhcp.h in Mde/Include/IndustryStandard, normalize the universal option numbers and other network number tags. Cc: Sriram Subramanian <sriram-s@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Replace ASSERT with error handling in Http boot and IScsiZhang Lubo2016-06-236-9/+30
| | | | | | | | | | | | | | | v2: *Fix some memory leak issue. This patch is used to replace ASSERT with error handling in Http boot Driver and IScsi driver. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Replace ASSERT with error handling in DnsDxeJiaxin Wu2016-06-211-18/+38
| | | | | | | | | | | | | | | | v2: * Use goto to simplify code logic. This patch is used to replace ASSERT with error handling in DnsDxe driver. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Remove ASSERT and use error handling in IpSecDxeJiaxin Wu2016-06-218-97/+379
| | | | | | | | | | | | | This patch is used to refine the code by removing ASSERT and using error handling in IpSecDxe driver. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Cc: Yao Jiewen <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStrStar Zeng2016-06-218-52/+87
| | | | | | | | | | | | | | | It is the follow up of 3ab41b7a325ca11a12b42f5ad1661c4b6791cb49 to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg: Fix unspecified address use case in IpsecConfigJiaxin Wu2016-06-173-15/+21
| | | | | | | | | | | | | | | | | | | This patch is used to fix unspecified address use case in ConstructSpdIndexer() function. Indexer->Name for ConstructSpdIndexer is unspecified, that will be a problem for UnicodeStrToAsciiStr. This patch also refine the code by removing ASSERT and user error handling. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Zeng Star <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Zeng Star <star.zeng@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg/TcpDxe: Fix GCC build failureJiaxin Wu2016-06-141-2/+0
| | | | | | | | | | Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Fix DNS GeneralLookUp failure in some caseJiaxin Wu2016-06-132-8/+23
| | | | | | | | | | | | | | | QClass value may be not equal to 1(DNS_CLASS_INET) when GeneralLookUp query is called. So, remove QClass value check. Moreover, the 'Identification' and 'Type' filed in Query packet should not be changed to little endian since the packet maybe retransmitted while there is any error happened. Cc: Ye Ting <ting.ye@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg: Remove TokenEntry from Token list before freedJiaxin Wu2016-06-131-0/+8
| | | | | | | | | | | | TokenEntry should be removed from Token list before freed. Otherwise, invalid TokenEntry will be existed in Token list. Cc: Ye Ting <ting.ye@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Fix IPv6 boot failure in diff net segment issueJiaxin Wu2016-06-131-9/+9
| | | | | | | | | | | | This patch is used to fix HTTP IPv6 boot failure in diff net segment issue. IPv6 gateway address should be registered before DNS query, otherwise, DNS query will fail. Cc: Ye Ting <ting.ye@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg: Handling timeout case in httpboot driverJiaxin Wu2016-06-134-3/+56
| | | | | | | | | | | | | | | | | | | This patch is used to handle timeout case when downloading the message. The Status in the token should also be checked to handle any response error case including timeout case. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Gary Lin <glin@suse.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Gary Lin <glin@suse.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Tested-by: Gary Lin <glin@suse.com> Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
* NetworkPkg: HttpDxe response/cancel issue fixJiaxin Wu2016-06-133-103/+77
| | | | | | | | | | | | | | | | | | | | | | | | | Remove timeout check for http body message receive. It should be handled in HttpBootDxe driver for http response unblocking implementation. After timeout removed, the Wrap date should not be freed immediately. Only the TCP CompletionToken in Wrap date is canceled or signaled, the Wrap date could be freed. In addition, Http cancel token is also incorrect. Tcp Cancel should be called to cancel TCP CompletionToken in Wrap date before close it directly. Otherwise, some exception behavior may happened. This patch also refine the coding style for HttpDxe driver. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Gary Lin <glin@suse.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Gary Lin <glin@suse.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Tested-by: Gary Lin <glin@suse.com> Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
* NetworkPkg: Support TCP Cancel functionJiaxin Wu2016-06-136-31/+271
| | | | | | | | | | | | | | | | | | | | | | | | This path is used to support TCP Cancel function to abort an asynchronous connection, listen, transmission or receive request. If any TCP CompletionToken is not signaled, it should not be closed directly by calling CloseEvent (Still in the TCP TokenList). If not, any exception behavior may be triggered. We should cancel it by calling Tcp->Cancel() first. In such a case, TCP Cancel function is necessary. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Gary Lin <glin@suse.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Gary Lin <glin@suse.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Tested-by: Gary Lin <glin@suse.com> Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
* NetworkPkg: Stop the timer before clean IP service.Fu, Siyuan2016-05-311-15/+16
| | | | | | | | | | | | | | | | | | In Ip6CleanService()it first cleaned some resources, then stop the timer . While before the timer stopped it may try to access some already freed data, which may generate an exception. This patch updates the driver to stop the timer event before starting to clean up the service data. Cc: Wu Jiaxin <jiaxin.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Subramanian Sriram <sriram-s@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Correct HttpConfigure parameter checkJiaxin Wu2016-05-262-5/+5
| | | | | | | | | | | | | | When HttpConfigData is NULL, HttpConfigure should not return EFI_INVALID_PARAMETER. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg: update code for NULL pointer check.Fu Siyuan2016-05-241-7/+10
| | | | | | | | | | This patch updates the HTTP driver to initialize the local variable for NULL and check the NULL pointer before dereference it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg/HttpDxe: Don't free Wrap in HttpTcpReceiveNotifyDpcGary Lin2016-05-202-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The HTTP Token Wrap is created in EfiHttpResponse() and then passed to the deferred Receive event callback, HttpTcpReceiveNotifyDpc. HttpTcpReceiveHeader and HttpTcpReceiveBody use a Tcp polling loop to monitor the socket status and trigger the Receive event when a new packet arrives. The Receive event brings up HttpTcpReceiveNotifyDpc to process the HTTP message and the function will set Wrap->TcpWrap.IsRxDone to TRUE to break the Tcp polling loop. However, HttpTcpReceiveNotifyDpc mistakenly freed Wrap, so the Tcp polling loop was actually checking a dead variable, and this led the system into an unstable status. Given the fact that the HTTP Token Wrap will be freed in EfiHttpResponse or HttpResponseWorker, this commit removes every "FreePool (Wrap)" in HttpTcpReceiveNotifyDpc. v2: * Free Wrap after HttpTcpReceiveBody returns normally. Cc: "Wu, Jiaxin" <jiaxin.wu@intel.com> Cc: "Siyuan Fu" <siyuan.fu@intel.com> Cc: "El-Haj-Mahmoud, Samer" <samer.el-haj-mahmoud@hpe.com> Cc: "Laszlo Ersek" <lersek@redhat.com> Cc: "Hegde, Nagaraj P" <nagaraj-p.hegde@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg/TcpDxe: Remove the status check of SockProcessRcvTokenGary Lin2016-05-201-5/+1
| | | | | | | | | | | | | SockProcessRcvToken only returns the number of the received bytes, not an EFI Status. Cc: "Siyuan Fu" <siyuan.fu@intel.com> Cc: "Jiaxin Wu" <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
* NetworkPkg:HttpDxe: Code changes to support HTTP PUT/POST operationsNagaraj Hegde2016-05-163-174/+253
| | | | | | | | | | | | | | | Code changes enables HttpDxe to handle PUT/POST operations. EfiHttpRequest assumes "Request" and "HttpMsg->Headers" can never be NULL. Also, HttpResponseWorker assumes HTTP Reponse will contain headers. We could have response which could contain only a string (HTTP 100 Continue) and no headers. Code changes tries to do-away from these assumptions, which would enable HttpDxe to support PUT/POST operations. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hegde, Nagaraj P nagaraj-p.hegde@hpe.com Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Make HttpBootGetBootFile return EFI_BUFFER_TOO_SMALLGary Lin2016-05-131-1/+3
| | | | | | | | | Per the description of HttpBootGetBootFile, the function should return EFI_BUFFER_TOO_SMALL if the given buffer is smaller than the remote image. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Bug fix of iSCSI to support MPIOZhang, Lubo2016-05-121-3/+15
| | | | | | | | | | | | | | | | | | If two attempts added on different NIC and enable MPIO attribute, then change the attempts order. If both two attempts succeed to connect the target,it should abort the later one in the order and uninstall ExtScsiPassThruProtocol Interface, But now it unistall it twice. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-By: Ye Ting <ting.ye@intel.com> Reviewed-By: Fu Siyuan <siyuan.fu@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Ignore BootFileName if it is overloaded.Fu Siyuan2016-05-061-2/+5
| | | | | | | | | | Make sure "File" field is not overloaded to carry other DHCP options before use it in PXE driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Ignore BootFileName if it is overloaded.Fu Siyuan2016-05-061-1/+4
| | | | | | | | | | Make sure "File" field is not overloaded to carry other DHCP options before use it in HTTP boot driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Fix a memory leak in HTTP boot driver.Fu Siyuan2016-05-061-3/+1
| | | | | | | | | | | We always need to call EfiBootManagerFreeLoadOption because the memory allocated for NewOption (description and device path) is no longer needed. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Sunny Wang <sunnywang@hpe.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg/HttpBootDxe: Fix for the issue that the HTTP boot option can't be ↵Sunny Wang2016-05-062-2/+5
| | | | | | | | | | | | | | | | | booted more than once This issue can be reproduced by the following steps: 1. Boot to HTTP boot option and the boot file is a ISO file like Ubuntu PE image. 2. Exit from boot option (GRUB) and then back to boot manager menu. 3. Boot to the same HTTP boot option again or a HTTP boot option pointing to the same HTTP ISO file. It will fail to boot. Root cause: When booting a HTTP boot option, the HTTP boot driver will save the Boot File's information in its private data as cache data for skipping the Boot file discovery from next time boot. However, the cache data doesn't include ImageType data, which would cause HTTP boot driver using the invalid ImageType (ImageTypeMax) and then fail to boot the cached boot file. In other words, for the second time boot, the HttpBootLoadFile() doesn't update ImageType (it returns a valid ImageType), which causes that the HttpBootDxeLoadFile() skips to Register a RAM Disk for downloaded HTTP ISO file and then BDS code can't find the RAM disk to boot. Solution: Save ImageType to private data for next time HTTP boot. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Sunny Wang <sunnywang@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Do not use hard coded TTL/ToS in PXE driver.Fu Siyuan2016-05-053-15/+25
| | | | | | | | | | | | | EFI_PXE_BASE_CODE_PROTOCOL has interface to set the TTL and ToS value, but not used by the UdpWrite() interface. The code always use a hard coded 16 for the TTL and 0 for ToS. This patch update the UpdWrite() to use the TTL and ToS which have been set by the SetParameters(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-By: Samer El-Haj-Mahmoud <elhaj@hpe.com>
* NetworkPkg: Use UefiBootManagerLib API to create load option.Fu Siyuan2016-05-053-112/+33
| | | | | | | | | | This patch updates the HTTP boot driver to use the API in UefiBootManagerLib to create new load option, to avoid duplicate code. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: : Ye Ting <ting.ye@intel.com> Reviewed-by: : Ni Ruiyu <ruiyu.ni@intel.com>
* NetworkPkg: Fix incorrect buffer free in HttpDxeJiaxin Wu2016-04-281-22/+22
| | | | | | | | | | | | | | FragmentBuffer of each TcpWrap in HttpDxe should not be freed in HttpTcpTokenCleanup(). This buffer points to HttpMsg body actually, which is the responsibility of the caller to allocate a buffer for Body. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* NetworkPkg: Avoid the indefinite wait case in HttpDxeJiaxin Wu2016-04-283-17/+117
| | | | | | | | | | | | | | | | | Need the timer check to avoid the indefinite wait case in HttpDxe driver A.HTTP receive Header process in HttpTcpReceiveHeader(); B.HTTP receive Body process in HttpTcpReceiveBody(); Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg:HttpDxe:Consume DxeHttpLib API changesNagaraj Hegde2016-04-273-21/+17
| | | | | | | | | | | | | HttpGenRequestString is updated to HttpGenRequestMessage, with an additional argument. This patch updates the caller of the DxeHttpLib API. Also, we will avoid adding any '\0' to the string, which was added to make AsciiStrLen to work on the string. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Nagaraj Hegde <nagaraj-p.hegde@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
* NetworkPkg: Allow user to create a HTTP corporate boot option in setup page.Fu Siyuan2016-04-272-5/+6
| | | | | | | | | | | | This patch updates the HTTP Boot Configuration page to allow the user to create a corporate mode HTTP boot option, by leaving the URI string empty. The patch also fix a bug that the L"https://" should use StrnCmp() with Length 8. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Fix GCC code build error of iSCSI driver.Zhang Lubo2016-04-221-1/+3
| | | | | | | | Fix GCC build error when refine the codes of iSCSI driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: refine codes of iSCSI driver.Zhang Lubo2016-04-223-15/+39
| | | | | | | | | | | | | | | Add error handling logic in DriverBingingStop function, it may return error status when invoking the UninstallProtocolInterface. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Fix issue in Ip6Dxe SetDataJiaxin Wu2016-04-141-37/+35
| | | | | | | | | | | | | | | EFI_NOT_READY should not be treated as an error status returned from SetData for Ip6ConfigDataTypeManualAddress since there is an asynchronous operation for DAD process. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
* NetworkPkg: Add RAM disk boot support to HTTP Boot driver.Fu Siyuan2016-04-117-55/+334
| | | | | | | | | | | | | | | | | | | This patch updates the HTTP Boot driver to support the download and boot a RAM disk image from HTTP server. The HTTP RAM disk boot is described in section 23.7 "HTTP Boot" in UEFI 2.6. HTTP server could provide either an UEFI image or a RAM disk image for the HTTP boot client to use. The RAM disk image must contain a UEFI compliant file system in it. HTTP boot driver will identify the image type either by the "Content-Type" entity header filed or by the file name extension as below: "application/efi" or *.efi -> EFI Image *.iso -> CD/DVD Image *.img -> Virtual Disk Image Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com>
* NetworkPkg: Add new macros and refine codesZhang Lubo2016-04-115-15/+15
| | | | | | | | | | | | | | | | | | | | | | | v2: *refine some codes Add 2 macros in NetLib.h #define IP4_MASK_MAX 32 #define IP6_PREFIX_MAX 128 we will use these two macros to check the max mask/prefix length, instead of #define IP4_MASK_NUM 33 #define IP6_PREFIX_NUM 129 which means a valid number This will make the code readability and maintainability. Cc: Subramanian Sriram <sriram-s@hpe.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@@hpe.com>
* NetworkPkg: Check received packet size before use it.Fu Siyuan2016-04-014-10/+40
| | | | | | | | | | | | | | | | | Arbitrary length of packet may be received from network, including the packets with zero payload data or malformed protocol header. So the code much check the actually received data size before using it. For example, in current edk2 network stack, an zero payload UDP packet may cause the platform ASSERT in NetbufFromExt() because of the zero fragment number. This patch update the IpIoLib and UdpIoLib to check and discard the zero payload data packet to avoid above assert. Some other network drivers are also updated to check the packet size to guarantee the minimum length of protocol header is received from upper layer driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Check pointer for NULL before use.Fu Siyuan2016-04-011-0/+4
| | | | | | | Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: IpSecDxe: remove set but unused variablesLaszlo Ersek2016-03-251-2/+0
| | | | | | | | | | | Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com>
* NetworkPkg:Fix bug when parsing the dhcp6 option 16Zhang, Lubo2016-03-251-2/+2
| | | | | | | | | | | | | | | when to parse the DHCP6 reply packet,there will be 6 bytes offset before the option data according to RFC 3315. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg:Fix Http boot download issue.Zhang Lubo2016-03-251-1/+1
| | | | | | | | | | | | | | | When http boot download the second time without return out of the boot manager, the DHCP process will start twice with the same Boot file uri and print the information twice which we not expected. This is caused by wrong logic of handling the device path of the boot file when loading it. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg: Fix HII related problem in HTTP boot driver.Fu Siyuan2016-03-243-17/+85
| | | | | | | | | | | | | | According to UEFI spec, HII_Config_Access.RouteConfig() should return success if the required configuration has been processed. Current HTTP boot driver may return error code in some situation, which failed the UEFI SCT test. This patch fix this issue by removing the returned error status code and adding extra check point in the Callback() function, which will pop up a message box if user input an unsupported URI string. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Dong Eric <eric.dong@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
* NetworkPkg: Fix the driver model issue in HTTP Boot driver.Fu Siyuan2016-03-166-41/+29
| | | | | | | | | | | | | | | | | | | The HTTP Boot driver have some UEFI driver model problems which will make the code ASSERT when it's disconnected. First, the driver opens the HttpSb protocol BY_CHILD without BY_DRIVER attribute. So the driver binding stop won't be called when HTTP driver is disconnected, so a child handle is left and made HTTP driver binding stop function goes into error. This patch remove this unnecessary OpenProtocol and only unload the HII from when both the IP4 and IP6 stack have been stopped completely. The second issue is the HTTP boot driver always use the driver's image handle as it's driver binding handle, it's not correct. HTTP Boot driver provides 2 separate driver binding protocols from IP4 and IP6 stack, so it has 2 driver binding handle. So this patch fix the code to use correct driver binding handle when create/open a HTTP child handle. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: fix function comments in HttpBootDxe.Fu Siyuan2016-03-153-2/+4
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* NetworkPkg: Refine the code of shell app under networkPkg.Zhang, Lubo2016-03-114-10/+10
| | | | | | | | | | | refine the code of ifconfig6 and ping6 application. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Fix IpsecConfig GCC build failure issueJiaxin Wu2016-03-112-7/+7
| | | | | | | | | | | | | | | | This issue is caused by the string token ID for help message, which is defined in the internal head file. This head file is used for reference more than once. So, multiple definition for the string token ID error will be enrolled. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Zhang, Lubo <lubo.zhang@intel.com>
* NetworkPkg: Use the New Functions from HttpLibGhazi Belaam2016-03-108-721/+35
| | | | | | | | | | | | | After submitting changes for HttpLib, other modules should be able to use those functions 1 remove the private function and their calls 2 update it with the functions from httpLib Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ghazi Belaam <Ghazi.belaam@hpe.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Samer EL-Haj-Mahmoud <elhaj@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>