summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_pw.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-07-09 00:18:58 +0200
committerRenato Westphal <renato@opensourcerouting.org>2018-08-13 23:59:31 +0200
commit1e9d11834535c506af8ba426f5c9c580e071313a (patch)
treedb9f11fafb467781c6d954675791639c01aef596 /zebra/zebra_pw.c
parentldpd: use DEFPY_NOSH whenever possible (diff)
downloadfrr-1e9d11834535c506af8ba426f5c9c580e071313a.tar.xz
frr-1e9d11834535c506af8ba426f5c9c580e071313a.zip
zebra: fix "no pseudowire IFNAME" on vtysh
We must hide only "pseudowire IFNAME" from vtysh, the "no" form of the command should be made available to the extract.pl script. Split the command into two to fix this problem. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_pw.c')
-rw-r--r--zebra/zebra_pw.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index bf76f7e86..c6db1463f 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -308,15 +308,14 @@ void zebra_pw_exit(struct zebra_vrf *zvrf)
DEFUN_NOSH (pseudowire_if,
pseudowire_if_cmd,
- "[no] pseudowire IFNAME",
- NO_STR
+ "pseudowire IFNAME",
"Static pseudowire configuration\n"
"Pseudowire name\n")
{
struct zebra_vrf *zvrf;
struct zebra_pw *pw;
- int idx = 0;
const char *ifname;
+ int idx = 0;
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
@@ -324,19 +323,13 @@ DEFUN_NOSH (pseudowire_if,
argv_find(argv, argc, "IFNAME", &idx);
ifname = argv[idx]->arg;
+
pw = zebra_pw_find(zvrf, ifname);
if (pw && pw->protocol != ZEBRA_ROUTE_STATIC) {
vty_out(vty, "%% Pseudowire is not static\n");
return CMD_WARNING;
}
- if (argv_find(argv, argc, "no", &idx)) {
- if (!pw)
- return CMD_SUCCESS;
- zebra_pw_del(zvrf, pw);
- return CMD_SUCCESS;
- }
-
if (!pw)
pw = zebra_pw_add(zvrf, ifname, ZEBRA_ROUTE_STATIC, NULL);
VTY_PUSH_CONTEXT(PW_NODE, pw);
@@ -344,6 +337,37 @@ DEFUN_NOSH (pseudowire_if,
return CMD_SUCCESS;
}
+DEFUN (no_pseudowire_if,
+ no_pseudowire_if_cmd,
+ "no pseudowire IFNAME",
+ NO_STR
+ "Static pseudowire configuration\n"
+ "Pseudowire name\n")
+{
+ struct zebra_vrf *zvrf;
+ struct zebra_pw *pw;
+ const char *ifname;
+ int idx = 0;
+
+ zvrf = vrf_info_lookup(VRF_DEFAULT);
+ if (!zvrf)
+ return CMD_WARNING;
+
+ argv_find(argv, argc, "IFNAME", &idx);
+ ifname = argv[idx]->arg;
+
+ pw = zebra_pw_find(zvrf, ifname);
+ if (pw) {
+ if (pw->protocol != ZEBRA_ROUTE_STATIC) {
+ vty_out(vty, "%% Pseudowire is not static\n");
+ return CMD_WARNING;
+ }
+ zebra_pw_del(zvrf, pw);
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (pseudowire_labels,
pseudowire_labels_cmd,
"[no] mpls label local (16-1048575) remote (16-1048575)",
@@ -531,6 +555,7 @@ void zebra_pw_vty_init(void)
install_default(PW_NODE);
install_element(CONFIG_NODE, &pseudowire_if_cmd);
+ install_element(CONFIG_NODE, &no_pseudowire_if_cmd);
install_element(PW_NODE, &pseudowire_labels_cmd);
install_element(PW_NODE, &pseudowire_neighbor_cmd);
install_element(PW_NODE, &pseudowire_control_word_cmd);