aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAhmed Abdelsalam <ahabdels@cisco.com>2020-11-09 14:04:07 +0000
committerNeale Ranns <nranns@cisco.com>2020-11-10 14:50:47 +0000
commit448bc81d3696dad2a35bb42ec37e097f431b5566 (patch)
tree87a8222dfb2a5b82bba47ee0e2a650715d77f944 /src
parent5f7f47ec7ad642c3938376420ef9530176052cd8 (diff)
sr: Show IPv6 address used as SRv6 Encaps source
Implements CLI to show the IPv6 address used as source address for the SRv6 encapsulation. Type: feature Signed-off-by: Ahmed Abdelsalam <ahabdels@cisco.com> Change-Id: Ia442d9345a7793836148d890745fc5dc92729b6f
Diffstat (limited to 'src')
-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