summaryrefslogtreecommitdiff
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorZhang Lubo <lubo.zhang@intel.com>2016-07-14 10:31:44 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-07-15 14:45:55 +0800
commite2f5c491d8749c88cbf56168a3493d70ff19a382 (patch)
treeafa3af3d50d6f74c5e3c0e21ba88fc7bf10da667 /ShellPkg/Library
parentdbab994991c76dc4b9414a3d80997b64b0fdf9c5 (diff)
downloadedk2-platforms-e2f5c491d8749c88cbf56168a3493d70ff19a382.tar.xz
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>
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c30
-rw-r--r--ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni2
2 files changed, 28 insertions, 4 deletions
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
index 371b368d6d..42c972e1a5 100644
--- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
@@ -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_NEWLINE), gShellNetwork2HiiHandle);
return SHELL_SUCCESS;
}
@@ -1065,6 +1066,7 @@ IfConfig6ShowInterfaceInfo (
The clean process of the IfConfig6 application.
@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 others The IfConfig6 clean process failed.
@@ -1072,7 +1074,8 @@ IfConfig6ShowInterfaceInfo (
**/
SHELL_STATUS
IfConfig6ClearInterfaceInfo (
- IN LIST_ENTRY *IfList
+ IN LIST_ENTRY *IfList,
+ IN CHAR16 *IfName
)
{
EFI_STATUS Status;
@@ -1081,7 +1084,6 @@ IfConfig6ClearInterfaceInfo (
IFCONFIG6_INTERFACE_CB *IfCb;
EFI_IP6_CONFIG_POLICY Policy;
- Policy = Ip6ConfigPolicyAutomatic;
Entry = IfList->ForwardLink;
Status = EFI_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) {
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 (
IfCb->IfCfg,
Ip6ConfigDataTypePolicy,
@@ -1105,6 +1126,7 @@ IfConfig6ClearInterfaceInfo (
);
if (EFI_ERROR (Status)) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellNetwork2HiiHandle, L"ifconfig6");
ShellStatus = SHELL_ACCESS_DENIED;
break;
}
@@ -1616,7 +1638,7 @@ IfConfig6 (
break;
case IfConfig6OpClear:
- ShellStatus = IfConfig6ClearInterfaceInfo (&Private->IfList);
+ ShellStatus = IfConfig6ClearInterfaceInfo (&Private->IfList, Private->IfName);
break;
case IfConfig6OpSet:
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
index 40e0284bfa..ef441e1351 100644
--- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.uni
@@ -23,6 +23,8 @@
#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_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"