From 160c923f99c2adc103495fab1bfcefe965fe7fb8 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Wed, 19 Jun 2019 06:25:56 -0700 Subject: gbp: VRF scoped contracts Type: feature Change-Id: I01772cfc3a0118a5c49bf346339788824e6931b2 Signed-off-by: Neale Ranns --- src/plugins/gbp/gbp_policy_node.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/plugins/gbp/gbp_policy_node.c') diff --git a/src/plugins/gbp/gbp_policy_node.c b/src/plugins/gbp/gbp_policy_node.c index 2cffc79cf2d..26f7e9b8c59 100644 --- a/src/plugins/gbp/gbp_policy_node.c +++ b/src/plugins/gbp/gbp_policy_node.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -49,8 +50,9 @@ typedef enum typedef struct gbp_policy_trace_t_ { /* per-pkt trace data */ - u32 sclass; - u32 dst_epg; + gbp_scope_t scope; + sclass_t sclass; + sclass_t dclass; u32 acl_index; u32 allowed; u32 flags; @@ -154,6 +156,9 @@ gbp_policy_inline (vlib_main_t * vm, h0 = vlib_buffer_get_current (b0); sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX]; + /* zero out the key to ensure the pad space is clear */ + key0.as_u64 = 0; + /* * Reflection check; in and out on an ivxlan tunnel */ @@ -176,7 +181,7 @@ gbp_policy_inline (vlib_main_t * vm, L2OUTPUT_FEAT_GBP_POLICY_PORT : L2OUTPUT_FEAT_GBP_POLICY_MAC)); n_allow_a_bit++; - key0.as_u32 = ~0; + key0.as_u64 = ~0; goto trace; } @@ -190,7 +195,11 @@ gbp_policy_inline (vlib_main_t * vm, vnet_buffer (b0)->l2.bd_index); if (NULL != ge0) - key0.gck_dst = ge0->ge_fwd.gef_sclass; + { + key0.gck_dst = ge0->ge_fwd.gef_sclass; + key0.gck_scope = + gbp_bridge_domain_get_scope (vnet_buffer (b0)->l2.bd_index); + } else { /* If you cannot determine the destination EP then drop */ @@ -373,7 +382,8 @@ gbp_policy_inline (vlib_main_t * vm, gbp_policy_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t)); t->sclass = key0.gck_src; - t->dst_epg = key0.gck_dst; + t->dclass = key0.gck_dst; + t->scope = key0.gck_scope; t->acl_index = (gc0 ? gc0->gc_acl_index : ~0); t->allowed = (next0 != GBP_POLICY_NEXT_DROP); t->flags = vnet_buffer2 (b0)->gbp.flags; @@ -422,8 +432,8 @@ format_gbp_policy_trace (u8 * s, va_list * args) gbp_policy_trace_t *t = va_arg (*args, gbp_policy_trace_t *); s = - format (s, "sclass:%d, dst:%d, acl:%d allowed:%d flags:%U", - t->sclass, t->dst_epg, t->acl_index, t->allowed, + format (s, "scope:%d sclass:%d, dclass:%d, acl:%d allowed:%d flags:%U", + t->scope, t->sclass, t->dclass, t->acl_index, t->allowed, format_vxlan_gbp_header_gpflags, t->flags); return s; -- cgit 1.2.3-korg