aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2024-07-18 09:10:48 -0700
committerFlorin Coras <florin.coras@gmail.com>2024-07-19 17:05:29 +0000
commite87a03f7a6e7c5558e115582b0006826a4c2105f (patch)
treeb1e2bec68c10b0953bd7605fa4c038e9bc0bf771
parent09b19fe8a31a61c04dedaa0ddec44576abad57c2 (diff)
session: show session rules does not display ip6 entries
1. Adding an ip6 rule entry session rule add proto tcp ee80::/10 0 ee80::/10 0 action 2 2. show session rules does not display the entry. show session rules tcp 3. However, show session rules for a specific entry shows the entry show session rules tcp ee80::/10 0 ee80::/10 0 Type: fix Change-Id: I65c881665d3698a2a9452a186ed657eee0bf13e0 Signed-off-by: Steven Luong <sluong@cisco.com>
-rw-r--r--src/vnet/session/session_lookup.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c
index ff20bc2d835..ff6e5818ce5 100644
--- a/src/vnet/session/session_lookup.c
+++ b/src/vnet/session/session_lookup.c
@@ -1665,9 +1665,9 @@ show_session_rules_command_fn (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (input, "appns %_%v%_", &ns_id))
;
else if (unformat (input, "scope global"))
- scope = 1;
+ scope = SESSION_RULE_SCOPE_GLOBAL;
else if (unformat (input, "scope local"))
- scope = 2;
+ scope = SESSION_RULE_SCOPE_LOCAL;
else if (unformat (input, "%U/%d %d %U/%d %d", unformat_ip4_address,
&lcl_ip.ip4, &lcl_plen, &lcl_port,
unformat_ip4_address, &rmt_ip.ip4, &rmt_plen,
@@ -1709,7 +1709,7 @@ show_session_rules_command_fn (vlib_main_t * vm, unformat_input_t * input,
app_ns = app_namespace_get_default ();
}
- if (scope == 1 || scope == 0)
+ if (scope == SESSION_RULE_SCOPE_GLOBAL || scope == 0)
{
fib_proto = is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
fib_index = is_ip4 ? app_ns->ip4_fib_index : app_ns->ip6_fib_index;
@@ -1730,9 +1730,36 @@ show_session_rules_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_output (vm, "%U rules table", format_transport_proto,
transport_proto);
- srt = &st->session_rules[transport_proto];
- session_rules_table_cli_dump (vm, srt, FIB_PROTOCOL_IP4);
- session_rules_table_cli_dump (vm, srt, FIB_PROTOCOL_IP6);
+ if (scope == SESSION_RULE_SCOPE_LOCAL)
+ {
+ if (st)
+ {
+ srt = &st->session_rules[transport_proto];
+ session_rules_table_cli_dump (vm, srt, FIB_PROTOCOL_IP4);
+ session_rules_table_cli_dump (vm, srt, FIB_PROTOCOL_IP6);
+ }
+ }
+ else
+ {
+ /*
+ * 2 separate session tables for global entries, 1 for ip4 and 1 for ip6
+ */
+ st = session_table_get_for_fib_index (FIB_PROTOCOL_IP4,
+ app_ns->ip4_fib_index);
+ if (st)
+ {
+ srt = &st->session_rules[transport_proto];
+ session_rules_table_cli_dump (vm, srt, FIB_PROTOCOL_IP4);
+ }
+
+ st = session_table_get_for_fib_index (FIB_PROTOCOL_IP6,
+ app_ns->ip6_fib_index);
+ if (st)
+ {
+ srt = &st->session_rules[transport_proto];
+ session_rules_table_cli_dump (vm, srt, FIB_PROTOCOL_IP6);
+ }
+ }
vec_free (ns_id);
return 0;