aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-07-02 14:35:28 +0000
committerDave Barach <openvpp@barachs.net>2019-07-03 11:30:43 +0000
commit7bf7ea3ce39c1d70c0409dcbecd5c4aaf26fae13 (patch)
treebba4fc609b2535d77db32a684d6f527beba4d961 /src
parent063f374393b7e3a86acee232ae828ba674e95839 (diff)
gbp: improve contract formatting
Type: feature Change-Id: I04be003bd86f828ec387dd0309bebcbf0a041e3a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gbp/gbp_contract.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/plugins/gbp/gbp_contract.c b/src/plugins/gbp/gbp_contract.c
index f0bb00a0154..a24edb362f5 100644
--- a/src/plugins/gbp/gbp_contract.c
+++ b/src/plugins/gbp/gbp_contract.c
@@ -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;
@@ -221,19 +221,19 @@ format_gbp_rule (u8 * s, va_list * args)
vec_foreach (gnhi, gu->gu_nhs)
{
- s = format (s, "\n [%U]", format_gbp_next_hop, *gnhi);
+ s = format (s, "\n [%U]", format_gbp_next_hop, *gnhi);
}
FOR_EACH_GBP_POLICY_NODE (pnode)
{
- s = format (s, "\n policy-%U", format_gbp_policy_node, pnode);
+ s = format (s, "\n policy-%U", format_gbp_policy_node, pnode);
FOR_EACH_FIB_IP_PROTOCOL (fproto)
{
if (dpo_id_is_valid (&gu->gu_dpo[pnode][fproto]))
{
s =
- format (s, "\n %U", format_dpo_id,
+ format (s, "\n %U", format_dpo_id,
&gu->gu_dpo[pnode][fproto], 8);
}
}
@@ -642,23 +642,27 @@ 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 %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);
+ s = format (s, "\n drop:[%Ld:%Ld]", counts.packets, counts.bytes);
vlib_get_combined_counter (&gbp_contract_permit_counters, gci, &counts);
- s = format (s, "\n permit:[%Ld:%Ld]", counts.packets, counts.bytes);
+ s = format (s, "\n permit:[%Ld:%Ld]", counts.packets, counts.bytes);
s = format (s, "]");