summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/srv6/sr.h1
-rw-r--r--src/vnet/srv6/sr_policy_rewrite.c27
2 files changed, 28 insertions, 0 deletions
diff --git a/src/vnet/srv6/sr.h b/src/vnet/srv6/sr.h
index 41adef30818..7452b95b34d 100644
--- a/src/vnet/srv6/sr.h
+++ b/src/vnet/srv6/sr.h
@@ -360,6 +360,7 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
u32 sw_if_index, u8 traffic_type);
extern void sr_set_source (ip6_address_t * address);
+extern ip6_address_t *sr_get_encaps_source ();
extern void sr_set_hop_limit (u8 hop_limit);
extern u8 sr_get_hop_limit (void);
diff --git a/src/vnet/srv6/sr_policy_rewrite.c b/src/vnet/srv6/sr_policy_rewrite.c
index 7c4f757f36b..77e14853bfa 100644
--- a/src/vnet/srv6/sr_policy_rewrite.c
+++ b/src/vnet/srv6/sr_policy_rewrite.c
@@ -119,6 +119,12 @@ sr_set_source (ip6_address_t * address)
clib_memcpy_fast (&sr_pr_encaps_src, address, sizeof (sr_pr_encaps_src));
}
+ip6_address_t *
+sr_get_encaps_source ()
+{
+ return &sr_pr_encaps_src;
+}
+
static clib_error_t *
set_sr_src_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
@@ -1162,6 +1168,27 @@ VLIB_CLI_COMMAND (show_sr_policies_command, static) = {
};
/* *INDENT-ON* */
+/**
+ * @brief CLI to display onscreen the SR encaps source addr
+ */
+static clib_error_t *
+show_sr_encaps_source_command_fn (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ vlib_cli_output (vm, "SR encaps source addr = %U", format_ip6_address,
+ sr_get_encaps_source ());
+
+ return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (show_sr_encaps_source_command, static) = {
+ .path = "show sr encaps source addr",
+ .short_help = "show sr encaps source addr",
+ .function = show_sr_encaps_source_command_fn,
+};
+/* *INDENT-ON* */
+
/*************************** SR rewrite graph node ****************************/
/**
* @brief Trace for the SR Policy Rewrite graph node