ShellPkg: Fix issue about Ifconfig6 -r command.
Follow the Shell Spec, when the interface name is Specified, we need to refresh the Ipv6 configuration. Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
@ -1057,6 +1057,7 @@ IfConfig6ShowInterfaceInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_BREAK), gShellNetwork2HiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_BREAK), gShellNetwork2HiiHandle);
|
||||||
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_NEWLINE), gShellNetwork2HiiHandle);
|
||||||
|
|
||||||
return SHELL_SUCCESS;
|
return SHELL_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1065,6 +1066,7 @@ IfConfig6ShowInterfaceInfo (
|
|||||||
The clean process of the IfConfig6 application.
|
The clean process of the IfConfig6 application.
|
||||||
|
|
||||||
@param[in] IfList The pointer of IfList(interface list).
|
@param[in] IfList The pointer of IfList(interface list).
|
||||||
|
@param[in] IfName The pointer of interface name.
|
||||||
|
|
||||||
@retval SHELL_SUCCESS The IfConfig6 clean processed successfully.
|
@retval SHELL_SUCCESS The IfConfig6 clean processed successfully.
|
||||||
@retval others The IfConfig6 clean process failed.
|
@retval others The IfConfig6 clean process failed.
|
||||||
@ -1072,7 +1074,8 @@ IfConfig6ShowInterfaceInfo (
|
|||||||
**/
|
**/
|
||||||
SHELL_STATUS
|
SHELL_STATUS
|
||||||
IfConfig6ClearInterfaceInfo (
|
IfConfig6ClearInterfaceInfo (
|
||||||
IN LIST_ENTRY *IfList
|
IN LIST_ENTRY *IfList,
|
||||||
|
IN CHAR16 *IfName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -1081,7 +1084,6 @@ IfConfig6ClearInterfaceInfo (
|
|||||||
IFCONFIG6_INTERFACE_CB *IfCb;
|
IFCONFIG6_INTERFACE_CB *IfCb;
|
||||||
EFI_IP6_CONFIG_POLICY Policy;
|
EFI_IP6_CONFIG_POLICY Policy;
|
||||||
|
|
||||||
Policy = Ip6ConfigPolicyAutomatic;
|
|
||||||
Entry = IfList->ForwardLink;
|
Entry = IfList->ForwardLink;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
@ -1091,12 +1093,31 @@ IfConfig6ClearInterfaceInfo (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Go through the interface list.
|
// Go through the interface list.If the interface name is specified, then
|
||||||
|
// need to refresh the configuration.
|
||||||
//
|
//
|
||||||
while (Entry != IfList) {
|
while (Entry != IfList) {
|
||||||
|
|
||||||
IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link);
|
IfCb = BASE_CR (Entry, IFCONFIG6_INTERFACE_CB, Link);
|
||||||
|
|
||||||
|
if ((IfName != NULL) && (StrCmp (IfName, IfCb->IfInfo->Name) == 0)) {
|
||||||
|
Policy = Ip6ConfigPolicyManual;
|
||||||
|
|
||||||
|
Status = IfCb->IfCfg->SetData (
|
||||||
|
IfCb->IfCfg,
|
||||||
|
Ip6ConfigDataTypePolicy,
|
||||||
|
sizeof (EFI_IP6_CONFIG_POLICY),
|
||||||
|
&Policy
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork2HiiHandle, L"ifconfig6");
|
||||||
|
ShellStatus = SHELL_ACCESS_DENIED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Policy = Ip6ConfigPolicyAutomatic;
|
||||||
|
|
||||||
Status = IfCb->IfCfg->SetData (
|
Status = IfCb->IfCfg->SetData (
|
||||||
IfCb->IfCfg,
|
IfCb->IfCfg,
|
||||||
Ip6ConfigDataTypePolicy,
|
Ip6ConfigDataTypePolicy,
|
||||||
@ -1105,6 +1126,7 @@ IfConfig6ClearInterfaceInfo (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork2HiiHandle, L"ifconfig6");
|
||||||
ShellStatus = SHELL_ACCESS_DENIED;
|
ShellStatus = SHELL_ACCESS_DENIED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1616,7 +1638,7 @@ IfConfig6 (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IfConfig6OpClear:
|
case IfConfig6OpClear:
|
||||||
ShellStatus = IfConfig6ClearInterfaceInfo (&Private->IfList);
|
ShellStatus = IfConfig6ClearInterfaceInfo (&Private->IfList, Private->IfName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IfConfig6OpSet:
|
case IfConfig6OpSet:
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#langdef en-US "english"
|
#langdef en-US "english"
|
||||||
|
|
||||||
|
#string STR_GEN_ERR_AD #language en-US "%H%s%N: Access denied.\r\n"
|
||||||
|
|
||||||
#string STR_PING6_INVALID_IP #language en-US "%Ping6: Invalid IP6 address, %s\r\n"
|
#string STR_PING6_INVALID_IP #language en-US "%Ping6: Invalid IP6 address, %s\r\n"
|
||||||
#string STR_PING6_INVALID_INPUT #language en-US "%Ping6: Invalid input, please type 'Ping6 -?'for help\r\n"
|
#string STR_PING6_INVALID_INPUT #language en-US "%Ping6: Invalid input, please type 'Ping6 -?'for help\r\n"
|
||||||
#string STR_PING6_INVALID_SEND_NUMBER #language en-US "%Ping6: Invalid send number, %s\r\n"
|
#string STR_PING6_INVALID_SEND_NUMBER #language en-US "%Ping6: Invalid send number, %s\r\n"
|
||||||
|
Reference in New Issue
Block a user