MdeModulePkg: Update Ip4Dxe driver to support Ip4Config2 protocol,

and also add new UI configuration support in Ip4Dxe driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: jiaxinwu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17853 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jiaxinwu 2015-07-07 08:19:55 +00:00 committed by jiaxinwu
parent 01a9598e31
commit 1f6729ffe9
20 changed files with 4169 additions and 574 deletions

View File

@ -0,0 +1,25 @@
/** @file
GUIDs used as HII FormSet and HII Package list GUID in Ip4Dxe driver.
Copyright (c) 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 that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __IP4_CONFIG2_HII_GUID_H__
#define __IP4_CONFIG2_HII_GUID_H__
#define IP4_CONFIG2_NVDATA_GUID \
{ \
0x9b942747, 0x154e, 0x4d29, { 0xa4, 0x36, 0xbf, 0x71, 0x0, 0xc8, 0xb5, 0x3b } \
}
extern EFI_GUID gIp4Config2NvDataGuid;
#endif

View File

@ -267,6 +267,9 @@
## Include/Guid/Ip4ConfigHii.h
gNicIp4ConfigNvDataGuid = { 0x9d5b53f, 0xf4b0, 0x4f59, { 0xa0, 0xb1, 0x7b, 0x57, 0xd3, 0x5c, 0xe, 0x5 }}
## Include/Guid/Ip4Config2Hii.h
gIp4Config2NvDataGuid = { 0x9b942747, 0x154e, 0x4d29, { 0xa4, 0x36, 0xbf, 0x71, 0x0, 0xc8, 0xb5, 0x3b }}
## Include/Guid/VlanConfigHii.h
gVlanConfigFormSetGuid = { 0xd79df6b0, 0xef44, 0x43bd, { 0x97, 0x97, 0x43, 0xe9, 0x3b, 0xcf, 0x5f, 0xa8 }}

View File

@ -0,0 +1,100 @@
/** @file
Vfr file for IP4Dxe.
Copyright (c) 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Ip4NvData.h"
#define EFI_NETWORK_DEVICE_CLASS 0x04
formset
guid = IP4_CONFIG2_NVDATA_GUID,
title = STRING_TOKEN(STR_IP4_CONFIG2_FORM_TITLE),
help = STRING_TOKEN(STR_IP4_CONFIG2_FORM_HELP),
class = EFI_NETWORK_DEVICE_CLASS,
subclass = 0x03,
varstore IP4_CONFIG2_IFR_NVDATA,
name = IP4_CONFIG2_IFR_NVDATA,
guid = IP4_CONFIG2_NVDATA_GUID;
form formid = FORMID_MAIN_FORM,
title = STRING_TOKEN(STR_IP4_DEVICE_FORM_TITLE);
checkbox varid = IP4_CONFIG2_IFR_NVDATA.Configure,
prompt = STRING_TOKEN(STR_IP4_CONFIGURE),
help = STRING_TOKEN(STR_IP4_CONFIGURE),
flags = INTERACTIVE,
key = KEY_ENABLE,
endcheckbox;
suppressif ideqval IP4_CONFIG2_IFR_NVDATA.Configure == 0x00;
checkbox varid = IP4_CONFIG2_IFR_NVDATA.DhcpEnable,
prompt = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
help = STRING_TOKEN(STR_IP4_ENABLE_DHCP),
flags = INTERACTIVE,
key = KEY_DHCP_ENABLE,
endcheckbox;
endif;
suppressif ideqval IP4_CONFIG2_IFR_NVDATA.DhcpEnable == 0x01 OR ideqval IP4_CONFIG2_IFR_NVDATA.Configure == 0x00;
string varid = IP4_CONFIG2_IFR_NVDATA.StationAddress,
prompt = STRING_TOKEN(STR_IP4_LOCAL_IP_ADDRESS),
help = STRING_TOKEN(STR_IP4_IP_ADDRESS_HELP),
flags = INTERACTIVE,
key = KEY_LOCAL_IP,
minsize = IP_MIN_SIZE,
maxsize = IP_MAX_SIZE,
endstring;
string varid = IP4_CONFIG2_IFR_NVDATA.SubnetMask,
prompt = STRING_TOKEN(STR_IP4_LOCAL_MASK),
help = STRING_TOKEN(STR_IP4_MASK_HELP),
flags = INTERACTIVE,
key = KEY_SUBNET_MASK,
minsize = IP_MIN_SIZE,
maxsize = IP_MAX_SIZE,
endstring;
string varid = IP4_CONFIG2_IFR_NVDATA.GatewayAddress,
prompt = STRING_TOKEN(STR_IP4_LOCAL_GATEWAY),
help = STRING_TOKEN(STR_IP4_GATEWAY_HELP),
flags = INTERACTIVE,
key = KEY_GATE_WAY,
minsize = IP_MIN_SIZE,
maxsize = IP_MAX_SIZE,
endstring;
string varid = IP4_CONFIG2_IFR_NVDATA.DnsAddress,
prompt = STRING_TOKEN(STR_IP4_LOCAL_DNS),
help = STRING_TOKEN(STR_IP4_DNS_HELP),
flags = INTERACTIVE,
key = KEY_DNS,
minsize = IP_MIN_SIZE,
maxsize = ADDRESS_STR_MAX_SIZE,
endstring;
endif;
subtitle text = STRING_TOKEN(STR_NULL);
text
help = STRING_TOKEN(STR_SAVE_CHANGES),
text = STRING_TOKEN(STR_SAVE_CHANGES),
flags = INTERACTIVE,
key = KEY_SAVE_CHANGES;
endform;
endformset;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,252 @@
/** @file
Definitions for EFI IPv4 Configuration II Protocol implementation.
Copyright (c) 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
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __IP4_CONFIG2_IMPL_H__
#define __IP4_CONFIG2_IMPL_H__
#define IP4_CONFIG2_INSTANCE_SIGNATURE SIGNATURE_32 ('I', 'P', 'C', '2')
#define IP4_FORM_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('I', 'F', 'C', 'I')
#define IP4_CONFIG2_VARIABLE_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS)
#define DATA_ATTRIB_SIZE_FIXED 0x1
#define DATA_ATTRIB_VOLATILE 0x2
#define DHCP_TAG_PARA_LIST 55
#define DHCP_TAG_NETMASK 1
#define DHCP_TAG_ROUTER 3
#define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
#define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE;
#define IP4_CONFIG2_INSTANCE_FROM_PROTOCOL(Proto) \
CR ((Proto), \
IP4_CONFIG2_INSTANCE, \
Ip4Config2, \
IP4_CONFIG2_INSTANCE_SIGNATURE \
)
#define IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE(Instance) \
CR ((Instance), \
IP4_SERVICE, \
Ip4Config2Instance, \
IP4_SERVICE_SIGNATURE \
)
#define IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK(Callback) \
CR ((Callback), \
IP4_CONFIG2_INSTANCE, \
CallbackInfo, \
IP4_CONFIG2_INSTANCE_SIGNATURE \
)
#define IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS(ConfigAccess) \
CR ((ConfigAccess), \
IP4_FORM_CALLBACK_INFO, \
HiiConfigAccessProtocol, \
IP4_FORM_CALLBACK_INFO_SIGNATURE \
)
/**
The prototype of work function for EfiIp4Config2SetData().
@param[in] Instance The pointer to the IP4 config2 instance data.
@param[in] DataSize In bytes, the size of the buffer pointed to by Data.
@param[in] Data The data buffer to set.
@retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type,
8 bytes.
@retval EFI_SUCCESS The specified configuration data for the EFI IPv4
network stack was set successfully.
**/
typedef
EFI_STATUS
(*IP4_CONFIG2_SET_DATA) (
IN IP4_CONFIG2_INSTANCE *Instance,
IN UINTN DataSize,
IN VOID *Data
);
/**
The prototype of work function for EfiIp4Config2GetData().
@param[in] Instance The pointer to the IP4 config2 instance data.
@param[in, out] DataSize On input, in bytes, the size of Data. On output, in
bytes, the size of buffer required to store the specified
configuration data.
@param[in] Data The data buffer in which the configuration data is returned.
Ignored if DataSize is ZERO.
@retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
configuration data, and the required size is
returned in DataSize.
@retval EFI_SUCCESS The specified configuration data was obtained successfully.
**/
typedef
EFI_STATUS
(*IP4_CONFIG2_GET_DATA) (
IN IP4_CONFIG2_INSTANCE *Instance,
IN OUT UINTN *DataSize,
IN VOID *Data OPTIONAL
);
typedef union {
VOID *Ptr;
EFI_IP4_CONFIG2_INTERFACE_INFO *IfInfo;
EFI_IP4_CONFIG2_POLICY *Policy;
EFI_IP4_CONFIG2_MANUAL_ADDRESS *ManualAddress;
EFI_IPv4_ADDRESS *Gateway;
EFI_IPv4_ADDRESS *DnsServers;
} IP4_CONFIG2_DATA;
typedef struct {
IP4_CONFIG2_SET_DATA SetData;
IP4_CONFIG2_GET_DATA GetData;
EFI_STATUS Status;
UINT8 Attribute;
NET_MAP EventMap;
IP4_CONFIG2_DATA Data;
UINTN DataSize;
} IP4_CONFIG2_DATA_ITEM;
typedef struct {
UINT16 Offset;
UINT32 DataSize;
EFI_IP4_CONFIG2_DATA_TYPE DataType;
} IP4_CONFIG2_DATA_RECORD;
#pragma pack(1)
//
// heap data that contains the data for each data record.
//
// EFI_IP4_CONFIG2_POLICY Policy;
// UINT32 ManualaddressCount;
// UINT32 GatewayCount;
// UINT32 DnsServersCount;
// EFI_IP4_CONFIG2_MANUAL_ADDRESS ManualAddress[];
// EFI_IPv4_ADDRESS Gateway[];
// EFI_IPv4_ADDRESS DnsServers[];
//
typedef struct {
UINT16 Checksum;
UINT16 DataRecordCount;
IP4_CONFIG2_DATA_RECORD DataRecord[1];
} IP4_CONFIG2_VARIABLE;
#pragma pack()
typedef struct {
EFI_IP4_CONFIG2_POLICY Policy; ///< manual or automatic
EFI_IP4_CONFIG2_MANUAL_ADDRESS *ManualAddress; ///< IP addresses
UINT32 ManualAddressCount; ///< IP addresses count
EFI_IPv4_ADDRESS *GatewayAddress; ///< Gateway address
UINT32 GatewayAddressCount; ///< Gateway address count
EFI_IPv4_ADDRESS *DnsAddress; ///< DNS server address
UINT32 DnsAddressCount; ///< DNS server address count
} IP4_CONFIG2_NVDATA;
typedef struct _IP4_FORM_CALLBACK_INFO {
UINT32 Signature;
EFI_HANDLE ChildHandle;
EFI_HII_CONFIG_ACCESS_PROTOCOL HiiConfigAccessProtocol;
EFI_DEVICE_PATH_PROTOCOL *HiiVendorDevicePath;
EFI_HII_HANDLE RegisteredHandle;
} IP4_FORM_CALLBACK_INFO;
struct _IP4_CONFIG2_INSTANCE {
UINT32 Signature;
BOOLEAN Configured;
LIST_ENTRY Link;
UINT16 IfIndex;
EFI_IP4_CONFIG2_PROTOCOL Ip4Config2;
EFI_IP4_CONFIG2_INTERFACE_INFO InterfaceInfo;
EFI_IP4_CONFIG2_POLICY Policy;
IP4_CONFIG2_DATA_ITEM DataItem[Ip4Config2DataTypeMaximum];
EFI_EVENT Dhcp4SbNotifyEvent;
VOID *Registration;
EFI_HANDLE Dhcp4Handle;
EFI_DHCP4_PROTOCOL *Dhcp4;
BOOLEAN DhcpSuccess;
BOOLEAN OtherInfoOnly;
EFI_EVENT Dhcp4Event;
UINT32 FailedIaAddressCount;
EFI_IPv4_ADDRESS *DeclineAddress;
UINT32 DeclineAddressCount;
IP4_FORM_CALLBACK_INFO CallbackInfo;
IP4_CONFIG2_NVDATA Ip4NvData;
};
//
// Configure the DHCP to request the routers and netmask
// from server. The DHCP_TAG_NETMASK is included in Head.
//
#pragma pack(1)
typedef struct {
EFI_DHCP4_PACKET_OPTION Head;
UINT8 Route;
} IP4_CONFIG2_DHCP4_OPTION;
#pragma pack()
/**
Initialize an IP4_CONFIG2_INSTANCE.
@param[out] Instance The buffer of IP4_CONFIG2_INSTANCE to be initialized.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources to complete the operation.
@retval EFI_SUCCESS The IP4_CONFIG2_INSTANCE initialized successfully.
**/
EFI_STATUS
Ip4Config2InitInstance (
OUT IP4_CONFIG2_INSTANCE *Instance
);
/**
Release an IP4_CONFIG2_INSTANCE.
@param[in, out] Instance The buffer of IP4_CONFIG2_INSTANCE to be freed.
**/
VOID
Ip4Config2CleanInstance (
IN OUT IP4_CONFIG2_INSTANCE *Instance
);
/**
Destroy the Dhcp4 child in IP4_CONFIG2_INSTANCE and release the resources.
@param[in, out] Instance The buffer of IP4 config2 instance to be freed.
@retval EFI_SUCCESS The child was successfully destroyed.
@retval Others Failed to destroy the child.
**/
EFI_STATUS
Ip4Config2DestroyDhcp4 (
IN OUT IP4_CONFIG2_INSTANCE *Instance
);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
/** @file
The header file of IP4Config2Nv.c
Copyright (c) 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _IP4_CONFIG2NV_H_
#define _IP4_CONFIG2NV_H_
#include "Ip4Impl.h"
extern UINT8 Ip4Config2Bin[];
extern UINT8 Ip4DxeStrings[];
#define NIC_ITEM_CONFIG_SIZE (sizeof (IP4_CONFIG2_INSTANCE) + (sizeof (EFI_IPv4_ADDRESS) * MAX_IP4_CONFIG_DNS))
/**
Install HII Config Access protocol for network device and allocate resource.
@param[in, out] Instance The IP4 config2 Instance.
@retval EFI_SUCCESS The HII Config Access protocol is installed.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
@retval Others Other errors as indicated.
**/
EFI_STATUS
Ip4Config2FormInit (
IN OUT IP4_CONFIG2_INSTANCE *Instance
);
/**
Uninstall the HII Config Access protocol for network devices and free up the resources.
@param[in, out] Instance The IP4 config2 instance to unload a form.
**/
VOID
Ip4Config2FormUnload (
IN OUT IP4_CONFIG2_INSTANCE *Instance
);
#endif

