35 u32 n_elts,
u32 * stream_index)
57 u8 transport_protocol;
71 real_mask = (
u8 *) (tblp->
mask);
75 #define _(field,mask,item,length) \ 76 if (((u8 *)&field >= real_mask) && (memcmp(&field, &mask, length) == 0)) \ 80 fr->fields_to_send = clib_bitmap_set (fr->fields_to_send, \ 112 udp->
dst_port = clib_host_to_net_u16 (collector_port);
113 udp->
length = clib_host_to_net_u16 (
vec_len (rewrite) -
sizeof (*ip));
121 #define _(field,mask,item,length) \ 122 if (((u8 *)&field >= real_mask) && (memcmp(&field, &mask, length) == 0)) \ 124 f->e_id_length = ipfix_e_id_length (0 , \ 151 ip->
length = clib_host_to_net_u16 ((
u8 *) f - (
u8 *) ip);
167 vnet_classify_entry_t *v, *save_v;
170 u32 record_offset = 0;
182 u32 records_this_buffer;
188 u8 transport_protocol;
232 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
253 next_offset = (
u32) (((
u8 *) (s + 1)) - (
u8 *) tp);
254 record_offset = next_offset;
255 records_this_buffer = 0;
261 #define _(field,mask,item,length) \ 262 if (clib_bitmap_get (fr->fields_to_send, field_index)) \ 264 clib_memcpy_fast (b0->data + next_offset, &field, \ 266 next_offset += length; \ 274 u64 packets = clib_host_to_net_u64 (v->hits);
277 next_offset +=
sizeof (packets);
279 records_this_buffer++;
283 u32 next_record_size = next_offset - record_offset;
284 record_offset = next_offset;
286 if (next_offset + next_record_size > frm->
path_mtu)
295 (
sizeof (*ip) +
sizeof (*udp)));
297 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
305 new_l0 = clib_host_to_net_u16 ((
u16) next_offset);
349 (sizeof (*ip) +
sizeof (*udp) +
352 (
sizeof (*ip) +
sizeof (*udp)));
354 b0->
flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID;
362 new_l0 = clib_host_to_net_u16 ((
u16) next_offset);
403 u32 classify_table_index = ~0;
405 u8 transport_protocol = 255;
419 else if (
unformat (input,
"%d", &classify_table_index))
426 transport_protocol = 6;
428 transport_protocol = 17;
436 if (classify_table_index == ~0)
455 "Specified classifier table already used");
463 "Specified classifier table not registered");
481 if (is_add == 0 || (rv && is_add))
489 .path =
"ipfix classify table",
490 .short_help =
"ipfix classify table add|del <table-index>",
507 if (
unformat (input,
"domain %d", &domain_id))
509 else if (
unformat (input,
"src-port %d", &src_port))
520 domain_id, (
u16) src_port);
532 .path =
"set ipfix classify stream",
533 .short_help =
"set ipfix classify stream" 534 "[domain <domain-id>] [src-port <src-port>]",
clib_error_t * flow_report_add_del_error_to_clib_error(int error)
static_always_inline void ipfix_classify_delete_table(u32 index)
static_always_inline u8 ipfix_classify_table_index_valid(u32 index)
#define clib_memcpy_fast(a, b, c)
static u32 ipfix_e_id_length(int e, u16 id, u16 length)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a, u16 *template_id)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
flow_report_stream_t * streams
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define VLIB_INIT_FUNCTION(x)
vnet_flow_rewrite_callback_t * rewrite_callback
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define clib_error_return(e, args...)
#define vlib_call_init_function(vm, x)
#define clib_atomic_test_and_set(a)
static int vnet_classify_entry_is_free(vnet_classify_entry_t *e)
flow_report_main_t flow_report_main
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
flow_report_classify_main_t flow_report_classify_main
u16 current_length
Nbytes between current data and the end of this buffer.
#define clib_atomic_release(a)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vl_api_address_union_t src_address
static u32 version_length(u16 length)
static vnet_classify_entry_t * vnet_classify_entry_at_index(vnet_classify_table_t *t, vnet_classify_entry_t *e, u32 index)
ipfix_classify_table_t * tables
static u32 ipfix_id_count(u16 id, u16 count)
static clib_error_t * ipfix_classify_table_add_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static_always_inline ipfix_classify_table_t * ipfix_classify_add_table(void)
#define VLIB_CLI_COMMAND(x,...)
struct _vnet_classify_main vnet_classify_main_t
static clib_error_t * set_ipfix_classify_stream_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
vnet_classify_main_t vnet_classify_main
#define foreach_ipfix_field
static u32 ipfix_set_id_length(u16 set_id, u16 length)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vnet_classify_bucket_t * buckets
int vnet_stream_change(flow_report_main_t *frm, u32 old_domain_id, u16 old_src_port, u32 new_domain_id, u16 new_src_port)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define ip_csum_update(sum, old, new, type, field)
volatile u32 * writer_lock
vnet_flow_data_callback_t * flow_data_callback
static clib_error_t * flow_report_classify_init(vlib_main_t *vm)
#define CLIB_CACHE_LINE_BYTES
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 u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
vlib_frame_t * ipfix_classify_send_flows(flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
static clib_error_t * flow_report_init(vlib_main_t *vm)
static u16 ip_csum_fold(ip_csum_t c)
static vnet_classify_entry_t * vnet_classify_get_entry(vnet_classify_table_t *t, uword offset)
u8 * ipfix_classify_template_rewrite(flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address, u16 collector_port, ipfix_report_element_t *elts, u32 n_elts, u32 *stream_index)