34 #define foreach_gbp_policy \ 39 #define _(sym,str) GBP_ERROR_##sym, 46 #define _(sym,string) string, 53 #define _(sym,str) GBP_POLICY_NEXT_##sym, 74 etype = clib_net_to_host_u16 (etype);
78 case ETHERNET_TYPE_IP4:
80 case ETHERNET_TYPE_IP6:
99 dpo = &gu->
gu_dpo[GBP_POLICY_NODE_L2][dproto];
116 if (*et == ethertype)
129 u32 n_left_from, *from, *to_next;
136 while (n_left_from > 0)
142 while (n_left_from > 0 && n_left_to_next > 0)
149 u32 bi0, sw_if_index0;
154 next0 = GBP_POLICY_NEXT_DENY;
176 L2OUTPUT_FEAT_GBP_POLICY_PORT :
177 L2OUTPUT_FEAT_GBP_POLICY_MAC));
210 L2OUTPUT_FEAT_GBP_POLICY_PORT :
211 L2OUTPUT_FEAT_GBP_POLICY_MAC));
220 u32 rule_match_p0, trace_bitmap0;
222 u32 acl_pos_p0, acl_match_p0;
223 u8 is_ip60, l2_len0, action0;
233 ether_type0 = *(
u16 *) (h0 + l2_len0 - 2);
244 clib_net_to_host_u16 (ETHERNET_TYPE_IP6))
246 clib_net_to_host_u16 (ETHERNET_TYPE_IP4)))
250 clib_net_to_host_u16 (ETHERNET_TYPE_IP6)) ? 1 :
281 case GBP_RULE_PERMIT:
287 L2OUTPUT_FEAT_GBP_POLICY_PORT :
288 L2OUTPUT_FEAT_GBP_POLICY_MAC));
294 case GBP_RULE_REDIRECT:
313 L2OUTPUT_FEAT_GBP_POLICY_PORT :
314 L2OUTPUT_FEAT_GBP_POLICY_MAC));
325 t->
allowed = (next0 != GBP_POLICY_NEXT_DENY);
330 to_next, n_left_to_next,
363 format (s,
"src:%d, dst:%d, acl:%d allowed:%d",
372 .name =
"gbp-policy-port",
373 .vector_size =
sizeof (
u32),
383 [GBP_POLICY_NEXT_DENY] =
"error-drop",
391 .name =
"gbp-policy-mac",
392 .vector_size =
sizeof (
u32),
395 .sibling_of =
"gbp-policy-port",
u16 * gc_allowed_ethertypes
An ethertype whitelist.
static u8 gbp_policy_is_ethertype_allowed(const gbp_contract_t *gc0, u16 ethertype)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
A Group Based Policy Endpoint.
char ** l2output_get_feat_names(void)
static dpo_proto_t ethertype_to_dpo_proto(u16 etype)
vlib_node_registration_t gbp_policy_mac_node
(constructor) VLIB_REGISTER_NODE (gbp_policy_mac_node)
gbp_endpoint_fwd_t ge_fwd
static u32 gbp_rule_l2_redirect(const gbp_rule_t *gu, vlib_buffer_t *b0)
static uword gbp_policy_port(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static gbp_rule_t * gbp_rule_get(index_t gui)
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
epg_id_t gef_epg_id
Endpoint Group's ID.
u32 l2_output_feat_next[2][32]
Next nodes for L2 output features.
VLIB_NODE_FUNCTION_MULTIARCH(gbp_policy_port_node, gbp_policy_port)
#define VLIB_INIT_FUNCTION(x)
static char * gbp_policy_error_strings[]
static_always_inline gbp_endpoint_t * gbp_endpoint_find_mac(const u8 *mac, u32 bd_index)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
#define foreach_gbp_policy
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)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
struct gbp_policy_trace_t_ gbp_policy_trace_t
per-packet trace data
index_t * gc_rules
The ACL to apply for packets from the source to the destination EPG.
static uword gbp_policy_mac(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
gbp_rule_action_t gu_action
#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.
#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 clib_error_t * gbp_policy_init(vlib_main_t *vm)
#define VLIB_REGISTER_NODE(x,...)
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.
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.
epg_id_t gck_src
source and destination EPGs for which the ACL applies
static gbp_policy_main_t gbp_policy_main
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 u8 * format_gbp_policy_trace(u8 *s, va_list *args)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
vlib_node_registration_t gbp_policy_port_node
(constructor) VLIB_REGISTER_NODE (gbp_policy_port_node)
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
struct gbp_policy_main_t_ gbp_policy_main_t
Grouping of global data for the GBP source EPG classification feature.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
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)
static uword gbp_policy_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_port_based)
#define vec_foreach(var, vec)
Vector iterator.
u16 dpoi_next_node
The next VLIB node to follow.
Grouping of global data for the GBP source EPG classification feature.
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_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static index_t gbp_contract_find(gbp_contract_key_t *key)
A Group Based Policy Contract.