22 #define foreach_gbp_policy \ 24 _(REFLECTION, "reflection") 28 #define _(sym,str) GBP_POLICY_ERROR_##sym, 35 #define _(sym,string) string, 62 etype = clib_net_to_host_u16 (etype);
66 case ETHERNET_TYPE_IP4:
68 case ETHERNET_TYPE_IP6:
87 dpo = &gu->
gu_dpo[GBP_POLICY_NODE_L2][dproto];
104 if (*et == ethertype)
117 u32 n_left_from, *from, *to_next;
118 u32 next_index, thread_index;
119 u32 n_allow_intra, n_allow_a_bit;
125 n_allow_intra = n_allow_a_bit = 0;
127 while (n_left_from > 0)
133 while (n_left_from > 0 && n_left_to_next > 0)
140 u32 bi0, sw_if_index0;
176 L2OUTPUT_FEAT_GBP_POLICY_PORT :
177 L2OUTPUT_FEAT_GBP_POLICY_MAC));
197 b0->
error = node->
errors[GBP_POLICY_ERROR_DROP_NO_DCLASS];
214 L2OUTPUT_FEAT_GBP_POLICY_PORT :
215 L2OUTPUT_FEAT_GBP_POLICY_MAC));
225 u32 rule_match_p0, trace_bitmap0;
227 u32 acl_pos_p0, acl_match_p0;
228 u8 is_ip60, l2_len0, action0;
243 ether_type0 = *(
u16 *) (h0 + l2_len0 - 2);
251 node->
errors[GBP_POLICY_ERROR_DROP_ETHER_TYPE];
262 clib_net_to_host_u16 (ETHERNET_TYPE_IP6))
264 clib_net_to_host_u16 (ETHERNET_TYPE_IP4)))
268 clib_net_to_host_u16 (ETHERNET_TYPE_IP6)) ? 1 :
299 case GBP_RULE_PERMIT:
305 L2OUTPUT_FEAT_GBP_POLICY_PORT :
306 L2OUTPUT_FEAT_GBP_POLICY_MAC));
311 case GBP_RULE_REDIRECT:
324 node->
errors[GBP_POLICY_ERROR_DROP_CONTRACT];
337 node->
errors[GBP_POLICY_ERROR_DROP_NO_CONTRACT];
351 L2OUTPUT_FEAT_GBP_POLICY_PORT :
352 L2OUTPUT_FEAT_GBP_POLICY_MAC));
369 to_next, n_left_to_next,
377 GBP_POLICY_ERROR_ALLOW_INTRA, n_allow_intra);
379 GBP_POLICY_ERROR_ALLOW_A_BIT, n_allow_a_bit);
407 format (s,
"sclass:%d, dst:%d, acl:%d allowed:%d flags:%U",
416 .name =
"gbp-policy-port",
417 .vector_size =
sizeof (
u32),
431 .name =
"gbp-policy-mac",
432 .vector_size =
sizeof (
u32),
u16 * gc_allowed_ethertypes
An ethertype whitelist.
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
A Group Based Policy Endpoint.
static u8 gbp_policy_is_ethertype_allowed(const gbp_contract_t *gc0, u16 ethertype)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
gbp_endpoint_fwd_t ge_fwd
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define VLIB_NODE_FN(node)
static gbp_rule_t * gbp_rule_get(index_t gui)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
vlib_node_registration_t gbp_policy_mac_node
(constructor) VLIB_REGISTER_NODE (gbp_policy_mac_node)
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
static acl_plugin_methods_t acl_plugin
u32 l2_output_feat_next[2][32]
Next nodes for L2 output features.
u8 * format_vxlan_gbp_header_gpflags(u8 *s, va_list *args)
static u32 vxlan_gbp_tunnel_by_sw_if_index(u32 sw_if_index)
static_always_inline gbp_endpoint_t * gbp_endpoint_find_mac(const u8 *mac, u32 bd_index)
static uword gbp_policy_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_port_based)
gbp_policy_main_t gbp_policy_main
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static void acl_plugin_fill_5tuple_inline(void *p_acl_main, u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
index_t * gc_rules
The ACL to apply for packets from the source to the destination EPG.
sclass_t gck_src
source and destination EPGs for which the ACL applies
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
gbp_rule_action_t gu_action
static void vlib_prefetch_combined_counter(const vlib_combined_counter_main_t *cm, u32 thread_index, u32 index)
Pre-fetch a per-thread combined counter for the given object index.
u32 node_index
Node index.
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
sclass_t gef_sclass
Endpoint Group's sclass.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
#define foreach_gbp_policy_error
vlib_combined_counter_main_t gbp_contract_permit_counters
static dpo_proto_t ethertype_to_dpo_proto(u16 etype)
vlib_node_registration_t gbp_policy_port_node
(constructor) VLIB_REGISTER_NODE (gbp_policy_port_node)
dpo_id_t gu_dpo[GBP_POLICY_N_NODES][FIB_PROTOCOL_IP_MAX]
DPO of the load-balance object used to redirect.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
static int acl_plugin_match_5tuple_inline(void *p_acl_main, u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
static char * gbp_policy_error_strings[]
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static gbp_contract_t * gbp_contract_get(index_t gci)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
index_t dpoi_index
the index of objects of that type
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
Group Base Policy (GBP) defines:
static_always_inline gbp_endpoint_t * gbp_endpoint_find_itf(u32 sw_if_index)
#define vec_foreach(var, vec)
Vector iterator.
static u8 * format_gbp_policy_trace(u8 *s, va_list *args)
u16 dpoi_next_node
The next VLIB node to follow.
vlib_combined_counter_main_t gbp_contract_drop_counters
Grouping of global data for the GBP source EPG classification feature.
struct gbp_policy_trace_t_ gbp_policy_trace_t
per-packet trace data
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u32 gbp_rule_l2_redirect(const gbp_rule_t *gu, vlib_buffer_t *b0)
static index_t gbp_contract_find(gbp_contract_key_t *key)
A Group Based Policy Contract.