diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-08 20:36:14 +0200 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-09 01:54:10 +0200 |
commit | ad7e12b0d9ccb1dfea1c3fba7d2355480bf6239b (patch) | |
tree | f3fe1165c253f5a69f01043c05357ffcc283ada1 /ospf6d | |
parent | Merge pull request #9727 from ton31337/feature/catch_struct_thread_xxx_agains... (diff) | |
download | frr-ad7e12b0d9ccb1dfea1c3fba7d2355480bf6239b.tar.xz frr-ad7e12b0d9ccb1dfea1c3fba7d2355480bf6239b.zip |
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>
Diffstat (limited to 'ospf6d')
-rw-r--r-- | ospf6d/ospf6_interface.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index a3eb1445f..9d7374081 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -2739,27 +2739,39 @@ void ospf6_interface_clear(struct interface *ifp) /* Clear interface */ DEFUN (clear_ipv6_ospf6_interface, clear_ipv6_ospf6_interface_cmd, - "clear ipv6 ospf6 interface [IFNAME]", + "clear ipv6 ospf6 [vrf NAME] interface [IFNAME]", CLEAR_STR IP6_STR OSPF6_STR + VRF_CMD_HELP_STR INTERFACE_STR IFNAME_STR ) { - struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT); + struct vrf *vrf; + int idx_vrf = 3; int idx_ifname = 4; 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) ospf6_interface_clear(ifp); - } else /* Interface name is specified. */ - { - if ((ifp = if_lookup_by_name(argv[idx_ifname]->arg, - VRF_DEFAULT)) - == NULL) { + } else { + /* Interface name is specified. */ + ifp = if_lookup_by_name_vrf(argv[idx_ifname]->arg, vrf); + if (!ifp) { vty_out(vty, "No such Interface: %s\n", argv[idx_ifname]->arg); return CMD_WARNING; |