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
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)
\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;
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;
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;
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"
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;
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"
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;
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;
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;
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;
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"
{
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;
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"
#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;
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;
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;
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"
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;
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"
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;
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;
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;
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;
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"
{
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;
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"