]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_vty.c
Merge branch 'quagga' into google-bgp-multipath
[mirror_frr.git] / bgpd / bgp_vty.c
index 2c44efc2285e15775e813fe111c4215a0754744b..cbe0b44346464ecbaf5d682be9de9cca23f4647d 100644 (file)
@@ -3851,7 +3851,7 @@ peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
   if (! peer)
     return CMD_WARNING;
 
-  VTY_GET_INTEGER ("maxmum number", max, num_str);
+  VTY_GET_INTEGER ("maximum number", max, num_str);
   if (threshold_str)
     threshold = atoi (threshold_str);
   else
@@ -4359,18 +4359,10 @@ bgp_clear (struct vty *vty, struct bgp *bgp,  afi_t afi, safi_t safi,
   if (sort == clear_as)
     {
       as_t as;
-      unsigned long as_ul;
       int find = 0;
 
-      VTY_GET_LONG ("AS", as_ul, arg);
+      VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
       
-      if (!as_ul)
-       {
-         vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); 
-         return CMD_WARNING;
-       }
-      as = (as_t) as_ul;
-
       for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
        {
          if (peer->as != as) 
@@ -8525,57 +8517,16 @@ ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
 \f
 /* Redistribute VTY commands.  */
 
-/* Utility function to convert user input route type string to route
-   type.  */
-static int
-bgp_str2route_type (int afi, const char *str)
-{
-  if (! str)
-    return 0;
-
-  if (afi == AFI_IP)
-    {
-      if (strncmp (str, "k", 1) == 0)
-       return ZEBRA_ROUTE_KERNEL;
-      else if (strncmp (str, "c", 1) == 0)
-       return ZEBRA_ROUTE_CONNECT;
-      else if (strncmp (str, "s", 1) == 0)
-       return ZEBRA_ROUTE_STATIC;
-      else if (strncmp (str, "r", 1) == 0)
-       return ZEBRA_ROUTE_RIP;
-      else if (strncmp (str, "o", 1) == 0)
-       return ZEBRA_ROUTE_OSPF;
-    }
-  if (afi == AFI_IP6)
-    {
-      if (strncmp (str, "k", 1) == 0)
-       return ZEBRA_ROUTE_KERNEL;
-      else if (strncmp (str, "c", 1) == 0)
-       return ZEBRA_ROUTE_CONNECT;
-      else if (strncmp (str, "s", 1) == 0)
-       return ZEBRA_ROUTE_STATIC;
-      else if (strncmp (str, "r", 1) == 0)
-       return ZEBRA_ROUTE_RIPNG;
-      else if (strncmp (str, "o", 1) == 0)
-       return ZEBRA_ROUTE_OSPF6;
-    }
-  return 0;
-}
-
 DEFUN (bgp_redistribute_ipv4,
        bgp_redistribute_ipv4_cmd,
-       "redistribute (connected|kernel|ospf|rip|static)",
+       "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n")
+       QUAGGA_IP_REDIST_HELP_STR_BGPD)
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8585,20 +8536,16 @@ DEFUN (bgp_redistribute_ipv4,
 
 DEFUN (bgp_redistribute_ipv4_rmap,
        bgp_redistribute_ipv4_rmap_cmd,
-       "redistribute (connected|kernel|ospf|rip|static) route-map WORD",
+       "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n")
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8610,21 +8557,17 @@ DEFUN (bgp_redistribute_ipv4_rmap,
 
 DEFUN (bgp_redistribute_ipv4_metric,
        bgp_redistribute_ipv4_metric_cmd,
-       "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
+       "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n")
 {
   int type;
   u_int32_t metric;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8637,13 +8580,9 @@ DEFUN (bgp_redistribute_ipv4_metric,
 
 DEFUN (bgp_redistribute_ipv4_rmap_metric,
        bgp_redistribute_ipv4_rmap_metric_cmd,
-       "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
+       "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n"
        "Metric for redistributed routes\n"
@@ -8652,8 +8591,8 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric,
   int type;
   u_int32_t metric;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8667,13 +8606,9 @@ DEFUN (bgp_redistribute_ipv4_rmap_metric,
 
 DEFUN (bgp_redistribute_ipv4_metric_rmap,
        bgp_redistribute_ipv4_metric_rmap_cmd,
-       "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
+       "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n"
        "Route map reference\n"
@@ -8682,8 +8617,8 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap,
   int type;
   u_int32_t metric;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8697,19 +8632,15 @@ DEFUN (bgp_redistribute_ipv4_metric_rmap,
 
 DEFUN (no_bgp_redistribute_ipv4,
        no_bgp_redistribute_ipv4_cmd,
-       "no redistribute (connected|kernel|ospf|rip|static)",
+       "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n")
+       QUAGGA_IP_REDIST_HELP_STR_BGPD)
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8720,21 +8651,17 @@ DEFUN (no_bgp_redistribute_ipv4,
 
 DEFUN (no_bgp_redistribute_ipv4_rmap,
        no_bgp_redistribute_ipv4_rmap_cmd,
-       "no redistribute (connected|kernel|ospf|rip|static) route-map WORD",
+       "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n")
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8746,21 +8673,17 @@ DEFUN (no_bgp_redistribute_ipv4_rmap,
 
 DEFUN (no_bgp_redistribute_ipv4_metric,
        no_bgp_redistribute_ipv4_metric_cmd,
-       "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>",
+       "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n")
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8772,14 +8695,10 @@ DEFUN (no_bgp_redistribute_ipv4_metric,
 
 DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
        no_bgp_redistribute_ipv4_rmap_metric_cmd,
-       "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>",
+       "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n"
        "Metric for redistributed routes\n"
@@ -8787,8 +8706,8 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8801,14 +8720,10 @@ DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
 
 ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
        no_bgp_redistribute_ipv4_metric_rmap_cmd,
-       "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD",
+       "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPF)\n"
-       "Routing Information Protocol (RIP)\n"
-       "Static routes\n"
+       QUAGGA_IP_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n"
        "Route map reference\n"
@@ -8817,18 +8732,14 @@ ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
 #ifdef HAVE_IPV6
 DEFUN (bgp_redistribute_ipv6,
        bgp_redistribute_ipv6_cmd,
-       "redistribute (connected|kernel|ospf6|ripng|static)",
+       "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n")
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD)
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8839,20 +8750,16 @@ DEFUN (bgp_redistribute_ipv6,
 
 DEFUN (bgp_redistribute_ipv6_rmap,
        bgp_redistribute_ipv6_rmap_cmd,
-       "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
+       "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n")
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8864,21 +8771,17 @@ DEFUN (bgp_redistribute_ipv6_rmap,
 
 DEFUN (bgp_redistribute_ipv6_metric,
        bgp_redistribute_ipv6_metric_cmd,
-       "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
+       "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n")
 {
   int type;
   u_int32_t metric;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8891,13 +8794,9 @@ DEFUN (bgp_redistribute_ipv6_metric,
 
 DEFUN (bgp_redistribute_ipv6_rmap_metric,
        bgp_redistribute_ipv6_rmap_metric_cmd,
-       "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
+       "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n"
        "Metric for redistributed routes\n"
@@ -8906,8 +8805,8 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric,
   int type;
   u_int32_t metric;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8921,13 +8820,9 @@ DEFUN (bgp_redistribute_ipv6_rmap_metric,
 
 DEFUN (bgp_redistribute_ipv6_metric_rmap,
        bgp_redistribute_ipv6_metric_rmap_cmd,
-       "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
+       "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n"
        "Route map reference\n"
@@ -8936,8 +8831,8 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap,
   int type;
   u_int32_t metric;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8951,19 +8846,15 @@ DEFUN (bgp_redistribute_ipv6_metric_rmap,
 
 DEFUN (no_bgp_redistribute_ipv6,
        no_bgp_redistribute_ipv6_cmd,
-       "no redistribute (connected|kernel|ospf6|ripng|static)",
+       "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n")
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD)
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -8974,21 +8865,17 @@ DEFUN (no_bgp_redistribute_ipv6,
 
 DEFUN (no_bgp_redistribute_ipv6_rmap,
        no_bgp_redistribute_ipv6_rmap_cmd,
-       "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD",
+       "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n")
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -9000,21 +8887,17 @@ DEFUN (no_bgp_redistribute_ipv6_rmap,
 
 DEFUN (no_bgp_redistribute_ipv6_metric,
        no_bgp_redistribute_ipv6_metric_cmd,
-       "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>",
+       "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n")
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -9026,14 +8909,10 @@ DEFUN (no_bgp_redistribute_ipv6_metric,
 
 DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
        no_bgp_redistribute_ipv6_rmap_metric_cmd,
-       "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>",
+       "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Route map reference\n"
        "Pointer to route-map entries\n"
        "Metric for redistributed routes\n"
@@ -9041,8 +8920,8 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
 {
   int type;
 
-  type = bgp_str2route_type (AFI_IP6, argv[0]);
-  if (! type)
+  type = proto_redistnum (AFI_IP6, argv[0]);
+  if (type < 0 || type == ZEBRA_ROUTE_BGP)
     {
       vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
       return CMD_WARNING;
@@ -9055,14 +8934,10 @@ DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
 
 ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
        no_bgp_redistribute_ipv6_metric_rmap_cmd,
-       "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD",
+       "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
        NO_STR
        "Redistribute information from another routing protocol\n"
-       "Connected\n"
-       "Kernel routes\n"
-       "Open Shurtest Path First (OSPFv3)\n"
-       "Routing Information Protocol (RIPng)\n"
-       "Static routes\n"
+       QUAGGA_IP6_REDIST_HELP_STR_BGPD
        "Metric for redistributed routes\n"
        "Default metric\n"
        "Route map reference\n"