gbp: improve contract formatting
Type: feature
@@ -213,7 +213,7 @@ format_gbp_rule (u8 * s, va_list * args)
{
case GBP_RULE_PERMIT:
case GBP_RULE_DENY:
- break;
+ return (s);
case GBP_RULE_REDIRECT:
s = format (s, ", %U", format_gbp_hash_mode, gu->gu_hash_mode);
break;
@@ -642,19 +642,23 @@ format_gbp_contract (u8 * s, va_list * args)
s = format (s, "[%d] %U: acl-index:%d",
gci, format_gbp_contract_key, &gc->gc_key, gc->gc_acl_index);
+ s = format (s, "\n rules:");
vec_foreach (gui, gc->gc_rules)
{
s = format (s, "\n %d: %U", *gui, format_gbp_rule, *gui);
}
- s = format (s, "\n allowed-ethertypes:[");
+ s = format (s, "\n allowed-ethertypes:");
+ s = format (s, "\n [");
vec_foreach (et, gc->gc_allowed_ethertypes)
{
int host_et = clib_net_to_host_u16 (*et);
if (0 != host_et)
s = format (s, "0x%x, ", host_et);
}
+ s = format (s, "]");
+ s = format (s, "\n stats:");
vlib_get_combined_counter (&gbp_contract_drop_counters, gci, &counts);
s = format (s, "\n drop:[%Ld:%Ld]", counts.packets, counts.bytes);
vlib_get_combined_counter (&gbp_contract_permit_counters, gci, &counts);
