The implementation for Shell command ifconfig based on IP4Config2 protocol.\r
\r
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
The clean process of the ifconfig command to clear interface info.\r
\r
@param[in] IfList The pointer of IfList(interface list).\r
+ @param[in] IfName The pointer of interface name.\r
\r
@retval SHELL_SUCCESS The ifconfig command clean processed successfully.\r
@retval others The ifconfig command clean process failed.\r
**/\r
SHELL_STATUS\r
IfConfigClearInterfaceInfo (\r
- IN LIST_ENTRY *IfList\r
+ IN LIST_ENTRY *IfList,\r
+ IN CHAR16 *IfName\r
)\r
{\r
EFI_STATUS Status; \r
LIST_ENTRY *Next;\r
IFCONFIG_INTERFACE_CB *IfCb;\r
EFI_IP4_CONFIG2_POLICY Policy;\r
-\r
- Policy = Ip4Config2PolicyDhcp;\r
+ \r
Status = EFI_SUCCESS;\r
ShellStatus = SHELL_SUCCESS;\r
\r
\r
//\r
// Go through the interface list.\r
+ // If the interface name is specified, DHCP DORA process will be \r
+ // triggered by the policy transition (static -> dhcp).\r
//\r
NET_LIST_FOR_EACH_SAFE (Entry, Next, IfList) {\r
IfCb = NET_LIST_USER_STRUCT (Entry, IFCONFIG_INTERFACE_CB, Link);\r
+\r
+ if ((IfName != NULL) && (StrCmp (IfName, IfCb->IfInfo->Name) == 0)) {\r
+ Policy = Ip4Config2PolicyStatic;\r
+ \r
+ Status = IfCb->IfCfg->SetData (\r
+ IfCb->IfCfg,\r
+ Ip4Config2DataTypePolicy,\r
+ sizeof (EFI_IP4_CONFIG2_POLICY),\r
+ &Policy\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork1HiiHandle, L"ifconfig");\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ break;\r
+ } \r
+ }\r
+\r
+ Policy = Ip4Config2PolicyDhcp;\r
\r
Status = IfCb->IfCfg->SetData (\r
IfCb->IfCfg,\r
break;\r
\r
case IfConfigOpClear:\r
- ShellStatus = IfConfigClearInterfaceInfo (&Private->IfList);\r
+ ShellStatus = IfConfigClearInterfaceInfo (&Private->IfList, Private->IfName);\r
break;\r
\r
case IfConfigOpSet:\r