\r
#include "Ip4Impl.h"\r
\r
+EFI_IPSEC_PROTOCOL *mIpSec = NULL;\r
+\r
/**\r
Gets the current operational settings for this instance of the EFI IPv4 Protocol driver.\r
\r
Ip4ModeData->RouteTable = NULL;\r
Ip4ModeData->RouteCount = 0;\r
\r
+ Ip4ModeData->MaxPacketSize = IpSb->MaxPacketSize;\r
+\r
//\r
// return the current station address for this IP child. So,\r
// the user can get the default address through this. Some\r
EFI_STATUS Status;\r
UINTN Len;\r
UINT32 Index;\r
+ IP4_ADDR StationAddress;\r
+ IP4_ADDR SubnetMask;\r
+ IP4_ADDR SubnetAddress;\r
+ IP4_ADDR GatewayAddress;\r
\r
IpSb = (IP4_SERVICE *) Context;\r
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);\r
// Set the default interface's address, then add a directed\r
// route for it, that is, the route whose nexthop is zero.\r
//\r
- Status = Ip4SetAddress (\r
- IpIf,\r
- EFI_NTOHL (Data->StationAddress),\r
- EFI_NTOHL (Data->SubnetMask)\r
- );\r
+ StationAddress = EFI_NTOHL (Data->StationAddress);\r
+ SubnetMask = EFI_NTOHL (Data->SubnetMask);\r
+ Status = Ip4SetAddress (IpIf, StationAddress, SubnetMask);\r
\r
if (EFI_ERROR (Status)) {\r
goto ON_EXIT;\r
\r
Ip4AddRoute (\r
IpSb->DefaultRouteTable,\r
- EFI_NTOHL (Data->StationAddress),\r
- EFI_NTOHL (Data->SubnetMask),\r
+ StationAddress,\r
+ SubnetMask,\r
IP4_ALLZERO_ADDRESS\r
);\r
\r
for (Index = 0; Index < Data->RouteTableSize; Index++) {\r
RouteEntry = &Data->RouteTable[Index];\r
\r
- Ip4AddRoute (\r
- IpSb->DefaultRouteTable,\r
- EFI_NTOHL (RouteEntry->SubnetAddress),\r
- EFI_NTOHL (RouteEntry->SubnetMask),\r
- EFI_NTOHL (RouteEntry->GatewayAddress)\r
- );\r
+ SubnetAddress = EFI_NTOHL (RouteEntry->SubnetAddress);\r
+ SubnetMask = EFI_NTOHL (RouteEntry->SubnetMask);\r
+ GatewayAddress = EFI_NTOHL (RouteEntry->GatewayAddress);\r
+ Ip4AddRoute (IpSb->DefaultRouteTable, SubnetAddress, SubnetMask, GatewayAddress);\r
}\r
\r
IpSb->State = IP4_SERVICE_CONFIGED;\r
Ip4SetVariableData (IpSb);\r
\r
ON_EXIT:\r
- gBS->FreePool (Data);\r
+ FreePool (Data);\r
}\r
\r
/**\r
//\r
// Request Ip4AutoConfigCallBackDpc as a DPC at TPL_CALLBACK\r
//\r
- NetLibQueueDpc (TPL_CALLBACK, Ip4AutoConfigCallBackDpc, Context);\r
+ QueueDpc (TPL_CALLBACK, Ip4AutoConfigCallBackDpc, Context);\r
}\r
\r
\r
}\r
\r
if (IpInstance->EfiRouteTable != NULL) {\r
- gBS->FreePool (IpInstance->EfiRouteTable);\r
+ FreePool (IpInstance->EfiRouteTable);\r
IpInstance->EfiRouteTable = NULL;\r
IpInstance->EfiRouteCount = 0;\r
}\r
\r
if (IpInstance->Groups != NULL) {\r
- gBS->FreePool (IpInstance->Groups);\r
+ FreePool (IpInstance->Groups);\r
IpInstance->Groups = NULL;\r
IpInstance->GroupCount = 0;\r
}\r
}\r
\r
if (EFI_ERROR (Ip4JoinGroup (IpInstance, NTOHL (Group)))) {\r
- gBS->FreePool (Members);\r
+ FreePool (Members);\r
return EFI_DEVICE_ERROR;\r
}\r
\r
if (IpInstance->Groups != NULL) {\r
- gBS->FreePool (IpInstance->Groups);\r
+ FreePool (IpInstance->Groups);\r
}\r
\r
IpInstance->Groups = Members;\r
if (IpInstance->GroupCount == 0) {\r
ASSERT (Index == 1);\r
\r
- gBS->FreePool (IpInstance->Groups);\r
+ FreePool (IpInstance->Groups);\r
IpInstance->Groups = NULL;\r
}\r
\r
\r
Wrap = (IP4_TXTOKEN_WRAP *) Context;\r
\r
+ //\r
+ // Signal IpSecRecycleEvent to inform IPsec free the memory\r
+ //\r
+ if (Wrap->IpSecRecycleSignal != NULL) {\r
+ gBS->SignalEvent (Wrap->IpSecRecycleSignal);\r
+ }\r
+\r
//\r
// Find the token in the instance's map. EfiIp4Transmit put the\r
// token to the map. If that failed, NetMapFindKey will return NULL.\r
//\r
// Dispatch the DPC queued by the NotifyFunction of Token->Event.\r
//\r
- NetLibDispatchDpc ();\r
+ DispatchDpc ();\r
}\r
\r
- gBS->FreePool (Wrap);\r
+ FreePool (Wrap);\r
}\r
\r
\r
}\r
\r
Head.Fragment = IP4_HEAD_FRAGMENT_FIELD (DontFragment, FALSE, 0);\r
- HeadLen = sizeof (IP4_HEAD) + ((TxData->OptionsLength + 3) &~0x03);\r
+ HeadLen = (TxData->OptionsLength + 3) & (~0x03);\r
\r
//\r
// If don't fragment and fragment needed, return error\r
//\r
- if (DontFragment && (TxData->TotalDataLength + HeadLen > IpSb->SnpMode.MaxPacketSize)) {\r
+ if (DontFragment && (TxData->TotalDataLength + HeadLen > IpSb->MaxPacketSize)) {\r
Status = EFI_BAD_BUFFER_SIZE;\r
goto ON_EXIT;\r
}\r
// a IP4_TXTOKEN_WRAP and the data in a netbuf\r
//\r
Status = EFI_OUT_OF_RESOURCES;\r
- Wrap = AllocatePool (sizeof (IP4_TXTOKEN_WRAP));\r
+ Wrap = AllocateZeroPool (sizeof (IP4_TXTOKEN_WRAP));\r
if (Wrap == NULL) {\r
goto ON_EXIT;\r
}\r
);\r
\r
if (Wrap->Packet == NULL) {\r
- gBS->FreePool (Wrap);\r
+ FreePool (Wrap);\r
goto ON_EXIT;\r
}\r
\r
// Dispatch the DPC queued by the NotifyFunction of this instane's receive\r
// event.\r
//\r
- NetLibDispatchDpc ();\r
+ DispatchDpc ();\r
\r
ON_EXIT:\r
gBS->RestoreTPL (OldTpl);\r
// Dispatch the DPCs queued by the NotifyFunction of the canceled rx token's\r
// events.\r
//\r
- NetLibDispatchDpc ();\r
+ DispatchDpc ();\r
if (EFI_ERROR (Status)) {\r
if ((Token != NULL) && (Status == EFI_ABORTED)) {\r
return EFI_SUCCESS;\r