/** @file\r
\r
-Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IP4_ADDR Ip;\r
IP4_ADDR Netmask;\r
EFI_ARP_PROTOCOL *Arp;\r
+ EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;\r
+ EFI_IP4_CONFIG2_POLICY Policy;\r
\r
IpSb = IpInstance->Service;\r
\r
+ Ip4Config2 = NULL;\r
+\r
//\r
// User is changing packet filters. It must be stopped\r
// before the station address can be changed.\r
// Use the default address. Check the state.\r
//\r
if (IpSb->State == IP4_SERVICE_UNSTARTED) {\r
- Status = Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);\r
-\r
- if (EFI_ERROR (Status)) {\r
- goto ON_ERROR;\r
+ //\r
+ // Trigger the EFI_IP4_CONFIG2_PROTOCOL to retrieve the \r
+ // default IPv4 address if it is not available yet.\r
+ //\r
+ Policy = IpSb->Ip4Config2Instance.Policy;\r
+ if (Policy != Ip4Config2PolicyDhcp) {\r
+ Ip4Config2 = &IpSb->Ip4Config2Instance.Ip4Config2;\r
+ Policy = Ip4Config2PolicyDhcp;\r
+ Status= Ip4Config2->SetData (\r
+ Ip4Config2,\r
+ Ip4Config2DataTypePolicy,\r
+ sizeof (EFI_IP4_CONFIG2_POLICY),\r
+ &Policy\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
}\r
}\r
\r
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
);\r
if (EFI_ERROR (Status)) {\r
+ Ip4FreeInterface (IpIf, IpInstance);\r
goto ON_ERROR;\r
}\r
}\r
// is decreamented each time an address is removed..\r
//\r
for (Index = IpInstance->GroupCount; Index > 0 ; Index--) {\r
+ ASSERT (IpInstance->Groups != NULL);\r
Group = IpInstance->Groups[Index - 1];\r
-\r
if ((GroupAddress == NULL) || EFI_IP4_EQUAL (&Group, GroupAddress)) {\r
if (EFI_ERROR (Ip4LeaveGroup (IpInstance, NTOHL (Group)))) {\r
return EFI_DEVICE_ERROR;\r
// the gateway address must be a unicast on the connected network if not zero.\r
//\r
if ((Nexthop != IP4_ALLZERO_ADDRESS) &&\r
- (!IP4_NET_EQUAL (Nexthop, IpIf->Ip, IpIf->SubnetMask) ||\r
+ ((IpIf->SubnetMask != IP4_ALLONE_ADDRESS && !IP4_NET_EQUAL (Nexthop, IpIf->Ip, IpIf->SubnetMask)) ||\r
IP4_IS_BROADCAST (Ip4GetNetCast (Nexthop, IpIf)))) {\r
\r
Status = EFI_INVALID_PARAMETER;\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
- There are two steps for this the heart beat timer of IP4 service instance. \r
- First, it times out all of its IP4 children's received-but-not-delivered \r
- and transmitted-but-not-recycle packets, and provides time input for its \r
- IGMP protocol.\r
- Second, a dedicated timer is used to poll underlying media status. In case \r
- of cable swap, a new round auto configuration will be initiated. The timer \r
- will signal the IP4 to run DHCP configuration again. IP4 driver will free\r
- old IP address related resource, such as route table and Interface, then\r
- initiate a DHCP process to acquire new IP, eventually create route table \r
- for new IP address.\r
+ This heart beat timer of IP4 service instance times out all of its IP4 children's \r
+ received-but-not-delivered and transmitted-but-not-recycle packets, and provides \r
+ time input for its IGMP protocol.\r
\r
@param[in] Event The IP4 service instance's heart beat timer.\r
@param[in] Context The IP4 service instance.\r
)\r
{\r
IP4_SERVICE *IpSb;\r
+\r
+ IpSb = (IP4_SERVICE *) Context;\r
+ NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);\r
+ \r
+ Ip4PacketTimerTicking (IpSb);\r
+ Ip4IgmpTicking (IpSb);\r
+}\r
+\r
+/**\r
+ This dedicated timer is used to poll underlying network media status. In case \r
+ of cable swap or wireless network switch, a new round auto configuration will \r
+ be initiated. The timer will signal the IP4 to run DHCP configuration again. \r
+ IP4 driver will free old IP address related resource, such as route table and \r
+ Interface, then initiate a DHCP process to acquire new IP, eventually create \r
+ route table for new IP address.\r
+\r
+ @param[in] Event The IP4 service instance's heart beat timer.\r
+ @param[in] Context The IP4 service instance.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+Ip4TimerReconfigChecking (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ IP4_SERVICE *IpSb;\r
BOOLEAN OldMediaPresent;\r
EFI_STATUS Status;\r
EFI_SIMPLE_NETWORK_MODE SnpModeData;\r
\r
OldMediaPresent = IpSb->MediaPresent;\r
\r
- Ip4PacketTimerTicking (IpSb);\r
- Ip4IgmpTicking (IpSb);\r
-\r
//\r
// Get fresh mode data from MNP, since underlying media status may change. \r
// Here, it needs to mention that the MediaPresent can also be checked even if \r