diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-08 02:35:56 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-01-08 02:35:56 +0000 |
commit | e285199897e538523f762cb5b3900e81f872035a (patch) | |
tree | aad7875d4dfb9f1705796b9c405c4f5549df18e1 | |
parent | 33338afebd3004e24d642e6dd7d053cda83990f1 (diff) | |
download | edk2-platforms-e285199897e538523f762cb5b3900e81f872035a.tar.xz |
refine the code and add more security check.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9691 6f19259b-4bc3-4df7-8a09-765794883524
18 files changed, 499 insertions, 493 deletions
diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h index 039e04f696..d90f82d97a 100644 --- a/MdeModulePkg/Include/Library/NetLib.h +++ b/MdeModulePkg/Include/Library/NetLib.h @@ -2,7 +2,7 @@ This library is only intended to be used by UEFI network stack modules.
It provides basic functions for the UEFI network stack.
-Copyright (c) 2005 - 2009, Intel Corporation
+Copyright (c) 2005 - 2010, Intel Corporation
All rights reserved. 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
@@ -1025,9 +1025,9 @@ NetLibGetVlanId ( This function will append VLAN device path node to the parent device path,
and then use LocateDevicePath() to find the correct VLAN device handle.
- @param[in] ServiceHandle The handle where network service binding protocols are
+ @param[in] ControllerHandle The handle where network service binding protocols are
installed on.
- @param[in] VLanId The configured VLAN ID for the VLAN device.
+ @param[in] VlanId The configured VLAN ID for the VLAN device.
@return The VLAN device handle, or NULL if not found.
diff --git a/MdeModulePkg/Include/Library/UdpIoLib.h b/MdeModulePkg/Include/Library/UdpIoLib.h index c93fb12085..a680cc6179 100644 --- a/MdeModulePkg/Include/Library/UdpIoLib.h +++ b/MdeModulePkg/Include/Library/UdpIoLib.h @@ -51,7 +51,7 @@ typedef struct { UdpIoRecvDatagram() or UdpIoSendDatagram(). When receiving, Netbuf is allocated by the
UDP access point and released by the user. When sending, the user allocates the the NetBuf, which is then
provided to the callback as a reference.
-
+
@param[in] Packet Packet received or sent
@param[in] EndPoint The UDP address pair corresponds to the UDP IO
@param[in] IoStatus Packet receiving or sending status
@@ -127,7 +127,7 @@ typedef struct { ///
/// Type defined as UDP_IO.
///
-/// This data structure wraps the UDP instance and configuration.
+/// This data structure wraps the UDP instance and configuration.
/// UdpIo Library uses this structure for all Udp4 or Udp6 operations.
///
struct _UDP_IO {
@@ -151,7 +151,7 @@ struct _UDP_IO { union {
EFI_UDP4_PROTOCOL *Udp4;
EFI_UDP6_PROTOCOL *Udp6;
- } Protocol;
+ } Protocol;
union {
EFI_UDP4_CONFIG_DATA Udp4;
@@ -161,12 +161,12 @@ struct _UDP_IO { /**
Prototype called when UdpIo Library configures a UDP instance.
-
+
The prototype is set and called when creating a UDP_IO in UdpIoCreatePort().
-
+
@param[in] UdpIo The UDP_IO to configure
@param[in] Context User-defined data when calling UdpIoCreatePort()
-
+
@retval EFI_SUCCESS The configuration succeeded
@retval Others The UDP_IO fails to configure indicating
UdpIoCreatePort() should fail
@@ -179,11 +179,11 @@ EFI_STATUS );
/**
- The select function to decide whether to cancel the UDP_TX_TOKEN.
-
+ The select function to decide whether to cancel the UDP_TX_TOKEN.
+
@param[in] Token The UDP_TX_TOKEN to decide whether to cancel
@param[in] Context User-defined data in UdpIoCancelDgrams()
-
+
@retval TRUE Cancel the UDP_TX_TOKEN
@retval FALSE Do not cancel this UDP_TX_TOKEN
@@ -196,12 +196,13 @@ BOOLEAN );
/**
- Cancel all sent datagrams selected by the parameter ToCancel.
+ Cancel all the sent datagram that pass the selection criteria of ToCancel.
If ToCancel is NULL, all the datagrams are cancelled.
@param[in] UdpIo The UDP_IO to cancel packet.
@param[in] IoStatus The IoStatus to return to the packet owners.
- @param[in] ToCancel Sets the criteria for canceling a packet.
+ @param[in] ToCancel The select funtion to test whether to cancel this
+ packet or not.
@param[in] Context The opaque parameter to the ToCancel.
**/
@@ -210,19 +211,18 @@ EFIAPI UdpIoCancelDgrams (
IN UDP_IO *UdpIo,
IN EFI_STATUS IoStatus,
- IN UDP_IO_TO_CANCEL ToCancel OPTIONAL,
+ IN UDP_IO_TO_CANCEL ToCancel, OPTIONAL
IN VOID *Context
);
/**
Creates a UDP_IO to access the UDP service. It creates and configures
a UDP child.
-
- This function:
- # locates the UDP service binding prototype on the Controller parameter
- # uses the UDP service binding prototype to create a UDP child (also known as a UDP instance)
- # configures the UDP child by calling Configure function prototype.
- Any failures in creating or configuring the UDP child return NULL for failure.
+
+ It locates the UDP service binding prototype on the Controller parameter
+ uses the UDP service binding prototype to create a UDP child (also known as
+ a UDP instance) configures the UDP child by calling Configure function prototype.
+ Any failures in creating or configuring the UDP child return NULL for failure.
@param[in] Controller The controller that has the UDP service binding.
protocol installed.
@@ -246,7 +246,7 @@ UdpIoCreateIo ( /**
Free the UDP_IO and all its related resources.
-
+
The function cancels all sent datagrams and receive requests.
@param[in] UdpIo The UDP_IO to free.
@@ -261,9 +261,9 @@ UdpIoFreeIo ( );
/**
- Cleans up the UDP_IO without freeing it. Call this function
+ Cleans up the UDP_IO without freeing it. Call this function
if you intend to later re-use the UDP_IO.
-
+
This function releases all transmitted datagrams and receive requests and configures NULL for the UDP instance.
@param[in] UdpIo The UDP_IO to clean up.
@@ -277,7 +277,7 @@ UdpIoCleanIo ( /**
Send a packet through the UDP_IO.
-
+
The packet will be wrapped in UDP_TX_TOKEN. Function Callback will be called
when the packet is sent. The optional parameter EndPoint overrides the default
address pair if specified.
@@ -286,7 +286,7 @@ UdpIoCleanIo ( @param[in] Packet The packet to send.
@param[in] EndPoint The local and remote access point. Override the
default address pair set during configuration.
- @param[in] Gateway The gateway to use.
+ @param[in] Gateway The gateway to use.
@param[in] CallBack The function being called when packet is
transmitted or failed.
@param[in] Context The opaque parameter passed to CallBack.
@@ -310,7 +310,7 @@ UdpIoSendDatagram ( /**
Cancel a single sent datagram.
- @param[in] UdpIo The UDP_IO from which to cancel the packet
+ @param[in] UdpIo The UDP_IO from which to cancel the packet
@param[in] Packet The packet to cancel
**/
@@ -323,7 +323,7 @@ UdpIoCancelSentDatagram ( /**
Issue a receive request to the UDP_IO.
-
+
This function is called when upper-layer needs packet from UDP for processing.
Only one receive request is acceptable at a time. Therefore, one common usage model is
to invoke this function inside its Callback function when the former packet
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index f58783cdfd..e18f4ab474 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -1,7 +1,7 @@ /** @file
Network library.
-Copyright (c) 2005 - 2009, Intel Corporation.<BR>
+Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -1530,7 +1530,7 @@ EFIAPI NetMapIterate (
IN NET_MAP *Map,
IN NET_MAP_CALLBACK CallBack,
- IN VOID *Arg
+ IN VOID *Arg OPTIONAL
)
{
@@ -1900,9 +1900,9 @@ NetLibGetVlanId ( This function will append VLAN device path node to the parent device path,
and then use LocateDevicePath() to find the correct VLAN device handle.
- @param[in] ServiceHandle The handle where network service binding protocols are
+ @param[in] ControllerHandle The handle where network service binding protocols are
installed on.
- @param[in] VLanId The configured VLAN ID for the VLAN device.
+ @param[in] VlanId The configured VLAN ID for the VLAN device.
@return The VLAN device handle, or NULL if not found.
@@ -2399,7 +2399,7 @@ NetLibGetNicHandle ( Handle = NULL;
for (Index = 0; Index < OpenCount; Index++) {
- if (OpenBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) {
+ if ((OpenBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
Handle = OpenBuffer[Index].ControllerHandle;
break;
}
diff --git a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c index bb85aebc28..afcde8199a 100644 --- a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c +++ b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c @@ -1,6 +1,6 @@ /** @file
Help functions to access UDP service, it is used by both the DHCP and MTFTP.
-
+
Copyright (c) 2005 - 2009, Intel Corporation.<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -44,7 +44,7 @@ UdpIoFreeTxToken ( } else {
ASSERT (FALSE);
}
-
+
FreePool (TxToken);
}
@@ -65,14 +65,14 @@ UdpIoFreeRxToken ( gBS->CloseEvent (RxToken->Token.Udp6.Event);
} else {
ASSERT (FALSE);
- }
+ }
FreePool (RxToken);
}
/**
The callback function when the packet is sent by UDP.
-
+
It will remove the packet from the local list then call
the packet owner's callback function set by UdpIoSendDatagram.
@@ -91,7 +91,7 @@ UdpIoOnDgramSentDpc ( ASSERT (TxToken->Signature == UDP_IO_TX_SIGNATURE);
ASSERT ((TxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||
(TxToken->UdpIo->UdpVersion == UDP_IO_UDP6_VERSION));
-
+
RemoveEntryList (&TxToken->Link);
if (TxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {
@@ -105,7 +105,7 @@ UdpIoOnDgramSentDpc ( /**
Request UdpIoOnDgramSentDpc as a DPC at TPL_CALLBACK.
-
+
@param[in] Event The event signaled.
@param[in] Context The UDP TX Token.
@@ -133,7 +133,7 @@ VOID UdpIoRecycleDgram (
IN VOID *Context
)
-{
+{
UDP_RX_TOKEN *RxToken;
RxToken = (UDP_RX_TOKEN *) Context;
@@ -151,7 +151,7 @@ UdpIoRecycleDgram ( /**
The event handle for UDP receive request.
-
+
It will build a NET_BUF from the recieved UDP data, then deliver it
to the receiver.
@@ -176,7 +176,7 @@ UdpIoOnDgramRcvdDpc ( ZeroMem (&EndPoint, sizeof(UDP_END_POINT));
- ASSERT ((RxToken->Signature == UDP_IO_RX_SIGNATURE) &&
+ ASSERT ((RxToken->Signature == UDP_IO_RX_SIGNATURE) &&
(RxToken == RxToken->UdpIo->RecvRequest));
ASSERT ((RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||
@@ -214,7 +214,7 @@ UdpIoOnDgramRcvdDpc ( // Build a NET_BUF from the UDP receive data, then deliver it up.
//
if (RxToken->UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) {
-
+
Netbuf = NetbufFromExt (
(NET_FRAGMENT *)((EFI_UDP4_RECEIVE_DATA *) RxData)->FragmentTable,
((EFI_UDP4_RECEIVE_DATA *) RxData)->FragmentCount,
@@ -251,7 +251,7 @@ UdpIoOnDgramRcvdDpc ( EndPoint.LocalAddr.Addr[0] = NTOHL (EndPoint.LocalAddr.Addr[0]);
EndPoint.RemoteAddr.Addr[0] = NTOHL (EndPoint.RemoteAddr.Addr[0]);
} else {
-
+
Netbuf = NetbufFromExt (
(NET_FRAGMENT *)((EFI_UDP6_RECEIVE_DATA *) RxData)->FragmentTable,
((EFI_UDP6_RECEIVE_DATA *) RxData)->FragmentCount,
@@ -260,19 +260,19 @@ UdpIoOnDgramRcvdDpc ( UdpIoRecycleDgram,
RxToken
);
-
+
if (Netbuf == NULL) {
gBS->SignalEvent (((EFI_UDP6_RECEIVE_DATA *) RxData)->RecycleSignal);
RxToken->CallBack (NULL, NULL, EFI_OUT_OF_RESOURCES, RxToken->Context);
-
+
UdpIoFreeRxToken (RxToken);
return;
}
-
+
Session = &((EFI_UDP6_RECEIVE_DATA *) RxData)->UdpSession;
EndPoint.LocalPort = ((EFI_UDP6_SESSION_DATA *) Session)->DestinationPort;
EndPoint.RemotePort = ((EFI_UDP6_SESSION_DATA *) Session)->SourcePort;
-
+
CopyMem (
&EndPoint.LocalAddr,
&((EFI_UDP6_SESSION_DATA *) Session)->DestinationAddress,
@@ -362,7 +362,7 @@ UdpIoCreateRxToken ( &Token->Token.Udp4.Event
);
} else {
-
+
Token->Token.Udp6.Status = EFI_NOT_READY;
Token->Token.Udp6.Packet.RxData = NULL;
@@ -373,7 +373,7 @@ UdpIoCreateRxToken ( Token,
&Token->Token.Udp6.Event
);
- }
+ }
if (EFI_ERROR (Status)) {
@@ -394,7 +394,7 @@ UdpIoCreateRxToken ( @param[in] CallBack The function to call when transmission completed.
@param[in] Context The opaque parameter to the call back.
- @return The wrapped transmission request or NULL if failed to allocate resources
+ @return The wrapped transmission request or NULL if failed to allocate resources
or for some errors.
**/
@@ -414,7 +414,7 @@ UdpIoCreateTxToken ( EFI_STATUS Status;
UINT32 Count;
UINTN Size;
- IP4_ADDR Ip;
+ IP4_ADDR Ip;
ASSERT (Packet != NULL);
ASSERT ((UdpIo->UdpVersion == UDP_IO_UDP4_VERSION) ||
@@ -478,15 +478,15 @@ UdpIoCreateTxToken ( if (EndPoint != NULL) {
Ip = HTONL (EndPoint->LocalAddr.Addr[0]);
CopyMem (
- &TxToken->Session.Udp4.SourceAddress,
- &Ip,
+ &TxToken->Session.Udp4.SourceAddress,
+ &Ip,
sizeof (EFI_IPv4_ADDRESS)
);
Ip = HTONL (EndPoint->RemoteAddr.Addr[0]);
CopyMem (
- &TxToken->Session.Udp4.DestinationAddress,
- &Ip,
+ &TxToken->Session.Udp4.DestinationAddress,
+ &Ip,
sizeof (EFI_IPv4_ADDRESS)
);
@@ -498,13 +498,13 @@ UdpIoCreateTxToken ( if (Gateway != NULL && (Gateway->Addr[0] != 0)) {
Ip = HTONL (Gateway->Addr[0]);
CopyMem (&TxToken->Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS));
- ((EFI_UDP4_TRANSMIT_DATA *) Data)->GatewayAddress = &TxToken->Gateway;
+ ((EFI_UDP4_TRANSMIT_DATA *) Data)->GatewayAddress = &TxToken->Gateway;
}
} else {
-
+
((EFI_UDP6_COMPLETION_TOKEN *) Token)->Status = EFI_NOT_READY;
-
+
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
@@ -517,7 +517,7 @@ UdpIoCreateTxToken ( FreePool (TxToken);
return NULL;
}
-
+
Data = &(TxToken->Data.Udp6);
((EFI_UDP6_COMPLETION_TOKEN *) Token)->Packet.TxData = Data;
((EFI_UDP6_TRANSMIT_DATA *) Data)->UdpSessionData = NULL;
@@ -533,21 +533,21 @@ UdpIoCreateTxToken ( if (EndPoint != NULL) {
CopyMem (
- &TxToken->Session.Udp6.SourceAddress,
- &EndPoint->LocalAddr.v6,
+ &TxToken->Session.Udp6.SourceAddress,
+ &EndPoint->LocalAddr.v6,
sizeof(EFI_IPv6_ADDRESS)
);
CopyMem (
- &TxToken->Session.Udp6.DestinationAddress,
- &EndPoint->RemoteAddr.v6,
+ &TxToken->Session.Udp6.DestinationAddress,
+ &EndPoint->RemoteAddr.v6,
sizeof(EFI_IPv6_ADDRESS)
);
TxToken->Session.Udp6.SourcePort = EndPoint->LocalPort;
TxToken->Session.Udp6.DestinationPort = EndPoint->RemotePort;
((EFI_UDP6_TRANSMIT_DATA *) Data)->UdpSessionData = &(TxToken->Session.Udp6);
- }
+ }
}
return TxToken;
@@ -556,12 +556,11 @@ UdpIoCreateTxToken ( /**
Creates a UDP_IO to access the UDP service. It creates and configures
a UDP child.
-
- This function:
- # locates the UDP service binding prototype on the Controller parameter
- # uses the UDP service binding prototype to create a UDP child (also known as a UDP instance)
- # configures the UDP child by calling Configure function prototype.
- Any failures in creating or configuring the UDP child return NULL for failure.
+
+ It locates the UDP service binding prototype on the Controller parameter
+ uses the UDP service binding prototype to create a UDP child (also known as
+ a UDP instance) configures the UDP child by calling Configure function prototype.
+ Any failures in creating or configuring the UDP child return NULL for failure.
@param[in] Controller The controller that has the UDP service binding.
protocol installed.
@@ -617,7 +616,7 @@ UdpIoCreateIo ( &gEfiUdp4ServiceBindingProtocolGuid,
&UdpIo->UdpHandle
);
-
+
if (EFI_ERROR (Status)) {
goto FREE_MEM;
}
@@ -638,32 +637,32 @@ UdpIoCreateIo ( if (EFI_ERROR (Configure (UdpIo, Context))) {
goto CLOSE_PROTOCOL;
}
-
+
Status = UdpIo->Protocol.Udp4->GetModeData (
- UdpIo->Protocol.Udp4,
- NULL,
- NULL,
- NULL,
+ UdpIo->Protocol.Udp4,
+ NULL,
+ NULL,
+ NULL,
&UdpIo->SnpMode
);
-
+
if (EFI_ERROR (Status)) {
goto CLOSE_PROTOCOL;
}
} else {
-
+
Status = NetLibCreateServiceChild (
Controller,
ImageHandle,
&gEfiUdp6ServiceBindingProtocolGuid,
&UdpIo->UdpHandle
);
-
+
if (EFI_ERROR (Status)) {
goto FREE_MEM;
}
-
+
Status = gBS->OpenProtocol (
UdpIo->UdpHandle,
&gEfiUdp6ProtocolGuid,
@@ -672,23 +671,23 @@ UdpIoCreateIo ( Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
-
+
if (EFI_ERROR (Status)) {
goto FREE_CHILD;
}
-
+
if (EFI_ERROR (Configure (UdpIo, Context))) {
goto CLOSE_PROTOCOL;
}
-
+
Status = UdpIo->Protocol.Udp6->GetModeData (
- UdpIo->Protocol.Udp6,
- NULL,
- NULL,
- NULL,
+ UdpIo->Protocol.Udp6,
+ NULL,
+ NULL,
+ NULL,
&UdpIo->SnpMode
);
-
+
if (EFI_ERROR (Status)) {
goto CLOSE_PROTOCOL;
}
@@ -763,12 +762,12 @@ UdpIoCancelDgrams ( UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &TxToken->Token.Udp6);
}
}
- }
+ }
}
/**
Free the UDP_IO and all its related resources.
-
+
The function will cancel all sent datagram and receive request.
@param[in] UdpIo The UDP_IO to free.
@@ -825,7 +824,7 @@ UdpIoFreeIo ( if ((RxToken = UdpIo->RecvRequest) != NULL) {
UdpIo->Protocol.Udp6->Cancel (UdpIo->Protocol.Udp6, &RxToken->Token.Udp6);
}
-
+
//
// Close then destory the Udp6 child
//
@@ -835,7 +834,7 @@ UdpIoFreeIo ( UdpIo->Image,
UdpIo->Controller
);
-
+
NetLibDestroyServiceChild (
UdpIo->Controller,
UdpIo->Image,
@@ -856,7 +855,7 @@ UdpIoFreeIo ( /**
Clean up the UDP_IO without freeing it. The function is called when
user wants to re-use the UDP_IO later.
-
+
It will release all the transmitted datagrams and receive request. It will
also configure NULL for the UDP instance.
@@ -897,7 +896,7 @@ UdpIoCleanIo ( /**
Send a packet through the UDP_IO.
-
+
The packet will be wrapped in UDP_TX_TOKEN. Function Callback will be called
when the packet is sent. The optional parameter EndPoint overrides the default
address pair if specified.
@@ -906,7 +905,7 @@ UdpIoCleanIo ( @param[in] Packet The packet to send.
@param[in] EndPoint The local and remote access point. Override the
default address pair set during configuration.
- @param[in] Gateway The gateway to use.
+ @param[in] Gateway The gateway to use.
@param[in] CallBack The function being called when packet is
transmitted or failed.
@param[in] Context The opaque parameter passed to CallBack.
@@ -1006,7 +1005,7 @@ UdpIoCancelSentDatagram ( /**
Issue a receive request to the UDP_IO.
-
+
This function is called when upper-layer needs packet from UDP for processing.
Only one receive request is acceptable at a time so a common usage model is
to invoke this function inside its Callback function when the former packet
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c index 76c55c4478..3136652f98 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2006 - 2009, Intel Corporation.<BR>
+Copyright (c) 2006 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -32,7 +32,7 @@ EFI_SERVICE_BINDING_PROTOCOL mDhcp4ServiceBindingTemplate = { This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
both device drivers and bus drivers.
-
+
Entry point of the DHCP driver to install various protocols.
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
@@ -315,6 +315,7 @@ Dhcp4DriverBindingStart ( if (EFI_ERROR (Status)) {
return Status;
}
+ ASSERT (DhcpSb != NULL);
//
// Start the receiving
@@ -360,7 +361,7 @@ ON_ERROR: restrictions for this service. DisconnectController()
must follow these calling restrictions. If any other agent wishes
to call Stop() it must also follow these calling restrictions.
-
+
@param[in] This Protocol instance pointer.
@param[in] ControllerHandle Handle of device to stop driver on
@param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
@@ -482,14 +483,14 @@ DhcpInitProtocol ( /**
Creates a child handle and installs a protocol.
-
- The CreateChild() function installs a protocol on ChildHandle.
- If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
+
+ The CreateChild() function installs a protocol on ChildHandle.
+ If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
@param ChildHandle Pointer to the handle of the child to create. If it is NULL,
- then a new handle is created. If it is a pointer to an existing UEFI handle,
+ then a new handle is created. If it is a pointer to an existing UEFI handle,
then the protocol is added to the existing UEFI handle.
@retval EFI_SUCCES The protocol was added to ChildHandle.
@@ -578,9 +579,9 @@ Dhcp4ServiceBindingCreateChild ( /**
Destroys a child handle with a protocol installed on it.
-
- The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
- that was installed by CreateChild() from ChildHandle. If the removed protocol is the
+
+ The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
+ that was installed by CreateChild() from ChildHandle. If the removed protocol is the
last protocol on ChildHandle, then ChildHandle is destroyed.
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c index fb0332722e..a0a53a4e33 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c @@ -1,7 +1,7 @@ /** @file
This file implement the EFI_DHCP4_PROTOCOL interface.
-
-Copyright (c) 2006 - 2009, Intel Corporation.<BR>
+
+Copyright (c) 2006 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
-
+
The GetModeData() function returns the current operating mode and cached data
packet for the EFI DHCPv4 Protocol driver.
@@ -82,7 +82,7 @@ EFIAPI EfiDhcp4Configure (
IN EFI_DHCP4_PROTOCOL *This,
IN EFI_DHCP4_CONFIG_DATA *Dhcp4CfgData OPTIONAL
- );
+ );
/**
Starts the DHCP configuration process.
@@ -100,7 +100,7 @@ EfiDhcp4Configure ( time when each event occurs in this process, the callback function that was set
by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this
opportunity to control the process.
-
+
@param[in] This Pointer to the EFI_DHCP4_PROTOCOL instance.
@param[in] CompletionEvent If not NULL, indicates the event that will be signaled when the
EFI DHCPv4 Protocol driver is transferred into the
@@ -133,7 +133,7 @@ EfiDhcp4Start ( /**
Extends the lease time by sending a request packet.
-
+
The RenewRebind() function is used to manually extend the lease time when the
EFI DHCPv4 Protocol driver is in the Dhcp4Bound state and the lease time has
not expired yet. This function will send a request packet to the previously
@@ -206,7 +206,7 @@ EfiDhcp4Release ( /**
Stops the current address configuration.
-
+
The Stop() function is used to stop the DHCP configuration process. After this
function is called successfully, the EFI DHCPv4 Protocol driver is transferred
into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called
@@ -263,10 +263,10 @@ EfiDhcp4Build ( IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL,
OUT EFI_DHCP4_PACKET **NewPacket
);
-
+
/**
Transmits a DHCP formatted packet and optionally waits for responses.
-
+
The TransmitReceive() function is used to transmit a DHCP packet and optionally
wait for the response from servers. This function does not change the state of
the EFI DHCPv4 Protocol driver and thus can be used at any time.
@@ -292,7 +292,7 @@ EfiDhcp4TransmitReceive ( /**
Parses the packed DHCP option data.
-
+
The Parse() function is used to retrieve the option list from a DHCP packet.
If *OptionCount isn't zero, and there is enough space for all the DHCP options
in the Packet, each element of PacketOptionList is set to point to somewhere in
@@ -340,7 +340,7 @@ EFI_DHCP4_PROTOCOL mDhcp4ProtocolTemplate = { /**
Returns the current operating mode and cached data packet for the EFI DHCPv4 Protocol driver.
-
+
The GetModeData() function returns the current operating mode and cached data
packet for the EFI DHCPv4 Protocol driver.
@@ -647,15 +647,15 @@ EfiDhcp4Configure ( }
if (Dhcp4CfgData != NULL) {
- if (Dhcp4CfgData->DiscoverTryCount && (Dhcp4CfgData->DiscoverTimeout == NULL)) {
+ if ((Dhcp4CfgData->DiscoverTryCount != 0) && (Dhcp4CfgData->DiscoverTimeout == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (Dhcp4CfgData->RequestTryCount && (Dhcp4CfgData->RequestTimeout == NULL)) {
+ if ((Dhcp4CfgData->RequestTryCount != 0) && (Dhcp4CfgData->RequestTimeout == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (Dhcp4CfgData->OptionCount && (Dhcp4CfgData->OptionList == NULL)) {
+ if ((Dhcp4CfgData->OptionCount != 0) && (Dhcp4CfgData->OptionList == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -748,7 +748,7 @@ ON_EXIT: time when each event occurs in this process, the callback function that was set
by EFI_DHCP4_PROTOCOL.Configure() will be called and the user can take this
opportunity to control the process.
-
+
@param[in] This Pointer to the EFI_DHCP4_PROTOCOL instance.
@param[in] CompletionEvent If not NULL, indicates the event that will be signaled when the
EFI DHCPv4 Protocol driver is transferred into the
@@ -842,7 +842,7 @@ ON_ERROR: /**
Extends the lease time by sending a request packet.
-
+
The RenewRebind() function is used to manually extend the lease time when the
EFI DHCPv4 Protocol driver is in the Dhcp4Bound state and the lease time has
not expired yet. This function will send a request packet to the previously
@@ -1045,7 +1045,7 @@ ON_EXIT: /**
Stops the current address configuration.
-
+
The Stop() function is used to stop the DHCP configuration process. After this
function is called successfully, the EFI DHCPv4 Protocol driver is transferred
into the Dhcp4Stopped state. EFI_DHCP4_PROTOCOL.Configure() needs to be called
@@ -1165,10 +1165,10 @@ EfiDhcp4Build ( /**
Callback by UdpIoCreatePort() when creating UdpIo for this Dhcp4 instance.
-
+
@param[in] UdpIo The UdpIo being created.
@param[in] Context Dhcp4 instance.
-
+
@retval EFI_SUCCESS UdpIo is configured successfully.
@retval other Other error occurs.
**/
@@ -1212,9 +1212,9 @@ Dhcp4InstanceConfigUdpIo ( /**
Create UdpIo for this Dhcp4 instance.
-
+
@param Instance The Dhcp4 instance.
-
+
@retval EFI_SUCCESS UdpIo is created successfully.
@retval EFI_OUT_OF_RESOURCES Fails to create UdpIo because of limited
resources or configuration failure.
@@ -1245,7 +1245,7 @@ Dhcp4InstanceCreateUdpIo ( /**
Callback of Dhcp packet. Does nothing.
-
+
@param Arg The context.
**/
@@ -1258,15 +1258,15 @@ DhcpDummyExtFree ( /**
Callback of UdpIoRecvDatagram() that handles a Dhcp4 packet.
-
+
Only BOOTP responses will be handled that correspond to the Xid of the request
sent out. The packet will be queued to the response queue.
-
+
@param UdpPacket The Dhcp4 packet.
@param EndPoint Udp4 address pair.
@param IoStatus Status of the input.
@param Context Extra info for the input.
-
+
**/
VOID
PxeDhcpInput (
@@ -1368,7 +1368,7 @@ RESTART: /**
Complete a Dhcp4 transaction and signal the upper layer.
-
+
@param Instance Dhcp4 instance.
**/
@@ -1417,7 +1417,7 @@ SIGNAL_USER: /**
Transmits a DHCP formatted packet and optionally waits for responses.
-
+
The TransmitReceive() function is used to transmit a DHCP packet and optionally
wait for the response from servers. This function does not change the state of
the EFI DHCPv4 Protocol driver and thus can be used at any time.
@@ -1643,7 +1643,7 @@ Dhcp4ParseCheckOption ( /**
Parses the packed DHCP option data.
-
+
The Parse() function is used to retrieve the option list from a DHCP packet.
If *OptionCount isn't zero, and there is enough space for all the DHCP options
in the Packet, each element of PacketOptionList is set to point to somewhere in
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.c index 97e9bb2b40..5b94266e1f 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiCHAP.c @@ -1,7 +1,7 @@ /** @file
This file is for Challenge-Handshake Authentication Protocol (CHAP) Configuration.
-
-Copyright (c) 2004 - 2009, Intel Corporation.<BR>
+
+Copyright (c) 2004 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -18,19 +18,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. EFI_GUID mIScsiCHAPAuthInfoGuid = ISCSI_CHAP_AUTH_INFO_GUID;
/**
- Initator caculates its own expected hash value.
-
- @param[in] ChapIdentifier iSCSI CHAP identifier sent by authenticator.
- @param[in] ChapSecret iSCSI CHAP secret of the authenticator.
+ Initator caculates its own expected hash value.
+
+ @param[in] ChapIdentifier iSCSI CHAP identifier sent by authenticator.
+ @param[in] ChapSecret iSCSI CHAP secret of the authenticator.
@param[in] SecretLength The length of iSCSI CHAP secret.
- @param[in] ChapChallenge The challenge message sent by authenticator.
+ @param[in] ChapChallenge The challenge message sent by authenticator.
@param[in] ChallengeLength The length of iSCSI CHAP challenge message.
@param[out] ChapResponse The calculation of the expected hash value.
-
+
@retval EFI_SUCCESS The expected hash value was caculatedly successfully.
- @retval EFI_PROTOCOL_ERROR The length of the secret should be at least the
+ @retval EFI_PROTOCOL_ERROR The length of the secret should be at least the
length of the hash value for the hashing algorithm chosen.
- @retval Others Other errors as indicated.
+ @retval Others Other errors as indicated.
**/
EFI_STATUS
IScsiCHAPCalculateResponse (
@@ -75,10 +75,10 @@ IScsiCHAPCalculateResponse ( /**
The initator checks the CHAP response replied by target against its own
- calculation of the expected hash value.
-
- @param[in] AuthData iSCSI CHAP authentication data.
- @param[in] TargetResponse The response from target.
+ calculation of the expected hash value.
+
+ @param[in] AuthData iSCSI CHAP authentication data.
+ @param[in] TargetResponse The response from target.
@retval EFI_SUCCESS The response from target passed authentication.
@retval EFI_SECURITY_VIOLATION The response from target was not expected value.
@@ -106,7 +106,7 @@ IScsiCHAPAuthTarget ( VerifyRsp
);
- if (CompareMem (VerifyRsp, TargetResponse, ISCSI_CHAP_RSP_LEN)) {
+ if (CompareMem (VerifyRsp, TargetResponse, ISCSI_CHAP_RSP_LEN) != 0) {
Status = EFI_SECURITY_VIOLATION;
}
@@ -116,7 +116,7 @@ IScsiCHAPAuthTarget ( /**
This function checks the received iSCSI Login Response during the security
negotiation stage.
-
+
@param[in] Conn The iSCSI connection.
@retval EFI_SUCCESS The Login Response passed the CHAP validation.
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c index 5e297821a2..cccaab6dee 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c @@ -1,7 +1,7 @@ /** @file
The driver binding and service binding protocol for IP4 driver.
-
-Copyright (c) 2005 - 2009, Intel Corporation.<BR>
+
+Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -27,7 +27,7 @@ EFI_DRIVER_BINDING_PROTOCOL gIp4DriverBinding = { This is the declaration of an EFI image entry point. This entry point is
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
both device drivers and bus drivers.
-
+
The entry point for IP4 driver which install the driver
binding and component name protocol on its image.
@@ -446,6 +446,7 @@ Ip4DriverBindingStart ( if (EFI_ERROR (Status)) {
return Status;
}
+ ASSERT (IpSb != NULL);
//
// Install the Ip4ServiceBinding Protocol onto ControlerHandle
@@ -507,7 +508,7 @@ FREE_SERVICE: restrictions for this service. DisconnectController()
must follow these calling restrictions. If any other agent wishes
to call Stop() it must also follow these calling restrictions.
-
+
@param[in] This Protocol instance pointer.
@param[in] ControllerHandle Handle of device to stop driver on
@param[in] NumberOfChildren Number of Handles in ChildHandleBuffer. If number
@@ -743,14 +744,14 @@ ON_ERROR: /**
Creates a child handle and installs a protocol.
-
- The CreateChild() function installs a protocol on ChildHandle.
- If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
+
+ The CreateChild() function installs a protocol on ChildHandle.
+ If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
@param ChildHandle Pointer to the handle of the child to create. If it is NULL,
- then a new handle is created. If it is a pointer to an existing UEFI handle,
+ then a new handle is created. If it is a pointer to an existing UEFI handle,
then the protocol is added to the existing UEFI handle.
@retval EFI_SUCCES The protocol was added to ChildHandle.
@@ -849,9 +850,9 @@ ON_ERROR: /**
Destroys a child handle with a protocol installed on it.
-
- The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
- that was installed by CreateChild() from ChildHandle. If the removed protocol is the
+
+ The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
+ that was installed by CreateChild() from ChildHandle. If the removed protocol is the
last protocol on ChildHandle, then ChildHandle is destroyed.
@param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c index 05fd96d634..ec545a6c54 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c @@ -1,6 +1,6 @@ /** @file
-Copyright (c) 2005 - 2009, Intel Corporation.<BR>
+Copyright (c) 2005 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -17,7 +17,7 @@ EFI_IPSEC_PROTOCOL *mIpSec = NULL; /**
Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
-
+
The GetModeData() function returns the current operational mode data for this
driver instance. The data fields in EFI_IP4_MODE_DATA are read only. This
function is used optionally to retrieve the operational mode data of underlying
@@ -41,10 +41,10 @@ EfiIp4GetModeData ( OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
);
-
+
/**
Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
-
+
The Configure() function is used to set, change, or reset the operational
parameters and filter settings for this EFI IPv4 Protocol instance. Until these
parameters have been set, no network traffic can be sent or received by this
@@ -53,14 +53,14 @@ EfiIp4GetModeData ( parameters have been set again. Each EFI IPv4 Protocol instance can be started
and stopped independently of each other by enabling or disabling their receive
filter settings with the Configure() function.
-
+
When IpConfigData.UseDefaultAddress is set to FALSE, the new station address will
be appended as an alias address into the addresses list in the EFI IPv4 Protocol
driver. While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG_PROTOCOL
to retrieve the default IPv4 address if it is not available yet. Clients could
frequently call GetModeData() to check the status to ensure that the default IPv4
address is ready.
-
+
If operational parameters are reset or changed, any pending transmit and receive
requests will be cancelled. Their completion token status will be set to EFI_ABORTED
and their events will be signaled.
@@ -91,14 +91,14 @@ EfiIp4Configure ( IN EFI_IP4_PROTOCOL *This,
IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL
);
-
+
/**
Joins and leaves multicast groups.
-
+
The Groups() function is used to join and leave multicast group sessions. Joining
a group will enable reception of matching multicast packets. Leaving a group will
disable the multicast packet reception.
-
+
If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
@param[in] This Pointer to the EFI_IP4_PROTOCOL instance.
@@ -129,25 +129,25 @@ EfiIp4Groups ( IN BOOLEAN JoinFlag,
IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL
);
-
+
/**
Adds and deletes routing table entries.
The Routes() function adds a route to or deletes a route from the routing table.
-
+
Routes are determined by comparing the SubnetAddress with the destination IPv4
address arithmetically AND-ed with the SubnetMask. The gateway address must be
on the same subnet as the configured station address.
-
+
The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.
The default route matches all destination IPv4 addresses that do not match any
other routes.
-
+
A GatewayAddress that is zero is a nonroute. Packets are sent to the destination
IP address if it can be found in the ARP cache or on the local subnet. One automatic
nonroute entry will be inserted into the routing table for outgoing packets that
are addressed to a local subnet (gateway address of 0.0.0.0).
-
+
Each EFI IPv4 Protocol instance has its own independent routing table. Those EFI
IPv4 Protocol instances that use the default IPv4 address will also have copies
of the routing table that was provided by the EFI_IP4_CONFIG_PROTOCOL, and these
@@ -178,7 +178,7 @@ EfiIp4Groups ( @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
@retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
DeleteRoute is FALSE).
-
+
**/
EFI_STATUS
EFIAPI
@@ -189,7 +189,7 @@ EfiIp4Routes ( IN EFI_IPv4_ADDRESS *SubnetMask,
IN EFI_IPv4_ADDRESS *GatewayAddress
);
-
+
/**
Places outgoing data packets into the transmit queue.
@@ -208,7 +208,7 @@ EfiIp4Routes ( @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
was already in the transmit queue.
@retval EFI_NOT_READY The completion token could not be queued because the transmit
- queue is full.
+ queue is full.
@retval EFI_NOT_FOUND Not route is found to destination address.
@retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
@retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
@@ -225,13 +225,13 @@ EfiIp4Transmit ( IN EFI_IP4_PROTOCOL *This,
IN EFI_IP4_COMPLETION_TOKEN *Token
);
-
+
/**
Places a receiving request into the receiving queue.
-
+
The Receive() function places a completion token into the receive packet queue.
This function is always asynchronous.
-
+
The Token.Event field in the completion token must be filled in by the caller
and cannot be NULL. When the receive operation completes, the EFI IPv4 Protocol
driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
@@ -264,10 +264,10 @@ EfiIp4Receive ( IN EFI_IP4_PROTOCOL *This,
IN EFI_IP4_COMPLETION_TOKEN *Token
);
-
+
/**
Abort an asynchronous transmit or receive request.
-
+
The Cancel() function is used to abort a pending transmit or receive request.
If the token is in the transmit or receive request queues, after calling this
function, Token->Status will be set to EFI_ABORTED and then Token->Event will
@@ -300,15 +300,15 @@ EfiIp4Cancel ( IN EFI_IP4_PROTOCOL *This,
IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL
);
-
+
/**
Polls for incoming data packets and processes outgoing data packets.
-
+
The Poll() function polls for incoming data packets and processes outgoing data
packets. Network drivers and applications can call the EFI_IP4_PROTOCOL.Poll()
function to increase the rate that data packets are moved between the communications
device and the transmit and receive queues.
-
+
In some systems the periodic timer event may not poll the underlying communications
device fast enough to transmit and/or receive all data packets without missing
incoming packets or dropping outgoing packets. Drivers and applications that are
@@ -348,7 +348,7 @@ mEfiIp4ProtocolTemplete = { /**
Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.
-
+
The GetModeData() function returns the current operational mode data for this
driver instance. The data fields in EFI_IP4_MODE_DATA are read only. This
function is used optionally to retrieve the operational mode data of underlying
@@ -687,7 +687,7 @@ ON_EXIT: /**
Request Ip4AutoConfigCallBackDpc as a DPC at TPL_CALLBACK.
-
+
@param Event The event that is signalled.
@param Context The IP4 service binding instance.
@@ -1126,7 +1126,7 @@ Ip4StationAddressValid ( /**
Assigns an IPv4 address and subnet mask to this EFI IPv4 Protocol driver instance.
-
+
The Configure() function is used to set, change, or reset the operational
parameters and filter settings for this EFI IPv4 Protocol instance. Until these
parameters have been set, no network traffic can be sent or received by this
@@ -1135,14 +1135,14 @@ Ip4StationAddressValid ( parameters have been set again. Each EFI IPv4 Protocol instance can be started
and stopped independently of each other by enabling or disabling their receive
filter settings with the Configure() function.
-
+
When IpConfigData.UseDefaultAddress is set to FALSE, the new station address will
be appended as an alias address into the addresses list in the EFI IPv4 Protocol
driver. While set to TRUE, Configure() will trigger the EFI_IP4_CONFIG_PROTOCOL
to retrieve the default IPv4 address if it is not available yet. Clients could
frequently call GetModeData() to check the status to ensure that the default IPv4
address is ready.
-
+
If operational parameters are reset or changed, any pending transmit and receive
requests will be cancelled. Their completion token status will be set to EFI_ABORTED
and their events will be signaled.
@@ -1318,7 +1318,7 @@ Ip4Groups ( // host byte order
//
if (JoinFlag) {
- //
+ //
// When JoinFlag is TRUE, GroupAddress shouldn't be NULL.
//
ASSERT (GroupAddress != NULL);
@@ -1386,11 +1386,11 @@ Ip4Groups ( /**
Joins and leaves multicast groups.
-
+
The Groups() function is used to join and leave multicast group sessions. Joining
a group will enable reception of matching multicast packets. Leaving a group will
disable the multicast packet reception.
-
+
If JoinFlag is FALSE and GroupAddress is NULL, all joined groups will be left.
@param[in] This Pointer to the EFI_IP4_PROTOCOL instance.
@@ -1464,20 +1464,20 @@ ON_EXIT: Adds and deletes routing table entries.
The Routes() function adds a route to or deletes a route from the routing table.
-
+
Routes are determined by comparing the SubnetAddress with the destination IPv4
address arithmetically AND-ed with the SubnetMask. The gateway address must be
on the same subnet as the configured station address.
-
+
The default route is added with SubnetAddress and SubnetMask both set to 0.0.0.0.
The default route matches all destination IPv4 addresses that do not match any
other routes.
-
+
A GatewayAddress that is zero is a nonroute. Packets are sent to the destination
IP address if it can be found in the ARP cache or on the local subnet. One automatic
nonroute entry will be inserted into the routing table for outgoing packets that
are addressed to a local subnet (gateway address of 0.0.0.0).
-
+
Each EFI IPv4 Protocol instance has its own independent routing table. Those EFI
IPv4 Protocol instances that use the default IPv4 address will also have copies
of the routing table that was provided by the EFI_IP4_CONFIG_PROTOCOL, and these
@@ -1508,7 +1508,7 @@ ON_EXIT: @retval EFI_NOT_FOUND This route is not in the routing table (when DeleteRoute is TRUE).
@retval EFI_ACCESS_DENIED The route is already defined in the routing table (when
DeleteRoute is FALSE).
-
+
**/
EFI_STATUS
EFIAPI
@@ -1693,7 +1693,7 @@ Ip4TxTokenValid ( // Check the source and gateway: they must be a valid unicast.
// Gateway must also be on the connected network.
//
- if (TxData->OverrideData) {
+ if (TxData->OverrideData != NULL) {
Override = TxData->OverrideData;
CopyMem (&Src, &Override->SourceAddress, sizeof (IP4_ADDR));
@@ -1857,7 +1857,7 @@ Ip4OnPacketSent ( @retval EFI_ACCESS_DENIED The transmit completion token with the same Token.Event
was already in the transmit queue.
@retval EFI_NOT_READY The completion token could not be queued because the transmit
- queue is full.
+ queue is full.
@retval EFI_NOT_FOUND Not route is found to destination address.
@retval EFI_OUT_OF_RESOURCES Could not queue the transmit data.
@retval EFI_BUFFER_TOO_SMALL Token.Packet.TxData.TotalDataLength is too
@@ -1936,7 +1936,7 @@ EfiIp4Transmit ( CopyMem (&Head.Dst, &TxData->DestinationAddress, sizeof (IP4_ADDR));
Head.Dst = NTOHL (Head.Dst);
- if (TxData->OverrideData) {
+ if (TxData->OverrideData != NULL) {
Override = TxData->OverrideData;
Head.Protocol = Override->Protocol;
Head.Tos = Override->TypeOfService;
@@ -2039,10 +2039,10 @@ ON_EXIT: /**
Places a receiving request into the receiving queue.
-
+
The Receive() function places a completion token into the receive packet queue.
This function is always asynchronous.
-
+
The Token.Event field in the completion token must be filled in by the caller
and cannot be NULL. When the receive operation completes, the EFI IPv4 Protocol
driver updates the Token.Status and Token.Packet.RxData fields and the Token.Event
@@ -2310,7 +2310,7 @@ Ip4Cancel ( /**
Abort an asynchronous transmit or receive request.
-
+
The Cancel() function is used to abort a pending transmit or receive request.
If the token is in the transmit or receive request queues, after calling this
function, Token->Status will be set to EFI_ABORTED and then Token->Event will
@@ -2376,12 +2376,12 @@ ON_EXIT: /**
Polls for incoming data packets and processes outgoing data packets.
-
+
The Poll() function polls for incoming data packets and processes outgoing data
packets. Network drivers and applications can call the EFI_IP4_PROTOCOL.Poll()
function to increase the rate that data packets are moved between the communications
device and the transmit and receive queues.
-
+
In some systems the periodic timer event may not poll the underlying communications
device fast enough to transmit and/or receive all data packets without missing
incoming packets or dropping outgoing packets. Drivers and applications that are
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c index 8ceb248064..b920e8b21a 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Driver.c @@ -1,7 +1,7 @@ /** @file
Implementation of Mtftp drivers.
-
-Copyright (c) 2006 - 2009, Intel Corporation<BR>
+
+Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. 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
@@ -35,7 +35,7 @@ EFI_SERVICE_BINDING_PROTOCOL gMtftp4ServiceBindingTemplete = { @param ImageHandle The MTFTP's image handle.
@param SystemTable The system table.
- @retval EFI_SUCCESS The handles are successfully installed on the image.
+ @retval EFI_SUCCESS The handles are successfully installed on the image.
@retval others some EFI_ERROR occured.
**/
@@ -67,14 +67,14 @@ Mtftp4DriverEntryPoint ( @retval EFI_SUCCESS The controller has UDP service binding protocol
installed, MTFTP can support it.
@retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
- RemainingDevicePath is already being managed by
+ RemainingDevicePath is already being managed by
the driver specified by This.
@retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
- RemainingDevicePath is already being managed by a
- different driver or an application that requires
+ RemainingDevicePath is already being managed by a
+ different driver or an application that requires
exclusive access.
@retval EFI_UNSUPPORTED The device specified by ControllerHandle and
- RemainingDevicePath is not supported by the driver
+ RemainingDevicePath is not supported by the driver
specified by This.
**/
@@ -102,9 +102,9 @@ Mtftp4DriverBindingSupported ( /**
- Config a NULL UDP that is used to keep the connection between UDP and MTFTP.
-
- Just leave the Udp child unconfigured. When UDP is unloaded,
+ Config a NULL UDP that is used to keep the connection between UDP and MTFTP.
+
+ Just leave the Udp child unconfigured. When UDP is unloaded,
MTFTP will be informed with DriverBinding Stop.
@param UdpIo The UDP_IO to configure
@@ -239,8 +239,8 @@ Mtftp4CleanService ( /**
- Start the MTFTP driver on this controller.
-
+ Start the MTFTP driver on this controller.
+
MTFTP driver will install a MTFTP SERVICE BINDING protocol on the supported
controller, which can be used to create/destroy MTFTP children.
@@ -286,6 +286,7 @@ Mtftp4DriverBindingStart ( if (EFI_ERROR (Status)) {
return Status;
}
+ ASSERT (MtftpSb != NULL);
Status = gBS->SetTimer (MtftpSb->Timer, TimerPeriodic, TICKS_PER_SECOND);
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c index 93e548ea1c..bfefb66d44 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Option.c @@ -1,7 +1,7 @@ /** @file
Routines to process MTFTP4 options.
-
-Copyright (c) 2006 - 2009, Intel Corporation<BR>
+
+Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. 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
@@ -224,8 +224,8 @@ Mtftp4FillOptions ( /**
- Allocate and fill in a array of Mtftp options from the Packet.
-
+ Allocate and fill in a array of Mtftp options from the Packet.
+
It first calls Mtftp4FillOption to get the option number, then allocate
the array, at last, call Mtftp4FillOption again to save the options.
@@ -525,6 +525,7 @@ Mtftp4ParseOptionOack ( if (EFI_ERROR (Status) || (Count == 0)) {
return Status;
}
+ ASSERT (OptionList != NULL);
Status = Mtftp4ParseOption (OptionList, Count, FALSE, MtftpOption);
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c index 213b724e5f..606b096328 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c @@ -1,11 +1,11 @@ /** @file
Implementation of driver entry point and driver binding protocol.
-
-Copyright (c) 2004 - 2009, Intel Corporation. <BR>
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php
+
+Copyright (c) 2004 - 2010, Intel Corporation. <BR>
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -49,13 +49,13 @@ SnpNotifyExitBootServices ( /**
Send command to UNDI. It does nothing currently.
-
+
@param Cdb command to be sent to UNDI.
-
- @retval EFI_INVALID_PARAMETER The command is 0.
- @retval EFI_UNSUPPORTED Default return status because it's not
+
+ @retval EFI_INVALID_PARAMETER The command is 0.
+ @retval EFI_UNSUPPORTED Default return status because it's not
supported currently.
-
+
**/
EFI_STATUS
IssueHwUndiCommand (
@@ -81,7 +81,7 @@ IssueHwUndiCommand ( @param Buffer Pointer to buffer.
@param Length Length of buffer in bytes.
- @return 8-bit checksum of all bytes in buffer, or zero if ptr is NULL or len
+ @return 8-bit checksum of all bytes in buffer, or zero if ptr is NULL or len
is zero.
**/
@@ -178,7 +178,7 @@ SimpleNetworkDriverSupported ( //
// Check to see if !PXE structure is valid. Paragraph alignment of !PXE structure is required.
//
- if (NiiProtocol->Id & 0x0F) {
+ if ((NiiProtocol->Id & 0x0F) != 0) {
DEBUG ((EFI_D_NET, "\n!PXE structure is not paragraph aligned.\n"));
Status = EFI_UNSUPPORTED;
goto Done;
@@ -615,7 +615,7 @@ SimpleNetworkDriverStart ( }
- if (Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) {
+ if ((Pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {
Snp->Mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
}
@@ -725,7 +725,7 @@ NiiError: restrictions for this service. DisconnectController()
must follow these calling restrictions. If any other agent wishes
to call Stop() it must also follow these calling restrictions.
-
+
@param This Protocol instance pointer.
@param ControllerHandle Handle of device to stop driver on
@param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c b/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c index c52fc23db3..ad97f2407d 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/Statistics.c @@ -1,11 +1,11 @@ /** @file
Implementation of collecting the statistics on a network interface.
-
-Copyright (c) 2004 - 2007, Intel Corporation. <BR>
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php
+
+Copyright (c) 2004 - 2010, Intel Corporation. <BR>
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -18,15 +18,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
Resets or collects the statistics on a network interface.
-
+
This function resets or collects the statistics on a network interface. If the
size of the statistics table specified by StatisticsSize is not big enough for
all the statistics that are collected by the network interface, then a partial
- buffer of statistics is returned in StatisticsTable, StatisticsSize is set to
- the size required to collect all the available statistics, and
+ buffer of statistics is returned in StatisticsTable, StatisticsSize is set to
+ the size required to collect all the available statistics, and
EFI_BUFFER_TOO_SMALL is returned.
- If StatisticsSize is big enough for all the statistics, then StatisticsTable
- will be filled, StatisticsSize will be set to the size of the returned
+ If StatisticsSize is big enough for all the statistics, then StatisticsTable
+ will be filled, StatisticsSize will be set to the size of the returned
StatisticsTable structure, and EFI_SUCCESS is returned.
If the driver has not been initialized, EFI_DEVICE_ERROR will be returned.
If Reset is FALSE, and both StatisticsSize and StatisticsTable are NULL, then
@@ -36,30 +36,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.
@param Reset Set to TRUE to reset the statistics for the network interface.
- @param StatisticsSize On input the size, in bytes, of StatisticsTable. On output
+ @param StatisticsSize On input the size, in bytes, of StatisticsTable. On output
the size, in bytes, of the resulting table of statistics.
- @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
- contains the statistics. Type EFI_NETWORK_STATISTICS is
- defined in "Related Definitions" below.
-
+ @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
+ contains the statistics. Type EFI_NETWORK_STATISTICS is
+ defined in "Related Definitions" below.
+
@retval EFI_SUCCESS The requested operation succeeded.
@retval EFI_NOT_STARTED The Simple Network Protocol interface has not been
started by calling Start().
- @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is
- NULL. The current buffer size that is needed to
+ @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is
+ NULL. The current buffer size that is needed to
hold all the statistics is returned in StatisticsSize.
- @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is
+ @retval EFI_BUFFER_TOO_SMALL StatisticsSize is not NULL and StatisticsTable is
not NULL. The current buffer size that is needed
- to hold all the statistics is returned in
- StatisticsSize. A partial set of statistics is
+ to hold all the statistics is returned in
+ StatisticsSize. A partial set of statistics is
returned in StatisticsTable.
- @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not
+ @retval EFI_INVALID_PARAMETER StatisticsSize is NULL and StatisticsTable is not
NULL.
- @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not
+ @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not
been initialized by calling Initialize().
- @retval EFI_DEVICE_ERROR An error was encountered collecting statistics
+ @retval EFI_DEVICE_ERROR An error was encountered collecting statistics
from the NIC.
- @retval EFI_UNSUPPORTED The NIC does not support collecting statistics
+ @retval EFI_UNSUPPORTED The NIC does not support collecting statistics
from the network interface.
**/
@@ -197,7 +197,7 @@ SnpUndi32Statistics ( break;
}
- if (Db->Supported & Mask) {
+ if ((Db->Supported & Mask) != 0) {
*Stp = Db->Data[Index];
Size = Index + 1;
} else {
@@ -208,7 +208,7 @@ SnpUndi32Statistics ( // Compute size up to last supported statistic.
//
while (++Index < 64) {
- if (Db->Supported & (Mask = LShiftU64 (Mask, 1))) {
+ if ((Db->Supported & (Mask = LShiftU64 (Mask, 1))) != 0) {
Size = Index;
}
}
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c index 2b924c4b4b..664d25a1a2 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c @@ -1,7 +1,7 @@ /** @file
Tcp request dispatcher implementation.
-Copyright (c) 2005 - 2009, Intel Corporation<BR>
+Copyright (c) 2005 - 2010, Intel Corporation<BR>
All rights reserved. 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
@@ -52,7 +52,7 @@ Tcp4Route ( RouteInfo->SubnetMask,
RouteInfo->GatewayAddress
);
-
+
}
@@ -249,7 +249,7 @@ Tcp4FlushPcb ( Attach a Pcb to the socket.
@param Sk Pointer to the socket of this TCP instance.
-
+
@retval EFI_SUCCESS The operation is completed successfully.
@retval EFI_OUT_OF_RESOURCES Failed due to resource limit.
@@ -300,7 +300,7 @@ Tcp4AttachPcb ( Detach the Pcb of the socket.
@param Sk Pointer to the socket of this TCP instance.
-
+
**/
VOID
Tcp4DetachPcb (
@@ -532,15 +532,15 @@ Tcp4ConfigurePcb ( (UINT32) (Option->ConnectionTimeout * TCP_TICK_HZ)
);
- if (Option->EnableNagle == FALSE) {
+ if (!Option->EnableNagle) {
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE);
}
- if (Option->EnableTimeStamp == FALSE) {
+ if (!Option->EnableTimeStamp) {
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_TS);
}
- if (Option->EnableWindowScaling == FALSE) {
+ if (!Option->EnableWindowScaling) {
TCP_SET_FLG (Tcb->CtrlFlag, TCP_CTRL_NO_WS);
}
}
@@ -557,7 +557,7 @@ Tcp4ConfigurePcb ( //
// update state of Tcb and socket
//
- if (CfgData->AccessPoint.ActiveFlag == FALSE) {
+ if (!CfgData->AccessPoint.ActiveFlag) {
TcpSetState (Tcb, TCP_LISTEN);
SockSetState (Sk, SO_LISTENING);
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c index ed7ee73e91..6b2da72b42 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c @@ -1,7 +1,7 @@ /** @file
Support for PxeBc dhcp functions.
-
-Copyright (c) 2007 - 2009, Intel Corporation.<BR>
+
+Copyright (c) 2007 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -33,7 +33,7 @@ UINT8 mInterestedDhcp4Tags[PXEBC_DHCP4_TAG_INDEX_MAX] = { This function initialize the DHCP4 message instance.
This function will pad each item of dhcp4 message packet.
-
+
@param Seed Pointer to the message instance of the DHCP4 packet.
@param Udp4 Pointer to the EFI_UDP4_PROTOCOL instance.
@@ -181,7 +181,7 @@ PxeBcParseCachedDhcpPacket ( // serverhostname option.
//
Option = Options[PXEBC_DHCP4_TAG_INDEX_OVERLOAD];
- if ((Option != NULL) && (Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE)) {
+ if ((Option != NULL) && ((Option->Data[0] & PXEBC_DHCP4_OVERLOAD_FILE) != 0)) {
Options[PXEBC_DHCP4_TAG_INDEX_BOOTFILE] = PxeBcParseExtendOptions (
(UINT8 *) Offer->Dhcp4.Header.BootFileName,
@@ -253,9 +253,9 @@ PxeBcParseCachedDhcpPacket ( the index is maximum offer number.
@retval TRUE Offer the service successfully under priority BINL.
- @retval FALSE Boot Service failed, parse cached dhcp packet failed or this
+ @retval FALSE Boot Service failed, parse cached dhcp packet failed or this
BINL ack cannot find options set or bootfile name specified.
-
+
**/
BOOLEAN
PxeBcTryBinl (
@@ -287,8 +287,8 @@ PxeBcTryBinl ( );
} else {
CopyMem (
- &ServerIp.Addr[0],
- &Offer->Dhcp4.Header.ServerAddr,
+ &ServerIp.Addr[0],
+ &Offer->Dhcp4.Header.ServerAddr,
sizeof (EFI_IPv4_ADDRESS)
);
}
@@ -338,7 +338,7 @@ PxeBcTryBinl ( Offer dhcp service for each proxy with a BINL dhcp offer.
@param Private Pointer to PxeBc private data
- @param OfferIndex Pointer to the index of cached packets as complements of
+ @param OfferIndex Pointer to the index of cached packets as complements of
pxe mode data, the index is maximum offer number.
@return If there is no service needed offer return FALSE, otherwise TRUE.
@@ -408,8 +408,8 @@ PxeBcCheckSelectedOffer ( }
} else if (SelectedOffer->OfferType == DHCP4_PACKET_TYPE_DHCP_ONLY) {
//
- // The selected offer to finish the D.O.R.A. is a DHCP only offer, we need
- // try proxy offers if there are some, othewise the bootfile name must be
+ // The selected offer to finish the D.O.R.A. is a DHCP only offer, we need
+ // try proxy offers if there are some, othewise the bootfile name must be
// set in this DHCP only offer.
//
if (Private->GotProxyOffer) {
@@ -439,7 +439,7 @@ PxeBcCheckSelectedOffer ( }
} else {
//
- // The proxy offer type is not determined, choose proxy offer in the
+ // The proxy offer type is not determined, choose proxy offer in the
// received order.
//
Status = EFI_NO_RESPONSE;
@@ -615,7 +615,7 @@ PxeBcCacheDhcpOffer ( /**
Select the specified proxy offer, such as BINL, DHCP_ONLY and so on.
If the proxy does not exist, try offers with bootfile.
-
+
@param Private Pointer to PxeBc private data.
**/
@@ -733,7 +733,7 @@ PxeBcSelectOffer ( /**
Callback routine.
-
+
EFI_DHCP4_CALLBACK is provided by the consumer of the EFI DHCPv4 Protocol driver
to intercept events that occurred in the configuration process. This structure
provides advanced control of each state transition of the DHCP process. The
@@ -902,8 +902,8 @@ PxeBcDhcpCallBack ( @param Private Pointer to PxeBc private data.
@param OptList Pointer to a DHCP option list.
-
- @param IsDhcpDiscover Discover dhcp option or not.
+
+ @param IsDhcpDiscover Discover dhcp option or not.
@return The index item number of the option list.
@@ -1048,7 +1048,7 @@ PxeBcBuildDhcpOptions ( CvtNum (SYS_ARCH, OptEnt.Clid->ArchitectureType, sizeof (OptEnt.Clid->ArchitectureType));
if (Private->Nii != NULL) {
- //
+ //
// If NII protocol exists, update DHCP option data
//
CopyMem (OptEnt.Clid->InterfaceName, Private->Nii->StringId, sizeof (OptEnt.Clid->InterfaceName));
@@ -1069,8 +1069,8 @@ PxeBcBuildDhcpOptions ( @param Type PxeBc option boot item type
@param Layer PxeBc option boot item layer
@param UseBis Use BIS or not
- @param DestIp Ip address for server
- @param IpCount The total count of the server ip address
+ @param DestIp Ip address for server
+ @param IpCount The total count of the server ip address
@param SrvList Server list
@param IsDiscv Discover the vendor or not
@param Reply The dhcp4 packet of Pxe reply
@@ -1078,8 +1078,8 @@ PxeBcBuildDhcpOptions ( @retval EFI_SUCCESS Operation succeeds.
@retval EFI_OUT_OF_RESOURCES Allocate memory pool failed.
@retval EFI_NOT_FOUND There is no vendor option exists.
- @retval EFI_TIMEOUT Send Pxe Discover time out.
-
+ @retval EFI_TIMEOUT Send Pxe Discover time out.
+
**/
EFI_STATUS
PxeBcDiscvBootService (
@@ -1179,7 +1179,7 @@ PxeBcDiscvBootService ( DhcpHeader->HwAddrLen = sizeof (EFI_GUID);
}
-
+
Xid = NET_RANDOM (NetRandomInitSeed ());
Token.Packet->Dhcp4.Header.Xid = HTONL(Xid);
Token.Packet->Dhcp4.Header.Reserved = HTONS((UINT16) ((IsBCast) ? 0x8000 : 0));
@@ -1288,7 +1288,7 @@ PxeBcDiscvBootService ( @param Length The length of the dhcp options.
@param OptTag The option OpCode.
- @return NULL if the buffer length is 0 and OpCode is not
+ @return NULL if the buffer length is 0 and OpCode is not
PXEBC_DHCP4_TAG_EOP, or the pointer to the buffer.
**/
@@ -1451,8 +1451,8 @@ PxeBcParseVendorOptions ( /**
This function display boot item detail.
- If the length of the boot item string over 70 Char, just display 70 Char.
-
+ If the length of the boot item string over 70 Char, just display 70 Char.
+
@param Str Pointer to a string (boot item string).
@param Len The length of string.
@@ -1479,11 +1479,11 @@ PxeBcDisplayBootItem ( @param Private Pointer to PxeBc private data.
@retval EFI_SUCCESS Select boot prompt done.
- @retval EFI_TIMEOUT Select boot prompt time out.
+ @retval EFI_TIMEOUT Select boot prompt time out.
@retval EFI_NOT_FOUND The proxy offer is not Pxe10.
@retval EFI_ABORTED User cancel the operation.
@retval EFI_NOT_READY Read the input key from the keybroad has not finish.
-
+
**/
EFI_STATUS
PxeBcSelectBootPrompt (
@@ -1657,10 +1657,10 @@ ON_EXIT: @param Private Pointer to PxeBc private data.
@param Type The type of the menu.
@param UseDefaultItem Use default item or not.
-
+
@retval EFI_ABORTED User cancel operation.
@retval EFI_SUCCESS Select the boot menu success.
- @retval EFI_NOT_READY Read the input key from the keybroad has not finish.
+ @retval EFI_NOT_READY Read the input key from the keybroad has not finish.
**/
EFI_STATUS
@@ -1671,7 +1671,7 @@ PxeBcSelectBootMenu ( )
{
PXEBC_CACHED_DHCP4_PACKET *Packet;
- PXEBC_VENDOR_OPTION *VendorOpt;
+ PXEBC_VENDOR_OPTION *VendorOpt;
EFI_INPUT_KEY InputKey;
UINT8 MenuSize;
UINT8 MenuNum;
@@ -1754,7 +1754,7 @@ PxeBcSelectBootMenu ( gBS->Stall (10 * TICKS_PER_MS);
}
- if (!InputKey.ScanCode) {
+ if (InputKey.ScanCode != 0) {
switch (InputKey.UnicodeChar) {
case CTRL ('c'):
InputKey.ScanCode = SCAN_ESC;
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c index 2dc66f168c..e5ff4addf6 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c @@ -1,7 +1,7 @@ /** @file
Interface routines for PxeBc.
-
-Copyright (c) 2007 - 2009, Intel Corporation.<BR>
+
+Copyright (c) 2007 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -61,8 +61,8 @@ UpdateArpCache ( );
for (Index = 0; Index < Mode->ArpCacheEntries; Index ++) {
CopyMem (
- &Mode->ArpCache[Index].IpAddr,
- Entries + 1,
+ &Mode->ArpCache[Index].IpAddr,
+ Entries + 1,
Entries->SwAddressLength
);
CopyMem (
@@ -98,12 +98,12 @@ ArpCacheUpdateTimeout ( /**
Do arp resolution from arp cache in PxeBcMode.
-
+
@param PxeBcMode The PXE BC mode to look into.
@param Ip4Addr The Ip4 address for resolution.
@param MacAddress The resoluted MAC address if the resolution is successful.
The value is undefined if resolution fails.
-
+
@retval TRUE The resolution is successful.
@retval FALSE Otherwise.
@@ -243,7 +243,7 @@ IcmpErrorListenHandler ( QueueDpc (TPL_CALLBACK, IcmpErrorListenHandlerDpc, Context);
}
-/**
+/**
Enables the use of the PXE Base Code Protocol functions.
This function enables the use of the PXE Base Code Protocol functions. If the
@@ -290,22 +290,22 @@ IcmpErrorListenHandler ( TftpErrorZero-filled.
MakeCallbacksSet to TRUE if the PXE Base Code Callback Protocol is available.
Set to FALSE if the PXE Base Code Callback Protocol is not available.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param UseIpv6 Specifies the type of IP addresses that are to be used during the session
- that is being started. Set to TRUE for IPv6 addresses, and FALSE for
- IPv4 addresses.
-
+ that is being started. Set to TRUE for IPv6 addresses, and FALSE for
+ IPv4 addresses.
+
@retval EFI_SUCCESS The PXE Base Code Protocol was started.
- @retval EFI_DEVICE_ERROR The network device encountered an error during this oper
+ @retval EFI_DEVICE_ERROR The network device encountered an error during this oper
@retval EFI_UNSUPPORTED UseIpv6 is TRUE, but the Ipv6Supported field of the
- EFI_PXE_BASE_CODE_MODE structure is FALSE.
- @retval EFI_ALREADY_STARTED The PXE Base Code Protocol is already in the started state.
+ EFI_PXE_BASE_CODE_MODE structure is FALSE.
+ @retval EFI_ALREADY_STARTED The PXE Base Code Protocol is already in the started state.
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
- EFI_PXE_BASE_CODE_PROTOCOL structure.
- @retval EFI_OUT_OF_RESOURCES Could not allocate enough memory or other resources to start the
- PXE Base Code Protocol.
-
+ EFI_PXE_BASE_CODE_PROTOCOL structure.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate enough memory or other resources to start the
+ PXE Base Code Protocol.
+
**/
EFI_STATUS
EFIAPI
@@ -340,7 +340,7 @@ EfiPxeBcStart ( // Configure the udp4 instance to let it receive data
//
Status = Private->Udp4Read->Configure (
- Private->Udp4Read,
+ Private->Udp4Read,
&Private->Udp4CfgData
);
if (EFI_ERROR (Status)) {
@@ -431,22 +431,22 @@ ON_EXIT: }
-/**
+/**
Disables the use of the PXE Base Code Protocol functions.
This function stops all activity on the network device. All the resources allocated
in Start() are released, the Started field of the EFI_PXE_BASE_CODE_MODE structure is
set to FALSE and EFI_SUCCESS is returned. If the Started field of the EFI_PXE_BASE_CODE_MODE
structure is already FALSE, then EFI_NOT_STARTED will be returned.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
-
+
@retval EFI_SUCCESS The PXE Base Code Protocol was stopped.
- @retval EFI_NOT_STARTED The PXE Base Code Protocol is already in the stopped state.
+ @retval EFI_NOT_STARTED The PXE Base Code Protocol is already in the stopped state.
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
- EFI_PXE_BASE_CODE_PROTOCOL structure.
- @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
-
+ EFI_PXE_BASE_CODE_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
+
**/
EFI_STATUS
EFIAPI
@@ -508,7 +508,7 @@ EfiPxeBcStop ( }
-/**
+/**
Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request / acknowledge) or DHCPv6
S.A.R.R (solicit / advertise / request / reply) sequence.
@@ -524,22 +524,22 @@ EfiPxeBcStop ( caller. If the DHCP sequence does not complete, then EFI_TIMEOUT will be returned.
If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
then the DHCP sequence will be stopped and EFI_ABORTED will be returned.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param SortOffers TRUE if the offers received should be sorted. Set to FALSE to try the
- offers in the order that they are received.
-
+ offers in the order that they are received.
+
@retval EFI_SUCCESS Valid DHCP has completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
- EFI_PXE_BASE_CODE_PROTOCOL structure.
- @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
+ EFI_PXE_BASE_CODE_PROTOCOL structure.
+ @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete the DHCP Protocol.
@retval EFI_ABORTED The callback function aborted the DHCP Protocol.
@retval EFI_TIMEOUT The DHCP Protocol timed out.
@retval EFI_ICMP_ERROR An ICMP error packet was received during the DHCP session.
@retval EFI_NO_RESPONSE Valid PXE offer was not received.
-
+
**/
EFI_STATUS
EFIAPI
@@ -596,7 +596,7 @@ EfiPxeBcDhcp ( if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
-
+
//
// Zero those arrays to record the varies numbers of DHCP OFFERS.
//
@@ -688,7 +688,7 @@ ON_EXIT: }
-/**
+/**
Attempts to complete the PXE Boot Server and/or boot image discovery sequence.
This function attempts to complete the PXE Boot Server and/or boot image discovery
@@ -710,26 +710,26 @@ ON_EXIT: additional details on the implementation of the Discovery sequence.
If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
then the Discovery sequence is stopped and EFI_ABORTED will be returned.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param Type The type of bootstrap to perform.
@param Layer Pointer to the boot server layer number to discover, which must be
- PXE_BOOT_LAYER_INITIAL when a new server type is being
- discovered.
- @param UseBis TRUE if Boot Integrity Services are to be used. FALSE otherwise.
+ PXE_BOOT_LAYER_INITIAL when a new server type is being
+ discovered.
+ @param UseBis TRUE if Boot Integrity Services are to be used. FALSE otherwise.
@param Info Pointer to a data structure that contains additional information on the
- type of discovery operation that is to be performed.
-
+ type of discovery operation that is to be performed.
+
@retval EFI_SUCCESS The Discovery sequence has been completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_OUT_OF_RESOURCES Could not allocate enough memory to complete Discovery.
@retval EFI_ABORTED The callback function aborted the Discovery sequence.
@retval EFI_TIMEOUT The Discovery sequence timed out.
@retval EFI_ICMP_ERROR An ICMP error packet was received during the PXE discovery
- session.
-
+ session.
+
**/
EFI_STATUS
EFIAPI
@@ -819,8 +819,8 @@ EfiPxeBcDiscover ( // Get the multicast discover ip address from vendor option.
//
CopyMem (
- &DefaultInfo.ServerMCastIp.Addr,
- &VendorOpt->DiscoverMcastIp,
+ &DefaultInfo.ServerMCastIp.Addr,
+ &VendorOpt->DiscoverMcastIp,
sizeof (EFI_IPv4_ADDRESS)
);
}
@@ -882,8 +882,8 @@ EfiPxeBcDiscover ( Private->ServerIp.Addr[0] = SrvList[Index].IpAddr.Addr[0];
} else {
CopyMem (
- &Private->ServerIp,
- &BootSvrEntry->IpAddr[Index],
+ &Private->ServerIp,
+ &BootSvrEntry->IpAddr[Index],
sizeof (EFI_IPv4_ADDRESS)
);
}
@@ -942,8 +942,8 @@ EfiPxeBcDiscover ( if (Mode->PxeBisReplyReceived) {
CopyMem (
- &Private->ServerIp,
- &Mode->PxeReply.Dhcpv4.BootpSiAddr,
+ &Private->ServerIp,
+ &Mode->PxeReply.Dhcpv4.BootpSiAddr,
sizeof (EFI_IPv4_ADDRESS)
);
}
@@ -952,7 +952,7 @@ EfiPxeBcDiscover ( }
-/**
+/**
Used to perform TFTP and MTFTP services.
This function is used to perform TFTP and MTFTP services. This includes the
@@ -997,31 +997,31 @@ EfiPxeBcDiscover ( IP address preceding the filename of the form %d.%d.%d.%d for IP v4. The final
entry is itself null-terminated, so that the final information string is terminated
with two null octets.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param Operation The type of operation to perform.
- @param BufferPtr A pointer to the data buffer.
+ @param BufferPtr A pointer to the data buffer.
@param Overwrite Only used on write file operations. TRUE if a file on a remote server can
- be overwritten.
+ be overwritten.
@param BufferSize For get-file-size operations, *BufferSize returns the size of the
- requested file.
+ requested file.
@param BlockSize The requested block size to be used during a TFTP transfer.
@param ServerIp The TFTP / MTFTP server IP address.
@param Filename A Null-terminated ASCII string that specifies a directory name or a file
- name.
+ name.
@param Info Pointer to the MTFTP information.
- @param DontUseBuffer Set to FALSE for normal TFTP and MTFTP read file operation.
-
+ @param DontUseBuffer Set to FALSE for normal TFTP and MTFTP read file operation.
+
@retval EFI_SUCCESS The TFTP/MTFTP operation was completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
- @retval EFI_BUFFER_TOO_SMALL The buffer is not large enough to complete the read operation.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
+ @retval EFI_BUFFER_TOO_SMALL The buffer is not large enough to complete the read operation.
@retval EFI_ABORTED The callback function aborted the TFTP/MTFTP operation.
@retval EFI_TIMEOUT The TFTP/MTFTP operation timed out.
@retval EFI_ICMP_ERROR An ICMP error packet was received during the MTFTP session.
@retval EFI_TFTP_ERROR A TFTP error packet was received during the MTFTP session.
-
+
**/
EFI_STATUS
EFIAPI
@@ -1076,23 +1076,23 @@ EfiPxeBcMtftp ( Mtftp4Config.TryCount = PXEBC_MTFTP_RETRIES;
CopyMem (
- &Mtftp4Config.StationIp,
- &Private->StationIp,
+ &Mtftp4Config.StationIp,
+ &Private->StationIp,
sizeof (EFI_IPv4_ADDRESS)
);
CopyMem (
- &Mtftp4Config.SubnetMask,
- &Private->SubnetMask,
+ &Mtftp4Config.SubnetMask,
+ &Private->SubnetMask,
sizeof (EFI_IPv4_ADDRESS)
);
CopyMem (
- &Mtftp4Config.GatewayIp,
- &Private->GatewayIp,
+ &Mtftp4Config.GatewayIp,
+ &Private->GatewayIp,
sizeof (EFI_IPv4_ADDRESS)
);
CopyMem (
- &Mtftp4Config.ServerIp,
- ServerIp,
+ &Mtftp4Config.ServerIp,
+ ServerIp,
sizeof (EFI_IPv4_ADDRESS)
);
@@ -1172,7 +1172,7 @@ EfiPxeBcMtftp ( }
-/**
+/**
Writes a UDP packet to the network interface.
This function writes a UDP packet specified by the (optional HeaderPtr and)
@@ -1185,29 +1185,29 @@ EfiPxeBcMtftp ( the IcmpErrorReceived field is set to TRUE, the IcmpError field is filled in and
EFI_ICMP_ERROR will be returned. If the Callback Protocol does not return
EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will be returned.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
- @param OpFlags The UDP operation flags.
+ @param OpFlags The UDP operation flags.
@param DestIp The destination IP address.
- @param DestPort The destination UDP port number.
- @param GatewayIp The gateway IP address.
+ @param DestPort The destination UDP port number.
+ @param GatewayIp The gateway IP address.
@param SrcIp The source IP address.
@param SrcPort The source UDP port number.
@param HeaderSize An optional field which may be set to the length of a header at
- HeaderPtr to be prefixed to the data at BufferPtr.
+ HeaderPtr to be prefixed to the data at BufferPtr.
@param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the
- data at BufferPtr.
+ data at BufferPtr.
@param BufferSize A pointer to the size of the data at BufferPtr.
@param BufferPtr A pointer to the data to be written.
-
+
@retval EFI_SUCCESS The UDP Write operation was completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_BAD_BUFFER_SIZE The buffer is too long to be transmitted.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_BAD_BUFFER_SIZE The buffer is too long to be transmitted.
@retval EFI_ABORTED The callback function aborted the UDP Write operation.
@retval EFI_TIMEOUT The UDP Write operation timed out.
- @retval EFI_ICMP_ERROR An ICMP error packet was received during the UDP write session.
-
+ @retval EFI_ICMP_ERROR An ICMP error packet was received during the UDP write session.
+
**/
EFI_STATUS
EFIAPI
@@ -1407,20 +1407,20 @@ CheckIpByFilter ( }
CopyMem (&DestIp4Address, &Session->DestinationAddress, sizeof (DestIp4Address));
- if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) &&
+ if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) != 0) &&
IP4_IS_MULTICAST (EFI_NTOHL (DestIp4Address))
) {
return TRUE;
}
- if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) &&
+ if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) != 0) &&
IP4_IS_LOCAL_BROADCAST (EFI_NTOHL (DestIp4Address))
) {
return TRUE;
}
CopyMem (&Ip4Address, &PxeBcMode->StationIp.v4, sizeof (Ip4Address));
- if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) &&
+ if (((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0) &&
EFI_IP4_EQUAL (&Ip4Address, &DestIp4Address)
) {
return TRUE;
@@ -1430,8 +1430,8 @@ CheckIpByFilter ( for (Index = 0; Index < PxeBcMode->IpFilter.IpCnt; Index++) {
CopyMem (
- &Ip4Address,
- &PxeBcMode->IpFilter.IpList[Index].v4,
+ &Ip4Address,
+ &PxeBcMode->IpFilter.IpList[Index].v4,
sizeof (Ip4Address)
);
if (EFI_IP4_EQUAL (&Ip4Address, &DestIp4Address)) {
@@ -1442,7 +1442,7 @@ CheckIpByFilter ( return FALSE;
}
-/**
+/**
Reads a UDP packet from the network interface.
This function reads a UDP packet from a network interface. The data contents
@@ -1453,31 +1453,31 @@ CheckIpByFilter ( contents of BufferPtr are undefined, and the packet is lost. If a UDP packet is
successfully received, then EFI_SUCCESS will be returned, and the information
from the UDP header will be returned in DestIp, DestPort, SrcIp, and SrcPort if
- they are not NULL. Depending on the values of OpFlags and the DestIp, DestPort,
- SrcIp, and SrcPort input values, different types of UDP packet receive filtering
+ they are not NULL. Depending on the values of OpFlags and the DestIp, DestPort,
+ SrcIp, and SrcPort input values, different types of UDP packet receive filtering
will be performed. The following tables summarize these receive filter operations.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
- @param OpFlags The UDP operation flags.
+ @param OpFlags The UDP operation flags.
@param DestIp The destination IP address.
@param DestPort The destination UDP port number.
@param SrcIp The source IP address.
@param SrcPort The source UDP port number.
@param HeaderSize An optional field which may be set to the length of a header at
- HeaderPtr to be prefixed to the data at BufferPtr.
+ HeaderPtr to be prefixed to the data at BufferPtr.
@param HeaderPtr If HeaderSize is not NULL, a pointer to a header to be prefixed to the
- data at BufferPtr.
+ data at BufferPtr.
@param BufferSize A pointer to the size of the data at BufferPtr.
@param BufferPtr A pointer to the data to be read.
-
+
@retval EFI_SUCCESS The UDP Read operation was completed.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
@retval EFI_BUFFER_TOO_SMALL The packet is larger than Buffer can hold.
@retval EFI_ABORTED The callback function aborted the UDP Read operation.
- @retval EFI_TIMEOUT The UDP Read operation timed out.
-
+ @retval EFI_TIMEOUT The UDP Read operation timed out.
+
**/
EFI_STATUS
EFIAPI
@@ -1676,8 +1676,8 @@ TRY_AGAIN: *BufferSize = RxData->DataLength - CopyLen;
CopyMem (
- BufferPtr,
- (UINT8 *) RxData->FragmentTable[0].FragmentBuffer + CopyLen,
+ BufferPtr,
+ (UINT8 *) RxData->FragmentTable[0].FragmentBuffer + CopyLen,
*BufferSize
);
}
@@ -1705,9 +1705,9 @@ ON_EXIT: return Status;
}
-/**
+/**
Updates the IP receive filters of a network device and enables software filtering.
-
+
The NewFilter field is used to modify the network device's current IP receive
filter settings and to enable a software filter. This function updates the IpFilter
field of the EFI_PXE_BASE_CODE_MODE structure with the contents of NewIpFilter.
@@ -1728,14 +1728,14 @@ ON_EXIT: The IPlist field is used to enable IPs other than the StationIP. They may be
multicast or unicast. If IPcnt is set as well as EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP,
then both the StationIP and the IPs from the IPlist will be used.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param NewFilter Pointer to the new set of IP receive filters.
-
+
@retval EFI_SUCCESS The IP receive filter settings were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -1784,7 +1784,7 @@ EfiPxeBcSetIpFilter ( return EFI_INVALID_PARAMETER;
}
if (NetIp4IsUnicast (EFI_IP4 (NewFilter->IpList[Index].v4), 0) &&
- (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP)
+ ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0)
) {
//
// If EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP is set and IP4 address is in IpList,
@@ -1803,8 +1803,8 @@ EfiPxeBcSetIpFilter ( Private->Udp4CfgData.AcceptBroadcast = FALSE;
if (PromiscuousNeed ||
- NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS ||
- NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST
+ ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) != 0) ||
+ ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) != 0)
) {
//
// Configure the udp4 filter to receive all packages
@@ -1821,7 +1821,7 @@ EfiPxeBcSetIpFilter ( } else {
- if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) {
+ if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) != 0) {
//
// Configure the udp4 filter to receive all broadcast packages
//
@@ -1836,7 +1836,7 @@ EfiPxeBcSetIpFilter ( return Status;
}
- if (NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) {
+ if ((NewFilter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) != 0) {
for (Index = 0; Index < NewFilter->IpCnt; ++Index) {
if (IP4_IS_MULTICAST (EFI_NTOHL (NewFilter->IpList[Index].v4))) {
@@ -1862,32 +1862,32 @@ EfiPxeBcSetIpFilter ( }
-/**
+/**
Uses the ARP protocol to resolve a MAC address.
-
+
This function uses the ARP protocol to resolve a MAC address. The UsingIpv6 field
of the EFI_PXE_BASE_CODE_MODE structure is used to determine if IPv4 or IPv6
addresses are being used. The IP address specified by IpAddr is used to resolve
a MAC address. If the ARP protocol succeeds in resolving the specified address,
then the ArpCacheEntries and ArpCache fields of the EFI_PXE_BASE_CODE_MODE structure
are updated, and EFI_SUCCESS is returned. If MacAddr is not NULL, the resolved
- MAC address is placed there as well. If the PXE Base Code protocol is in the
- stopped state, then EFI_NOT_STARTED is returned. If the ARP protocol encounters
- a timeout condition while attempting to resolve an address, then EFI_TIMEOUT is
- returned. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
+ MAC address is placed there as well. If the PXE Base Code protocol is in the
+ stopped state, then EFI_NOT_STARTED is returned. If the ARP protocol encounters
+ a timeout condition while attempting to resolve an address, then EFI_TIMEOUT is
+ returned. If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
then EFI_ABORTED is returned.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param IpAddr Pointer to the IP address that is used to resolve a MAC address.
@param MacAddr If not NULL, a pointer to the MAC address that was resolved with the
- ARP protocol.
-
+ ARP protocol.
+
@retval EFI_SUCCESS The IP or MAC address was resolved.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
- @retval EFI_ICMP_ERROR Something error occur with the ICMP packet message.
-
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
+ @retval EFI_ICMP_ERROR Something error occur with the ICMP packet message.
+
**/
EFI_STATUS
EFIAPI
@@ -1948,9 +1948,9 @@ EfiPxeBcArp ( return EFI_SUCCESS;
}
-/**
+/**
Updates the parameters that affect the operation of the PXE Base Code Protocol.
-
+
This function sets parameters that affect the operation of the PXE Base Code Protocol.
The parameter specified by NewAutoArp is used to control the generation of ARP
protocol packets. If NewAutoArp is TRUE, then ARP Protocol packets will be generated
@@ -1962,23 +1962,23 @@ EfiPxeBcArp ( the EFI_PXE_BASE_CODE_MODE structure to NewAutoArp.
The SetParameters() call must be invoked after a Callback Protocol is installed
to enable the use of callbacks.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param NewAutoArp If not NULL, a pointer to a value that specifies whether to replace the
- current value of AutoARP.
+ current value of AutoARP.
@param NewSendGUID If not NULL, a pointer to a value that specifies whether to replace the
- current value of SendGUID.
+ current value of SendGUID.
@param NewTTL If not NULL, a pointer to be used in place of the current value of TTL,
- the "time to live" field of the IP header.
+ the "time to live" field of the IP header.
@param NewToS If not NULL, a pointer to be used in place of the current value of ToS,
- the "type of service" field of the IP header.
+ the "type of service" field of the IP header.
@param NewMakeCallback If not NULL, a pointer to a value that specifies whether to replace the
- current value of the MakeCallback field of the Mode structure.
-
+ current value of the MakeCallback field of the Mode structure.
+
@retval EFI_SUCCESS The new parameters values were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -2073,9 +2073,9 @@ ON_EXIT: return Status;
}
-/**
+/**
Updates the station IP address and/or subnet mask values of a network device.
-
+
This function updates the station IP address and/or subnet mask values of a network
device. The NewStationIp field is used to modify the network device's current IP address.
If NewStationIP is NULL, then the current IP address will not be modified. Otherwise,
@@ -2084,15 +2084,15 @@ ON_EXIT: mask. If NewSubnetMask is NULL, then the current subnet mask will not be modified.
Otherwise, this function updates the SubnetMask field of the EFI_PXE_BASE_CODE_MODE
structure with NewSubnetMask.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
- @param NewStationIp Pointer to the new IP address to be used by the network device.
- @param NewSubnetMask Pointer to the new subnet mask to be used by the network device.
-
+ @param NewStationIp Pointer to the new IP address to be used by the network device.
+ @param NewSubnetMask Pointer to the new subnet mask to be used by the network device.
+
@retval EFI_SUCCESS The new station IP address and/or subnet mask were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -2163,36 +2163,36 @@ EfiPxeBcSetStationIP ( return EFI_SUCCESS;
}
-/**
+/**
Updates the contents of the cached DHCP and Discover packets.
-
+
The pointers to the new packets are used to update the contents of the cached
packets in the EFI_PXE_BASE_CODE_MODE structure.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
@param NewDhcpDiscoverValid Pointer to a value that will replace the current
- DhcpDiscoverValid field.
+ DhcpDiscoverValid field.
@param NewDhcpAckReceived Pointer to a value that will replace the current
- DhcpAckReceived field.
+ DhcpAckReceived field.
@param NewProxyOfferReceived Pointer to a value that will replace the current
- ProxyOfferReceived field.
- @param NewPxeDiscoverValid Pointer to a value that will replace the current
- ProxyOfferReceived field.
+ ProxyOfferReceived field.
+ @param NewPxeDiscoverValid Pointer to a value that will replace the current
+ ProxyOfferReceived field.
@param NewPxeReplyReceived Pointer to a value that will replace the current
- PxeReplyReceived field.
+ PxeReplyReceived field.
@param NewPxeBisReplyReceived Pointer to a value that will replace the current
- PxeBisReplyReceived field.
- @param NewDhcpDiscover Pointer to the new cached DHCP Discover packet contents.
+ PxeBisReplyReceived field.
+ @param NewDhcpDiscover Pointer to the new cached DHCP Discover packet contents.
@param NewDhcpAck Pointer to the new cached DHCP Ack packet contents.
@param NewProxyOffer Pointer to the new cached Proxy Offer packet contents.
@param NewPxeDiscover Pointer to the new cached PXE Discover packet contents.
@param NewPxeReply Pointer to the new cached PXE Reply packet contents.
@param NewPxeBisReply Pointer to the new cached PXE BIS Reply packet contents.
-
+
@retval EFI_SUCCESS The cached packet contents were updated.
@retval EFI_NOT_STARTED The PXE Base Code Protocol is in the stopped state.
@retval EFI_INVALID_PARAMETER This is NULL or not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.
-
+
**/
EFI_STATUS
EFIAPI
@@ -2296,10 +2296,10 @@ EFI_PXE_BASE_CODE_PROTOCOL mPxeBcProtocolTemplate = { NULL
};
-/**
+/**
Callback function that is invoked when the PXE Base Code Protocol is about to transmit, has
- received, or is waiting to receive a packet.
-
+ received, or is waiting to receive a packet.
+
This function is invoked when the PXE Base Code Protocol is about to transmit, has received,
or is waiting to receive a packet. Parameters Function and Received specify the type of event.
Parameters PacketLen and Packet specify the packet that generated the event. If these fields
@@ -2309,19 +2309,19 @@ EFI_PXE_BASE_CODE_PROTOCOL mPxeBcProtocolTemplate = { the polling nature of UEFI device drivers, a callback function should not execute for more than 5 ms.
The SetParameters() function must be called after a Callback Protocol is installed to enable the
use of callbacks.
-
+
@param This Pointer to the EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL instance.
- @param Function The PXE Base Code Protocol function that is waiting for an event.
+ @param Function The PXE Base Code Protocol function that is waiting for an event.
@param Received TRUE if the callback is being invoked due to a receive event. FALSE if
- the callback is being invoked due to a transmit event.
+ the callback is being invoked due to a transmit event.
@param PacketLength The length, in bytes, of Packet. This field will have a value of zero if
- this is a wait for receive event.
+ this is a wait for receive event.
@param PacketPtr If Received is TRUE, a pointer to the packet that was just received;
- otherwise a pointer to the packet that is about to be transmitted.
-
- @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation
+ otherwise a pointer to the packet that is about to be transmitted.
+
+ @retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE if Function specifies a continue operation
@retval EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT if Function specifies an abort operation
-
+
**/
EFI_PXE_BASE_CODE_CALLBACK_STATUS
EFIAPI
@@ -2398,15 +2398,15 @@ EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL mPxeBcCallBackTemplate = { /**
Find the boot file.
- @param Private Pointer to PxeBc private data.
- @param BufferSize Pointer to buffer size.
- @param Buffer Pointer to buffer.
+ @param Private Pointer to PxeBc private data.
+ @param BufferSize Pointer to buffer size.
+ @param Buffer Pointer to buffer.
@retval EFI_SUCCESS Discover the boot file successfully.
@retval EFI_TIMEOUT The TFTP/MTFTP operation timed out.
@retval EFI_ABORTED PXE bootstrap server, so local boot need abort.
@retval EFI_BUFFER_TOO_SMALL The buffer is too small to load the boot file.
-
+
**/
EFI_STATUS
DiscoverBootFile (
@@ -2492,8 +2492,8 @@ DiscoverBootFile ( );
} else {
CopyMem (
- &Private->ServerIp,
- &Packet->Packet.Offer.Dhcp4.Header.ServerAddr,
+ &Private->ServerIp,
+ &Packet->Packet.Offer.Dhcp4.Header.ServerAddr,
sizeof (EFI_IPv4_ADDRESS)
);
}
@@ -2544,21 +2544,21 @@ DiscoverBootFile ( @param This Protocol instance pointer.
@param FilePath The device specific path of the file to load.
- @param BootPolicy If TRUE, indicates that the request originates from the
+ @param BootPolicy If TRUE, indicates that the request originates from the
boot manager is attempting to load FilePath as a boot
selection. If FALSE, then FilePath must match as exact file
to be loaded.
@param BufferSize On input the size of Buffer in bytes. On output with a return
- code of EFI_SUCCESS, the amount of data transferred to
+ code of EFI_SUCCESS, the amount of data transferred to
Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL,
the size of Buffer required to retrieve the requested file.
@param Buffer The memory buffer to transfer the file to. IF Buffer is NULL,
- then no the size of the requested file is returned in
+ then no the size of the requested file is returned in
BufferSize.
@retval EFI_SUCCESS The file was loaded.
@retval EFI_UNSUPPORTED The device does not support the provided BootPolicy
- @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
+ @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
BufferSize is NULL.
@retval EFI_NO_MEDIA No medium was present to load the file.
@retval EFI_DEVICE_ERROR The file was not loaded due to a device error.
@@ -2707,7 +2707,7 @@ EfiPxeLoadFile ( if (Buffer != NULL) {
AsciiPrint ("PXE-E05: Download buffer is smaller than requested file.\n");
} else {
- PxeBc->Stop (PxeBc);
+ PxeBc->Stop (PxeBc);
return Status;
}
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c index 0a67fdeda2..d425b1ff8f 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c @@ -1,7 +1,7 @@ /** @file
Support routines for PxeBc.
-
-Copyright (c) 2007 - 2009, Intel Corporation.<BR>
+
+Copyright (c) 2007 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
This function returns SMBIOS string given the string number.
-
+
@param Smbios Pointer to SMBIOS structure
@param StringNumber String number to return. 0 is used to skip all
strings and point to the next SMBIOS structure.
@@ -97,6 +97,7 @@ GetSmbiosSystemGuidAndSerialNumber ( if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
+ ASSERT (SmbiosTable != NULL);
Smbios.Hdr = (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress;
SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength);
@@ -137,7 +138,7 @@ GetSmbiosSystemGuidAndSerialNumber ( /**
- The common notify function associated with various PxeBc events.
+ The common notify function associated with various PxeBc events.
@param Event The event signaled.
@param Context The context.
@@ -156,13 +157,13 @@ PxeBcCommonNotify ( /**
This function initialize(or configure) the Udp4Write instance.
-
+
@param Udp4 Pointer to the EFI_UDP4_PROTOCOL instance.
@param StationIp Pointer to the station ip address.
@param SubnetMask Pointer to the subnetmask of the station ip address.
@param Gateway Pointer to the gateway ip address.
@param SrcPort Pointer to the srouce port of the station.
-
+
@retval EFI_SUCCESS The configuration settings were set, changed, or reset successfully.
@retval EFI_NO_MAPPING When using a default address, configuration (DHCP, BOOTP,
RARP, etc.) is not finished yet.
@@ -177,7 +178,7 @@ PxeBcCommonNotify ( @retval EFI_DEVICE_ERROR An unexpected network or system error occurred and this instance
was not opened.
@retval Others Please examine the function Udp4->Routes(Udp4, FALSE, &mZeroIp4Addr, &mZeroIp4Addr, Gateway) returns.
-
+
**/
EFI_STATUS
PxeBcConfigureUdpWriteInstance (
diff --git a/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c b/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c index 8d72f585d0..54d317416d 100644 --- a/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c +++ b/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c @@ -1,7 +1,7 @@ /** @file
HII Config Access protocol implementation of VLAN configuration module.
-Copyright (c) 2009, Intel Corporation.<BR>
+Copyright (c) 2009 - 2010, Intel Corporation.<BR>
All rights reserved. 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
@@ -238,6 +238,7 @@ VlanCallback ( //
// Remove VLAN
//
+ ASSERT (PrivateData->NumberOfVlan <= MAX_VLAN_NUMBER);
for (Index = 0; Index < PrivateData->NumberOfVlan; Index++) {
if (Configuration->VlanList[Index] != 0) {
//
@@ -421,7 +422,7 @@ InstallVlanConfigForm ( EFI_STATUS Status;
EFI_HII_HANDLE HiiHandle;
EFI_HANDLE DriverHandle;
- CHAR16 Str[40];
+ CHAR16 Str[26 + sizeof (EFI_MAC_ADDRESS) * 2 + 1];
CHAR16 *MacString;
EFI_DEVICE_PATH_PROTOCOL *ChildDevicePath;
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
@@ -479,6 +480,7 @@ InstallVlanConfigForm ( PrivateData->MacString = MacString;
StrCpy (Str, L"VLAN Configuration (MAC:");
+ ASSERT (StrLen (MacString) <= (sizeof (EFI_MAC_ADDRESS) * 2));
StrCat (Str, MacString);
StrCat (Str, L")");
HiiSetString (
|