Import ArpDxe, Dhcp4Dxe, Ip4Dxe, Mtftp4Dxe, PxeBcDxe and PxeDhcp4Dxe.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3492 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2007-07-30 02:37:10 +00:00
parent eca7eaf49b
commit 772db4bb33
113 changed files with 42735 additions and 302 deletions

View File

@@ -424,7 +424,7 @@ Udp4FindInstanceByPort (
continue;
}
if (EFI_IP_EQUAL (ConfigData->StationAddress, *Address) &&
if (EFI_IP4_EQUAL (ConfigData->StationAddress, *Address) &&
(ConfigData->StationPort == Port)) {
//
// if both the address and the port are the same, return TRUE.
@@ -566,8 +566,8 @@ Udp4IsReconfigurable (
}
if (!NewConfigData->UseDefaultAddress &&
(!EFI_IP_EQUAL (NewConfigData->StationAddress, OldConfigData->StationAddress) ||
!EFI_IP_EQUAL (NewConfigData->SubnetMask, OldConfigData->SubnetMask))) {
(!EFI_IP4_EQUAL (NewConfigData->StationAddress, OldConfigData->StationAddress) ||
!EFI_IP4_EQUAL (NewConfigData->SubnetMask, OldConfigData->SubnetMask))) {
//
// If the instance doesn't use the default address, and the new address or
// new subnet mask is different from the old values.
@@ -576,15 +576,14 @@ Udp4IsReconfigurable (
}
}
if (!EFI_IP_EQUAL (NewConfigData->RemoteAddress, OldConfigData->RemoteAddress)) {
if (!EFI_IP4_EQUAL (NewConfigData->RemoteAddress, OldConfigData->RemoteAddress)) {
//
// The remoteaddress is not the same.
//
return FALSE;
}
if ((EFI_IP4 (NewConfigData->RemoteAddress) != 0) &&
(NewConfigData->RemotePort != OldConfigData->RemotePort)) {
if (!EFI_IP4_EQUAL (NewConfigData->RemoteAddress, mZeroIp4Addr) && (NewConfigData->RemotePort != OldConfigData->RemotePort)) {
//
// The RemotePort differs if it's designated in the configdata.
//
@@ -667,6 +666,7 @@ Udp4ValidateTxToken (
EFI_UDP4_CONFIG_DATA *ConfigData;
EFI_UDP4_SESSION_DATA *UdpSessionData;
IP4_ADDR SourceAddress;
IP4_ADDR GatewayAddress;
if (TxToken->Event == NULL) {
return EFI_INVALID_PARAMETER;
@@ -700,12 +700,15 @@ Udp4ValidateTxToken (
return EFI_INVALID_PARAMETER;
}
if ((TxData->GatewayAddress != NULL) &&
!Ip4IsUnicast(EFI_NTOHL (*(TxData->GatewayAddress)), 0)) {
//
// The specified GatewayAddress is not a unicast IPv4 address while it's not 0.
//
return EFI_INVALID_PARAMETER;
if (TxData->GatewayAddress != NULL) {
NetCopyMem (&GatewayAddress, TxData->GatewayAddress, sizeof (IP4_ADDR));
if (!Ip4IsUnicast (NTOHL (GatewayAddress), 0)) {
//
// The specified GatewayAddress is not a unicast IPv4 address while it's not 0.
//
return EFI_INVALID_PARAMETER;
}
}
ConfigData = &Instance->ConfigData;
@@ -713,9 +716,9 @@ Udp4ValidateTxToken (
if (UdpSessionData != NULL) {
SourceAddress = EFI_NTOHL (UdpSessionData->SourceAddress);
NetCopyMem (&SourceAddress, &UdpSessionData->SourceAddress, sizeof (IP4_ADDR));
if ((SourceAddress != 0) && !Ip4IsUnicast (SourceAddress, 0)) {
if ((SourceAddress != 0) && !Ip4IsUnicast (HTONL (SourceAddress), 0)) {
//
// Check whether SourceAddress is a valid IPv4 address in case it's not zero.
// The configured station address is used if SourceAddress is zero.
@@ -730,13 +733,13 @@ Udp4ValidateTxToken (
return EFI_INVALID_PARAMETER;
}
if (EFI_IP4 (UdpSessionData->DestinationAddress) == 0) {
if (EFI_IP4_EQUAL (UdpSessionData->DestinationAddress, mZeroIp4Addr)) {
//
// The DestinationAddress specified in the UdpSessionData is 0.
//
return EFI_INVALID_PARAMETER;
}
} else if (EFI_IP4 (ConfigData->RemoteAddress) == 0) {
} else if (EFI_IP4_EQUAL (ConfigData->RemoteAddress, mZeroIp4Addr)) {
//
// the configured RemoteAddress is all zero, and the user doens't override the
// destination address.
@@ -959,9 +962,9 @@ Udp4LeaveGroup (
McastIp = Arg;
if ((McastIp != NULL) && ((UINTN) EFI_IP4 (*McastIp) != (UINTN) (Item->Key))) {
if ((McastIp != NULL) && (!EFI_IP4_EQUAL (*McastIp, (UINTN) Item->Key))) {
//
// McastIp is not NULL and the multicast address contained in the Item
// McastIp is not NULL and the multicast address contained in the Item
// is not the same as McastIp.
//
return EFI_SUCCESS;
@@ -1169,16 +1172,16 @@ Udp4MatchDgram (
return FALSE;
}
if ((EFI_IP4 (ConfigData->RemoteAddress) != 0) &&
!EFI_IP_EQUAL (ConfigData->RemoteAddress, Udp4Session->SourceAddress)) {
if (!EFI_IP4_EQUAL (ConfigData->RemoteAddress, mZeroIp4Addr) &&
!EFI_IP4_EQUAL (ConfigData->RemoteAddress, Udp4Session->SourceAddress)) {
//
// This datagram doesn't come from the instance's specified sender.
//
return FALSE;
}
if ((EFI_IP4 (ConfigData->StationAddress) == 0) ||
EFI_IP_EQUAL (Udp4Session->DestinationAddress, ConfigData->StationAddress)) {
if (EFI_IP4_EQUAL (ConfigData->StationAddress, mZeroIp4Addr) ||
EFI_IP4_EQUAL (Udp4Session->DestinationAddress, ConfigData->StationAddress)) {
//
// The instance is configured to receive datagrams destinated to any station IP or
// the destination address of this datagram matches the configured station IP.
@@ -1186,7 +1189,7 @@ Udp4MatchDgram (
return TRUE;
}
Destination = EFI_IP4 (Udp4Session->DestinationAddress);
NetCopyMem (&Destination, &Udp4Session->DestinationAddress, sizeof (IP4_ADDR));
if (IP4_IS_LOCAL_BROADCAST (Destination) && ConfigData->AcceptBroadcast) {
//
@@ -1513,11 +1516,12 @@ Udp4Demultiplex (
gRT->GetTime (&RxData.TimeStamp, NULL);
Udp4Session = &RxData.UdpSession;
EFI_IP4 (Udp4Session->SourceAddress) = NetSession->Source;
EFI_IP4 (Udp4Session->DestinationAddress) = NetSession->Dest;
Udp4Session->SourcePort = NTOHS (Udp4Header->SrcPort);
Udp4Session->DestinationPort = NTOHS (Udp4Header->DstPort);
Udp4Session = &RxData.UdpSession;
Udp4Session->SourcePort = NTOHS (Udp4Header->SrcPort);
Udp4Session->DestinationPort = NTOHS (Udp4Header->DstPort);
NetCopyMem (&Udp4Session->SourceAddress, &NetSession->Source, sizeof (EFI_IPv4_ADDRESS));
NetCopyMem (&Udp4Session->DestinationAddress, &NetSession->Dest, sizeof (EFI_IPv4_ADDRESS));
//
// Trim the UDP header.
@@ -1637,12 +1641,13 @@ Udp4SendPortUnreach (
//
// Fill the override data.
//
Override.DoNotFragment = FALSE;
Override.TypeOfService = 0;
Override.TimeToLive = 255;
Override.Protocol = EFI_IP_PROTO_ICMP;
EFI_IP4 (Override.SourceAddress) = NetSession->Dest;
EFI_IP4 (Override.GatewayAddress) = 0;
Override.DoNotFragment = FALSE;
Override.TypeOfService = 0;
Override.TimeToLive = 255;
Override.Protocol = EFI_IP_PROTO_ICMP;
NetCopyMem (&Override.SourceAddress, &NetSession->Dest, sizeof (EFI_IPv4_ADDRESS));
NetZeroMem (&Override.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
//
// Send out this icmp packet.
@@ -1682,10 +1687,11 @@ Udp4IcmpHandler (
Udp4Header = (EFI_UDP4_HEADER *) NetbufGetByte (Packet, 0, NULL);
EFI_IP4 (Udp4Session.SourceAddress) = NetSession->Source;
EFI_IP4 (Udp4Session.DestinationAddress) = NetSession->Dest;
Udp4Session.SourcePort = NTOHS (Udp4Header->DstPort);
Udp4Session.DestinationPort = NTOHS (Udp4Header->SrcPort);
NetCopyMem (&Udp4Session.SourceAddress, &NetSession->Source, sizeof (EFI_IPv4_ADDRESS));
NetCopyMem (&Udp4Session.DestinationAddress, &NetSession->Dest, sizeof (EFI_IPv4_ADDRESS));
Udp4Session.SourcePort = NTOHS (Udp4Header->DstPort);
Udp4Session.DestinationPort = NTOHS (Udp4Header->SrcPort);
NET_LIST_FOR_EACH (Entry, &Udp4Service->ChildrenList) {
//
@@ -1696,7 +1702,7 @@ Udp4IcmpHandler (
if (!Instance->Configured ||
Instance->ConfigData.AcceptPromiscuous ||
Instance->ConfigData.AcceptAnyPort ||
(EFI_IP4 (Instance->ConfigData.StationAddress) == 0)) {
EFI_IP4_EQUAL (Instance->ConfigData.StationAddress, mZeroIp4Addr)) {
//
// Don't try to deliver the ICMP error to this instance if it is not configured,
// or it's configured to be promiscuous or accept any port or accept all the