summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authortye <tye@6f19259b-4bc3-4df7-8a09-765794883524>2009-10-26 10:15:40 +0000
committertye <tye@6f19259b-4bc3-4df7-8a09-765794883524>2009-10-26 10:15:40 +0000
commitfb115c61504fe6c4f94be0a87f75e28e1684657f (patch)
tree5e5b43d24f64f96eaa93d7acb1d48cc7c028c2c7 /MdeModulePkg/Universal
parent326f0711dc8dd443908ca856df138e93d0eca557 (diff)
downloadedk2-fb115c61504fe6c4f94be0a87f75e28e1684657f.zip
edk2-fb115c61504fe6c4f94be0a87f75e28e1684657f.tar.gz
edk2-fb115c61504fe6c4f94be0a87f75e28e1684657f.tar.bz2
NetLib:
1. Add new interface Ip6IsValidUnicast 2. Add new enum IP6_EXTENSION_HEADER_TYPE 3. Add new structure IP6_ICMP_* definitions 4. Update structure from EFI_UDP4_HEADER to EFI_UDP_HEADER 5. Add new macro EFI_IP6_EQUAL IpIoLib: 1. Update the IpIoLib to a combined library for both v4 and v6 network stack 2. Fix a bug in IpIoIcmpHandler() - for IPv6 packet, the header length is variable (basic header + extension) rathar than fixed length. The fix removes the IPv6 header fields and notify the user with the ICMPv6 packet only containing payload. TcpDxe/UdpDxe: 1. Update to adapt the new combined IpIoLib 2. Add gEfiIp6ProtocolGuid/gEfiIp6ServiceBindingProtocolGuid to [Protocols] in INF file since the Ip6.h is included in IpIoLib and NetLib. 3. Pass the TCP4/UDP4 UEFI SCT test on NT32 platform. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9374 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c6
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c17
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf5
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c9
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c27
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c4
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf5
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c54
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h2
-rw-r--r--MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c26
10 files changed, 92 insertions, 63 deletions
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
index 49b3136..a6acd26 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 - 2006, Intel Corporation<BR>
+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
which accompanies this distribution. The full text of the license may be found at
@@ -357,7 +357,7 @@ Tcp4ConfigurePcb (
//
// Add Ip for send pkt to the peer
//
- CopyMem (&IpCfgData, &mIpIoDefaultIpConfigData, sizeof (IpCfgData));
+ CopyMem (&IpCfgData, &mIp4IoDefaultIpConfigData, sizeof (IpCfgData));
IpCfgData.DefaultProtocol = EFI_IP_PROTO_TCP;
IpCfgData.UseDefaultAddress = CfgData->AccessPoint.UseDefaultAddress;
IpCfgData.StationAddress = CfgData->AccessPoint.StationAddress;
@@ -605,7 +605,7 @@ Tcp4Dispatcher (
switch (Request) {
case SOCK_POLL:
- Ip = ProtoData->TcpService->IpIo->Ip;
+ Ip = (EFI_IP4_PROTOCOL *) (ProtoData->TcpService->IpIo->Ip);
Ip->Poll (Ip);
break;
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
index d4ea65d..cffd53e 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c
@@ -1,7 +1,7 @@
/** @file
Tcp driver function.
-Copyright (c) 2005 - 2007, Intel Corporation<BR>
+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
which accompanies this distribution. The full text of the license may be found at
@@ -303,7 +303,11 @@ Tcp4DriverBindingStart (
//
// Create a new IP IO to Consume it
//
- TcpServiceData->IpIo = IpIoCreate (This->DriverBindingHandle, ControllerHandle);
+ TcpServiceData->IpIo = IpIoCreate (
+ This->DriverBindingHandle,
+ ControllerHandle,
+ IP_VERSION_4
+ );
if (NULL == TcpServiceData->IpIo) {
DEBUG ((EFI_D_ERROR, "Tcp4DriverBindingStart: Have no enough"
@@ -318,8 +322,13 @@ Tcp4DriverBindingStart (
//
ZeroMem (&OpenData, sizeof (IP_IO_OPEN_DATA));
- CopyMem (&OpenData.IpConfigData, &mIpIoDefaultIpConfigData, sizeof (OpenData.IpConfigData));
- OpenData.IpConfigData.DefaultProtocol = EFI_IP_PROTO_TCP;
+ CopyMem (
+ &OpenData.IpConfigData.Ip4CfgData,
+ &mIp4IoDefaultIpConfigData,
+ sizeof (EFI_IP4_CONFIG_DATA)
+ );
+
+ OpenData.IpConfigData.Ip4CfgData.DefaultProtocol = EFI_IP_PROTO_TCP;
OpenData.PktRcvdNotify = Tcp4RxCallback;
Status = IpIoOpen (TcpServiceData->IpIo, &OpenData);
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
index cdb35dc..c298f2d 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
@@ -2,7 +2,7 @@
# Component name for module Tcp4
#
# FIX ME!
-# Copyright (c) 2006, Intel Corporation.
+# Copyright (c) 2006 - 2009, 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
@@ -77,3 +77,6 @@
gEfiTcp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiIp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiTcp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiIp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiIp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
index 882a6b7..a2cf20e 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
@@ -1,7 +1,7 @@
/** @file
TCP input process routines.
-Copyright (c) 2005 - 2007, Intel Corporation<BR>
+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
which accompanies this distribution. The full text of the license may be found at
@@ -1441,7 +1441,12 @@ TcpIcmpInput (
goto CLEAN_EXIT;
}
- IcmpErrStatus = IpIoGetIcmpErrStatus (IcmpErr, &IcmpErrIsHard, &IcmpErrNotify);
+ IcmpErrStatus = IpIoGetIcmpErrStatus (
+ IcmpErr,
+ IP_VERSION_4,
+ &IcmpErrIsHard,
+ &IcmpErrNotify
+ );
if (IcmpErrNotify) {
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c
index 963d730..39e8fbe 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Io.c
@@ -1,7 +1,7 @@
/** @file
I/O interfaces between TCP and IpIo.
-Copyright (c) 2005 - 2006, Intel Corporation<BR>
+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
which accompanies this distribution. The full text of the license may be found at
@@ -37,9 +37,9 @@ Tcp4RxCallback (
)
{
if (EFI_SUCCESS == Status) {
- TcpInput (Pkt, NetSession->Source, NetSession->Dest);
+ TcpInput (Pkt, NetSession->Source.Addr[0], NetSession->Dest.Addr[0]);
} else {
- TcpIcmpInput (Pkt, IcmpErr, NetSession->Source, NetSession->Dest);
+ TcpIcmpInput (Pkt, IcmpErr, NetSession->Source.Addr[0], NetSession->Dest.Addr[0]);
}
}
@@ -70,11 +70,16 @@ TcpSendIpPacket (
SOCKET *Sock;
VOID *IpSender;
TCP4_PROTO_DATA *TcpProto;
+ EFI_IP_ADDRESS Source;
+ EFI_IP_ADDRESS Destination;
+
+ Source.Addr[0] = Src;
+ Destination.Addr[0] = Dest;
if (NULL == Tcb) {
IpIo = NULL;
- IpSender = IpIoFindSender (&IpIo, Src);
+ IpSender = IpIoFindSender (&IpIo, IP_VERSION_4, &Source);
if (IpSender == NULL) {
DEBUG ((EFI_D_WARN, "TcpSendIpPacket: No appropriate IpSender.\n"));
@@ -88,14 +93,14 @@ TcpSendIpPacket (
IpSender = Tcb->IpInfo;
}
- Override.TypeOfService = 0;
- Override.TimeToLive = 255;
- Override.DoNotFragment = FALSE;
- Override.Protocol = EFI_IP_PROTO_TCP;
- ZeroMem (&Override.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
- CopyMem (&Override.SourceAddress, &Src, sizeof (EFI_IPv4_ADDRESS));
+ Override.Ip4OverrideData.TypeOfService = 0;
+ Override.Ip4OverrideData.TimeToLive = 255;
+ Override.Ip4OverrideData.DoNotFragment = FALSE;
+ Override.Ip4OverrideData.Protocol = EFI_IP_PROTO_TCP;
+ ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&Override.Ip4OverrideData.SourceAddress, &Src, sizeof (EFI_IPv4_ADDRESS));
- Status = IpIoSend (IpIo, Nbuf, IpSender, NULL, NULL, Dest, &Override);
+ Status = IpIoSend (IpIo, Nbuf, IpSender, NULL, NULL, &Destination, &Override);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "TcpSendIpPacket: return %r error\n", Status));
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
index 1f47829..ce66231 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c
@@ -1,7 +1,7 @@
/** @file
Misc support routines for tcp.
-Copyright (c) 2005 - 2006, Intel Corporation<BR>
+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
which accompanies this distribution. The full text of the license may be found at
@@ -478,7 +478,7 @@ TcpGetRcvMss (
ASSERT (Sock != NULL);
TcpProto = (TCP4_PROTO_DATA *) Sock->ProtoReserved;
- Ip = TcpProto->TcpService->IpIo->Ip;
+ Ip = (EFI_IP4_PROTOCOL *) (TcpProto->TcpService->IpIo->Ip);
ASSERT (Ip != NULL);
Ip->GetModeData (Ip, NULL, NULL, &SnpMode);
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
index d1c06f3..eae8c20 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
@@ -2,7 +2,7 @@
# Component name for module Udp4
#
# FIX ME!
-# Copyright (c) 2006, Intel Corporation.
+# Copyright (c) 2006 - 2009, 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
@@ -63,3 +63,6 @@
gEfiUdp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiIp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiUdp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiIp6ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiIp6ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c
index 8d392ee..b0bc0ae 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c
@@ -270,8 +270,9 @@ Udp4CreateService (
IN EFI_HANDLE ControllerHandle
)
{
- EFI_STATUS Status;
- IP_IO_OPEN_DATA OpenData;
+ EFI_STATUS Status;
+ IP_IO_OPEN_DATA OpenData;
+ EFI_IP4_CONFIG_DATA *Ip4ConfigData;
ZeroMem (Udp4Service, sizeof (UDP4_SERVICE_DATA));
@@ -286,7 +287,7 @@ Udp4CreateService (
//
// Create the IpIo for this service context.
//
- Udp4Service->IpIo = IpIoCreate (ImageHandle, ControllerHandle);
+ Udp4Service->IpIo = IpIoCreate (ImageHandle, ControllerHandle, IP_VERSION_4);
if (Udp4Service->IpIo == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -294,12 +295,13 @@ Udp4CreateService (
//
// Set the OpenData used to open the IpIo.
//
- CopyMem (&OpenData.IpConfigData, &mIpIoDefaultIpConfigData, sizeof (OpenData.IpConfigData));
- OpenData.IpConfigData.AcceptBroadcast = TRUE;
- OpenData.RcvdContext = (VOID *) Udp4Service;
- OpenData.SndContext = NULL;
- OpenData.PktRcvdNotify = Udp4DgramRcvd;
- OpenData.PktSentNotify = Udp4DgramSent;
+ Ip4ConfigData = &OpenData.IpConfigData.Ip4CfgData;
+ CopyMem (Ip4ConfigData, &mIp4IoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA));
+ Ip4ConfigData->AcceptBroadcast = TRUE;
+ OpenData.RcvdContext = (VOID *) Udp4Service;
+ OpenData.SndContext = NULL;
+ OpenData.PktRcvdNotify = Udp4DgramRcvd;
+ OpenData.PktSentNotify = Udp4DgramSent;
//
// Configure and start the IpIo.
@@ -731,7 +733,7 @@ Udp4BuildIp4ConfigData (
IN OUT EFI_IP4_CONFIG_DATA *Ip4ConfigData
)
{
- CopyMem (Ip4ConfigData, &mIpIoDefaultIpConfigData, sizeof (*Ip4ConfigData));
+ CopyMem (Ip4ConfigData, &mIp4IoDefaultIpConfigData, sizeof (*Ip4ConfigData));
Ip4ConfigData->DefaultProtocol = EFI_IP_PROTO_UDP;
Ip4ConfigData->AcceptBroadcast = Udp4ConfigData->AcceptBroadcast;
@@ -1592,7 +1594,7 @@ Udp4Demultiplex (
IN NET_BUF *Packet
)
{
- EFI_UDP4_HEADER *Udp4Header;
+ EFI_UDP_HEADER *Udp4Header;
UINT16 HeadSum;
EFI_UDP4_RECEIVE_DATA RxData;
EFI_UDP4_SESSION_DATA *Udp4Session;
@@ -1601,15 +1603,15 @@ Udp4Demultiplex (
//
// Get the datagram header from the packet buffer.
//
- Udp4Header = (EFI_UDP4_HEADER *) NetbufGetByte (Packet, 0, NULL);
+ Udp4Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
if (Udp4Header->Checksum != 0) {
//
// check the checksum.
//
HeadSum = NetPseudoHeadChecksum (
- NetSession->Source,
- NetSession->Dest,
+ NetSession->Source.Addr[0],
+ NetSession->Dest.Addr[0],
EFI_IP_PROTO_UDP,
0
);
@@ -1689,7 +1691,7 @@ Udp4SendPortUnreach (
IP_IO_OVERRIDE Override;
IP_IO_IP_INFO *IpSender;
- IpSender = IpIoFindSender (&IpIo, NetSession->Dest);
+ IpSender = IpIoFindSender (&IpIo, NetSession->IpVersion, &NetSession->Dest);
if (IpSender == NULL) {
//
// No apropriate sender, since we cannot send out the ICMP message through
@@ -1698,7 +1700,7 @@ Udp4SendPortUnreach (
return;
}
- IpHdr = NetSession->IpHdr;
+ IpHdr = NetSession->IpHdr.Ip4Hdr;
//
// Calculate the requried length of the icmp error message.
@@ -1747,18 +1749,18 @@ Udp4SendPortUnreach (
//
// Fill the override data.
//
- Override.DoNotFragment = FALSE;
- Override.TypeOfService = 0;
- Override.TimeToLive = 255;
- Override.Protocol = EFI_IP_PROTO_ICMP;
+ Override.Ip4OverrideData.DoNotFragment = FALSE;
+ Override.Ip4OverrideData.TypeOfService = 0;
+ Override.Ip4OverrideData.TimeToLive = 255;
+ Override.Ip4OverrideData.Protocol = EFI_IP_PROTO_ICMP;
- CopyMem (&Override.SourceAddress, &NetSession->Dest, sizeof (EFI_IPv4_ADDRESS));
- ZeroMem (&Override.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&Override.Ip4OverrideData.SourceAddress, &NetSession->Dest, sizeof (EFI_IPv4_ADDRESS));
+ ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
//
// Send out this icmp packet.
//
- IpIoSend (IpIo, Packet, IpSender, NULL, NULL, NetSession->Source, &Override);
+ IpIoSend (IpIo, Packet, IpSender, NULL, NULL, &NetSession->Source, &Override);
NetbufFree (Packet);
}
@@ -1783,12 +1785,12 @@ Udp4IcmpHandler (
IN NET_BUF *Packet
)
{
- EFI_UDP4_HEADER *Udp4Header;
+ EFI_UDP_HEADER *Udp4Header;
EFI_UDP4_SESSION_DATA Udp4Session;
LIST_ENTRY *Entry;
UDP4_INSTANCE_DATA *Instance;
- Udp4Header = (EFI_UDP4_HEADER *) NetbufGetByte (Packet, 0, NULL);
+ Udp4Header = (EFI_UDP_HEADER *) NetbufGetByte (Packet, 0, NULL);
CopyMem (&Udp4Session.SourceAddress, &NetSession->Source, sizeof (EFI_IPv4_ADDRESS));
CopyMem (&Udp4Session.DestinationAddress, &NetSession->Dest, sizeof (EFI_IPv4_ADDRESS));
@@ -1819,7 +1821,7 @@ Udp4IcmpHandler (
//
// Translate the Icmp Error code according to the udp spec.
//
- Instance->IcmpError = IpIoGetIcmpErrStatus (IcmpError, NULL, NULL);
+ Instance->IcmpError = IpIoGetIcmpErrStatus (IcmpError, IP_VERSION_4, NULL, NULL);
if (IcmpError > ICMP_ERR_UNREACH_PORT) {
Instance->IcmpError = EFI_ICMP_ERROR;
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h
index 0823b69..f7d6322 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.h
@@ -45,7 +45,7 @@ extern UINT16 mUdp4RandomPort;
#define UDP4_TIMEOUT_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
-#define UDP4_HEADER_SIZE sizeof (EFI_UDP4_HEADER)
+#define UDP4_HEADER_SIZE sizeof (EFI_UDP_HEADER)
#define UDP4_MAX_DATA_SIZE 65507
#define UDP4_PORT_KNOWN 1024
diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c
index 7bb83b0..582d6f6 100644
--- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c
+++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c
@@ -507,7 +507,7 @@ Udp4Transmit (
UDP4_INSTANCE_DATA *Instance;
EFI_TPL OldTpl;
NET_BUF *Packet;
- EFI_UDP4_HEADER *Udp4Header;
+ EFI_UDP_HEADER *Udp4Header;
EFI_UDP4_CONFIG_DATA *ConfigData;
IP4_ADDR Source;
IP4_ADDR Destination;
@@ -516,6 +516,7 @@ Udp4Transmit (
UDP4_SERVICE_DATA *Udp4Service;
IP_IO_OVERRIDE Override;
UINT16 HeadSum;
+ EFI_IP_ADDRESS IpDestAddr;
if ((This == NULL) || (Token == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -575,7 +576,7 @@ Udp4Transmit (
Udp4Service = Instance->Udp4Service;
*((UINTN *) &Packet->ProtoData[0]) = (UINTN) (Udp4Service->IpIo);
- Udp4Header = (EFI_UDP4_HEADER *) NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);
+ Udp4Header = (EFI_UDP_HEADER *) NetbufAllocSpace (Packet, UDP4_HEADER_SIZE, TRUE);
ASSERT (Udp4Header != NULL);
ConfigData = &Instance->ConfigData;
@@ -589,7 +590,7 @@ Udp4Transmit (
Udp4Header->Checksum = 0;
UdpSessionData = TxData->UdpSessionData;
- Override.SourceAddress = ConfigData->StationAddress;
+ Override.Ip4OverrideData.SourceAddress = ConfigData->StationAddress;
if (UdpSessionData != NULL) {
//
@@ -597,7 +598,7 @@ Udp4Transmit (
// UdpSessionData.
//
if (!EFI_IP4_EQUAL (&UdpSessionData->SourceAddress, &mZeroIp4Addr)) {
- CopyMem (&Override.SourceAddress, &UdpSessionData->SourceAddress, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&Override.Ip4OverrideData.SourceAddress, &UdpSessionData->SourceAddress, sizeof (EFI_IPv4_ADDRESS));
}
if (UdpSessionData->SourcePort != 0) {
@@ -608,7 +609,7 @@ Udp4Transmit (
Udp4Header->DstPort = HTONS (UdpSessionData->DestinationPort);
}
- CopyMem (&Source, &Override.SourceAddress, sizeof (IP4_ADDR));
+ CopyMem (&Source, &Override.Ip4OverrideData.SourceAddress, sizeof (IP4_ADDR));
CopyMem (&Destination, &UdpSessionData->DestinationAddress, sizeof (IP4_ADDR));
//
@@ -644,15 +645,15 @@ Udp4Transmit (
// Fill the IpIo Override data.
//
if (TxData->GatewayAddress != NULL) {
- CopyMem (&Override.GatewayAddress, TxData->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
+ CopyMem (&Override.Ip4OverrideData.GatewayAddress, TxData->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
} else {
- ZeroMem (&Override.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
+ ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
}
- Override.Protocol = EFI_IP_PROTO_UDP;
- Override.TypeOfService = ConfigData->TypeOfService;
- Override.TimeToLive = ConfigData->TimeToLive;
- Override.DoNotFragment = ConfigData->DoNotFragment;
+ Override.Ip4OverrideData.Protocol = EFI_IP_PROTO_UDP;
+ Override.Ip4OverrideData.TypeOfService = ConfigData->TypeOfService;
+ Override.Ip4OverrideData.TimeToLive = ConfigData->TimeToLive;
+ Override.Ip4OverrideData.DoNotFragment = ConfigData->DoNotFragment;
//
// Save the token into the TxToken map.
@@ -665,13 +666,14 @@ Udp4Transmit (
//
// Send out this datagram through IpIo.
//
+ IpDestAddr.Addr[0] = Destination;
Status = IpIoSend (
Udp4Service->IpIo,
Packet,
Instance->IpInfo,
Instance,
Token,
- Destination,
+ &IpDestAddr,
&Override
);
if (EFI_ERROR (Status)) {