mirror of https://github.com/acidanthera/audk.git
NetworkPkg: Fix protocol handler service in HttpDxe.
When we create a HTTP driver service binding private instance, there may be different DriverBindingHandle for Ipv4 or Ipv6, so it is essential to distinguish the HttpService image which will be used in open protocol or close protocol. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> 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> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
This commit is contained in:
parent
f3fa35a002
commit
7cf59c854f
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Routines for HttpDxe driver to perform DNS resolution based on UEFI DNS protocols.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -88,7 +88,7 @@ HttpDns4 (
|
|||
//
|
||||
Status = NetLibCreateServiceChild (
|
||||
Service->ControllerHandle,
|
||||
Service->ImageHandle,
|
||||
Service->Ip4DriverBindingHandle,
|
||||
&gEfiDns4ServiceBindingProtocolGuid,
|
||||
&Dns4Handle
|
||||
);
|
||||
|
@ -100,7 +100,7 @@ HttpDns4 (
|
|||
Dns4Handle,
|
||||
&gEfiDns4ProtocolGuid,
|
||||
(VOID **) &Dns4,
|
||||
Service->ImageHandle,
|
||||
Service->Ip4DriverBindingHandle,
|
||||
Service->ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
|
@ -196,7 +196,7 @@ Exit:
|
|||
gBS->CloseProtocol (
|
||||
Dns4Handle,
|
||||
&gEfiDns4ProtocolGuid,
|
||||
Service->ImageHandle,
|
||||
Service->Ip4DriverBindingHandle,
|
||||
Service->ControllerHandle
|
||||
);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ Exit:
|
|||
if (Dns4Handle != NULL) {
|
||||
NetLibDestroyServiceChild (
|
||||
Service->ControllerHandle,
|
||||
Service->ImageHandle,
|
||||
Service->Ip4DriverBindingHandle,
|
||||
&gEfiDns4ServiceBindingProtocolGuid,
|
||||
Dns4Handle
|
||||
);
|
||||
|
@ -290,7 +290,7 @@ HttpDns6 (
|
|||
//
|
||||
Status = NetLibCreateServiceChild (
|
||||
Service->ControllerHandle,
|
||||
Service->ImageHandle,
|
||||
Service->Ip6DriverBindingHandle,
|
||||
&gEfiDns6ServiceBindingProtocolGuid,
|
||||
&Dns6Handle
|
||||
);
|
||||
|
@ -302,7 +302,7 @@ HttpDns6 (
|
|||
Dns6Handle,
|
||||
&gEfiDns6ProtocolGuid,
|
||||
(VOID **) &Dns6,
|
||||
Service->ImageHandle,
|
||||
Service->Ip6DriverBindingHandle,
|
||||
Service->ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
|
@ -393,7 +393,7 @@ Exit:
|
|||
gBS->CloseProtocol (
|
||||
Dns6Handle,
|
||||
&gEfiDns6ProtocolGuid,
|
||||
Service->ImageHandle,
|
||||
Service->Ip6DriverBindingHandle,
|
||||
Service->ControllerHandle
|
||||
);
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ Exit:
|
|||
if (Dns6Handle != NULL) {
|
||||
NetLibDestroyServiceChild (
|
||||
Service->ControllerHandle,
|
||||
Service->ImageHandle,
|
||||
Service->Ip6DriverBindingHandle,
|
||||
&gEfiDns6ServiceBindingProtocolGuid,
|
||||
Dns6Handle
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The driver binding and service binding protocol for HttpDxe driver.
|
||||
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
|
@ -45,7 +45,6 @@ EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp6DriverBinding = {
|
|||
|
||||
@param[in] Controller The controller that has TCP4 service binding
|
||||
installed.
|
||||
@param[in] ImageHandle The HTTP driver's image handle.
|
||||
@param[out] ServiceData Point to HTTP driver private instance.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.
|
||||
|
@ -55,7 +54,6 @@ EFI_DRIVER_BINDING_PROTOCOL gHttpDxeIp6DriverBinding = {
|
|||
EFI_STATUS
|
||||
HttpCreateService (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
OUT HTTP_SERVICE **ServiceData
|
||||
)
|
||||
{
|
||||
|
@ -72,7 +70,6 @@ HttpCreateService (
|
|||
HttpService->Signature = HTTP_SERVICE_SIGNATURE;
|
||||
HttpService->ServiceBinding.CreateChild = HttpServiceBindingCreateChild;
|
||||
HttpService->ServiceBinding.DestroyChild = HttpServiceBindingDestroyChild;
|
||||
HttpService->ImageHandle = ImageHandle;
|
||||
HttpService->ControllerHandle = Controller;
|
||||
HttpService->ChildrenNumber = 0;
|
||||
InitializeListHead (&HttpService->ChildrenList);
|
||||
|
@ -104,13 +101,13 @@ HttpCleanService (
|
|||
gBS->CloseProtocol (
|
||||
HttpService->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
HttpService->ImageHandle,
|
||||
HttpService->Ip4DriverBindingHandle,
|
||||
HttpService->ControllerHandle
|
||||
);
|
||||
|
||||
NetLibDestroyServiceChild (
|
||||
HttpService->ControllerHandle,
|
||||
HttpService->ImageHandle,
|
||||
HttpService->Ip4DriverBindingHandle,
|
||||
&gEfiTcp4ServiceBindingProtocolGuid,
|
||||
HttpService->Tcp4ChildHandle
|
||||
);
|
||||
|
@ -122,13 +119,13 @@ HttpCleanService (
|
|||
gBS->CloseProtocol (
|
||||
HttpService->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
HttpService->ImageHandle,
|
||||
HttpService->Ip6DriverBindingHandle,
|
||||
HttpService->ControllerHandle
|
||||
);
|
||||
|
||||
NetLibDestroyServiceChild (
|
||||
HttpService->ControllerHandle,
|
||||
HttpService->ImageHandle,
|
||||
HttpService->Ip6DriverBindingHandle,
|
||||
&gEfiTcp6ServiceBindingProtocolGuid,
|
||||
HttpService->Tcp6ChildHandle
|
||||
);
|
||||
|
@ -382,7 +379,7 @@ HttpDxeStart (
|
|||
if (!EFI_ERROR (Status)) {
|
||||
HttpService = HTTP_SERVICE_FROM_PROTOCOL (ServiceBinding);
|
||||
} else {
|
||||
Status = HttpCreateService (ControllerHandle, This->DriverBindingHandle, &HttpService);
|
||||
Status = HttpCreateService (ControllerHandle, &HttpService);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
@ -405,7 +402,8 @@ HttpDxeStart (
|
|||
}
|
||||
|
||||
if (IpVersion == IP_VERSION_4) {
|
||||
|
||||
HttpService->Ip4DriverBindingHandle = This->DriverBindingHandle;
|
||||
|
||||
if (HttpService->Tcp4ChildHandle == NULL) {
|
||||
//
|
||||
// Create a TCP4 child instance, but do not configure it. This will establish the parent-child relationship.
|
||||
|
@ -440,7 +438,8 @@ HttpDxeStart (
|
|||
|
||||
} else {
|
||||
UsingIpv6 = TRUE;
|
||||
|
||||
HttpService->Ip6DriverBindingHandle = This->DriverBindingHandle;
|
||||
|
||||
if (HttpService->Tcp6ChildHandle == NULL) {
|
||||
//
|
||||
// Create a TCP6 child instance, but do not configure it. This will establish the parent-child relationship.
|
||||
|
|
|
@ -249,6 +249,7 @@ EfiHttpRequest (
|
|||
HTTP_TOKEN_WRAP *Wrap;
|
||||
CHAR8 *FileUrl;
|
||||
UINTN RequestMsgSize;
|
||||
EFI_HANDLE ImageHandle;
|
||||
|
||||
//
|
||||
// Initializations
|
||||
|
@ -371,8 +372,14 @@ EfiHttpRequest (
|
|||
//
|
||||
// Use TlsSb to create Tls child and open the TLS protocol.
|
||||
//
|
||||
if (HttpInstance->LocalAddressIsIPv6) {
|
||||
ImageHandle = HttpInstance->Service->Ip6DriverBindingHandle;
|
||||
} else {
|
||||
ImageHandle = HttpInstance->Service->Ip4DriverBindingHandle;
|
||||
}
|
||||
|
||||
HttpInstance->TlsChildHandle = TlsCreateChild (
|
||||
HttpInstance->Service->ImageHandle,
|
||||
ImageHandle,
|
||||
&(HttpInstance->Tls),
|
||||
&(HttpInstance->TlsConfiguration)
|
||||
);
|
||||
|
|
|
@ -642,7 +642,7 @@ HttpInitProtocol (
|
|||
//
|
||||
Status = NetLibCreateServiceChild (
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
&gEfiTcp4ServiceBindingProtocolGuid,
|
||||
&HttpInstance->Tcp4ChildHandle
|
||||
);
|
||||
|
@ -655,7 +655,7 @@ HttpInitProtocol (
|
|||
HttpInstance->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
(VOID **) &Interface,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
|
@ -668,7 +668,7 @@ HttpInitProtocol (
|
|||
HttpInstance->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
(VOID **) &HttpInstance->Tcp4,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
|
@ -680,7 +680,7 @@ HttpInitProtocol (
|
|||
HttpInstance->Service->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
(VOID **) &Interface,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
|
@ -693,7 +693,7 @@ HttpInitProtocol (
|
|||
//
|
||||
Status = NetLibCreateServiceChild (
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
&gEfiTcp6ServiceBindingProtocolGuid,
|
||||
&HttpInstance->Tcp6ChildHandle
|
||||
);
|
||||
|
@ -706,7 +706,7 @@ HttpInitProtocol (
|
|||
HttpInstance->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
(VOID **) &Interface,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
|
@ -719,7 +719,7 @@ HttpInitProtocol (
|
|||
HttpInstance->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
(VOID **) &HttpInstance->Tcp6,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
|
@ -732,7 +732,7 @@ HttpInitProtocol (
|
|||
HttpInstance->Service->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
(VOID **) &Interface,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Handle,
|
||||
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
|
||||
);
|
||||
|
@ -756,20 +756,20 @@ ON_ERROR:
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Service->ControllerHandle
|
||||
);
|
||||
|
||||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
|
||||
NetLibDestroyServiceChild (
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
&gEfiTcp4ServiceBindingProtocolGuid,
|
||||
HttpInstance->Tcp4ChildHandle
|
||||
);
|
||||
|
@ -779,7 +779,7 @@ ON_ERROR:
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Service->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
}
|
||||
|
@ -788,20 +788,20 @@ ON_ERROR:
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Service->ControllerHandle
|
||||
);
|
||||
|
||||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
|
||||
NetLibDestroyServiceChild (
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
&gEfiTcp6ServiceBindingProtocolGuid,
|
||||
HttpInstance->Tcp6ChildHandle
|
||||
);
|
||||
|
@ -811,7 +811,7 @@ ON_ERROR:
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Service->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
}
|
||||
|
@ -868,20 +868,20 @@ HttpCleanProtocol (
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Service->ControllerHandle
|
||||
);
|
||||
|
||||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
|
||||
NetLibDestroyServiceChild (
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
&gEfiTcp4ServiceBindingProtocolGuid,
|
||||
HttpInstance->Tcp4ChildHandle
|
||||
);
|
||||
|
@ -891,7 +891,7 @@ HttpCleanProtocol (
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Service->Tcp4ChildHandle,
|
||||
&gEfiTcp4ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip4DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
}
|
||||
|
@ -900,20 +900,20 @@ HttpCleanProtocol (
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Service->ControllerHandle
|
||||
);
|
||||
|
||||
gBS->CloseProtocol (
|
||||
HttpInstance->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
|
||||
NetLibDestroyServiceChild (
|
||||
HttpInstance->Service->ControllerHandle,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
&gEfiTcp6ServiceBindingProtocolGuid,
|
||||
HttpInstance->Tcp6ChildHandle
|
||||
);
|
||||
|
@ -923,7 +923,7 @@ HttpCleanProtocol (
|
|||
gBS->CloseProtocol (
|
||||
HttpInstance->Service->Tcp6ChildHandle,
|
||||
&gEfiTcp6ProtocolGuid,
|
||||
HttpInstance->Service->ImageHandle,
|
||||
HttpInstance->Service->Ip6DriverBindingHandle,
|
||||
HttpInstance->Handle
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The header files of miscellaneous routines for HttpDxe driver.
|
||||
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -59,7 +59,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
typedef struct _HTTP_SERVICE {
|
||||
UINT32 Signature;
|
||||
EFI_SERVICE_BINDING_PROTOCOL ServiceBinding;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_HANDLE Ip4DriverBindingHandle;
|
||||
EFI_HANDLE Ip6DriverBindingHandle;
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_HANDLE Tcp4ChildHandle;
|
||||
EFI_HANDLE Tcp6ChildHandle;
|
||||
|
|
Loading…
Reference in New Issue