diff options
author | Benoît Ganne <bganne@cisco.com> | 2022-06-08 10:56:33 +0200 |
---|---|---|
committer | Neale Ranns <neale@graphiant.com> | 2022-06-10 01:09:57 +0000 |
commit | c629f9075219b253530985a9a6ccf3dc77a90953 (patch) | |
tree | 3d48c5b8d2e9d6bcb45b87e090b9018ac6f7c098 /src/vnet | |
parent | f4cfa2a8a03737e1caa19b5d41820e8f236fbcc2 (diff) |
ip: improve ip ACL traces
Type: improvement
Change-Id: I85c73cb940d81d0b249eda0d57de135bcd798418
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/classify/vnet_classify.c | 4 | ||||
-rw-r--r-- | src/vnet/classify/vnet_classify.h | 1 | ||||
-rw-r--r-- | src/vnet/ip/ip_in_out_acl.c | 31 |
3 files changed, 26 insertions, 10 deletions
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c index c9a6fc6ac5b..479d3024631 100644 --- a/src/vnet/classify/vnet_classify.c +++ b/src/vnet/classify/vnet_classify.c @@ -660,8 +660,8 @@ vnet_classify_find_entry (vnet_classify_table_t * t, return vnet_classify_find_entry_inline (t, h, hash, now); } -static u8 * -format_classify_entry (u8 * s, va_list * args) +u8 * +format_classify_entry (u8 *s, va_list *args) { vnet_classify_table_t *t = va_arg (*args, vnet_classify_table_t *); vnet_classify_entry_t *e = va_arg (*args, vnet_classify_entry_t *); diff --git a/src/vnet/classify/vnet_classify.h b/src/vnet/classify/vnet_classify.h index 17a728deb48..c61ec8ff055 100644 --- a/src/vnet/classify/vnet_classify.h +++ b/src/vnet/classify/vnet_classify.h @@ -239,6 +239,7 @@ struct _vnet_classify_main extern vnet_classify_main_t vnet_classify_main; +u8 *format_classify_entry (u8 *s, va_list *args); u8 *format_classify_table (u8 * s, va_list * args); u8 *format_vnet_classify_table (u8 *s, va_list *args); diff --git a/src/vnet/ip/ip_in_out_acl.c b/src/vnet/ip/ip_in_out_acl.c index 500eefd7c91..9fc07176fa8 100644 --- a/src/vnet/ip/ip_in_out_acl.c +++ b/src/vnet/ip/ip_in_out_acl.c @@ -32,11 +32,26 @@ format_ip_in_out_acl_trace (u8 * s, u32 is_output, va_list * args) CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); ip_in_out_acl_trace_t *t = va_arg (*args, ip_in_out_acl_trace_t *); - - s = format (s, "%s: sw_if_index %d, next_index %d, table %d, offset %d", - is_output ? "OUTACL" : "INACL", - t->sw_if_index, t->next_index, t->table_index, t->offset); - return s; + const vnet_classify_main_t *vcm = &vnet_classify_main; + const u32 indent = format_get_indent (s); + vnet_classify_table_t *table; + vnet_classify_entry_t *e; + + s = + format (s, "%s: sw_if_index %d, next_index %d, table_index %d, offset %d", + is_output ? "OUTACL" : "INACL", t->sw_if_index, t->next_index, + t->table_index, t->offset); + + if (pool_is_free_index (vcm->tables, t->table_index)) + return format (s, "\n%Uno table", format_white_space, indent + 4); + + if (~0 == t->offset) + return format (s, "\n%Uno match", format_white_space, indent + 4); + + table = vnet_classify_table_get (t->table_index); + e = vnet_classify_get_entry (table, t->offset); + return format (s, "\n%U%U", format_white_space, indent + 4, + format_classify_entry, table, e); } static u8 * @@ -496,7 +511,7 @@ ip_in_out_acl_inline_trace ( _t->sw_if_index = ~0 == way ? 0 : vnet_buffer (b[0])->sw_if_index[way]; _t->next_index = _next[0]; - _t->table_index = t[0] ? t[0] - tables : ~0; + _t->table_index = table_index[0]; _t->offset = (e[0] && t[0]) ? vnet_classify_get_offset (t[0], e[0]) : ~0; } @@ -508,7 +523,7 @@ ip_in_out_acl_inline_trace ( _t->sw_if_index = ~0 == way ? 0 : vnet_buffer (b[1])->sw_if_index[way]; _t->next_index = _next[1]; - _t->table_index = t[1] ? t[1] - tables : ~0; + _t->table_index = table_index[1]; _t->offset = (e[1] && t[1]) ? vnet_classify_get_offset (t[1], e[1]) : ~0; } @@ -694,7 +709,7 @@ ip_in_out_acl_inline_trace ( t->sw_if_index = ~0 == way ? 0 : vnet_buffer (b[0])->sw_if_index[way]; t->next_index = next0; - t->table_index = t0 - tables; + t->table_index = table_index0; t->offset = (e0 && t0) ? vnet_classify_get_offset (t0, e0) : ~0; } |