ospf6d: add missing vrf parameter to "clear ipv6 ospf6 interface"

Currently, it's not possible to run this command in any VRF other than default.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
Igor Ryzhov 2021-10-08 21:36:14 +03:00
parent b1e27fbba4
commit ad7e12b0d9
2 changed files with 26 additions and 9 deletions

View File

@ -85,6 +85,11 @@ OSPF6 router
change to take effect, user can use this cli instead of restarting the change to take effect, user can use this cli instead of restarting the
ospf6d daemon. ospf6d daemon.
.. clicmd:: clear ipv6 ospf6 [vrf NAME] interface [IFNAME]
This command restarts the interface state machine for all interfaces in the
VRF or only for the specific interface if ``IFNAME`` is specified.
ASBR Summarisation Support in OSPFv3 ASBR Summarisation Support in OSPFv3
==================================== ====================================

View File

@ -2739,27 +2739,39 @@ void ospf6_interface_clear(struct interface *ifp)
/* Clear interface */ /* Clear interface */
DEFUN (clear_ipv6_ospf6_interface, DEFUN (clear_ipv6_ospf6_interface,
clear_ipv6_ospf6_interface_cmd, clear_ipv6_ospf6_interface_cmd,
"clear ipv6 ospf6 interface [IFNAME]", "clear ipv6 ospf6 [vrf NAME] interface [IFNAME]",
CLEAR_STR CLEAR_STR
IP6_STR IP6_STR
OSPF6_STR OSPF6_STR
VRF_CMD_HELP_STR
INTERFACE_STR INTERFACE_STR
IFNAME_STR IFNAME_STR
) )
{ {
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); struct vrf *vrf;
int idx_vrf = 3;
int idx_ifname = 4; int idx_ifname = 4;
struct interface *ifp; struct interface *ifp;
const char *vrf_name;
if (argc == 4) /* Clear all the ospfv3 interfaces. */ if (argv_find(argv, argc, "vrf", &idx_vrf))
{ vrf_name = argv[idx_vrf + 1]->arg;
else
vrf_name = VRF_DEFAULT_NAME;
vrf = vrf_lookup_by_name(vrf_name);
if (!vrf) {
vty_out(vty, "%% VRF %s not found\n", vrf_name);
return CMD_WARNING;
}
if (!argv_find(argv, argc, "IFNAME", &idx_ifname)) {
/* Clear all the ospfv3 interfaces. */
FOR_ALL_INTERFACES (vrf, ifp) FOR_ALL_INTERFACES (vrf, ifp)
ospf6_interface_clear(ifp); ospf6_interface_clear(ifp);
} else /* Interface name is specified. */ } else {
{ /* Interface name is specified. */
if ((ifp = if_lookup_by_name(argv[idx_ifname]->arg, ifp = if_lookup_by_name_vrf(argv[idx_ifname]->arg, vrf);
VRF_DEFAULT)) if (!ifp) {
== NULL) {
vty_out(vty, "No such Interface: %s\n", vty_out(vty, "No such Interface: %s\n",
argv[idx_ifname]->arg); argv[idx_ifname]->arg);
return CMD_WARNING; return CMD_WARNING;