summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-06-12 17:49:29 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-06-12 19:51:12 +0000
commit7bec514c7e42649b0c153fda9f66b5b52ce1de43 (patch)
treee6835d6543b424439afb87507f1d52f0fb5977f5
parentb7ae6ac4db91d0d8a3e2508a50550332e28c8b5b (diff)
pbrd: allow configurable table id range
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--pbrd/pbr_vty.c30
-rw-r--r--pbrd/pbr_vty.h2
2 files changed, 30 insertions, 2 deletions
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index 7e0e8d632b..79d42a42c3 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -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);
diff --git a/pbrd/pbr_vty.h b/pbrd/pbr_vty.h
index 6e345fd7e2..5a1d606e59 100644
--- a/pbrd/pbr_vty.h
+++ b/pbrd/pbr_vty.h
@@ -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