58 #define _(field,mask,item,length) \ 59 if ((field) == (mask)) \ 63 fr->fields_to_send = clib_bitmap_set (fr->fields_to_send, \ 89 ip->ip_version_and_header_length = 0x45;
91 ip->protocol = IP_PROTOCOL_UDP;
92 ip->src_address.as_u32 = src_address->
as_u32;
93 ip->dst_address.as_u32 = collector_address->
as_u32;
94 udp->src_port = clib_host_to_net_u16 (4739 );
95 udp->dst_port = clib_host_to_net_u16 (UDP_DST_PORT_ipfix);
96 udp->length = clib_host_to_net_u16 (
vec_len(rewrite) -
sizeof (*ip));
100 h->domain_id = clib_host_to_net_u32 (fr->
domain_id);
105 #define _(field,mask,item,length) \ 106 if ((field) == (mask)) \ 108 f->e_id_length = ipfix_e_id_length (0 , \ 133 ip->length = clib_host_to_net_u16 ((
u8 *)f - (
u8 *)ip);
150 vnet_classify_entry_t * v, * save_v;
162 u32 records_this_buffer;
167 while (__sync_lock_test_and_set (t->writer_lock, 1))
170 for (i = 0; i < t->nbuckets; i++)
179 for (k = 0; k < t->entries_per_page; k++)
182 (t, save_v, j*t->entries_per_page + k);
217 next_offset = (
u32) (((
u8 *)(s+1)) - (
u8 *)tp);
218 records_this_buffer = 0;
226 #define _(field,mask,item,length) \ 227 if (clib_bitmap_get (fr->fields_to_send, field_index)) \ 229 clib_memcpy (b0->data + next_offset, &field, \ 231 next_offset += length; \ 239 u64 packets = clib_host_to_net_u64 (v->hits);
241 next_offset +=
sizeof (packets);
243 records_this_buffer++;
245 if (next_offset > 1450)
249 (
sizeof (*ip) +
sizeof (*udp) +
259 old_l0 = clib_net_to_host_u16 (ip->
length);
261 clib_host_to_net_u16 ((
u16)next_offset);
294 (
sizeof (*ip) +
sizeof (*udp) +
305 new_l0 = clib_host_to_net_u16 ((
u16)next_offset);
323 *(t->writer_lock) = 0;
342 memset (&args, 0,
sizeof (args));
347 else if (
unformat (input,
"domain %d", &domain_id))
359 args.
opaque = (
void *) fsm;
371 case VNET_API_ERROR_NO_SUCH_ENTRY:
381 .path =
"flow sample",
382 .short_help =
"flow sample",
flow_report_main_t flow_report_main
sll srl srl sll sra u16x4 i
static u32 ipfix_e_id_length(int e, u16 id, u16 length)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
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
#define vlib_call_init_function(vm, x)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
flow_report_sample_main_t flow_report_sample_main
static int vnet_classify_entry_is_free(vnet_classify_entry_t *e)
always_inline u16 ip_csum_fold(ip_csum_t c)
#define pool_elt_at_index(p, i)
u16 current_length
Nbytes between current data and the end of this buffer.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
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)
always_inline u16 ip4_header_checksum(ip4_header_t *i)
static clib_error_t * flow_report_sample_init(vlib_main_t *vm)
static u32 ipfix_id_count(u16 id, u16 count)
static u8 * template_rewrite(flow_report_main_t *frm, flow_report_t *fr, ip4_address_t *collector_address, ip4_address_t *src_address)
#define clib_memcpy(a, b, c)
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
static vlib_frame_t * send_flows(flow_report_main_t *frm, flow_report_t *fr, vlib_frame_t *f, u32 *to_next, u32 node_index)
#define VLIB_CLI_COMMAND(x,...)
struct _vnet_classify_main vnet_classify_main_t
vnet_classify_main_t vnet_classify_main
u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
static u32 ipfix_set_id_length(u16 set_id, u16 length)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define ip_csum_update(sum, old, new, type, field)
vnet_flow_data_callback_t * flow_data_callback
#define foreach_ipfix_field
static clib_error_t * flow_sample_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
always_inline f64 vlib_time_now(vlib_main_t *vm)
#define clib_error_return(e, args...)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static clib_error_t * flow_report_init(vlib_main_t *vm)
static vnet_classify_entry_t * vnet_classify_get_entry(vnet_classify_table_t *t, uword offset)
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a)