FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
gbp_policy.c
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 #include <plugins/gbp/gbp.h>
17 #include <plugins/gbp/gbp_policy.h>
19 
21 
22 /* packet trace format function */
23 u8 *
24 format_gbp_policy_trace (u8 * s, va_list * args)
25 {
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 *);
29 
30  s =
31  format (s,
32  "scope:%d sclass:%d, dclass:%d, action:%U flags:%U acl: %d rule: %d",
35  t->rule_match);
36 
37  return s;
38 }
39 
40 static clib_error_t *
42 {
44  clib_error_t *error = 0;
45 
46  /* Initialize the feature next-node indexes */
47  vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-port");
49  node->index,
53 
54  node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-mac");
56  node->index,
60 
61  node = vlib_get_node_by_name (vm, (u8 *) "gbp-policy-lpm");
63  node->index,
67 
68  return error;
69 }
70 
72 
73 /*
74  * fd.io coding-style-patch-verification: ON
75  *
76  * Local Variables:
77  * eval: (c-set-style "gnu")
78  * End:
79  */
gbp_policy.h
GBP_POLICY_PORT
@ GBP_POLICY_PORT
Definition: gbp.h:52
gbp_policy_trace_t_::acl_match
u32 acl_match
Definition: gbp_policy.h:32
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
GBP_POLICY_LPM
@ GBP_POLICY_LPM
Definition: gbp.h:54
gbp_policy_trace_t_::rule_match
u32 rule_match
Definition: gbp_policy.h:33
gbp.h
GBP_POLICY_MAC
@ GBP_POLICY_MAC
Definition: gbp.h:53
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
gbp_policy_trace_t_::action
gbp_rule_action_t action
Definition: gbp_policy.h:30
error
Definition: cJSON.c:88
format_gbp_rule_action
u8 * format_gbp_rule_action(u8 *s, va_list *args)
Definition: gbp_contract.c:171
CLIB_UNUSED
#define CLIB_UNUSED(x)
Definition: clib.h:90
l2output_get_feat_names
char ** l2output_get_feat_names(void)
Definition: l2_output.c:38
L2OUTPUT_N_FEAT
@ L2OUTPUT_N_FEAT
Definition: l2_output.h:105
gbp_policy_main_t_::l2_output_feat_next
u32 l2_output_feat_next[GBP_N_POLICY][32]
Next nodes for L2 output features.
Definition: gbp.h:67
gbp_policy_main
gbp_policy_main_t gbp_policy_main
Definition: gbp_policy.c:20
gbp_policy_init
static clib_error_t * gbp_policy_init(vlib_main_t *vm)
Definition: gbp_policy.c:41
vxlan_gbp_packet.h
vlib_get_node_by_name
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
Definition: node.c:45
gbp_policy_trace_t_
per-packet trace data
Definition: gbp_policy.h:24
format
description fragment has unexpected format
Definition: map.api:433
gbp_policy_main_t_
Grouping of global data for the GBP source EPG classification feature.
Definition: gbp.h:62
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
gbp_policy_trace_t_::flags
u32 flags
Definition: gbp_policy.h:31
gbp_policy_trace_t_::scope
gbp_scope_t scope
Definition: gbp_policy.h:27
vlib_main_t
Definition: main.h:102
vlib_node_t
Definition: node.h:247
gbp_policy_trace_t_::sclass
sclass_t sclass
Definition: gbp_policy.h:28
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
format_vxlan_gbp_header_gpflags
u8 * format_vxlan_gbp_header_gpflags(u8 *s, va_list *args)
Definition: vxlan_gbp_packet.c:37
format_gbp_policy_trace
u8 * format_gbp_policy_trace(u8 *s, va_list *args)
Definition: gbp_policy.c:24
gbp_policy_trace_t_::dclass
sclass_t dclass
Definition: gbp_policy.h:29
feat_bitmap_init_next_nodes
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
Definition: feat_bitmap.h:43