2 This code implements the IP4Config and NicIp4Config protocols.
4 Copyright (c) 2006 - 2008, Intel Corporation.<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at<BR>
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "Ip4Config.h"
17 IP4_CONFIG_INSTANCE
*mIp4ConfigNicList
[MAX_IP4_CONFIG_IN_VARIABLE
];
20 Return the name and MAC address for the NIC. The Name, if not NULL,
21 has at least IP4_NIC_NAME_LENGTH bytes.
23 @param This The NIC IP4 CONFIG protocol
24 @param Name The buffer to return the name
25 @param NicAddr The buffer to return the MAC addr
27 @retval EFI_INVALID_PARAMETER This is NULL
28 @retval EFI_SUCCESS The name or address of the NIC are returned.
33 EfiNicIp4ConfigGetName (
34 IN EFI_NIC_IP4_CONFIG_PROTOCOL
*This
,
35 OUT UINT16
*Name OPTIONAL
,
36 OUT NIC_ADDR
*NicAddr OPTIONAL
39 IP4_CONFIG_INSTANCE
*Instance
;
42 return EFI_INVALID_PARAMETER
;
45 Instance
= IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG (This
);
48 CopyMem (Name
, Instance
->NicName
, IP4_NIC_NAME_LENGTH
);
51 if (NicAddr
!= NULL
) {
52 CopyMem (NicAddr
, &Instance
->NicAddr
, sizeof (*NicAddr
));
60 Get the NIC's configure information from the IP4 configure variable.
61 It will remove the invalid variable.
63 @param NicAddr The NIC to check
65 @return NULL if no configure for the NIC in the variable, or it is invalid.
66 Otherwise the pointer to the NIC's IP configure parameter will be returned.
74 IP4_CONFIG_VARIABLE
*Variable
;
75 IP4_CONFIG_VARIABLE
*NewVariable
;
76 NIC_IP4_CONFIG_INFO
*Config
;
79 // Read the configuration parameter for this NicAddr from
82 Variable
= Ip4ConfigReadVariable ();
84 if (Variable
== NULL
) {
88 Config
= Ip4ConfigFindNicVariable (Variable
, NicAddr
);
91 gBS
->FreePool (Variable
);
96 // Validate the configuration, if the configuration is invalid,
97 // remove it from the variable.
99 if (!Ip4ConfigIsValid (Config
)) {
100 NewVariable
= Ip4ConfigModifyVariable (Variable
, &Config
->NicAddr
, NULL
);
101 Ip4ConfigWriteVariable (NewVariable
);
103 if (NewVariable
!= NULL
) {
104 gBS
->FreePool (NewVariable
);
107 gBS
->FreePool (Config
);
111 gBS
->FreePool (Variable
);
117 Get the configure parameter for this NIC.
119 @param This The NIC IP4 CONFIG protocol.
120 @param ConfigLen The length of the NicConfig buffer.
121 @param NicConfig The buffer to receive the NIC's configure
124 @retval EFI_SUCCESS The configure parameter for this NIC was
125 obtained successfully .
126 @retval EFI_INVALID_PARAMETER This or ConfigLen is NULL.
127 @retval EFI_NOT_FOUND There is no configure parameter for the NIC in
129 @retval EFI_BUFFER_TOO_SMALL The ConfigLen is too small or the NicConfig is
135 EfiNicIp4ConfigGetInfo (
136 IN EFI_NIC_IP4_CONFIG_PROTOCOL
*This
,
137 IN OUT UINTN
*ConfigLen
,
138 OUT NIC_IP4_CONFIG_INFO
*NicConfig
141 IP4_CONFIG_INSTANCE
*Instance
;
142 NIC_IP4_CONFIG_INFO
*Config
;
146 if ((This
== NULL
) || (ConfigLen
== NULL
)) {
147 return EFI_INVALID_PARAMETER
;
151 // Read the Nic's configuration parameter from variable
153 Instance
= IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG (This
);
154 Config
= Ip4ConfigGetNicInfo (&Instance
->NicAddr
);
156 if (Config
== NULL
) {
157 return EFI_NOT_FOUND
;
161 // Copy the data to user's buffer
163 Len
= SIZEOF_NIC_IP4_CONFIG_INFO (Config
);
165 if ((*ConfigLen
< Len
) || (NicConfig
== NULL
)) {
166 Status
= EFI_BUFFER_TOO_SMALL
;
168 Status
= EFI_SUCCESS
;
169 CopyMem (NicConfig
, Config
, Len
);
170 Ip4ConfigFixRouteTablePointer (&NicConfig
->Ip4Info
);
175 gBS
->FreePool (Config
);
181 Set the IP configure parameters for this NIC.
183 If Reconfig is TRUE, the IP driver will be informed to discard current
184 auto configure parameter and restart the auto configuration process.
185 If current there is a pending auto configuration, EFI_ALREADY_STARTED is
186 returned. You can only change the configure setting when either
187 the configure has finished or not started yet. If NicConfig, the
188 NIC's configure parameter is removed from the variable.
190 @param This The NIC IP4 CONFIG protocol
191 @param NicConfig The new NIC IP4 configure parameter
192 @param Reconfig Inform the IP4 driver to restart the auto
195 @retval EFI_SUCCESS The configure parameter for this NIC was
197 @retval EFI_INVALID_PARAMETER This is NULL or the configure parameter is
199 @retval EFI_ALREADY_STARTED There is a pending auto configuration.
200 @retval EFI_NOT_FOUND No auto configure parameter is found
205 EfiNicIp4ConfigSetInfo (
206 IN EFI_NIC_IP4_CONFIG_PROTOCOL
*This
,
207 IN NIC_IP4_CONFIG_INFO
*NicConfig OPTIONAL
,
211 IP4_CONFIG_INSTANCE
*Instance
;
212 IP4_CONFIG_VARIABLE
*Variable
;
213 IP4_CONFIG_VARIABLE
*NewVariable
;
217 // Validate the parameters
220 return EFI_INVALID_PARAMETER
;
223 Instance
= IP4_CONFIG_INSTANCE_FROM_NIC_IP4CONFIG (This
);
225 if ((NicConfig
!= NULL
) && (!Ip4ConfigIsValid (NicConfig
) ||
226 !NIC_ADDR_EQUAL (&NicConfig
->NicAddr
, &Instance
->NicAddr
))) {
227 return EFI_INVALID_PARAMETER
;
230 if (Instance
->State
== IP4_CONFIG_STATE_STARTED
) {
231 return EFI_ALREADY_STARTED
;
235 // Update the parameter in the configure variable
237 Variable
= Ip4ConfigReadVariable ();
239 if ((Variable
== NULL
) && (NicConfig
== NULL
)) {
240 return EFI_NOT_FOUND
;
243 NewVariable
= Ip4ConfigModifyVariable (Variable
, &Instance
->NicAddr
, NicConfig
);
244 Status
= Ip4ConfigWriteVariable (NewVariable
);
246 if (NewVariable
!= NULL
) {
247 gBS
->FreePool (NewVariable
);
251 // Variable is NULL when saving the first configure parameter
253 if (Variable
!= NULL
) {
254 gBS
->FreePool (Variable
);
257 if (EFI_ERROR (Status
)) {
262 // Signal the IP4 to run the auto configuration again
264 if (Reconfig
&& (Instance
->ReconfigEvent
!= NULL
)) {
265 Status
= gBS
->SignalEvent (Instance
->ReconfigEvent
);
266 NetLibDispatchDpc ();
273 Callback function when DHCP process finished. It will save the
274 retrieved IP configure parameter from DHCP to the NVRam.
276 @param Event The callback event
277 @param Context Opaque context to the callback
284 Ip4ConfigOnDhcp4Complete (
289 IP4_CONFIG_INSTANCE
*Instance
;
290 EFI_DHCP4_MODE_DATA Dhcp4Mode
;
291 EFI_IP4_IPCONFIG_DATA
*Ip4Config
;
298 Instance
= (IP4_CONFIG_INSTANCE
*) Context
;
299 ASSERT (Instance
->Dhcp4
!= NULL
);
301 Instance
->State
= IP4_CONFIG_STATE_CONFIGURED
;
302 Instance
->Result
= EFI_TIMEOUT
;
305 // Get the DHCP retrieved parameters
307 Status
= Instance
->Dhcp4
->GetModeData (Instance
->Dhcp4
, &Dhcp4Mode
);
309 if (EFI_ERROR (Status
)) {
313 if (Dhcp4Mode
.State
== Dhcp4Bound
) {
315 // Save the new configuration retrieved by DHCP both in
316 // the instance and to NVRam. So, both the IP4 driver and
317 // other user can get that address.
321 if (Instance
->NicConfig
!= NULL
) {
322 ASSERT (Instance
->NicConfig
->Source
== IP4_CONFIG_SOURCE_DHCP
);
323 Perment
= Instance
->NicConfig
->Perment
;
324 gBS
->FreePool (Instance
->NicConfig
);
327 Instance
->NicConfig
= AllocatePool (sizeof (NIC_IP4_CONFIG_INFO
) + 2* sizeof (EFI_IP4_ROUTE_TABLE
));
329 if (Instance
->NicConfig
== NULL
) {
330 Instance
->Result
= EFI_OUT_OF_RESOURCES
;
334 Instance
->NicConfig
->Ip4Info
.RouteTable
= (EFI_IP4_ROUTE_TABLE
*) (Instance
->NicConfig
+ 1);
336 CopyMem (&Instance
->NicConfig
->NicAddr
, &Instance
->NicAddr
, sizeof (Instance
->NicConfig
->NicAddr
));
337 Instance
->NicConfig
->Source
= IP4_CONFIG_SOURCE_DHCP
;
338 Instance
->NicConfig
->Perment
= Perment
;
340 Ip4Config
= &Instance
->NicConfig
->Ip4Info
;
341 Ip4Config
->StationAddress
= Dhcp4Mode
.ClientAddress
;
342 Ip4Config
->SubnetMask
= Dhcp4Mode
.SubnetMask
;
345 // Create a route for the connected network
347 Ip4Config
->RouteTableSize
= 1;
349 CopyMem (&Ip1
, &Dhcp4Mode
.ClientAddress
, sizeof (IP4_ADDR
));
350 CopyMem (&Ip2
, &Dhcp4Mode
.SubnetMask
, sizeof (IP4_ADDR
));
354 CopyMem (&Ip4Config
->RouteTable
[0].SubnetAddress
, &Subnet
, sizeof (EFI_IPv4_ADDRESS
));
355 CopyMem (&Ip4Config
->RouteTable
[0].SubnetMask
, &Dhcp4Mode
.SubnetMask
, sizeof (EFI_IPv4_ADDRESS
));
356 ZeroMem (&Ip4Config
->RouteTable
[0].GatewayAddress
, sizeof (EFI_IPv4_ADDRESS
));
359 // Create a route if there is a default router.
361 if (!EFI_IP4_EQUAL (&Dhcp4Mode
.RouterAddress
, &mZeroIp4Addr
)) {
362 Ip4Config
->RouteTableSize
= 2;
364 ZeroMem (&Ip4Config
->RouteTable
[1].SubnetAddress
, sizeof (EFI_IPv4_ADDRESS
));
365 ZeroMem (&Ip4Config
->RouteTable
[1].SubnetMask
, sizeof (EFI_IPv4_ADDRESS
));
366 CopyMem (&Ip4Config
->RouteTable
[1].GatewayAddress
, &Dhcp4Mode
.RouterAddress
, sizeof (EFI_IPv4_ADDRESS
));
369 Instance
->Result
= EFI_SUCCESS
;
372 // ignore the return status of EfiNicIp4ConfigSetInfo. Network
373 // stack can operate even that failed.
375 EfiNicIp4ConfigSetInfo (&Instance
->NicIp4Protocol
, Instance
->NicConfig
, FALSE
);
379 gBS
->SignalEvent (Instance
->DoneEvent
);
380 Ip4ConfigCleanDhcp4 (Instance
);
382 NetLibDispatchDpc ();
388 Starts running the configuration policy for the EFI IPv4 Protocol driver.
390 The Start() function is called to determine and to begin the platform
391 configuration policy by the EFI IPv4 Protocol driver. This determination may
392 be as simple as returning EFI_UNSUPPORTED if there is no EFI IPv4 Protocol
393 driver configuration policy. It may be as involved as loading some defaults
394 from nonvolatile storage, downloading dynamic data from a DHCP server, and
395 checking permissions with a site policy server.
396 Starting the configuration policy is just the beginning. It may finish almost
397 instantly or it may take several minutes before it fails to retrieve configuration
398 information from one or more servers. Once the policy is started, drivers
399 should use the DoneEvent parameter to determine when the configuration policy
400 has completed. EFI_IP4_CONFIG_PROTOCOL.GetData() must then be called to
401 determine if the configuration succeeded or failed.
402 Until the configuration completes successfully, EFI IPv4 Protocol driver instances
403 that are attempting to use default configurations must return EFI_NO_MAPPING.
404 Once the configuration is complete, the EFI IPv4 Configuration Protocol driver
405 signals DoneEvent. The configuration may need to be updated in the future,
406 however; in this case, the EFI IPv4 Configuration Protocol driver must signal
407 ReconfigEvent, and all EFI IPv4 Protocol driver instances that are using default
408 configurations must return EFI_NO_MAPPING until the configuration policy has
411 @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.
412 @param DoneEvent Event that will be signaled when the EFI IPv4
413 Protocol driver configuration policy completes
414 execution. This event must be of type EVT_NOTIFY_SIGNAL.
415 @param ReconfigEvent Event that will be signaled when the EFI IPv4
416 Protocol driver configuration needs to be updated.
417 This event must be of type EVT_NOTIFY_SIGNAL.
419 @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol
420 driver is now running.
421 @retval EFI_INVALID_PARAMETER One or more of the following parameters is NULL:
425 @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated.
426 @retval EFI_ALREADY_STARTED The configuration policy for the EFI IPv4 Protocol
427 driver was already started.
428 @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred.
429 @retval EFI_UNSUPPORTED This interface does not support the EFI IPv4 Protocol
430 driver configuration.
436 IN EFI_IP4_CONFIG_PROTOCOL
*This
,
437 IN EFI_EVENT DoneEvent
,
438 IN EFI_EVENT ReconfigEvent
441 IP4_CONFIG_INSTANCE
*Instance
;
442 EFI_DHCP4_PROTOCOL
*Dhcp4
;
443 EFI_DHCP4_MODE_DATA Dhcp4Mode
;
444 EFI_DHCP4_PACKET_OPTION
*OptionList
[1];
445 IP4_CONFIG_DHCP4_OPTION ParaList
;
450 if ((This
== NULL
) || (DoneEvent
== NULL
) || (ReconfigEvent
== NULL
)) {
451 return EFI_INVALID_PARAMETER
;
454 Instance
= IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (This
);
456 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
458 if (Instance
->State
!= IP4_CONFIG_STATE_IDLE
) {
459 Status
= EFI_ALREADY_STARTED
;
464 Instance
->DoneEvent
= DoneEvent
;
465 Instance
->ReconfigEvent
= ReconfigEvent
;
467 Instance
->NicConfig
= Ip4ConfigGetNicInfo (&Instance
->NicAddr
);
469 if (Instance
->NicConfig
== NULL
) {
470 Source
= IP4_CONFIG_SOURCE_DHCP
;
472 Source
= Instance
->NicConfig
->Source
;
476 // If the source is static, the auto configuration is done.
479 if (Source
== IP4_CONFIG_SOURCE_STATIC
) {
480 Instance
->State
= IP4_CONFIG_STATE_CONFIGURED
;
481 Instance
->Result
= EFI_SUCCESS
;
483 gBS
->SignalEvent (Instance
->DoneEvent
);
484 Status
= EFI_SUCCESS
;
489 // Start the dhcp process
491 ASSERT ((Source
== IP4_CONFIG_SOURCE_DHCP
) && (Instance
->Dhcp4
== NULL
));
493 Status
= NetLibCreateServiceChild (
494 Instance
->Controller
,
496 &gEfiDhcp4ServiceBindingProtocolGuid
,
497 &Instance
->Dhcp4Handle
500 if (EFI_ERROR (Status
)) {
504 Status
= gBS
->OpenProtocol (
505 Instance
->Dhcp4Handle
,
506 &gEfiDhcp4ProtocolGuid
,
507 (VOID
**) &Instance
->Dhcp4
,
509 Instance
->Controller
,
510 EFI_OPEN_PROTOCOL_BY_DRIVER
513 if (EFI_ERROR (Status
)) {
518 // Check the current DHCP status, if the DHCP process has
519 // already finished, return now.
521 Dhcp4
= Instance
->Dhcp4
;
522 Status
= Dhcp4
->GetModeData (Dhcp4
, &Dhcp4Mode
);
524 if (EFI_ERROR (Status
)) {
528 if (Dhcp4Mode
.State
== Dhcp4Bound
) {
529 Ip4ConfigOnDhcp4Complete (NULL
, Instance
);
535 // Try to start the DHCP process. Use most of the current
536 // DHCP configuration to avoid problems if some DHCP client
537 // yields the control of this DHCP service to us.
539 ParaList
.Head
.OpCode
= DHCP_TAG_PARA_LIST
;
540 ParaList
.Head
.Length
= 2;
541 ParaList
.Head
.Data
[0] = DHCP_TAG_NETMASK
;
542 ParaList
.Route
= DHCP_TAG_ROUTER
;
543 OptionList
[0] = &ParaList
.Head
;
544 Dhcp4Mode
.ConfigData
.OptionCount
= 1;
545 Dhcp4Mode
.ConfigData
.OptionList
= OptionList
;
547 Status
= Dhcp4
->Configure (Dhcp4
, &Dhcp4Mode
.ConfigData
);
549 if (EFI_ERROR (Status
)) {
554 // Start the DHCP process
556 Status
= gBS
->CreateEvent (
559 Ip4ConfigOnDhcp4Complete
,
561 &Instance
->Dhcp4Event
564 if (EFI_ERROR (Status
)) {
568 Status
= Dhcp4
->Start (Dhcp4
, Instance
->Dhcp4Event
);
570 if (EFI_ERROR (Status
)) {
574 Instance
->State
= IP4_CONFIG_STATE_STARTED
;
575 Instance
->Result
= EFI_NOT_READY
;
578 if (EFI_ERROR (Status
)) {
579 Ip4ConfigCleanConfig (Instance
);
583 gBS
->RestoreTPL (OldTpl
);
585 NetLibDispatchDpc ();
592 Stops running the configuration policy for the EFI IPv4 Protocol driver.
594 The Stop() function stops the configuration policy for the EFI IPv4 Protocol driver.
595 All configuration data will be lost after calling Stop().
597 @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.
599 @retval EFI_SUCCESS The configuration policy for the EFI IPv4 Protocol
600 driver has been stopped.
601 @retval EFI_INVALID_PARAMETER This is NULL.
602 @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol
603 driver was not started.
609 IN EFI_IP4_CONFIG_PROTOCOL
*This
612 IP4_CONFIG_INSTANCE
*Instance
;
617 return EFI_INVALID_PARAMETER
;
620 Instance
= IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (This
);
622 Status
= EFI_SUCCESS
;
623 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
625 if (Instance
->State
== IP4_CONFIG_STATE_IDLE
) {
626 Status
= EFI_NOT_STARTED
;
631 // Release all the configure parameters. Don't signal the user
632 // event. The user wants to abort the configuration, this isn't
633 // the configuration done or reconfiguration.
635 Ip4ConfigCleanConfig (Instance
);
638 gBS
->RestoreTPL (OldTpl
);
645 Returns the default configuration data (if any) for the EFI IPv4 Protocol driver.
647 The GetData() function returns the current configuration data for the EFI IPv4
648 Protocol driver after the configuration policy has completed.
650 @param This Pointer to the EFI_IP4_CONFIG_PROTOCOL instance.
651 @param ConfigDataSize On input, the size of the ConfigData buffer.
652 On output, the count of bytes that were written
653 into the ConfigData buffer.
654 @param ConfigData Pointer to the EFI IPv4 Configuration Protocol
655 driver configuration data structure.
656 Type EFI_IP4_IPCONFIG_DATA is defined in
657 "Related Definitions" below.
659 @retval EFI_SUCCESS The EFI IPv4 Protocol driver configuration has been returned.
660 @retval EFI_INVALID_PARAMETER This is NULL.
661 @retval EFI_NOT_STARTED The configuration policy for the EFI IPv4 Protocol
662 driver is not running.
663 @retval EFI_NOT_READY EFI IPv4 Protocol driver configuration is still running.
664 @retval EFI_ABORTED EFI IPv4 Protocol driver configuration could not complete.
665 Currently not implemented.
666 @retval EFI_BUFFER_TOO_SMALL *ConfigDataSize is smaller than the configuration
667 data buffer or ConfigData is NULL.
672 EfiIp4ConfigGetData (
673 IN EFI_IP4_CONFIG_PROTOCOL
*This
,
674 IN OUT UINTN
*ConfigDataSize
,
675 OUT EFI_IP4_IPCONFIG_DATA
*ConfigData OPTIONAL
678 IP4_CONFIG_INSTANCE
*Instance
;
679 NIC_IP4_CONFIG_INFO
*NicConfig
;
684 if ((This
== NULL
) || (ConfigDataSize
== NULL
)) {
685 return EFI_INVALID_PARAMETER
;
688 Instance
= IP4_CONFIG_INSTANCE_FROM_IP4CONFIG (This
);
690 Status
= EFI_SUCCESS
;
691 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
693 if (Instance
->State
== IP4_CONFIG_STATE_IDLE
) {
694 Status
= EFI_NOT_STARTED
;
695 } else if (Instance
->State
== IP4_CONFIG_STATE_STARTED
) {
696 Status
= EFI_NOT_READY
;
699 if (EFI_ERROR (Status
)) {
704 // Copy the configure data if auto configuration succeeds.
706 Status
= Instance
->Result
;
708 if (Status
== EFI_SUCCESS
) {
709 ASSERT (Instance
->NicConfig
!= NULL
);
711 NicConfig
= Instance
->NicConfig
;
712 Len
= SIZEOF_IP4_CONFIG_INFO (&NicConfig
->Ip4Info
);
714 if ((*ConfigDataSize
< Len
) || (ConfigData
== NULL
)) {
715 Status
= EFI_BUFFER_TOO_SMALL
;
717 CopyMem (ConfigData
, &NicConfig
->Ip4Info
, Len
);
718 Ip4ConfigFixRouteTablePointer (ConfigData
);
721 *ConfigDataSize
= Len
;
725 gBS
->RestoreTPL (OldTpl
);
731 Release all the DHCP related resources.
733 @param This The IP4 configure instance
739 Ip4ConfigCleanDhcp4 (
740 IN IP4_CONFIG_INSTANCE
*This
743 if (This
->Dhcp4
!= NULL
) {
744 This
->Dhcp4
->Stop (This
->Dhcp4
);
748 &gEfiDhcp4ProtocolGuid
,
756 if (This
->Dhcp4Handle
!= NULL
) {
757 NetLibDestroyServiceChild (
760 &gEfiDhcp4ServiceBindingProtocolGuid
,
764 This
->Dhcp4Handle
= NULL
;
767 if (This
->Dhcp4Event
== NULL
) {
768 gBS
->CloseEvent (This
->Dhcp4Event
);
769 This
->Dhcp4Event
= NULL
;
775 Clean up all the configuration parameters.
777 @param Instance The IP4 configure instance
783 Ip4ConfigCleanConfig (
784 IN IP4_CONFIG_INSTANCE
*Instance
787 if (Instance
->NicConfig
!= NULL
) {
788 gBS
->FreePool (Instance
->NicConfig
);
789 Instance
->NicConfig
= NULL
;
792 Instance
->State
= IP4_CONFIG_STATE_IDLE
;
793 Instance
->DoneEvent
= NULL
;
794 Instance
->ReconfigEvent
= NULL
;
796 Ip4ConfigCleanDhcp4 (Instance
);
799 EFI_IP4_CONFIG_PROTOCOL mIp4ConfigProtocolTemplate
= {
805 EFI_NIC_IP4_CONFIG_PROTOCOL mNicIp4ConfigProtocolTemplate
= {
806 EfiNicIp4ConfigGetName
,
807 EfiNicIp4ConfigGetInfo
,
808 EfiNicIp4ConfigSetInfo