]> git.proxmox.com Git - mirror_frr.git/commitdiff
pbrd: allow configurable table id range
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 12 Jun 2018 17:49:29 +0000 (17:49 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 12 Jun 2018 19:51:12 +0000 (19:51 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
pbrd/pbr_vty.c
pbrd/pbr_vty.h

index 7e0e8d632ba2bc2b447f94df8796252f02514e08..79d42a42c33292ffe3378a5940a93dfdf83482a4 100644 (file)
@@ -85,6 +85,33 @@ DEFUN_NOSH(no_pbr_map, no_pbr_map_cmd, "no pbr-map WORD [seq (1-700)]",
        return CMD_SUCCESS;
 }
 
+DEFPY(pbr_set_table_range,
+      pbr_set_table_range_cmd,
+      "[no] pbr table range (10000-4294966272)$lb (10000-4294966272)$ub",
+      NO_STR
+      PBR_STR
+      "Set table ID range\n"
+      "Set table ID range\n"
+      "Lower bound for table ID range\n"
+      "Upper bound for table ID range\n")
+{
+       /* upper bound is 2^32 - 2^10 */
+       int ret = CMD_WARNING;
+
+       /* validate given bounds */
+       if (lb > ub)
+               vty_out(vty, "%% Lower bound must be less than upper bound\n");
+       else if (ub - lb < 10)
+               vty_out(vty, "%% Range breadth must be at least 10\n");
+       else {
+               ret = CMD_SUCCESS;
+               pbr_nht_set_tableid_range((uint32_t) lb, (uint32_t) ub);
+       }
+
+       return ret;
+}
+
+
 DEFPY(pbr_map_match_src, pbr_map_match_src_cmd,
        "[no] match src-ip <A.B.C.D/M|X:X::X:X/M>$prefix",
        NO_STR
@@ -489,7 +516,6 @@ DEFPY (show_pbr_interface,
 }
 
 /* PBR debugging CLI ------------------------------------------------------- */
-/* clang-format off */
 
 static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
 
@@ -536,7 +562,6 @@ DEFUN_NOSH(show_debugging_pbr,
        return CMD_SUCCESS;
 }
 
-/* clang-format on */
 /* ------------------------------------------------------------------------- */
 
 
@@ -634,6 +659,7 @@ void pbr_vty_init(void)
 
        install_element(CONFIG_NODE, &pbr_map_cmd);
        install_element(CONFIG_NODE, &no_pbr_map_cmd);
+       install_element(CONFIG_NODE, &pbr_set_table_range_cmd);
        install_element(INTERFACE_NODE, &pbr_policy_cmd);
        install_element(PBRMAP_NODE, &pbr_map_match_src_cmd);
        install_element(PBRMAP_NODE, &pbr_map_match_dst_cmd);
index 6e345fd7e21ca7e8a75844b9f5d3fb15f82ff15e..5a1d606e59e8cab26840c8c7a3aae5ac206d8376 100644 (file)
@@ -20,5 +20,7 @@
 #ifndef __PBR_VTY_H__
 #define __PBR_VTY_H__
 
+#define PBR_STR "Policy based routing\n"
+
 extern void pbr_vty_init(void);
 #endif