Revision: 17652
http://sourceforge.net/p/edk2/code/17652
Author: jiaxinwu
Date: 2015-06-18 00:43:15 +0000 (Thu, 18 Jun 2015)
Log Message:
-----------
MdeModulePkg: Remove DHCP4.TransmitReceive()and DORA process dependency.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
Modified: trunk/edk2/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
2015-06-17 09:36:35 UTC (rev 17651)
+++ trunk/edk2/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Impl.c
2015-06-18 00:43:15 UTC (rev 17652)
@@ -1,7 +1,7 @@
/** @file
This file implement the EFI_DHCP4_PROTOCOL interface.
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
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
@@ -1191,7 +1191,10 @@
DHCP_SERVICE *DhcpSb;
EFI_DHCP4_TRANSMIT_RECEIVE_TOKEN *Token;
EFI_UDP4_CONFIG_DATA UdpConfigData;
- IP4_ADDR Ip;
+ IP4_ADDR ClientAddr;
+ IP4_ADDR Ip;
+ INTN Class;
+ IP4_ADDR SubnetMask;
Instance = (DHCP_PROTOCOL *) Context;
DhcpSb = Instance->Service;
@@ -1204,10 +1207,14 @@
UdpConfigData.TimeToLive = 64;
UdpConfigData.DoNotFragment = TRUE;
- Ip = HTONL (DhcpSb->ClientAddr);
+ ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr);
+ Ip = HTONL (ClientAddr);
CopyMem (&UdpConfigData.StationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
-
- Ip = HTONL (DhcpSb->Netmask);
+
+ Class = NetGetIpClass (ClientAddr);
+ ASSERT (Class < IP4_ADDR_CLASSE);
+ SubnetMask = gIp4AllMasks[Class << 3];
+ Ip = HTONL (SubnetMask);
CopyMem (&UdpConfigData.SubnetMask, &Ip, sizeof (EFI_IPv4_ADDRESS));
if ((Token->ListenPointCount == 0) || (Token->ListenPoints[0].ListenPort ==
0)) {
@@ -1357,7 +1364,7 @@
//
if ((Head->OpCode != BOOTP_REPLY) ||
(Head->Xid != Token->Packet->Dhcp4.Header.Xid) ||
- (CompareMem (DhcpSb->ClientAddressSendOut, Head->ClientHwAddr,
Head->HwAddrLen) != 0)) {
+ (CompareMem (&Token->Packet->Dhcp4.Header.ClientHwAddr[0],
Head->ClientHwAddr, Head->HwAddrLen) != 0)) {
goto RESTART;
}
@@ -1481,6 +1488,8 @@
IP4_ADDR Ip;
DHCP_SERVICE *DhcpSb;
EFI_IP_ADDRESS Gateway;
+ IP4_ADDR ClientAddr;
+ INTN Class;
IP4_ADDR SubnetMask;
if ((This == NULL) || (Token == NULL) || (Token->Packet == NULL)) {
@@ -1489,6 +1498,7 @@
Instance = DHCP_INSTANCE_FROM_THIS (This);
DhcpSb = Instance->Service;
+ DhcpSb->ActiveChild = Instance;
if (Instance->Token != NULL) {
//
@@ -1512,8 +1522,9 @@
return EFI_INVALID_PARAMETER;
}
- if (DhcpSb->ClientAddr == 0) {
-
+ ClientAddr = EFI_NTOHL (Token->Packet->Dhcp4.Header.ClientAddr);
+
+ if (ClientAddr == 0) {
return EFI_NO_MAPPING;
}
@@ -1573,9 +1584,11 @@
//
// Get the gateway.
//
- SubnetMask = DhcpSb->Netmask;
+ Class = NetGetIpClass (ClientAddr);
+ ASSERT (Class < IP4_ADDR_CLASSE);
+ SubnetMask = gIp4AllMasks[Class << 3];
ZeroMem (&Gateway, sizeof (Gateway));
- if (!IP4_NET_EQUAL (DhcpSb->ClientAddr, EndPoint.RemoteAddr.Addr[0],
SubnetMask)) {
+ if (!IP4_NET_EQUAL (ClientAddr, EndPoint.RemoteAddr.Addr[0], SubnetMask)) {
CopyMem (&Gateway.v4, &Token->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));
Gateway.Addr[0] = NTOHL (Gateway.Addr[0]);
}
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits