2 * Copyright (c) 2018 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <plugins/gbp/gbp.h>
17 #include <plugins/gbp/gbp_policy.h>
18 #include <vnet/vxlan-gbp/vxlan_gbp_packet.h>
20 gbp_policy_main_t gbp_policy_main;
22 /* packet trace format function */
24 format_gbp_policy_trace (u8 * s, va_list * args)
26 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
27 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
28 gbp_policy_trace_t *t = va_arg (*args, gbp_policy_trace_t *);
31 format (s, "scope:%d sclass:%d, dclass:%d, allowed:%d flags:%U", t->scope,
32 t->sclass, t->dclass, t->allowed, format_vxlan_gbp_header_gpflags,
39 gbp_policy_init (vlib_main_t * vm)
41 gbp_policy_main_t *gpm = &gbp_policy_main;
42 clib_error_t *error = 0;
44 /* Initialize the feature next-node indexes */
45 vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-port");
46 feat_bitmap_init_next_nodes (vm,
49 l2output_get_feat_names (),
50 gpm->l2_output_feat_next[GBP_POLICY_PORT]);
52 node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-mac");
53 feat_bitmap_init_next_nodes (vm,
56 l2output_get_feat_names (),
57 gpm->l2_output_feat_next[GBP_POLICY_MAC]);
59 node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-lpm");
60 feat_bitmap_init_next_nodes (vm,
63 l2output_get_feat_names (),
64 gpm->l2_output_feat_next[GBP_POLICY_LPM]);
69 VLIB_INIT_FUNCTION (gbp_policy_init);
72 * fd.io coding-style-patch-verification: ON
75 * eval: (c-set-style "gnu")