[quagga-dev 11992] [PATCH 09/15] zebra: fix optional distance on static mrib route

David Lamparter equinox at opensourcerouting.org
Fri Jan 30 00:54:27 GMT 2015


Unfortunately, the quagga CLI parser doesn't support [<1-255>].  Fix by
working around with an alias.

Replaces the following commits:
- zebra: mrib: [no] ip mroute - require distance.
- zebra: mrib: [no] ip mroute - make distance optional.
(Rewritten as alias)

Cc: Everton Marques <everton.marques at gmail.com>
Cc: Balaji G <balajig81 at gmail.com>
Signed-off-by: David Lamparter <equinox at opensourcerouting.org>
---
 zebra/zebra_vty.c | 39 +++++++++++++++++++++++++++++++--------
 1 file changed, 31 insertions(+), 8 deletions(-)

diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 6802ece..69245a5 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -142,9 +142,9 @@ zebra_static_ipv4 (struct vty *vty, int add_cmd, const char *dest_str,
 }
 
 /* Static unicast routes for multicast RPF lookup. */
-DEFUN (ip_mroute,
-       ip_mroute_cmd,
-       "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) [<1-255>]",
+DEFUN (ip_mroute_dist,
+       ip_mroute_dist_cmd,
+       "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
        IP_STR
        "Configure static unicast route into MRIB for multicast RPF lookup\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -152,12 +152,22 @@ DEFUN (ip_mroute,
        "Nexthop interface name\n"
        "Distance\n")
 {
-  return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1], NULL, argv[2]);
+  return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
+                                NULL, argc > 2 ? argv[2] : NULL);
 }
 
-DEFUN (no_ip_mroute,
-       no_ip_mroute_cmd,
-       "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) [<1-255>]",
+ALIAS (ip_mroute_dist,
+       ip_mroute_cmd,
+       "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
+       IP_STR
+       "Configure static unicast route into MRIB for multicast RPF lookup\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "Nexthop address\n"
+       "Nexthop interface name\n")
+
+DEFUN (no_ip_mroute_dist,
+       no_ip_mroute_dist_cmd,
+       "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
        IP_STR
        "Configure static unicast route into MRIB for multicast RPF lookup\n"
        "IP destination prefix (e.g. 10.0.0.0/8)\n"
@@ -165,9 +175,20 @@ DEFUN (no_ip_mroute,
        "Nexthop interface name\n"
        "Distance\n")
 {
-  return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1], NULL, argv[2]);
+  return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
+                                NULL, argc > 2 ? argv[2] : NULL);
 }
 
+ALIAS (no_ip_mroute_dist,
+       no_ip_mroute_cmd,
+       "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
+       NO_STR
+       IP_STR
+       "Configure static unicast route into MRIB for multicast RPF lookup\n"
+       "IP destination prefix (e.g. 10.0.0.0/8)\n"
+       "Nexthop address\n"
+       "Nexthop interface name\n")
+
 DEFUN (show_ip_rpf,
        show_ip_rpf_cmd,
        "show ip rpf",
@@ -2239,7 +2260,9 @@ zebra_vty_init (void)
   install_node (&protocol_node, config_write_protocol);
 
   install_element (CONFIG_NODE, &ip_mroute_cmd);
+  install_element (CONFIG_NODE, &ip_mroute_dist_cmd);
   install_element (CONFIG_NODE, &no_ip_mroute_cmd);
+  install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd);
   install_element (CONFIG_NODE, &ip_protocol_cmd);
   install_element (CONFIG_NODE, &no_ip_protocol_cmd);
   install_element (VIEW_NODE, &show_ip_protocol_cmd);
-- 
2.0.4





More information about the Quagga-dev mailing list