From: Donald Sharp Date: Thu, 11 Jun 2015 16:11:13 +0000 (-0700) Subject: zebra, bgpd, ospfd: 'redistribute table' to 'redistribute table ' X-Git-Tag: frr-2.0-rc1~1347 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2d627ff50c181a26839aef7c0fc48ea4621b3e64;p=matthieu%2Ffrr.git zebra, bgpd, ospfd: 'redistribute table' to 'redistribute table ' Table-id argument support wasnt complete, used the [proto, instance] combination changes that were done for OSPF multi-instance. In this case its 'table ' just like it was 'ospf ' --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 53b01a7381..28643419b2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -55,6 +55,41 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA extern struct in_addr router_id_zebra; +/* Intentional re-definition of the auto-generated macros, without table */ +#define QUAGGA_REDIST_STR_BGPD \ + "(kernel|connected|static|rip|ripng|ospf|ospf6|isis|babel)" +#define QUAGGA_REDIST_HELP_STR_BGPD \ + "Kernel routes (not installed via the zebra RIB)\n" \ + "Connected routes (directly attached subnet or host)\n" \ + "Statically configured routes\n" \ + "Routing Information Protocol (RIP)\n" \ + "Routing Information Protocol next-generation (IPv6) (RIPng)\n" \ + "Open Shortest Path First (OSPFv2)\n" \ + "Open Shortest Path First (IPv6) (OSPFv3)\n" \ + "Intermediate System to Intermediate System (IS-IS)\n" \ + "Babel routing protocol (Babel)\n" +#define QUAGGA_IP_REDIST_STR_BGPD \ + "(kernel|connected|static|rip|ospf|isis|babel)" +#define QUAGGA_IP_REDIST_HELP_STR_BGPD \ + "Kernel routes (not installed via the zebra RIB)\n" \ + "Connected routes (directly attached subnet or host)\n" \ + "Statically configured routes\n" \ + "Routing Information Protocol (RIP)\n" \ + "Open Shortest Path First (OSPFv2)\n" \ + "Intermediate System to Intermediate System (IS-IS)\n" \ + "Babel routing protocol (Babel)\n" +#define QUAGGA_IP6_REDIST_STR_BGPD \ + "(kernel|connected|static|ripng|ospf6|isis|babel)" +#define QUAGGA_IP6_REDIST_HELP_STR_BGPD \ + "Kernel routes (not installed via the zebra RIB)\n" \ + "Connected routes (directly attached subnet or host)\n" \ + "Statically configured routes\n" \ + "Routing Information Protocol next-generation (IPv6) (RIPng)\n" \ + "Open Shortest Path First (IPv6) (OSPFv3)\n" \ + "Intermediate System to Intermediate System (IS-IS)\n" \ + "Babel routing protocol (Babel)\n" + + /* Utility function to get address family from current node. */ afi_t bgp_node_afi (struct vty *vty) @@ -11096,7 +11131,8 @@ DEFUN (bgp_redistribute_ipv4_ospf, "redistribute (ospf|table) <1-65535>", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n") + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n") { u_short instance; u_short protocol; @@ -11117,7 +11153,8 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap, "redistribute (ospf|table) <1-65535> route-map WORD", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Route map reference\n" "Pointer to route-map entries\n") { @@ -11141,7 +11178,8 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric, "redistribute (ospf|table) <1-65535> metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Metric for redistributed routes\n" "Default metric\n") { @@ -11168,7 +11206,8 @@ DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" @@ -11198,7 +11237,8 @@ DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" @@ -11229,7 +11269,8 @@ DEFUN (no_bgp_redistribute_ipv4_ospf, NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n") + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n") { u_short instance; int protocol; @@ -11249,7 +11290,8 @@ ALIAS (no_bgp_redistribute_ipv4_ospf, NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Route map reference\n" "Pointer to route-map entries\n") @@ -11259,7 +11301,8 @@ ALIAS (no_bgp_redistribute_ipv4_ospf, NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Metric for redistributed routes\n" "Default metric\n") @@ -11269,7 +11312,8 @@ ALIAS (no_bgp_redistribute_ipv4_ospf, NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Route map reference\n" "Pointer to route-map entries\n" "Metric for redistributed routes\n" @@ -11281,7 +11325,8 @@ ALIAS (no_bgp_redistribute_ipv4_ospf, NO_STR "Redistribute information from another routing protocol\n" "Open Shortest Path First (OSPFv2)\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Metric for redistributed routes\n" "Default metric\n" "Route map reference\n" diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 707944a3b4..6bf3768a25 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -49,6 +49,17 @@ #include "ospfd/ospf_vty.h" #include "ospfd/ospf_dump.h" +#define QUAGGA_REDIST_STR_OSPFD \ + "(kernel|connected|static|rip|isis|bgp|babel)" +#define QUAGGA_REDIST_HELP_STR_OSPFD \ + "Kernel routes (not installed via the zebra RIB)\n" \ + "Connected routes (directly attached subnet or host)\n" \ + "Statically configured routes\n" \ + "Routing Information Protocol (RIP)\n" \ + "Intermediate System to Intermediate System (IS-IS)\n" \ + "Border Gateway Protocol (BGP)\n" \ + "Babel routing protocol (Babel)\n" + static const char *ospf_network_type_str[] = { @@ -6912,11 +6923,12 @@ DEFUN (no_ospf_redistribute_source, DEFUN (ospf_redistribute_instance_source, ospf_redistribute_instance_source_cmd, - "redistribute ospf <1-65535>" + "redistribute (ospf|table) <1-65535>" " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", REDIST_STR "Open Shortest Path First\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table ID\n" "Metric for redistributed routes\n" "OSPF default metric\n" "OSPF exterior metric type for redistributed routes\n" @@ -6932,40 +6944,43 @@ DEFUN (ospf_redistribute_instance_source, u_short instance; struct ospf_redist *red; - VTY_GET_INTEGER ("Instance ID", instance, argv[0]); + if (strncmp(argv[0], "o", 1) == 0) + source = ZEBRA_ROUTE_OSPF; + else + source = ZEBRA_ROUTE_TABLE; + + VTY_GET_INTEGER ("Instance ID", instance, argv[1]); if (!ospf) return CMD_SUCCESS; - if (!ospf->instance) + if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance) { vty_out (vty, "Instance redistribution in non-instanced OSPF not allowed%s", VTY_NEWLINE); return CMD_WARNING; } - if (ospf->instance == instance) + if ((source == ZEBRA_ROUTE_OSPF) && (ospf->instance == instance)) { vty_out (vty, "Same instance OSPF redistribution not allowed%s", VTY_NEWLINE); return CMD_WARNING; } - source = ZEBRA_ROUTE_OSPF; - /* Get metric value. */ - if (argv[1] != NULL) - if (!str2metric (argv[1], &metric)) + if (argv[2] != NULL) + if (!str2metric (argv[2], &metric)) return CMD_WARNING; /* Get metric type. */ - if (argv[2] != NULL) - if (!str2metric_type (argv[2], &type)) + if (argv[3] != NULL) + if (!str2metric_type (argv[3], &type)) return CMD_WARNING; red = ospf_redist_add(ospf, source, instance); - if (argv[3] != NULL) - ospf_routemap_set (red, argv[3]); + if (argv[4] != NULL) + ospf_routemap_set (red, argv[4]); else ospf_routemap_unset (red); @@ -6974,12 +6989,13 @@ DEFUN (ospf_redistribute_instance_source, DEFUN (no_ospf_redistribute_instance_source, no_ospf_redistribute_instance_source_cmd, - "no redistribute ospf <1-65535>" + "no redistribute (ospf|table) <1-65535>" " {metric <0-16777214>|metric-type (1|2)|route-map WORD}", NO_STR REDIST_STR "Open Shortest Path First\n" - "Instance ID\n" + "Non-main Kernel Routing Table\n" + "Instance ID/Table Id\n" "Metric for redistributed routes\n" "OSPF default metric\n" "OSPF exterior metric type for redistributed routes\n" @@ -6996,23 +7012,27 @@ DEFUN (no_ospf_redistribute_instance_source, if (!ospf) return CMD_SUCCESS; - VTY_GET_INTEGER ("Instance ID", instance, argv[0]); + if (strncmp(argv[0], "o", 1) == 0) + source = ZEBRA_ROUTE_OSPF; + else + source = ZEBRA_ROUTE_TABLE; + + VTY_GET_INTEGER ("Instance ID", instance, argv[1]); - if (!ospf->instance) + if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance) { vty_out (vty, "Instance redistribution in non-instanced OSPF not allowed%s", VTY_NEWLINE); return CMD_WARNING; } - if (ospf->instance == instance) + if ((source == ZEBRA_ROUTE_OSPF) && (ospf->instance == instance)) { vty_out (vty, "Same instance OSPF redistribution not allowed%s", VTY_NEWLINE); return CMD_WARNING; } - source = ZEBRA_ROUTE_OSPF; red = ospf_redist_lookup(ospf, source, instance); if (!red) return CMD_SUCCESS;