132 sw_if_index, ITF_INVALID);
137 sw_if_index, 1,
NULL, 0);
139 sw_if_index, 1,
NULL, 0);
156 sw_if_index, 0,
NULL, 0);
158 sw_if_index, 0,
NULL, 0);
165 const ip46_address_t * ip,
epg_id_t epg_id)
169 .gek_sw_if_index = sw_if_index,
201 .gek_sw_if_index = sw_if_index,
268 gbp_contract_t gbpc = {
270 .gc_acl_index = acl_index,
285 ip46_address_t ip = { };
286 u32 sw_if_index = ~0;
298 else if (
unformat (input,
"epg %d", &epg_id))
308 if (~0 == sw_if_index)
337 else if (
unformat (input,
"src-epg %d", &src_epg_id))
339 else if (
unformat (input,
"dst-epg %d", &dst_epg_id))
341 else if (
unformat (input,
"acl-index %d", &acl_index))
373 .path =
"gbp endpoint",
374 .short_help =
"gbp endpoint [del] <interface> epg <ID> ip <IP>",
386 .path =
"gbp contract",
387 .short_help =
"gbp contract [del] src-epg <ID> dst-epg <ID> acl-index <ACL>",
413 ip46_address_t ip, *ipp;
437 vlib_cli_output (vm,
" %U -> %d", format_ip46_address, &ip,
438 IP46_TYPE_IP4, epg_id);
447 vlib_cli_output (vm,
" %U -> %d", format_ip46_address, ipp,
448 IP46_TYPE_IP6, epg_id);
467 vlib_cli_output (vm,
" {%d,%d} -> %d", key.gck_src,
468 key.gck_dst, epg_id);
484 .path =
"show gbp endpoint",
485 .short_help =
"show gbp endpoint\n",
499 .path =
"show gbp contract",
500 .short_help =
"show gbp contract\n",
505 #define foreach_gbp \ 510 #define _(sym,str) GBP_ERROR_##sym, 517 #define _(sym,string) string, 524 #define _(sym,str) GBP_NEXT_##sym, 545 u32 n_left_from, *from, *to_next;
552 while (n_left_from > 0)
558 while (n_left_from > 0 && n_left_to_next > 0)
578 next0 = GBP_NEXT_DENY;
625 if (~0 == acl_index0)
665 (b0->
flags & VLIB_BUFFER_IS_TRACED)))
675 to_next, n_left_to_next,
693 s =
format (s,
"gbp: src:%d dst:%d acl:%d",
715 .vector_size =
sizeof (
u32),
725 [GBP_NEXT_DENY] =
"ip4-drop",
732 .arc_name =
"ip4-unicast",
740 .vector_size =
sizeof (
u32),
750 [GBP_NEXT_DENY] =
"ip6-drop",
757 .arc_name =
"ip6-unicast",
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define hash_set(h, key, value)
A Group Based Policy Endpoint.
int(* gbp_endpoint_cb_t)(gbp_endpoint_t *gbpe, void *ctx)
#define hash_unset(h, key)
vnet_main_t * vnet_get_main(void)
static char * gbp_error_strings[]
IP6 destintion address to destination EPG mapping table.
static uword gbp_6(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Interface to source EPG DB - a per-interface vector.
VLIB_NODE_FUNCTION_MULTIARCH(gbp_4_node, gbp_4)
gbp_endpoint_key_t * ge_key
The endpoint's interface and IP address.
struct gbp_ip6_to_epg_db_t_ gbp_ip6_to_epg_db_t
IP6 destintion address to destination EPG mapping table.
#define hash_set_mem(h, key, value)
unformat_function_t unformat_vnet_sw_interface
static clib_error_t * gbp_endpoint_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
EPG src,dst pair to ACL mapping table, aka contract DB.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static u8 * format_gbp_trace(u8 *s, va_list *args)
format_function_t format_vnet_sw_if_index_name
void gbp_contract_walk(gbp_contract_cb_t cb, void *ctx)
uword * g6ie_hash
use a memroy hash table
static gbp_ip6_to_epg_db_t gbp_ip6_to_epg_db
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
static void gbp_ip_epg_delete(const ip46_address_t *ip)
vlib_node_registration_t gbp_4_node
(constructor) VLIB_REGISTER_NODE (gbp_4_node)
u32 gek_sw_if_index
The interface on which the EP is connected.
#define hash_foreach(key_var, value_var, h, body)
#define clib_error_return(e, args...)
void gbp_contract_delete(epg_id_t src_epg, epg_id_t dst_epg)
static int gbp_endpoint_show_one(gbp_endpoint_t *gbpe, void *ctx)
void gbp_endpoint_delete(u32 sw_if_index, const ip46_address_t *ip)
uword * gc_hash
We can form a u64 key from the pair, so use a simple hash table.
#define hash_create_mem(elts, key_bytes, value_bytes)
static gbp_itf_to_epg_db_t gbp_itf_to_epg_db
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define hash_unset_mem(h, key)
static void gbp_itf_epg_update(u32 sw_if_index, epg_id_t src_epg)
static clib_error_t * gbp_endpoint_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
struct gbp_ip4_to_epg_db_t_ gbp_ip4_to_epg_db_t
IP4 destintion address to destination EPG mapping table.
static gbp_ip4_to_epg_db_t gbp_ip4_to_epg_db
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
#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).
#define hash_foreach_mem(key_var, value_var, h, body)
#define ip46_address_is_ip4(ip46)
static uword gbp_4(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VLIB_REGISTER_NODE(x,...)
ip46_address_t gek_ip
The IP[46] address of the endpoint.
Result of a interface to EPG mapping.
uword * g4ie_hash
use a simple hash table
static void gbp_ip_epg_update(const ip46_address_t *ip, epg_id_t epg_id)
#define clib_memcpy(a, b, c)
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
#define VLIB_CLI_COMMAND(x,...)
VNET_FEATURE_INIT(gbp_4_node, static)
static void clib_mem_free(void *p)
static void * clib_mem_alloc(uword size)
#define VNET_FEATURES(...)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static clib_error_t * gbp_contract_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void gbp_endpoint_update(u32 sw_if_index, const ip46_address_t *ip, epg_id_t epg_id)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static clib_error_t * gbp_contract_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
epg_id_t ge_epg_id
The endpoint's designated EPG.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
IP4 destintion address to destination EPG mapping table.
struct gbp_contract_db_t_ gbp_contract_db_t
EPG src,dst pair to ACL mapping table, aka contract DB.
u32 epg_id_t
Group Base Policy (GBP) defines:
#define hash_get_mem(h, key)
vlib_node_registration_t gbp_6_node
(constructor) VLIB_REGISTER_NODE (gbp_6_node)
int(* gbp_contract_cb_t)(gbp_contract_t *gbpe, void *ctx)
static gbp_endpoint_t * gbp_endpoint_pool
Pool of GBP endpoints.
u16 flags
Copy of main node flags.
void gbp_endpoint_walk(gbp_endpoint_cb_t cb, void *ctx)
static uword * gbp_endpoint_db
DB of endpoints.
#define VLIB_NODE_FLAG_TRACE
static uword gbp_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_ip6)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
struct gbp_trace_t_ gbp_trace_t
per-packet trace data
#define ip46_address_is_zero(ip46)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
struct gbp_itf_to_epg_db_t_ gbp_itf_to_epg_db_t
Interface to source EPG DB - a per-interface vector.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void gbp_contract_update(epg_id_t src_epg, epg_id_t dst_epg, u32 acl_index)
static void gbp_itf_epg_delete(u32 sw_if_index)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
struct gbp_itf_t_ gbp_itf_t
Result of a interface to EPG mapping.
static gbp_contract_db_t gbp_contract_db
Since contract DB instance.
static clib_error_t * gbp_init(vlib_main_t *vm)