summaryrefslogtreecommitdiffstats
path: root/src/plugins/gbp/gbp_policy.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-07-03 17:34:21 +0200
committerNeale Ranns <nranns@cisco.com>2019-07-08 07:46:49 +0000
commit1d6d9f021c5a169dedca55b46451ab54728e3ee8 (patch)
tree6c8317499e028ff743e7fa33e3f2da1fcfcfcd90 /src/plugins/gbp/gbp_policy.c
parent94bef09213c1e47d37f8342b746de767d9669739 (diff)
gbp: refactor policy nodes
Refactor both policy and policy-dpo nodes so they share the same code for contract & acl lookup and for tracing. This should help to implement new policy schemes. Type: refactor Change-Id: If5704bda708838eb01516dd39473d9bf248cfdf6 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/gbp/gbp_policy.c')
-rw-r--r--src/plugins/gbp/gbp_policy.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/gbp/gbp_policy.c b/src/plugins/gbp/gbp_policy.c
index 0f26701bd19..21e4bdba064 100644
--- a/src/plugins/gbp/gbp_policy.c
+++ b/src/plugins/gbp/gbp_policy.c
@@ -14,10 +14,27 @@
*/
#include <plugins/gbp/gbp.h>
-#include <plugins/gbp/gbp_policy_dpo.h>
+#include <plugins/gbp/gbp_policy.h>
+#include <vnet/vxlan-gbp/vxlan_gbp_packet.h>
gbp_policy_main_t gbp_policy_main;
+/* packet trace format function */
+u8 *
+format_gbp_policy_trace (u8 * s, va_list * args)
+{
+ CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
+ CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
+ gbp_policy_trace_t *t = va_arg (*args, gbp_policy_trace_t *);
+
+ s =
+ format (s, "scope:%d sclass:%d, dclass:%d, allowed:%d flags:%U", t->scope,
+ t->sclass, t->dclass, t->allowed, format_vxlan_gbp_header_gpflags,
+ t->flags);
+
+ return s;
+}
+
static clib_error_t *
gbp_policy_init (vlib_main_t * vm)
{