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
This commit is contained in:
tye
2009-10-26 10:15:40 +00:00
parent 326f0711dc
commit fb115c6150
14 changed files with 1217 additions and 312 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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) {

View File

@@ -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));

View File

@@ -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);