summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_policy_node.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-19 06:25:56 -0700
committerDamjan Marion <dmarion@me.com>2019-07-01 08:37:53 +0000
commit160c923f99c2adc103495fab1bfcefe965fe7fb8 (patch)
treea3b33e764c9ec138d519a5a2b4001bdf63eb8dba /src/plugins/gbp/gbp_policy_node.c
parent5770c916c0cf110ced690ff128b065bbb2c827ca (diff)
gbp: VRF scoped contracts
Type: feature Change-Id: I01772cfc3a0118a5c49bf346339788824e6931b2 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/gbp/gbp_policy_node.c')
-rw-r--r--src/plugins/gbp/gbp_policy_node.c24
1 files changed, 17 insertions, 7 deletions
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 <plugins/gbp/gbp.h>
#include <plugins/gbp/gbp_policy_dpo.h>
+#include <plugins/gbp/gbp_bridge_domain.h>
#include <vnet/vxlan-gbp/vxlan_gbp_packet.h>
#include <vnet/vxlan-gbp/vxlan_gbp.h>
@@ -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;