#include <plugins/gbp/gbp_bridge_domain.h>
#include <plugins/gbp/gbp_route_domain.h>
#include <plugins/gbp/gbp_policy_dpo.h>
+#include <plugins/gbp/gbp_contract.h>
#include <vnet/dpo/load_balance.h>
#include <vnet/dpo/drop_dpo.h>
+char *gbp_contract_error_strings[] = {
+#define _(sym,string) string,
+ foreach_gbp_contract_error
+#undef _
+};
+
/**
* Single contract DB instance
*/
return (gu - gbp_rule_pool);
}
+void
+gbp_rule_free (index_t gui)
+{
+ pool_put_index (gbp_rule_pool, gui);
+}
+
index_t
gbp_next_hop_alloc (const ip46_address_t * ip,
index_t grd, const mac_address_t * mac, index_t gbd)
adj_unlock (gnh->gnh_ai[fproto]);
}
}
+
+ gbp_rule_free (*gui);
}
vec_free (rules);
}
return (s);
}
-static u8 *
+u8 *
format_gbp_rule_action (u8 * s, va_list * args)
{
gbp_rule_action_t action = va_arg (*args, gbp_rule_action_t);
{
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;
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);
}
}
gnh->gnh_ai[fproto] =
adj_nbr_add_or_lock_w_rewrite (fproto,
fib_proto_to_link (fproto),
- &gnh->gnh_ip, ge->ge_fwd.gef_itf, rewrite);
+ &gnh->gnh_ip,
+ gbp_itf_get_sw_if_index (ge->
+ ge_fwd.gef_itf),
+ rewrite);
adj_unlock (old_ai);
}
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, "]");