mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:57:45 +00:00
lib: put route_types.txt to real use
this replaces most occurences of routing protocol lists by preprocessor defines from route_types.h. the latter is autogenerated from route_types.txt by a perl script (previously awk). adding a routing protocol now is mostly a matter of changing route_types.txt and log.c. Conflicts: lib/route_types.awk
This commit is contained in:
parent
6864a99077
commit
daca2cf463
269
bgpd/bgp_vty.c
269
bgpd/bgp_vty.c
@ -8210,57 +8210,16 @@ ALIAS (show_bgp_instance_rsclient_summary,
|
||||
|
||||
/* 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;
|
||||
@ -8270,20 +8229,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;
|
||||
@ -8295,21 +8250,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;
|
||||
@ -8322,13 +8273,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"
|
||||
@ -8337,8 +8284,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;
|
||||
@ -8352,13 +8299,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"
|
||||
@ -8367,8 +8310,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;
|
||||
@ -8382,19 +8325,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;
|
||||
@ -8405,21 +8344,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;
|
||||
@ -8431,21 +8366,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;
|
||||
@ -8457,14 +8388,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"
|
||||
@ -8472,8 +8399,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;
|
||||
@ -8486,14 +8413,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"
|
||||
@ -8502,18 +8425,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;
|
||||
@ -8524,20 +8443,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;
|
||||
@ -8549,21 +8464,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;
|
||||
@ -8576,13 +8487,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"
|
||||
@ -8591,8 +8498,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;
|
||||
@ -8606,13 +8513,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"
|
||||
@ -8621,8 +8524,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;
|
||||
@ -8636,19 +8539,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;
|
||||
@ -8659,21 +8558,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;
|
||||
@ -8685,21 +8580,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;
|
||||
@ -8711,14 +8602,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"
|
||||
@ -8726,8 +8613,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;
|
||||
@ -8740,14 +8627,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"
|
||||
|
@ -29,10 +29,10 @@ pkginclude_HEADERS = \
|
||||
privs.h sigevent.h pqueue.h jhash.h zassert.h memtypes.h \
|
||||
workqueue.h route_types.h
|
||||
|
||||
EXTRA_DIST = regex.c regex-gnu.h memtypes.awk route_types.awk route_types.txt
|
||||
EXTRA_DIST = regex.c regex-gnu.h memtypes.awk route_types.pl route_types.txt
|
||||
|
||||
memtypes.h: $(srcdir)/memtypes.c $(srcdir)/memtypes.awk
|
||||
($(GAWK) -f $(srcdir)/memtypes.awk $(srcdir)/memtypes.c > $@)
|
||||
|
||||
route_types.h: $(srcdir)/route_types.txt $(srcdir)/route_types.awk
|
||||
($(GAWK) -f $(srcdir)/route_types.awk $(srcdir)/route_types.txt > $@)
|
||||
route_types.h: $(srcdir)/route_types.txt $(srcdir)/route_types.pl
|
||||
@PERL@ $(srcdir)/route_types.pl < $(srcdir)/route_types.txt > $@
|
||||
|
69
lib/log.c
69
lib/log.c
@ -20,6 +20,8 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define QUAGGA_DEFINE_DESC_TABLE
|
||||
|
||||
#include <zebra.h>
|
||||
|
||||
#include "log.h"
|
||||
@ -817,29 +819,6 @@ safe_strerror(int errnum)
|
||||
return (s != NULL) ? s : "Unknown error";
|
||||
}
|
||||
|
||||
struct zebra_desc_table
|
||||
{
|
||||
unsigned int type;
|
||||
const char *string;
|
||||
char chr;
|
||||
};
|
||||
|
||||
#define DESC_ENTRY(T,S,C) [(T)] = { (T), (S), (C) }
|
||||
static const struct zebra_desc_table route_types[] = {
|
||||
DESC_ENTRY (ZEBRA_ROUTE_SYSTEM, "system", 'X' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_KERNEL, "kernel", 'K' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_CONNECT, "connected", 'C' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_STATIC, "static", 'S' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_RIP, "rip", 'R' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_RIPNG, "ripng", 'R' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_OSPF, "ospf", 'O' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_OSPF6, "ospf6", 'O' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_ISIS, "isis", 'I' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_BGP, "bgp", 'B' ),
|
||||
DESC_ENTRY (ZEBRA_ROUTE_HSLS, "hsls", 'H' ),
|
||||
};
|
||||
#undef DESC_ENTRY
|
||||
|
||||
#define DESC_ENTRY(T) [(T)] = { (T), (#T), '\0' }
|
||||
static const struct zebra_desc_table command_types[] = {
|
||||
DESC_ENTRY (ZEBRA_INTERFACE_ADD),
|
||||
@ -929,4 +908,48 @@ proto_name2num(const char *s)
|
||||
return route_types[i].type;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#undef RTSIZE
|
||||
|
||||
int
|
||||
proto_redistnum(int afi, const char *s)
|
||||
{
|
||||
if (! s)
|
||||
return -1;
|
||||
|
||||
if (afi == AFI_IP)
|
||||
{
|
||||
if (strncmp (s, "k", 1) == 0)
|
||||
return ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (s, "c", 1) == 0)
|
||||
return ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (s, "s", 1) == 0)
|
||||
return ZEBRA_ROUTE_STATIC;
|
||||
else if (strncmp (s, "r", 1) == 0)
|
||||
return ZEBRA_ROUTE_RIP;
|
||||
else if (strncmp (s, "o", 1) == 0)
|
||||
return ZEBRA_ROUTE_OSPF;
|
||||
else if (strncmp (s, "i", 1) == 0)
|
||||
return ZEBRA_ROUTE_ISIS;
|
||||
else if (strncmp (s, "b", 1) == 0)
|
||||
return ZEBRA_ROUTE_BGP;
|
||||
}
|
||||
if (afi == AFI_IP6)
|
||||
{
|
||||
if (strncmp (s, "k", 1) == 0)
|
||||
return ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (s, "c", 1) == 0)
|
||||
return ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (s, "s", 1) == 0)
|
||||
return ZEBRA_ROUTE_STATIC;
|
||||
else if (strncmp (s, "r", 1) == 0)
|
||||
return ZEBRA_ROUTE_RIPNG;
|
||||
else if (strncmp (s, "o", 1) == 0)
|
||||
return ZEBRA_ROUTE_OSPF6;
|
||||
else if (strncmp (s, "i", 1) == 0)
|
||||
return ZEBRA_ROUTE_ISIS;
|
||||
else if (strncmp (s, "b", 1) == 0)
|
||||
return ZEBRA_ROUTE_BGP;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -1,185 +0,0 @@
|
||||
# Scan a file of route-type definitions (see eg route_types.txt) and
|
||||
# generate a corresponding header file with:
|
||||
#
|
||||
# - enum of Zserv route-types
|
||||
# - redistribute strings for the various Quagga daemons
|
||||
#
|
||||
# See route_types.txt for the format.
|
||||
#
|
||||
#
|
||||
|
||||
BEGIN {
|
||||
FS="[,]";
|
||||
|
||||
# globals
|
||||
exitret = 0;
|
||||
tcount = 0;
|
||||
|
||||
# formats for output
|
||||
## the define format
|
||||
redist_def_fmt = "#define QUAGGA_REDIST_STR_%s \\\n";
|
||||
## DEFUN/vty route-type argument
|
||||
redist_str_fmt = "\"(%s)\"\n";
|
||||
redist_help_def_fmt = "#define QUAGGA_REDIST_HELP_STR_%s";
|
||||
redist_help_str_fmt = " \\\n \"%s\\n\"";
|
||||
|
||||
# header
|
||||
header = "/* Auto-generated from route_types.txt by " ARGV[0] ". */\n";
|
||||
header = header "/* Do not edit! */\n";
|
||||
header = header "\n#ifndef _QUAGGA_ROUTE_TYPES_H\n";
|
||||
header = header "#define _QUAGGA_ROUTE_TYPES_H\n";
|
||||
footer = "#endif /* _QUAGGA_ROUTE_TYPES_H */\n";
|
||||
printf ("%s\n", header);
|
||||
}
|
||||
|
||||
# Chomp comment lines
|
||||
($0 ~ /^#/) {
|
||||
next;
|
||||
}
|
||||
|
||||
# get rid of the commas, leading/trailling whitespace and
|
||||
# quotes
|
||||
{
|
||||
for (i = 1; i <= NF; i++) {
|
||||
#print "before:" $i;
|
||||
$i = gensub(/^[[:blank:]]*(.*)[,]*.*/, "\\1", "g",$i);
|
||||
$i = gensub(/^["](.*)["]$/, "\\1", "g", $i);
|
||||
#print "after :" $i;
|
||||
}
|
||||
}
|
||||
|
||||
# 7 field format:
|
||||
# type cname daemon C 4 6 short help
|
||||
(NF >= 7) {
|
||||
#print "7", $1, $0;
|
||||
|
||||
if ($1 in types) {
|
||||
print "error: attempt to redefine", $1;
|
||||
exitret = 1;
|
||||
exit exitret;
|
||||
}
|
||||
|
||||
typesbynum[tcount] = $1;
|
||||
types[$1,"num"] = tcount++;
|
||||
types[$1,"cname"] = $2;
|
||||
types[$1,"daemon"] = $3;
|
||||
types[$1,"C"] = $4;
|
||||
types[$1,"4"] = strtonum($5);
|
||||
types[$1,"6"] = strtonum($6);
|
||||
types[$1,"shelp"] = $7;
|
||||
|
||||
#print "num :", types[$1,"num"]
|
||||
#print "cname :", types[$1,"cname"]
|
||||
#print "daemon:", types[$1,"daemon"];
|
||||
#print "char :", types[$1,"C"];
|
||||
};
|
||||
|
||||
# 2 field: type "long description"
|
||||
(NF == 2) {
|
||||
#print "2", $1, $2;
|
||||
|
||||
if (!(($1 SUBSEP "num") in types)) {
|
||||
print "error: type", $1, "must be defined before help str";
|
||||
exitret = 2;
|
||||
exit exitret;
|
||||
}
|
||||
|
||||
types[$1,"lhelp"] = $2;
|
||||
}
|
||||
|
||||
END {
|
||||
if (exitret)
|
||||
exit exitret;
|
||||
|
||||
# The enums
|
||||
# not yet...
|
||||
#printf("enum\n{\n");
|
||||
#for (i = 0; i < tcount; i++) {
|
||||
# type = typesbynum[i];
|
||||
# if (type != "" && types[type,"num"] == i)
|
||||
# printf (" %s,\n", type);
|
||||
#}
|
||||
#printf (" ZEBRA_ROUTE_MAX,\n};\n\n");
|
||||
|
||||
# the redistribute defines
|
||||
for (i = 0; i < tcount; i++) {
|
||||
type = typesbynum[i];
|
||||
|
||||
# must be a type, and must cross-check against recorded type
|
||||
if (type == "" || types[type,"num"] != i)
|
||||
continue;
|
||||
|
||||
# ignore route types that can't be redistributed
|
||||
if (!(types[type,"4"] || types[type,"6"]))
|
||||
continue;
|
||||
|
||||
# must have a daemon name
|
||||
if (!((type SUBSEP "daemon") in types))
|
||||
continue;
|
||||
if (!(daemon = types[type,"daemon"]))
|
||||
continue;
|
||||
|
||||
# might have done this daemon already?
|
||||
if (daemon in seen_daemons)
|
||||
continue;
|
||||
|
||||
cname = types[type,"cname"];
|
||||
all = all "|" cname;
|
||||
rstr = "";
|
||||
hstr = "";
|
||||
|
||||
# add it to the others
|
||||
for (j = 0; j < tcount; j++) {
|
||||
# ignore self
|
||||
if (i == j)
|
||||
continue;
|
||||
|
||||
type2 = typesbynum[j];
|
||||
|
||||
# type2 must be valid, and self-check.
|
||||
if (type2 == "" || types[type2,"num"] != j)
|
||||
continue;
|
||||
|
||||
# ignore different route types for the same daemon
|
||||
# (eg system/kernel/connected)
|
||||
if (types[type2,"daemon"] == daemon)
|
||||
continue;
|
||||
|
||||
if ((types[type2,"4"] && types[type,"4"]) \
|
||||
|| (types[type2,"6"] && types[type,"6"])) {
|
||||
|
||||
if (rstr == "")
|
||||
rstr = types[type2,"cname"];
|
||||
else
|
||||
rstr = rstr "|" types[type2,"cname"];
|
||||
|
||||
if ((type2 SUBSEP "lhelp") in types)
|
||||
hstr2 = types[type2,"lhelp"];
|
||||
else if ((type2 SUBSEP "shelp") in types)
|
||||
hstr2 = types[type2,"shelp"];
|
||||
else
|
||||
hstr2 = types[type2,"cname"];
|
||||
|
||||
hstr = hstr sprintf(redist_help_str_fmt, hstr2);
|
||||
}
|
||||
}
|
||||
|
||||
# dont double-process daemons.
|
||||
seen_daemons[daemon] = 1;
|
||||
|
||||
printf("/* %s */\n", daemon);
|
||||
printf(redist_def_fmt, toupper(daemon));
|
||||
printf(redist_str_fmt, rstr);
|
||||
printf(redist_help_def_fmt, toupper(daemon));
|
||||
printf("%s", hstr);
|
||||
printf("\n\n");
|
||||
}
|
||||
|
||||
#printf("#define QUAGGA_REDIST_STR_ALL %s\n",all);
|
||||
|
||||
# for (i = 0; i < lcount; i++) {
|
||||
# if (mlists[i] != "")
|
||||
# printf (mlistformat "\n", mlists[i]);
|
||||
# }
|
||||
printf (footer);
|
||||
}
|
199
lib/route_types.pl
Executable file
199
lib/route_types.pl
Executable file
@ -0,0 +1,199 @@
|
||||
#!/usr/bin/perl
|
||||
##
|
||||
## Scan a file of route-type definitions (see eg route_types.txt) and
|
||||
## generate a corresponding header file with:
|
||||
##
|
||||
## - enum of Zserv route-types
|
||||
## - redistribute strings for the various Quagga daemons
|
||||
##
|
||||
## See route_types.txt for the format.
|
||||
##
|
||||
##
|
||||
## Copyright (C) 2009 David Lamparter.
|
||||
## This file is part of GNU Zebra.
|
||||
##
|
||||
## GNU Zebra is free software; you can redistribute it and/or modify it
|
||||
## under the terms of the GNU General Public License as published by the
|
||||
## Free Software Foundation; either version 2, or (at your option) any
|
||||
## later version.
|
||||
##
|
||||
## GNU Zebra is distributed in the hope that it will be useful, but
|
||||
## WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with GNU Zebra; see the file COPYING. If not, write to the Free
|
||||
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
## 02111-1307, USA.
|
||||
##
|
||||
|
||||
use strict;
|
||||
|
||||
# input processing
|
||||
#
|
||||
my @protos;
|
||||
my %protodetail;
|
||||
|
||||
my %daemons;
|
||||
|
||||
while (<STDIN>) {
|
||||
# skip comments and empty lines
|
||||
next if (/^\s*(#|$)/);
|
||||
|
||||
# strip whitespace
|
||||
chomp;
|
||||
$_ =~ s/^\s*//;
|
||||
$_ =~ s/\s*$//;
|
||||
|
||||
# match help strings
|
||||
if (/^(ZEBRA_ROUTE_[^\s]+)\s*,\s*"(.*)"$/) {
|
||||
$protodetail{$1}->{'longhelp'} = $2;
|
||||
next;
|
||||
}
|
||||
|
||||
$_ =~ s/\s*,\s*/,/g;
|
||||
|
||||
# else: 7-field line
|
||||
my @f = split(/,/, $_);
|
||||
unless (@f == 7) {
|
||||
die "invalid input on route_types line $.\n";
|
||||
}
|
||||
|
||||
my $proto = $f[0];
|
||||
$f[3] = $1 if ($f[3] =~ /^'(.*)'$/);
|
||||
$f[6] = $1 if ($f[6] =~ /^"(.*)"$/);
|
||||
|
||||
$protodetail{$proto} = {
|
||||
"number" => scalar @protos,
|
||||
"type" => $f[0],
|
||||
"cname" => $f[1],
|
||||
"daemon" => $f[2],
|
||||
"char" => $f[3],
|
||||
"ipv4" => int($f[4]),
|
||||
"ipv6" => int($f[5]),
|
||||
"shorthelp" => $f[6],
|
||||
};
|
||||
push @protos, $proto;
|
||||
$daemons{$f[2]} = {
|
||||
"ipv4" => int($f[4]),
|
||||
"ipv6" => int($f[5])
|
||||
} unless ($f[2] eq "NULL");
|
||||
}
|
||||
|
||||
# output
|
||||
printf <<EOF, $ARGV[0];
|
||||
/* Auto-generated from route_types.txt by %s. */
|
||||
/* Do not edit! */
|
||||
|
||||
#ifndef _QUAGGA_ROUTE_TYPES_H
|
||||
#define _QUAGGA_ROUTE_TYPES_H
|
||||
|
||||
/* Zebra route's types. */
|
||||
EOF
|
||||
|
||||
push @protos, "ZEBRA_ROUTE_MAX";
|
||||
my (@protosv4, @protosv6) = ((), ());
|
||||
for (my $c = 0; $c < @protos; $c++) {
|
||||
my $p = $protos[$c];
|
||||
printf "#define %-32s %d\n", $p, $c;
|
||||
push @protosv4, $p if ($protodetail{$p}->{"ipv4"});
|
||||
push @protosv6, $p if ($protodetail{$p}->{"ipv6"});
|
||||
}
|
||||
pop @protos;
|
||||
|
||||
sub codelist {
|
||||
my (@protos) = @_;
|
||||
my (@lines) = ();
|
||||
my $str = " \"Codes: ";
|
||||
for my $p (@protos) {
|
||||
my $s = sprintf("%s - %s, ",
|
||||
$protodetail{$p}->{"char"},
|
||||
$protodetail{$p}->{"shorthelp"});
|
||||
if (length($str . $s) > 70) {
|
||||
$str =~ s/ $//;
|
||||
push @lines, $str . "%s\" \\\n";
|
||||
$str = " \" ";
|
||||
}
|
||||
$str .= $s;
|
||||
}
|
||||
$str =~ s/ $//;
|
||||
push @lines, $str . "%s\" \\\n";
|
||||
push @lines, " \" > - selected route, * - FIB route%s%s\", \\\n";
|
||||
my @nl = ();
|
||||
for (my $c = 0; $c < @lines + 1; $c++) {
|
||||
push @nl, "VTY_NEWLINE"
|
||||
}
|
||||
return join("", @lines) ." ". join(", ", @nl);
|
||||
}
|
||||
|
||||
print "\n";
|
||||
printf "#define SHOW_ROUTE_V4_HEADER \\\n%s\n", codelist(@protosv4);
|
||||
printf "#define SHOW_ROUTE_V6_HEADER \\\n%s\n", codelist(@protosv6);
|
||||
print "\n";
|
||||
|
||||
sub collect {
|
||||
my ($daemon, $ipv4, $ipv6) = @_;
|
||||
my (@names, @help) = ((), ());
|
||||
for my $p (@protos) {
|
||||
next if ($protodetail{$p}->{"daemon"} eq $daemon && $daemon ne "zebra");
|
||||
next unless (($ipv4 && $protodetail{$p}->{"ipv4"})
|
||||
|| ($ipv6 && $protodetail{$p}->{"ipv6"}));
|
||||
push @names, $protodetail{$p}->{"cname"};
|
||||
push @help, " \"".$protodetail{$p}->{"longhelp"}."\\n\"";
|
||||
}
|
||||
return ("\"(" . join("|", @names) . ")\"", join(" \\\n", @help));
|
||||
}
|
||||
|
||||
for my $daemon (sort keys %daemons) {
|
||||
next unless ($daemons{$daemon}->{"ipv4"} || $daemons{$daemon}->{"ipv6"});
|
||||
printf "/* %s */\n", $daemon;
|
||||
if ($daemons{$daemon}->{"ipv4"} && $daemons{$daemon}->{"ipv6"}) {
|
||||
my ($names, $help) = collect($daemon, 1, 1);
|
||||
printf "#define QUAGGA_REDIST_STR_%s \\\n %s\n", uc $daemon, $names;
|
||||
printf "#define QUAGGA_REDIST_HELP_STR_%s \\\n%s\n", uc $daemon, $help;
|
||||
($names, $help) = collect($daemon, 1, 0);
|
||||
printf "#define QUAGGA_IP_REDIST_STR_%s \\\n %s\n", uc $daemon, $names;
|
||||
printf "#define QUAGGA_IP_REDIST_HELP_STR_%s \\\n%s\n", uc $daemon, $help;
|
||||
($names, $help) = collect($daemon, 0, 1);
|
||||
printf "#define QUAGGA_IP6_REDIST_STR_%s \\\n %s\n", uc $daemon, $names;
|
||||
printf "#define QUAGGA_IP6_REDIST_HELP_STR_%s \\\n%s\n", uc $daemon, $help;
|
||||
} else {
|
||||
my ($names, $help) = collect($daemon,
|
||||
$daemons{$daemon}->{"ipv4"}, $daemons{$daemon}->{"ipv6"});
|
||||
printf "#define QUAGGA_REDIST_STR_%s \\\n %s\n", uc $daemon, $names;
|
||||
printf "#define QUAGGA_REDIST_HELP_STR_%s \\\n%s\n", uc $daemon, $help;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
|
||||
#ifdef QUAGGA_DEFINE_DESC_TABLE
|
||||
|
||||
struct zebra_desc_table
|
||||
{
|
||||
unsigned int type;
|
||||
const char *string;
|
||||
char chr;
|
||||
};
|
||||
|
||||
#define DESC_ENTRY(T,S,C) [(T)] = { (T), (S), (C) }
|
||||
static const struct zebra_desc_table route_types[] = {
|
||||
EOF
|
||||
|
||||
for (my $c = 0; $c < @protos; $c++) {
|
||||
my $p = $protos[$c];
|
||||
printf " DESC_ENTRY\t(%s\t \"%s\",\t'%s' ),\n",
|
||||
$p.",", $protodetail{$p}->{"cname"}, $protodetail{$p}->{"char"};
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
};
|
||||
#undef DESC_ENTRY
|
||||
|
||||
#endif /* QUAGGA_DEFINE_DESC_TABLE */
|
||||
|
||||
#endif /* _QUAGGA_ROUTE_TYPES_H */
|
||||
EOF
|
||||
|
@ -42,13 +42,13 @@
|
||||
|
||||
## type cname daemon C 4 6 short help
|
||||
ZEBRA_ROUTE_SYSTEM, system, NULL, 'X', 0, 0, "Reserved"
|
||||
ZEBRA_ROUTE_KERNEL, kernel, zebra, 'K', 1, 1, NULL
|
||||
ZEBRA_ROUTE_CONNECT, connected, zebra, 'C', 1, 1, NULL
|
||||
ZEBRA_ROUTE_STATIC, static, zebra, 'S', 1, 1, NULL
|
||||
ZEBRA_ROUTE_KERNEL, kernel, zebra, 'K', 1, 1, "kernel route"
|
||||
ZEBRA_ROUTE_CONNECT, connected, zebra, 'C', 1, 1, "connected"
|
||||
ZEBRA_ROUTE_STATIC, static, zebra, 'S', 1, 1, "static"
|
||||
ZEBRA_ROUTE_RIP, rip, ripd, 'R', 1, 0, "RIP"
|
||||
ZEBRA_ROUTE_RIPNG, ripng, ripngd, 'R', 0, 1, "RIPng"
|
||||
ZEBRA_ROUTE_OSPF, ospf, ospfd, 'O', 1, 0, "OSPF"
|
||||
ZEBRA_ROUTE_OSPF6, ospf6, ospf6d, 'O', 0, 1, "OSPF"
|
||||
ZEBRA_ROUTE_OSPF6, ospf6, ospf6d, 'O', 0, 1, "OSPFv6"
|
||||
ZEBRA_ROUTE_ISIS, isis, isisd, 'I', 1, 1, "IS-IS"
|
||||
ZEBRA_ROUTE_BGP, bgp, bgpd, 'B', 1, 1, "BGP"
|
||||
# HSLS and OLSR both are AFI independent (so: 1, 1), however
|
||||
@ -57,7 +57,7 @@ ZEBRA_ROUTE_BGP, bgp, bgpd, 'B', 1, 1, "BGP"
|
||||
# to 'switch on' redist support (direct numeric entry remaining
|
||||
# possible).
|
||||
ZEBRA_ROUTE_HSLS, hsls, hslsd, 'H', 0, 0, "HSLS"
|
||||
ZEBRA_ROUTE_OLSR, olsr, oslrd, 'o', 0, 0, "OLSR"
|
||||
ZEBRA_ROUTE_OLSR, olsr, olsrd, 'o', 0, 0, "OLSR"
|
||||
|
||||
## help strings
|
||||
ZEBRA_ROUTE_SYSTEM, "Reserved route type, for internal use only"
|
||||
|
19
lib/zebra.h
19
lib/zebra.h
@ -425,19 +425,8 @@ struct in_pktinfo
|
||||
*/
|
||||
#define ZEBRA_HEADER_MARKER 255
|
||||
|
||||
/* Zebra route's types. */
|
||||
#define ZEBRA_ROUTE_SYSTEM 0
|
||||
#define ZEBRA_ROUTE_KERNEL 1
|
||||
#define ZEBRA_ROUTE_CONNECT 2
|
||||
#define ZEBRA_ROUTE_STATIC 3
|
||||
#define ZEBRA_ROUTE_RIP 4
|
||||
#define ZEBRA_ROUTE_RIPNG 5
|
||||
#define ZEBRA_ROUTE_OSPF 6
|
||||
#define ZEBRA_ROUTE_OSPF6 7
|
||||
#define ZEBRA_ROUTE_ISIS 8
|
||||
#define ZEBRA_ROUTE_BGP 9
|
||||
#define ZEBRA_ROUTE_HSLS 10
|
||||
#define ZEBRA_ROUTE_MAX 11
|
||||
/* Zebra route's types are defined in route_types.h */
|
||||
#include "route_types.h"
|
||||
|
||||
/* Note: whenever a new route-type or zserv-command is added the
|
||||
* corresponding {command,route}_types[] table in lib/log.c MUST be
|
||||
@ -451,6 +440,10 @@ extern char zebra_route_char(unsigned int route_type);
|
||||
* e.g. ZEBRA_INTERFACE_ADD -> "ZEBRA_INTERFACE_ADD" */
|
||||
/* Map a protocol name to its number. e.g. ZEBRA_ROUTE_BGP->9*/
|
||||
extern int proto_name2num(const char *s);
|
||||
/* Map redistribute X argument to protocol number.
|
||||
* unlike proto_name2num, this accepts shorthands and takes
|
||||
* an AFI value to restrict input */
|
||||
extern int proto_redistnum(int afi, const char *s);
|
||||
|
||||
extern const char *zserv_command_string (unsigned int command);
|
||||
|
||||
|
@ -616,27 +616,16 @@ ospf6_asbr_redistribute_remove (int type, int ifindex, struct prefix *prefix)
|
||||
|
||||
DEFUN (ospf6_redistribute,
|
||||
ospf6_redistribute_cmd,
|
||||
"redistribute (static|kernel|connected|ripng|bgp)",
|
||||
"redistribute " QUAGGA_REDIST_STR_OSPF6D,
|
||||
"Redistribute\n"
|
||||
"Static route\n"
|
||||
"Kernel route\n"
|
||||
"Connected route\n"
|
||||
"RIPng route\n"
|
||||
"BGP route\n"
|
||||
QUAGGA_REDIST_HELP_STR_OSPF6D
|
||||
)
|
||||
{
|
||||
int type = 0;
|
||||
int type;
|
||||
|
||||
if (strncmp (argv[0], "sta", 3) == 0)
|
||||
type = ZEBRA_ROUTE_STATIC;
|
||||
else if (strncmp (argv[0], "ker", 3) == 0)
|
||||
type = ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (argv[0], "con", 3) == 0)
|
||||
type = ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (argv[0], "rip", 3) == 0)
|
||||
type = ZEBRA_ROUTE_RIPNG;
|
||||
else if (strncmp (argv[0], "bgp", 3) == 0)
|
||||
type = ZEBRA_ROUTE_BGP;
|
||||
type = proto_redistnum(AFI_IP6, argv[0]);
|
||||
if (type < 0 || type == ZEBRA_ROUTE_OSPF6)
|
||||
return CMD_WARNING;
|
||||
|
||||
ospf6_asbr_redistribute_unset (type);
|
||||
ospf6_asbr_routemap_unset (type);
|
||||
@ -646,29 +635,18 @@ DEFUN (ospf6_redistribute,
|
||||
|
||||
DEFUN (ospf6_redistribute_routemap,
|
||||
ospf6_redistribute_routemap_cmd,
|
||||
"redistribute (static|kernel|connected|ripng|bgp) route-map WORD",
|
||||
"redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD",
|
||||
"Redistribute\n"
|
||||
"Static routes\n"
|
||||
"Kernel route\n"
|
||||
"Connected route\n"
|
||||
"RIPng route\n"
|
||||
"BGP route\n"
|
||||
QUAGGA_REDIST_HELP_STR_OSPF6D
|
||||
"Route map reference\n"
|
||||
"Route map name\n"
|
||||
)
|
||||
{
|
||||
int type = 0;
|
||||
int type;
|
||||
|
||||
if (strncmp (argv[0], "sta", 3) == 0)
|
||||
type = ZEBRA_ROUTE_STATIC;
|
||||
else if (strncmp (argv[0], "ker", 3) == 0)
|
||||
type = ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (argv[0], "con", 3) == 0)
|
||||
type = ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (argv[0], "rip", 3) == 0)
|
||||
type = ZEBRA_ROUTE_RIPNG;
|
||||
else if (strncmp (argv[0], "bgp", 3) == 0)
|
||||
type = ZEBRA_ROUTE_BGP;
|
||||
type = proto_redistnum(AFI_IP6, argv[0]);
|
||||
if (type < 0 || type == ZEBRA_ROUTE_OSPF6)
|
||||
return CMD_WARNING;
|
||||
|
||||
ospf6_asbr_redistribute_unset (type);
|
||||
ospf6_asbr_routemap_set (type, argv[1]);
|
||||
@ -678,28 +656,17 @@ DEFUN (ospf6_redistribute_routemap,
|
||||
|
||||
DEFUN (no_ospf6_redistribute,
|
||||
no_ospf6_redistribute_cmd,
|
||||
"no redistribute (static|kernel|connected|ripng|bgp)",
|
||||
"no redistribute " QUAGGA_REDIST_STR_OSPF6D,
|
||||
NO_STR
|
||||
"Redistribute\n"
|
||||
"Static route\n"
|
||||
"Kernel route\n"
|
||||
"Connected route\n"
|
||||
"RIPng route\n"
|
||||
"BGP route\n"
|
||||
QUAGGA_REDIST_HELP_STR_OSPF6D
|
||||
)
|
||||
{
|
||||
int type = 0;
|
||||
int type;
|
||||
|
||||
if (strncmp (argv[0], "sta", 3) == 0)
|
||||
type = ZEBRA_ROUTE_STATIC;
|
||||
else if (strncmp (argv[0], "ker", 3) == 0)
|
||||
type = ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (argv[0], "con", 3) == 0)
|
||||
type = ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (argv[0], "rip", 3) == 0)
|
||||
type = ZEBRA_ROUTE_RIPNG;
|
||||
else if (strncmp (argv[0], "bgp", 3) == 0)
|
||||
type = ZEBRA_ROUTE_BGP;
|
||||
type = proto_redistnum(AFI_IP6, argv[0]);
|
||||
if (type < 0 || type == ZEBRA_ROUTE_OSPF6)
|
||||
return CMD_WARNING;
|
||||
|
||||
ospf6_asbr_redistribute_unset (type);
|
||||
ospf6_asbr_routemap_unset (type);
|
||||
|
@ -92,29 +92,6 @@ ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
str2distribute_source (const char *str, int *source)
|
||||
{
|
||||
/* Sanity check. */
|
||||
if (str == NULL)
|
||||
return 0;
|
||||
|
||||
if (strncmp (str, "k", 1) == 0)
|
||||
*source = ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (str, "c", 1) == 0)
|
||||
*source = ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (str, "s", 1) == 0)
|
||||
*source = ZEBRA_ROUTE_STATIC;
|
||||
else if (strncmp (str, "r", 1) == 0)
|
||||
*source = ZEBRA_ROUTE_RIP;
|
||||
else if (strncmp (str, "b", 1) == 0)
|
||||
*source = ZEBRA_ROUTE_BGP;
|
||||
else
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
str2metric (const char *str, int *metric)
|
||||
{
|
||||
@ -5818,7 +5795,8 @@ DEFUN (ospf_redistribute_source_metric_type,
|
||||
int metric = -1;
|
||||
|
||||
/* Get distribute source. */
|
||||
if (!str2distribute_source (argv[0], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
/* Get metric value. */
|
||||
@ -5879,7 +5857,8 @@ DEFUN (ospf_redistribute_source_type_metric,
|
||||
int metric = -1;
|
||||
|
||||
/* Get distribute source. */
|
||||
if (!str2distribute_source (argv[0], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
/* Get metric value. */
|
||||
@ -5943,7 +5922,8 @@ DEFUN (ospf_redistribute_source_metric_routemap,
|
||||
int metric = -1;
|
||||
|
||||
/* Get distribute source. */
|
||||
if (!str2distribute_source (argv[0], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
/* Get metric value. */
|
||||
@ -5976,7 +5956,8 @@ DEFUN (ospf_redistribute_source_type_routemap,
|
||||
int type = -1;
|
||||
|
||||
/* Get distribute source. */
|
||||
if (!str2distribute_source (argv[0], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
/* Get metric value. */
|
||||
@ -6004,7 +5985,8 @@ DEFUN (ospf_redistribute_source_routemap,
|
||||
int source;
|
||||
|
||||
/* Get distribute source. */
|
||||
if (!str2distribute_source (argv[0], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (argc == 2)
|
||||
@ -6025,7 +6007,8 @@ DEFUN (no_ospf_redistribute_source,
|
||||
struct ospf *ospf = vty->index;
|
||||
int source;
|
||||
|
||||
if (!str2distribute_source (argv[0], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
ospf_routemap_unset (ospf, source);
|
||||
@ -6044,7 +6027,8 @@ DEFUN (ospf_distribute_list_out,
|
||||
int source;
|
||||
|
||||
/* Get distribute source. */
|
||||
if (!str2distribute_source (argv[1], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
return ospf_distribute_list_out_set (ospf, source, argv[0]);
|
||||
@ -6062,7 +6046,8 @@ DEFUN (no_ospf_distribute_list_out,
|
||||
struct ospf *ospf = vty->index;
|
||||
int source;
|
||||
|
||||
if (!str2distribute_source (argv[1], &source))
|
||||
source = proto_redistnum(AFI_IP, argv[0]);
|
||||
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
|
||||
return CMD_WARNING;
|
||||
|
||||
return ospf_distribute_list_out_unset (ospf, source, argv[0]);
|
||||
|
@ -802,10 +802,6 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
|
||||
}
|
||||
}
|
||||
|
||||
#define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \
|
||||
"S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \
|
||||
"> - selected route, * - FIB route%s%s"
|
||||
|
||||
DEFUN (show_ip_route,
|
||||
show_ip_route_cmd,
|
||||
"show ip route",
|
||||
@ -828,8 +824,7 @@ DEFUN (show_ip_route,
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, VTY_NEWLINE,
|
||||
VTY_NEWLINE);
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER);
|
||||
first = 0;
|
||||
}
|
||||
vty_show_ip_route (vty, rn, rib);
|
||||
@ -871,8 +866,7 @@ DEFUN (show_ip_route_prefix_longer,
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE,
|
||||
VTY_NEWLINE, VTY_NEWLINE);
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER);
|
||||
first = 0;
|
||||
}
|
||||
vty_show_ip_route (vty, rn, rib);
|
||||
@ -910,8 +904,7 @@ DEFUN (show_ip_route_supernets,
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE,
|
||||
VTY_NEWLINE, VTY_NEWLINE);
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER);
|
||||
first = 0;
|
||||
}
|
||||
vty_show_ip_route (vty, rn, rib);
|
||||
@ -922,17 +915,11 @@ DEFUN (show_ip_route_supernets,
|
||||
|
||||
DEFUN (show_ip_route_protocol,
|
||||
show_ip_route_protocol_cmd,
|
||||
"show ip route (bgp|connected|isis|kernel|ospf|rip|static)",
|
||||
"show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
"IP routing table\n"
|
||||
"Border Gateway Protocol (BGP)\n"
|
||||
"Connected\n"
|
||||
"ISO IS-IS (ISIS)\n"
|
||||
"Kernel\n"
|
||||
"Open Shortest Path First (OSPF)\n"
|
||||
"Routing Information Protocol (RIP)\n"
|
||||
"Static routes\n")
|
||||
QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
|
||||
{
|
||||
int type;
|
||||
struct route_table *table;
|
||||
@ -940,21 +927,8 @@ DEFUN (show_ip_route_protocol,
|
||||
struct rib *rib;
|
||||
int first = 1;
|
||||
|
||||
if (strncmp (argv[0], "b", 1) == 0)
|
||||
type = ZEBRA_ROUTE_BGP;
|
||||
else if (strncmp (argv[0], "c", 1) == 0)
|
||||
type = ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (argv[0], "k", 1) ==0)
|
||||
type = ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (argv[0], "o", 1) == 0)
|
||||
type = ZEBRA_ROUTE_OSPF;
|
||||
else if (strncmp (argv[0], "i", 1) == 0)
|
||||
type = ZEBRA_ROUTE_ISIS;
|
||||
else if (strncmp (argv[0], "r", 1) == 0)
|
||||
type = ZEBRA_ROUTE_RIP;
|
||||
else if (strncmp (argv[0], "s", 1) == 0)
|
||||
type = ZEBRA_ROUTE_STATIC;
|
||||
else
|
||||
type = proto_redistnum (AFI_IP, argv[0]);
|
||||
if (type < 0)
|
||||
{
|
||||
vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
@ -971,8 +945,7 @@ DEFUN (show_ip_route_protocol,
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER,
|
||||
VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
|
||||
vty_out (vty, SHOW_ROUTE_V4_HEADER);
|
||||
first = 0;
|
||||
}
|
||||
vty_show_ip_route (vty, rn, rib);
|
||||
@ -1766,8 +1739,6 @@ vty_show_ipv6_route (struct vty *vty, struct route_node *rn,
|
||||
}
|
||||
}
|
||||
|
||||
#define SHOW_ROUTE_V6_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,%s I - ISIS, B - BGP, * - FIB route.%s%s"
|
||||
|
||||
DEFUN (show_ipv6_route,
|
||||
show_ipv6_route_cmd,
|
||||
"show ipv6 route",
|
||||
@ -1790,7 +1761,7 @@ DEFUN (show_ipv6_route,
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
|
||||
vty_out (vty, SHOW_ROUTE_V6_HEADER);
|
||||
first = 0;
|
||||
}
|
||||
vty_show_ipv6_route (vty, rn, rib);
|
||||
@ -1832,7 +1803,7 @@ DEFUN (show_ipv6_route_prefix_longer,
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
|
||||
vty_out (vty, SHOW_ROUTE_V6_HEADER);
|
||||
first = 0;
|
||||
}
|
||||
vty_show_ipv6_route (vty, rn, rib);
|
||||
@ -1842,17 +1813,11 @@ DEFUN (show_ipv6_route_prefix_longer,
|
||||
|
||||
DEFUN (show_ipv6_route_protocol,
|
||||
show_ipv6_route_protocol_cmd,
|
||||
"show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)",
|
||||
"show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
"IP routing table\n"
|
||||
"Border Gateway Protocol (BGP)\n"
|
||||
"Connected\n"
|
||||
"ISO IS-IS (ISIS)\n"
|
||||
"Kernel\n"
|
||||
"Open Shortest Path First (OSPFv3)\n"
|
||||
"Routing Information Protocol (RIPng)\n"
|
||||
"Static routes\n")
|
||||
QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
|
||||
{
|
||||
int type;
|
||||
struct route_table *table;
|
||||
@ -1860,21 +1825,8 @@ DEFUN (show_ipv6_route_protocol,
|
||||
struct rib *rib;
|
||||
int first = 1;
|
||||
|
||||
if (strncmp (argv[0], "b", 1) == 0)
|
||||
type = ZEBRA_ROUTE_BGP;
|
||||
else if (strncmp (argv[0], "c", 1) == 0)
|
||||
type = ZEBRA_ROUTE_CONNECT;
|
||||
else if (strncmp (argv[0], "k", 1) ==0)
|
||||
type = ZEBRA_ROUTE_KERNEL;
|
||||
else if (strncmp (argv[0], "o", 1) == 0)
|
||||
type = ZEBRA_ROUTE_OSPF6;
|
||||
else if (strncmp (argv[0], "i", 1) == 0)
|
||||
type = ZEBRA_ROUTE_ISIS;
|
||||
else if (strncmp (argv[0], "r", 1) == 0)
|
||||
type = ZEBRA_ROUTE_RIPNG;
|
||||
else if (strncmp (argv[0], "s", 1) == 0)
|
||||
type = ZEBRA_ROUTE_STATIC;
|
||||
else
|
||||
type = proto_redistnum (AFI_IP6, argv[0]);
|
||||
if (type < 0)
|
||||
{
|
||||
vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
|
||||
return CMD_WARNING;
|
||||
@ -1891,7 +1843,7 @@ DEFUN (show_ipv6_route_protocol,
|
||||
{
|
||||
if (first)
|
||||
{
|
||||
vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
|
||||
vty_out (vty, SHOW_ROUTE_V6_HEADER);
|
||||
first = 0;
|
||||
}
|
||||
vty_show_ipv6_route (vty, rn, rib);
|
||||
|
Loading…
Reference in New Issue
Block a user