View File

@ -1,7 +1,7 @@
/** @file
The driver binding and service binding protocol for IP4 driver.
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -121,7 +121,7 @@ Ip4DriverBindingSupported (
destroyed, it is marked as that in case the destroy failed and
being called again later.
@param[in] IpSb The IP4 serviceing binding instance to clean up
@param[in] IpSb The IP4 service binding instance to clean up
@retval EFI_SUCCESS The resource used by the instance are cleaned up
@retval other Failed to clean up some of the resources.
@ -166,7 +166,7 @@ Ip4CreateService (
// empty resources, so if any thing goes wrong when allocating
// resources, Ip4CleanService can be called to clean it up.
//
IpSb = AllocatePool (sizeof (IP4_SERVICE));
IpSb = AllocateZeroPool (sizeof (IP4_SERVICE));
if (IpSb == NULL) {
return EFI_OUT_OF_RESOURCES;
@ -208,11 +208,7 @@ Ip4CreateService (
ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE));
IpSb->Timer = NULL;
IpSb->Ip4Config = NULL;
IpSb->DoneEvent = NULL;
IpSb->ReconfigEvent = NULL;
IpSb->ActiveEvent = NULL;
IpSb->Timer = NULL;
//
// Create various resources. First create the route table, timer
@ -280,6 +276,13 @@ Ip4CreateService (
goto ON_ERROR;
}
IpSb->MacString = NULL;
Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &IpSb->MacString);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
IpSb->DefaultInterface = Ip4CreateInterface (IpSb->Mnp, Controller, ImageHandle);
if (IpSb->DefaultInterface == NULL) {
@ -289,6 +292,14 @@ Ip4CreateService (
InsertHeadList (&IpSb->Interfaces, &IpSb->DefaultInterface->Link);
ZeroMem (&IpSb->Ip4Config2Instance, sizeof (IP4_CONFIG2_INSTANCE));
Status = Ip4Config2InitInstance (&IpSb->Ip4Config2Instance);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
IpSb->MaxPacketSize = IpSb->SnpMode.MaxPacketSize - sizeof (IP4_HEAD);
if (NetLibGetVlanId (IpSb->Controller) != 0) {
//
@ -298,6 +309,7 @@ Ip4CreateService (
}
IpSb->OldMaxPacketSize = IpSb->MaxPacketSize;
*Service = IpSb;
return EFI_SUCCESS;
ON_ERROR:
@ -315,7 +327,7 @@ ON_ERROR:
destroyed, it is marked as that in case the destroy failed and
being called again later.
@param[in] IpSb The IP4 serviceing binding instance to clean up
@param[in] IpSb The IP4 service binding instance to clean up
@retval EFI_SUCCESS The resource used by the instance are cleaned up
@retval other Failed to clean up some of the resources.
@ -374,22 +386,12 @@ Ip4CleanService (
IpSb->Timer = NULL;
}
if (IpSb->Ip4Config != NULL) {
IpSb->Ip4Config->Stop (IpSb->Ip4Config);
gBS->CloseProtocol (
IpSb->Controller,
&gEfiIp4ConfigProtocolGuid,
IpSb->Image,
IpSb->Controller
);
gBS->CloseEvent (IpSb->DoneEvent);
gBS->CloseEvent (IpSb->ReconfigEvent);
IpSb->ActiveEvent = NULL;
IpSb->Ip4Config = NULL;
if (IpSb->MacString != NULL) {
FreePool (IpSb->MacString);
}
Ip4Config2CleanInstance (&IpSb->Ip4Config2Instance);
return EFI_SUCCESS;
}
@ -452,13 +454,13 @@ Ip4DestroyChildEntryInHandleBuffer (
EFI_STATUS
EFIAPI
Ip4DriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL * This,
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
IP4_SERVICE *IpSb;
EFI_STATUS Status;
{
EFI_STATUS Status;
IP4_SERVICE *IpSb;
//
// Test for the Ip4 service binding protocol
@ -475,12 +477,13 @@ Ip4DriverBindingStart (
if (Status == EFI_SUCCESS) {
return EFI_ALREADY_STARTED;
}
Status = Ip4CreateService (ControllerHandle, This->DriverBindingHandle, &IpSb);
if (EFI_ERROR (Status)) {
return Status;
}
ASSERT (IpSb != NULL);
//
@ -490,19 +493,23 @@ Ip4DriverBindingStart (
&ControllerHandle,
&gEfiIp4ServiceBindingProtocolGuid,
&IpSb->ServiceBinding,
&gEfiIp4Config2ProtocolGuid,
&IpSb->Ip4Config2Instance.Ip4Config2,
NULL
);
if (EFI_ERROR (Status)) {
goto FREE_SERVICE;
}
//
// ready to go: start the receiving and timer
// Ready to go: start the receiving and timer.
// Ip4Config2SetPolicy maybe call Ip4ReceiveFrame() to set the default interface's RecvRequest first after
// Ip4Config2 instance is initialized. So, EFI_ALREADY_STARTED is the allowed return status.
//
Status = Ip4ReceiveFrame (IpSb->DefaultInterface, NULL, Ip4AccpetFrame, IpSb);
if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
goto UNINSTALL_PROTOCOL;
}
@ -529,7 +536,6 @@ UNINSTALL_PROTOCOL:
FREE_SERVICE:
Ip4CleanService (IpSb);
FreePool (IpSb);
return Status;
}
@ -571,90 +577,23 @@ Ip4DriverBindingStop (
IP4_INTERFACE *IpIf;
IP4_ROUTE_TABLE *RouteTable;
//
// IP4 driver opens the MNP child, ARP children or the IP4_CONFIG protocol
// by driver. So the ControllerHandle may be the MNP child handle, ARP child
// handle, or the NIC (UNDI) handle because IP4_CONFIG protocol is installed
// in the NIC handle.
//
//
// First, check whether it is the IP4_CONFIG protocol being uninstalled.
// IP4_CONFIG protocol is installed on the NIC handle. It isn't necessary
// to clean up the default configuration if IP4_CONFIG is being stopped.
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiIp4ConfigProtocolGuid,
NULL,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
if (Status == EFI_SUCCESS) {
//
// Retrieve the IP4 service binding protocol. If failed, it is
// likely that Ip4 ServiceBinding is uninstalled already. In this
// case, return immediately.
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiIp4ServiceBindingProtocolGuid,
(VOID **) &ServiceBinding,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
BOOLEAN IsDhcp4;
IpSb = IP4_SERVICE_FROM_PROTOCOL (ServiceBinding);
if (IpSb->Ip4Config != NULL && (IpSb->State != IP4_SERVICE_DESTROY)) {
IpSb->Ip4Config->Stop (IpSb->Ip4Config);
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiIp4ConfigProtocolGuid,
IpSb->Image,
ControllerHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// If the auto configure hasn't complete, mark it as not started.
//
if (IpSb->State == IP4_SERVICE_STARTED) {
IpSb->State = IP4_SERVICE_UNSTARTED;
}
IpSb->Ip4Config = NULL;
gBS->CloseEvent (IpSb->DoneEvent);
gBS->CloseEvent (IpSb->ReconfigEvent);
}
return EFI_SUCCESS;
}
//
// Either MNP or ARP protocol is being uninstalled. The controller
// handle is either the MNP child or ARP child. But, the IP4's
// service binding is installed on the NIC handle. So, need to open
// the protocol info to find the NIC handle.
//
IsDhcp4 = FALSE;
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiManagedNetworkProtocolGuid);
if (NicHandle == NULL) {
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiArpProtocolGuid);
if (NicHandle == NULL) {
return EFI_SUCCESS;
NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiDhcp4ProtocolGuid);
if (NicHandle != NULL) {
IsDhcp4 = TRUE;
} else {
return EFI_SUCCESS;
}
}
}
//
// Retrieve the IP4 service binding protocol
//
Status = gBS->OpenProtocol (
NicHandle,
&gEfiIp4ServiceBindingProtocolGuid,
@ -666,9 +605,14 @@ Ip4DriverBindingStop (
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
IpSb = IP4_SERVICE_FROM_PROTOCOL (ServiceBinding);
IpSb = IP4_SERVICE_FROM_PROTOCOL (ServiceBinding);
if (NumberOfChildren != 0) {
if (IsDhcp4) {
Status = Ip4Config2DestroyDhcp4 (&IpSb->Ip4Config2Instance);
gBS->CloseEvent (IpSb->Ip4Config2Instance.Dhcp4Event);
IpSb->Ip4Config2Instance.Dhcp4Event = NULL;
} else if (NumberOfChildren != 0) {
List = &IpSb->Children;
Context.ServiceBinding = ServiceBinding;
Context.NumberOfChildren = NumberOfChildren;
@ -680,6 +624,7 @@ Ip4DriverBindingStop (
NULL
);
} else if (IpSb->DefaultInterface->ArpHandle == ControllerHandle) {
//
// The ARP protocol for the default interface is being uninstalled and all
// its IP child handles should have been destroyed before. So, release the
@ -704,10 +649,8 @@ Ip4DriverBindingStop (
IpSb->DefaultRouteTable = RouteTable;
Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
if (IpSb->Ip4Config != NULL && IpSb->State != IP4_SERVICE_DESTROY) {
IpSb->Ip4Config->Stop (IpSb->Ip4Config);
}
IpSb->State = IP4_SERVICE_UNSTARTED;
} else if (IsListEmpty (&IpSb->Children)) {
State = IpSb->State;
IpSb->State = IP4_SERVICE_DESTROY;
@ -721,10 +664,13 @@ Ip4DriverBindingStop (
goto ON_ERROR;
}
gBS->UninstallProtocolInterface (
gBS->UninstallMultipleProtocolInterfaces (
NicHandle,
&gEfiIp4ServiceBindingProtocolGuid,
ServiceBinding
ServiceBinding,
&gEfiIp4Config2ProtocolGuid,
&IpSb->Ip4Config2Instance.Ip4Config2,
NULL
);
if (gIp4ControllerNameTable != NULL) {

View File

@ -6,7 +6,7 @@
# subset of the Internet Control Message Protocol (ICMP) and may include support for
# the Internet Group Management Protocol (IGMP).
#
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 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
@ -60,13 +60,19 @@
Ip4Route.c
Ip4Icmp.h
Ip4Input.c
Ip4Config2Impl.c
Ip4Config2Impl.h
Ip4Config2.vfr
Ip4DxeStrings.uni
Ip4NvData.h
Ip4Config2Nv.h
Ip4Config2Nv.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
UefiLib
BaseLib
@ -76,6 +82,10 @@
DebugLib
NetLib
DpcLib
HiiLib
PrintLib
DevicePathLib
UefiHiiServicesLib
[Protocols]
## BY_START
@ -85,9 +95,21 @@
gEfiManagedNetworkServiceBindingProtocolGuid ## TO_START
gEfiManagedNetworkProtocolGuid ## TO_START
gEfiArpServiceBindingProtocolGuid ## TO_START
gEfiIp4ConfigProtocolGuid ## TO_START
gEfiIp4Config2ProtocolGuid ## TO_START
gEfiArpProtocolGuid ## TO_START
gEfiDhcp4ServiceBindingProtocolGuid ## TO_START
gEfiDhcp4ProtocolGuid ## TO_START
gEfiIpSec2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiHiiConfigAccessProtocolGuid ## BY_START
gEfiDevicePathProtocolGuid ## TO_START
[Guids]
## SOMETIMES_CONSUMES ## GUID # HiiIsConfigHdrMatch EFI_NIC_IP4_CONFIG_VARIABLE
## SOMETIMES_PRODUCES ## GUID # HiiConstructConfigHdr EFI_NIC_IP4_CONFIG_VARIABLE
## SOMETIMES_PRODUCES ## GUID # HiiGetBrowserData EFI_NIC_IP4_CONFIG_VARIABLE
## SOMETIMES_CONSUMES ## HII
gIp4Config2NvDataGuid
[UserExtensions.TianoCore."ExtraFiles"]
Ip4DxeExtra.uni

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -158,9 +158,9 @@ Ip4ProcessIcmpRedirect (
update call Ip4ProcessIcmpRedirect to update the IP instance's
route cache, otherwise, deliver the packet to upper layer.
@param[in] IpSb The IP service that received the packet.
@param[in] Head The IP head of the ICMP error packet
@param[in] Packet The content of the ICMP error with IP head
@param[in] IpSb The IP4 service that received the packet.
@param[in] Head The IP4 head of the ICMP error packet
@param[in] Packet The content of the ICMP error with IP4 head
removed.
@retval EFI_SUCCESS The ICMP error is processed successfully.
@ -200,9 +200,9 @@ Ip4ProcessIcmpError (
/**
Replay an ICMP echo request.
@param[in] IpSb The IP service that receivd the packet
@param[in] Head The IP head of the ICMP error packet
@param[in] Packet The content of the ICMP error with IP head
@param[in] IpSb The IP4 service that receivd the packet
@param[in] Head The IP4 head of the ICMP error packet
@param[in] Packet The content of the ICMP error with IP4 head
removed.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource.
@ -278,9 +278,9 @@ ON_EXIT:
Process the ICMP query message. If it is an ICMP echo
request, answer it. Otherwise deliver it to upper layer.
@param[in] IpSb The IP service that receivd the packet
@param[in] Head The IP head of the ICMP query packet
@param[in] Packet The content of the ICMP query with IP head
@param[in] IpSb The IP4 service that receivd the packet
@param[in] Head The IP4 head of the ICMP query packet
@param[in] Packet The content of the ICMP query with IP4 head
removed.
@retval EFI_INVALID_PARAMETER The packet is invalid
@ -317,9 +317,9 @@ Ip4ProcessIcmpQuery (
then according to the message types, process it as query or
error packet.
@param[in] IpSb The IP service that receivd the packet
@param[in] Head The IP head of the ICMP query packet
@param[in] Packet The content of the ICMP query with IP head
@param[in] IpSb The IP4 service that receivd the packet.
@param[in] Head The IP4 head of the ICMP query packet.
@param[in] Packet The content of the ICMP query with IP4 head
removed.
@retval EFI_INVALID_PARAMETER The packet is malformated.

View File

@ -1,7 +1,7 @@
/** @file
Header file for ICMP protocol.
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -84,9 +84,9 @@ extern EFI_IP4_ICMP_TYPE mIp4SupportedIcmp[];
then according to the message types, process it as query or
error packet.
@param[in] IpSb The IP service that receivd the packet
@param[in] Head The IP head of the ICMP query packet
@param[in] Packet The content of the ICMP query with IP head
@param[in] IpSb The IP4 service that receivd the packet.
@param[in] Head The IP4 head of the ICMP query packet.
@param[in] Packet The content of the ICMP query with IP4 head
removed.
@retval EFI_INVALID_PARAMETER The packet is malformated.

View File

@ -1,7 +1,7 @@
/** @file
Implement IP4 pesudo interface.
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -423,12 +423,12 @@ Ip4CancelFrameArp (
either queued on ARP queues or that have already been delivered to
MNP and not yet recycled.
@param[in] Interface Interface to remove the frames from
@param[in] Interface Interface to remove the frames from.
@param[in] IoStatus The transmit status returned to the frames'
callback
callback.
@param[in] FrameToCancel Function to select the frame to cancel, NULL to
select all
@param[in] Context Opaque parameters passed to FrameToCancel
select all.
@param[in] Context Opaque parameters passed to FrameToCancel.
**/
VOID
@ -476,10 +476,10 @@ Ip4CancelFrames (
the interface is configured.
@param[in] Mnp The shared MNP child of this IP4 service binding
instance
instance.
@param[in] Controller The controller this IP4 service binding instance
is installed. Most like the UNDI handle.
@param[in] ImageHandle This driver's image handle
@param[in] ImageHandle This driver's image handle.
@return Point to the created IP4_INTERFACE, otherwise NULL.
@ -542,9 +542,9 @@ Ip4CreateInterface (
Set the interface's address, create and configure
the ARP child if necessary.
@param Interface The interface to set the address
@param IpAddr The interface's IP address
@param SubnetMask The interface's netmask
@param Interface The interface to set the address.
@param IpAddr The interface's IP address.
@param SubnetMask The interface's netmask.
@retval EFI_SUCCESS The interface is configured with Ip/netmask pair,
and a ARP is created for it.
@ -566,8 +566,6 @@ Ip4SetAddress (
NET_CHECK_SIGNATURE (Interface, IP4_INTERFACE_SIGNATURE);
ASSERT (!Interface->Configured);
//
// Set the ip/netmask, then compute the subnet broadcast
// and network broadcast for easy access. When computing
@ -587,13 +585,35 @@ Ip4SetAddress (
Netmask = gIp4AllMasks[MIN (Len, Type << 3)];
Interface->NetBrdcast = (IpAddr | ~Netmask);
//
// Do clean up for Arp child
//
if (Interface->ArpHandle != NULL) {
if (Interface->Arp != NULL) {
gBS->CloseProtocol (
Interface->ArpHandle,
&gEfiArpProtocolGuid,
Interface->Image,
Interface->Controller
);
Interface->Arp = NULL;
}
NetLibDestroyServiceChild (
Interface->Controller,
Interface->Image,
&gEfiArpServiceBindingProtocolGuid,
&Interface->ArpHandle
);
Interface->ArpHandle = NULL;
}
//
// If the address is NOT all zero, create then configure an ARP child.
// Pay attention: DHCP configures its station address as 0.0.0.0/0
//
Interface->Arp = NULL;
Interface->ArpHandle = NULL;
if (IpAddr != IP4_ALLZERO_ADDRESS) {
Status = NetLibCreateServiceChild (
Interface->Controller,
@ -603,7 +623,7 @@ Ip4SetAddress (
);
if (EFI_ERROR (Status)) {
return Status;;
return Status;
}
Status = gBS->OpenProtocol (
@ -631,11 +651,11 @@ Ip4SetAddress (
if (EFI_ERROR (Status)) {
gBS->CloseProtocol (
Interface->ArpHandle,
&gEfiArpProtocolGuid,
Interface->Image,
Interface->Controller
);
Interface->ArpHandle,
&gEfiArpProtocolGuid,
Interface->Image,
Interface->Controller
);
goto ON_ERROR;
}
@ -721,7 +741,7 @@ Ip4CancelReceive (
Because the IpInstance is optional, the caller must remove
IpInstance from the interface's instance list itself.
@param[in] Interface The interface used by the IpInstance
@param[in] Interface The interface used by the IpInstance.
@param[in] IpInstance The Ip instance that free the interface. NULL if
the Ip driver is releasing the default interface.
@ -1197,14 +1217,14 @@ Ip4OnFrameReceived (
/**
Request to receive the packet from the interface.
@param[in] Interface The interface to receive the frames from
@param[in] Interface The interface to receive the frames from.
@param[in] IpInstance The instance that requests the receive. NULL for
the driver itself.
@param[in] CallBack Function to call when receive finished.
@param[in] Context Opaque parameter to the callback
@param[in] Context Opaque parameter to the callback.
@retval EFI_ALREADY_STARTED There is already a pending receive request.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to receive
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to receive.
@retval EFI_SUCCESS The recieve request has been started.
@retval other Other error occurs.

View File

@ -1,7 +1,7 @@
/** @file
Definition for IP4 pesudo interface structure.
Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -192,10 +192,10 @@ struct _IP4_INTERFACE {
the interface is configured.
@param[in] Mnp The shared MNP child of this IP4 service binding
instance
instance.
@param[in] Controller The controller this IP4 service binding instance
is installed. Most like the UNDI handle.
@param[in] ImageHandle This driver's image handle
@param[in] ImageHandle This driver's image handle.
@return Point to the created IP4_INTERFACE, otherwise NULL.
@ -211,9 +211,9 @@ Ip4CreateInterface (
Set the interface's address, create and configure
the ARP child if necessary.
@param Interface The interface to set the address
@param IpAddr The interface's IP address
@param SubnetMask The interface's netmask
@param Interface The interface to set the address.
@param IpAddr The interface's IP address.
@param SubnetMask The interface's netmask.
@retval EFI_SUCCESS The interface is configured with Ip/netmask pair,
and a ARP is created for it.
@ -234,7 +234,7 @@ Ip4SetAddress (
Because the IpInstance is optional, the caller must remove
IpInstance from the interface's instance list itself.
@param[in] Interface The interface used by the IpInstance
@param[in] Interface The interface used by the IpInstance.
@param[in] IpInstance The Ip instance that free the interface. NULL if
the Ip driver is releasing the default interface.
@ -284,12 +284,12 @@ Ip4SendFrame (
either queued on ARP queues or that have already been delivered to
MNP and not yet recycled.
@param[in] Interface Interface to remove the frames from
@param[in] Interface Interface to remove the frames from.
@param[in] IoStatus The transmit status returned to the frames'
callback
callback.
@param[in] FrameToCancel Function to select the frame to cancel, NULL to
select all
@param[in] Context Opaque parameters passed to FrameToCancel
select all.
@param[in] Context Opaque parameters passed to FrameToCancel.
**/
VOID
@ -320,14 +320,14 @@ Ip4CancelReceive (
/**
Request to receive the packet from the interface.
@param[in] Interface The interface to receive the frames from
@param[in] Interface The interface to receive the frames from.
@param[in] IpInstance The instance that requests the receive. NULL for
the driver itself.
@param[in] CallBack Function to call when receive finished.
@param[in] Context Opaque parameter to the callback
@param[in] Context Opaque parameter to the callback.
@retval EFI_ALREADY_STARTED There is already a pending receive request.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to receive
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource to receive.
@retval EFI_SUCCESS The recieve request has been started.
@retval other Other error occurs.

View File

@ -1,7 +1,7 @@
/** @file
This file implements the RFC2236: IGMP v2.
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -85,8 +85,8 @@ ON_ERROR:
Find the IGMP_GROUP structure which contains the status of multicast
group Address in this IGMP control block
@param[in] IgmpCtrl The IGMP control block to search from
@param[in] Address The multicast address to search
@param[in] IgmpCtrl The IGMP control block to search from.
@param[in] Address The multicast address to search.
@return NULL if the multicast address isn't in the IGMP control block. Otherwise
the point to the IGMP_GROUP which contains the status of multicast group
@ -119,8 +119,8 @@ Ip4FindGroup (
same MAC address. Several IP4 multicast address may be mapped to
the same MAC address.
@param[in] IgmpCtrl The IGMP control block to search in
@param[in] Mac The MAC address to search
@param[in] IgmpCtrl The IGMP control block to search in.
@param[in] Mac The MAC address to search.
@return The number of the IP4 multicast group that mapped to the same
multicast group Mac.
@ -154,14 +154,14 @@ Ip4FindMac (
Send an IGMP protocol message to the Dst, such as IGMP v1 membership report.
@param[in] IpSb The IP4 service instance that requests the
transmission
@param[in] Dst The destinaton to send to
transmission.
@param[in] Dst The destinaton to send to.
@param[in] Type The IGMP message type, such as IGMP v1 membership
report
report.
@param[in] Group The group address in the IGMP message head.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory to build the message
@retval EFI_SUCCESS The IGMP message is successfully send
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory to build the message.
@retval EFI_SUCCESS The IGMP message is successfully send.
@retval Others Failed to send the IGMP message.
**/
@ -229,10 +229,10 @@ Ip4SendIgmpMessage (
@param[in] IpSb The IP4 service instance that requests the
transmission.
@param[in] Group The group address to report
@param[in] Group The group address to report.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory to build the message
@retval EFI_SUCCESS The IGMP report message is successfully send
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory to build the message.
@retval EFI_SUCCESS The IGMP report message is successfully send.
@retval Others Failed to send the report.
**/
@ -253,11 +253,11 @@ Ip4SendIgmpReport (
/**
Join the multicast group on behalf of this IP4 child
@param[in] IpInstance The IP4 child that wants to join the group
@param[in] Address The group to join
@param[in] IpInstance The IP4 child that wants to join the group.
@param[in] Address The group to join.
@retval EFI_SUCCESS Successfully join the multicast group
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources
@retval EFI_SUCCESS Successfully join the multicast group.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
@retval Others Failed to join the multicast group.
**/
@ -334,10 +334,10 @@ ON_ERROR:
Leave the IP4 multicast group on behalf of IpInstance.
@param[in] IpInstance The IP4 child that wants to leave the group
address
@param[in] Address The group address to leave
address.
@param[in] Address The group address to leave.
@retval EFI_NOT_FOUND The IP4 service instance isn't in the group
@retval EFI_NOT_FOUND The IP4 service instance isn't in the group.
@retval EFI_SUCCESS Successfully leave the multicast group.
@retval Others Failed to leave the multicast group.
@ -403,9 +403,9 @@ Ip4LeaveGroup (
/**
Handle the received IGMP message for the IP4 service instance.
@param[in] IpSb The IP4 service instance that received the message
@param[in] Head The IP4 header of the received message
@param[in] Packet The IGMP message, without IP4 header
@param[in] IpSb The IP4 service instance that received the message.
@param[in] Head The IP4 header of the received message.
@param[in] Packet The IGMP message, without IP4 header.
@retval EFI_INVALID_PARAMETER The IGMP message is malformated.
@retval EFI_SUCCESS The IGMP message is successfully processed.
@ -509,7 +509,7 @@ Ip4IgmpHandle (
2. Decrease the report timer for each IGMP group in "delaying
member" state.
@param[in] IpSb The IP4 service instance that is ticking
@param[in] IpSb The IP4 service instance that is ticking.
**/
VOID
@ -553,9 +553,9 @@ Ip4IgmpTicking (
assume the byte order of the both Source and Addr, the
network byte order is used by the caller.
@param[in] Source The array of group addresses to add to
@param[in] Count The number of group addresses in the Source
@param[in] Addr The IP4 multicast address to add
@param[in] Source The array of group addresses to add to.
@param[in] Count The number of group addresses in the Source.
@param[in] Addr The IP4 multicast address to add.
@return NULL if failed to allocate memory for the new groups,
otherwise the new combined group addresses.
@ -589,9 +589,9 @@ Ip4CombineGroups (
both Groups and Addr, the network byte order is used by
the caller.
@param Groups The array of group addresses to remove from
@param Count The number of group addresses in the Groups
@param Addr The IP4 multicast address to remove
@param Groups The array of group addresses to remove from.
@param Count The number of group addresses in the Groups.
@param Addr The IP4 multicast address to remove.
@return The nubmer of group addresses in the Groups after remove.
It is Count if the Addr isn't in the Groups.

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2005 - 2009, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -78,11 +78,11 @@ Ip4InitIgmp (
/**
Join the multicast group on behalf of this IP4 child
@param[in] IpInstance The IP4 child that wants to join the group
@param[in] Address The group to join
@param[in] IpInstance The IP4 child that wants to join the group.
@param[in] Address The group to join.
@retval EFI_SUCCESS Successfully join the multicast group
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources
@retval EFI_SUCCESS Successfully join the multicast group.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
@retval Others Failed to join the multicast group.
**/
@ -96,10 +96,10 @@ Ip4JoinGroup (
Leave the IP4 multicast group on behalf of IpInstance.
@param[in] IpInstance The IP4 child that wants to leave the group
address
@param[in] Address The group address to leave
address.
@param[in] Address The group address to leave.
@retval EFI_NOT_FOUND The IP4 service instance isn't in the group
@retval EFI_NOT_FOUND The IP4 service instance isn't in the group.
@retval EFI_SUCCESS Successfully leave the multicast group.
@retval Others Failed to leave the multicast group.
@ -113,9 +113,9 @@ Ip4LeaveGroup (
/**
Handle the received IGMP message for the IP4 service instance.
@param[in] IpSb The IP4 service instance that received the message
@param[in] Head The IP4 header of the received message
@param[in] Packet The IGMP message, without IP4 header
@param[in] IpSb The IP4 service instance that received the message.
@param[in] Head The IP4 header of the received message.
@param[in] Packet The IGMP message, without IP4 header.
@retval EFI_INVALID_PARAMETER The IGMP message is malformated.
@retval EFI_SUCCESS The IGMP message is successfully processed.
@ -136,7 +136,7 @@ Ip4IgmpHandle (
2. Decrease the report timer for each IGMP group in "delaying
member" state.
@param[in] IpSb The IP4 service instance that is ticking
@param[in] IpSb The IP4 service instance that is ticking.
**/
VOID
@ -151,9 +151,9 @@ Ip4IgmpTicking (
assume the byte order of the both Source and Addr, the
network byte order is used by the caller.
@param[in] Source The array of group addresses to add to
@param[in] Count The number of group addresses in the Source
@param[in] Addr The IP4 multicast address to add
@param[in] Source The array of group addresses to add to.
@param[in] Count The number of group addresses in the Source.
@param[in] Addr The IP4 multicast address to add.
@return NULL if failed to allocate memory for the new groups,
otherwise the new combined group addresses.
@ -172,9 +172,9 @@ Ip4CombineGroups (
both Groups and Addr, the network byte order is used by
the caller.
@param Groups The array of group addresses to remove from
@param Count The number of group addresses in the Groups
@param Addr The IP4 multicast address to remove
@param Groups The array of group addresses to remove from.
@param Count The number of group addresses in the Groups.
@param Addr The IP4 multicast address to remove.
@return The nubmer of group addresses in the Groups after remove.
It is Count if the Addr isn't in the Groups.
@ -191,8 +191,8 @@ Ip4RemoveGroupAddr (
Find the IGMP_GROUP structure which contains the status of multicast
group Address in this IGMP control block
@param[in] IgmpCtrl The IGMP control block to search from
@param[in] Address The multicast address to search
@param[in] IgmpCtrl The IGMP control block to search from.
@param[in] Address The multicast address to search.
@return NULL if the multicast address isn't in the IGMP control block. Otherwise
the point to the IGMP_GROUP which contains the status of multicast group

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -530,303 +530,6 @@ Ip4ServiceConfigMnp (
}
/**
The event handle for IP4 auto configuration. If IP is asked
to reconfigure the default address. The original default
interface and route table are removed as the default. If there
is active IP children using the default address, the interface
will remain valid until all the children have freed their
references. If IP is signalled when auto configuration is done,
it will configure the default interface and default route table
with the configuration information retrieved by IP4_CONFIGURE.
@param[in] Context The IP4 service binding instance.
**/
VOID
EFIAPI
Ip4AutoConfigCallBackDpc (
IN VOID *Context
)
{
EFI_IP4_CONFIG_PROTOCOL *Ip4Config;
EFI_IP4_IPCONFIG_DATA *Data;
EFI_IP4_ROUTE_TABLE *RouteEntry;
IP4_SERVICE *IpSb;
IP4_ROUTE_TABLE *RouteTable;
IP4_INTERFACE *IpIf;
EFI_STATUS Status;
UINTN Len;
UINT32 Index;
IP4_ADDR StationAddress;
IP4_ADDR SubnetMask;
IP4_ADDR SubnetAddress;
IP4_ADDR GatewayAddress;
IP4_PROTOCOL *Ip4Instance;
EFI_ARP_PROTOCOL *Arp;
LIST_ENTRY *Entry;
IpSb = (IP4_SERVICE *) Context;
NET_CHECK_SIGNATURE (IpSb, IP4_SERVICE_SIGNATURE);
Ip4Config = IpSb->Ip4Config;
//
// IP is asked to do the reconfiguration. If the default interface
// has been configured, release the default interface and route
// table, then create a new one. If there are some IP children
// using it, the interface won't be physically freed until all the
// children have released their reference to it. Also remember to
// restart the receive on the default address. IP4 driver only receive
// frames on the default address, and when the default interface is
// freed, Ip4AcceptFrame won't be informed.
//
if (IpSb->ActiveEvent == IpSb->ReconfigEvent) {
if (IpSb->DefaultInterface->Configured) {
IpIf = Ip4CreateInterface (IpSb->Mnp, IpSb->Controller, IpSb->Image);
if (IpIf == NULL) {
return;
}
RouteTable = Ip4CreateRouteTable ();
if (RouteTable == NULL) {
Ip4FreeInterface (IpIf, NULL);
return;
}
Ip4CancelReceive (IpSb->DefaultInterface);
Ip4FreeInterface (IpSb->DefaultInterface, NULL);
Ip4FreeRouteTable (IpSb->DefaultRouteTable);
IpSb->DefaultInterface = IpIf;
InsertHeadList (&IpSb->Interfaces, &IpIf->Link);
IpSb->DefaultRouteTable = RouteTable;
Ip4ReceiveFrame (IpIf, NULL, Ip4AccpetFrame, IpSb);
}
Ip4Config->Stop (Ip4Config);
Ip4Config->Start (Ip4Config, IpSb->DoneEvent, IpSb->ReconfigEvent);
return ;
}
//
// Get the configure data in two steps: get the length then the data.
//
Len = 0;
if (Ip4Config->GetData (Ip4Config, &Len, NULL) != EFI_BUFFER_TOO_SMALL) {
return ;
}
Data = AllocatePool (Len);
if (Data == NULL) {
return ;
}
Status = Ip4Config->GetData (Ip4Config, &Len, Data);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
IpIf = IpSb->DefaultInterface;
//
// If the default address has been configured don't change it.
// This is unlikely to happen if EFI_IP4_CONFIG protocol has
// informed us to reconfigure each time it wants to change the
// configuration parameters.
//
if (IpIf->Configured) {
goto ON_EXIT;
}
//
// Set the default interface's address, then add a directed
// route for it, that is, the route whose nexthop is zero.
//
StationAddress = EFI_NTOHL (Data->StationAddress);
SubnetMask = EFI_NTOHL (Data->SubnetMask);
Status = Ip4SetAddress (IpIf, StationAddress, SubnetMask);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
if (IpIf->Arp != NULL) {
//
// A non-NULL IpIf->Arp here means a new ARP child is created when setting default address,
// but some IP children may have referenced the default interface before it is configured,
// these IP instances also consume this ARP protocol so they need to open it BY_CHILD_CONTROLLER.
//
Arp = NULL;
NET_LIST_FOR_EACH (Entry, &IpIf->IpInstances) {
Ip4Instance = NET_LIST_USER_STRUCT_S (Entry, IP4_PROTOCOL, AddrLink, IP4_PROTOCOL_SIGNATURE);
Status = gBS->OpenProtocol (
IpIf->ArpHandle,
&gEfiArpProtocolGuid,
(VOID **) &Arp,
gIp4DriverBinding.DriverBindingHandle,
Ip4Instance->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
}
}
Ip4AddRoute (
IpSb->DefaultRouteTable,
StationAddress,
SubnetMask,
IP4_ALLZERO_ADDRESS
);
//
// Add routes returned by EFI_IP4_CONFIG protocol.
//
for (Index = 0; Index < Data->RouteTableSize; Index++) {
RouteEntry = &Data->RouteTable[Index];
SubnetAddress = EFI_NTOHL (RouteEntry->SubnetAddress);
SubnetMask = EFI_NTOHL (RouteEntry->SubnetMask);
GatewayAddress = EFI_NTOHL (RouteEntry->GatewayAddress);
Ip4AddRoute (IpSb->DefaultRouteTable, SubnetAddress, SubnetMask, GatewayAddress);
}
IpSb->State = IP4_SERVICE_CONFIGED;
ON_EXIT:
FreePool (Data);
}
/**
Request Ip4AutoConfigCallBackDpc as a DPC at TPL_CALLBACK.
@param Event The event that is signalled.
@param Context The IP4 service binding instance.
**/
VOID
EFIAPI
Ip4AutoConfigCallBack (
IN EFI_EVENT Event,
IN VOID *Context
)
{
IP4_SERVICE *IpSb;
IpSb = (IP4_SERVICE *) Context;
IpSb->ActiveEvent = Event;
//
// Request Ip4AutoConfigCallBackDpc as a DPC at TPL_CALLBACK
//
QueueDpc (TPL_CALLBACK, Ip4AutoConfigCallBackDpc, Context);
}
/**
Start the auto configuration for this IP service instance.
It will locates the EFI_IP4_CONFIG_PROTOCOL, then start the
auto configuration.
@param[in] IpSb The IP4 service instance to configure
@retval EFI_SUCCESS The auto configuration is successfull started
@retval Others Failed to start auto configuration.
**/
EFI_STATUS
Ip4StartAutoConfig (
IN IP4_SERVICE *IpSb
)
{
EFI_IP4_CONFIG_PROTOCOL *Ip4Config;
EFI_STATUS Status;
if (IpSb->State > IP4_SERVICE_UNSTARTED) {
return EFI_SUCCESS;
}
//
// Create the DoneEvent and ReconfigEvent to call EFI_IP4_CONFIG
//
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
Ip4AutoConfigCallBack,
IpSb,
&IpSb->DoneEvent
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
Ip4AutoConfigCallBack,
IpSb,
&IpSb->ReconfigEvent
);
if (EFI_ERROR (Status)) {
goto CLOSE_DONE_EVENT;
}
//
// Open the EFI_IP4_CONFIG protocol then start auto configure
//
Status = gBS->OpenProtocol (
IpSb->Controller,
&gEfiIp4ConfigProtocolGuid,
(VOID **) &Ip4Config,
IpSb->Image,
IpSb->Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE
);
if (EFI_ERROR (Status)) {
Status = EFI_UNSUPPORTED;
goto CLOSE_RECONFIG_EVENT;
}
Status = Ip4Config->Start (Ip4Config, IpSb->DoneEvent, IpSb->ReconfigEvent);
if (EFI_ERROR (Status)) {
gBS->CloseProtocol (
IpSb->Controller,
&gEfiIp4ConfigProtocolGuid,
IpSb->Image,
IpSb->Controller
);
goto CLOSE_RECONFIG_EVENT;
}
IpSb->Ip4Config = Ip4Config;
IpSb->State = IP4_SERVICE_STARTED;
return Status;
CLOSE_RECONFIG_EVENT:
gBS->CloseEvent (IpSb->ReconfigEvent);
IpSb->ReconfigEvent = NULL;
CLOSE_DONE_EVENT:
gBS->CloseEvent (IpSb->DoneEvent);
IpSb->DoneEvent = NULL;
return Status;
}
/**
Intiialize the IP4_PROTOCOL structure to the unconfigured states.
@ -860,6 +563,7 @@ Ip4InitProtocol (
}
/**
Configure the IP4 child. If the child is already configured,
change the configuration parameter. Otherwise configure it
@ -974,11 +678,8 @@ Ip4ConfigProtocol (
// been started, start it.
//
if (IpSb->State == IP4_SERVICE_UNSTARTED) {
Status = Ip4StartAutoConfig (IpSb);
if (EFI_ERROR (Status)) {
goto ON_ERROR;
}
Status = EFI_NO_MAPPING;
goto ON_ERROR;
}
IpIf = IpSb->DefaultInterface;
@ -1038,8 +739,8 @@ ON_ERROR:
@param[in] IpInstance The IP4 child to clean up.
@retval EFI_SUCCESS The IP4 child is cleaned up
@retval EFI_DEVICE_ERROR Some resources failed to be released
@retval EFI_SUCCESS The IP4 child is cleaned up.
@retval EFI_DEVICE_ERROR Some resources failed to be released.
**/
EFI_STATUS
@ -1112,11 +813,11 @@ Ip4CleanProtocol (
address. Only continuous netmasks are supported. and check
that StationAddress is a unicast address on the newtwork.
@param[in] Ip The IP address to validate
@param[in] Netmask The netmaks of the IP
@param[in] Ip The IP address to validate.
@param[in] Netmask The netmaks of the IP.
@retval TRUE The Ip/Netmask pair is valid
@retval FALSE The Ip/Netmask pair is invalid
@retval TRUE The Ip/Netmask pair is valid.
@retval FALSE The Ip/Netmask pair is invalid.
**/
BOOLEAN
@ -1322,12 +1023,12 @@ ON_EXIT:
should make sure that the parameters is valid.
@param[in] IpInstance The IP4 child to change the setting.
@param[in] JoinFlag TRUE to join the group, otherwise leave it
@param[in] GroupAddress The target group address
@param[in] JoinFlag TRUE to join the group, otherwise leave it.
@param[in] GroupAddress The target group address.
@retval EFI_ALREADY_STARTED Want to join the group, but already a member of it
@retval EFI_ALREADY_STARTED Want to join the group, but already a member of it.
@retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.
@retval EFI_DEVICE_ERROR Failed to set the group configuraton
@retval EFI_DEVICE_ERROR Failed to set the group configuraton.
@retval EFI_SUCCESS Successfully updated the group setting.
@retval EFI_NOT_FOUND Try to leave the group which it isn't a member.
@ -1624,10 +1325,10 @@ ON_EXIT:
@param[in] Map The container of either user's transmit or receive
token.
@param[in] Item Current item to check against
@param[in] Item Current item to check against.
@param[in] Context The Token to check againist.
@retval EFI_ACCESS_DENIED The token or event has already been enqueued in IP
@retval EFI_ACCESS_DENIED The token or event has already been enqueued in IP.
@retval EFI_SUCCESS The current item isn't the same token/event as the
context.
@ -1800,7 +1501,7 @@ Ip4TxTokenValid (
are bound together. Check the comments in Ip4Output for information
about IP fragmentation.
@param[in] Context The token's wrap
@param[in] Context The token's wrap.
**/
VOID
@ -1848,9 +1549,9 @@ Ip4FreeTxToken (
The callback function to Ip4Output to update the transmit status.
@param Ip4Instance The Ip4Instance that request the transmit.
@param Packet The user's transmit request
@param IoStatus The result of the transmission
@param Flag Not used during transmission
@param Packet The user's transmit request.
@param IoStatus The result of the transmission.
@param Flag Not used during transmission.
@param Context The token's wrap.
**/
@ -1911,7 +1612,7 @@ Ip4OnPacketSent (
@retval EFI_BAD_BUFFER_SIZE The length of the IPv4 header + option length + total data length is
greater than MTU (or greater than the maximum packet size if
Token.Packet.TxData.OverrideData.
DoNotFragment is TRUE.)
DoNotFragment is TRUE).
**/
EFI_STATUS
@ -2262,9 +1963,9 @@ ON_EXIT:
Because Ip4CancelPacket and other functions are all called in
line, so, after Ip4CancelPacket returns, the Item has been freed.
@param[in] Map The IP4 child's transmit queue
@param[in] Item The current transmitted packet to test.
@param[in] Context The user's token to cancel.
@param[in] Map The IP4 child's transmit queue.
@param[in] Item The current transmitted packet to test.
@param[in] Context The user's token to cancel.
@retval EFI_SUCCESS Continue to check the next Item.
@retval EFI_ABORTED The user's Token (Token != NULL) is cancelled.
@ -2316,9 +2017,9 @@ Ip4CancelTxTokens (
Cancel the receive request. This is quiet simple, because
it is only enqueued in our local receive map.
@param[in] Map The IP4 child's receive queue
@param[in] Item Current receive request to cancel.
@param[in] Context The user's token to cancel
@param[in] Map The IP4 child's receive queue.
@param[in] Item Current receive request to cancel.
@param[in] Context The user's token to cancel.
@retval EFI_SUCCESS Continue to check the next receive request on the
queue.
@ -2361,13 +2062,13 @@ Ip4CancelRxTokens (
/**
Cancel the user's receive/transmit request.
@param[in] IpInstance The IP4 child
@param[in] IpInstance The IP4 child.
@param[in] Token The token to cancel. If NULL, all token will be
cancelled.
@retval EFI_SUCCESS The token is cancelled
@retval EFI_SUCCESS The token is cancelled.
@retval EFI_NOT_FOUND The token isn't found on either the
transmit/receive queue
transmit/receive queue.
@retval EFI_DEVICE_ERROR Not all token is cancelled when Token is NULL.
**/
@ -2563,10 +2264,10 @@ EfiIp4Poll (
packets.
@param[in] Map The IP4 child's transmit map.
@param[in] Item Current transmitted packet
@param[in] Item Current transmitted packet.
@param[in] Context Not used.
@retval EFI_SUCCESS Always returns EFI_SUCCESS
@retval EFI_SUCCESS Always returns EFI_SUCCESS.
**/
EFI_STATUS

View File

@ -1,7 +1,7 @@
/** @file
Ip4 internal functions and type defintions.
Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -19,9 +19,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/IpSec.h>
#include <Protocol/Ip4.h>
#include <Protocol/Ip4Config.h>
#include <Protocol/Ip4Config2.h>
#include <Protocol/Arp.h>
#include <Protocol/ManagedNetwork.h>
#include <Protocol/Dhcp4.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiConfigAccess.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
@ -34,6 +37,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h>
#include <Library/DpcLib.h>
#include <Library/PrintLib.h>
#include <Library/DevicePathLib.h>
#include <Library/HiiLib.h>
#include <Library/UefiHiiServicesLib.h>
#include "Ip4Common.h"
#include "Ip4Driver.h"
@ -44,6 +50,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Ip4Route.h"
#include "Ip4Input.h"
#include "Ip4Output.h"
#include "Ip4Config2Impl.h"
#include "Ip4Config2Nv.h"
#include "Ip4NvData.h"
#define IP4_PROTOCOL_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'P')
#define IP4_SERVICE_SIGNATURE SIGNATURE_32 ('I', 'P', '4', 'S')
@ -195,12 +204,11 @@ struct _IP4_SERVICE {
EFI_EVENT Timer;
//
// Auto configure staff
// IPv4 Configuration II Protocol instance
//
EFI_IP4_CONFIG_PROTOCOL *Ip4Config;
EFI_EVENT DoneEvent;
EFI_EVENT ReconfigEvent;
EFI_EVENT ActiveEvent;
IP4_CONFIG2_INSTANCE Ip4Config2Instance;
CHAR16 *MacString;
UINT32 MaxPacketSize;
UINT32 OldMaxPacketSize; ///< The MTU before IPsec enable.
@ -212,6 +220,10 @@ struct _IP4_SERVICE {
#define IP4_SERVICE_FROM_PROTOCOL(Sb) \
CR ((Sb), IP4_SERVICE, ServiceBinding, IP4_SERVICE_SIGNATURE)
#define IP4_SERVICE_FROM_CONFIG2_INSTANCE(This) \
CR (This, IP4_SERVICE, Ip4Config2Instance, IP4_SERVICE_SIGNATURE)
#define IP4_NO_MAPPING(IpInstance) (!(IpInstance)->Interface->Configured)
extern EFI_IP4_PROTOCOL mEfiIp4ProtocolTemplete;
@ -258,8 +270,8 @@ Ip4InitProtocol (
@param[in] IpInstance The IP4 child to clean up.
@retval EFI_SUCCESS The IP4 child is cleaned up
@retval EFI_DEVICE_ERROR Some resources failed to be released
@retval EFI_SUCCESS The IP4 child is cleaned up.
@retval EFI_DEVICE_ERROR Some resources failed to be released.
**/
EFI_STATUS
@ -270,13 +282,13 @@ Ip4CleanProtocol (
/**
Cancel the user's receive/transmit request.
@param[in] IpInstance The IP4 child
@param[in] IpInstance The IP4 child.
@param[in] Token The token to cancel. If NULL, all token will be
cancelled.
@retval EFI_SUCCESS The token is cancelled
@retval EFI_SUCCESS The token is cancelled.
@retval EFI_NOT_FOUND The token isn't found on either the
transmit/receive queue
transmit/receive queue.
@retval EFI_DEVICE_ERROR Not all token is cancelled when Token is NULL.
**/
@ -333,10 +345,10 @@ Ip4TimerTicking (
packets.
@param[in] Map The IP4 child's transmit map.
@param[in] Item Current transmitted packet
@param[in] Item Current transmitted packet.
@param[in] Context Not used.
@retval EFI_SUCCESS Always returns EFI_SUCCESS
@retval EFI_SUCCESS Always returns EFI_SUCCESS.
**/
EFI_STATUS
@ -365,7 +377,7 @@ Ip4SentPacketTicking (
are bound together. Check the comments in Ip4Output for information
about IP fragmentation.
@param[in] Context The token's wrap
@param[in] Context The token's wrap.
**/
VOID

View File

@ -0,0 +1,51 @@
/** @file
Routines used to operate the Ip4Dxe.
Copyright (c) 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<BR>
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _IP4_NV_DATA_H_
#define _IP4_NV_DATA_H_
#include <Guid/Ip4Config2Hii.h>
#define FORMID_MAIN_FORM 1
#define FORMID_DEVICE_FORM 2
#define KEY_ENABLE 0x100
#define KEY_DHCP_ENABLE 0x101
#define KEY_LOCAL_IP 0x102
#define KEY_SUBNET_MASK 0x103
#define KEY_GATE_WAY 0x104
#define KEY_DNS 0x105
#define KEY_SAVE_CHANGES 0x106
#define IP_MIN_SIZE 7
#define IP_MAX_SIZE 15
#define IP4_STR_MAX_SIZE 16
#define ADDRESS_STR_MAX_SIZE 255
#define MAX_IP4_CONFIG_DNS 16
///
/// IP4_CONFIG2_IFR_NVDATA contains the IP4 configure
/// parameters for that NIC.
///
typedef struct {
UINT8 Configure; ///< NIC configure status
UINT8 DhcpEnable; ///< Static or DHCP
CHAR16 StationAddress[IP4_STR_MAX_SIZE]; ///< IP addresses
CHAR16 SubnetMask[IP4_STR_MAX_SIZE]; ///< Subnet address
CHAR16 GatewayAddress[IP4_STR_MAX_SIZE]; ///< Gateway address
CHAR16 DnsAddress[ADDRESS_STR_MAX_SIZE]; ///< DNS server address
} IP4_CONFIG2_IFR_NVDATA;
#endif

View File

@ -1,7 +1,7 @@
/** @file
Transmit the IP4 packet.
Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 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
@ -312,6 +312,13 @@ Ip4Output (
CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);
} else {
CacheEntry = Ip4Route (IpInstance->RouteTable, Head->Dst, Head->Src);
//
// If failed to route the packet by using the instance's route table,
// try to use the default route table.
//
if (CacheEntry == NULL) {
CacheEntry = Ip4Route (IpSb->DefaultRouteTable, Head->Dst, Head->Src);
}
}
if (CacheEntry == NULL) {