62 }
else if (src_port == stream->
src_port) {
90 clib_warning (
"no collector: disabling flow collector process");
92 VLIB_NODE_STATE_DISABLED);
154 *buffer_indexp = bi0;
168 u32 ip4_lookup_node_index;
177 uword *event_data = 0;
183 clib_warning (
"bogus kickoff event received, %d", event_type);
188 ip4_lookup_node_index = ip4_lookup_node->
index;
217 if (template_bi != ~0)
219 to_next[0] = template_bi;
225 nf, to_next, ip4_lookup_node_index);
237 .name =
"flow-report-process",
244 int found_index = ~0;
251 return VNET_API_ERROR_INVALID_VALUE;
252 if (si == -1 && a->
is_add == 0)
253 return VNET_API_ERROR_NO_SUCH_ENTRY;
269 if (found_index != ~0)
278 return VNET_API_ERROR_NO_SUCH_ENTRY;
281 if (found_index != ~0)
282 return VNET_API_ERROR_VALUE_EXIST;
317 case VNET_API_ERROR_NO_SUCH_ENTRY:
319 case VNET_API_ERROR_VALUE_EXIST:
321 case VNET_API_ERROR_INVALID_VALUE:
323 "for both domain_id and src_port " 324 "or already used values for both fields");
361 u32 old_domain_id,
u16 old_src_port,
362 u32 new_domain_id,
u16 new_src_port)
365 if (stream_index < 0)
370 if (old_domain_id != new_domain_id || old_src_port != new_src_port)
382 u16 collector_port = UDP_DST_PORT_ipfix;
389 u32 template_interval = 20;
395 else if (
unformat (input,
"port %u", &collector_port))
399 else if (
unformat (input,
"fib-id %u", &fib_id))
408 else if (
unformat (input,
"path-mtu %u", &path_mtu))
410 else if (
unformat (input,
"template-interval %u", &template_interval))
412 else if (
unformat (input,
"udp-checksum"))
418 if (collector.
as_u32 == 0)
424 if (path_mtu > 1450 )
445 "fib index %d, path MTU %u, " 446 "template resend interval %us, " 450 fib_index, path_mtu, template_interval,
451 udp_checksum ?
"enabled" :
"disabled");
460 .path =
"set ipfix exporter",
461 .short_help =
"set ipfix exporter " 462 "collector <ip4-address> [port <port>] " 463 "src <ip4-address> [fib-id <fib-id>] " 464 "[path-mtu <path-mtu>] " 465 "[template-interval <template-interval>]",
483 .path =
"ipfix flush",
484 .short_help =
"flush the current ipfix data [for make test]",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
clib_error_t * flow_report_add_del_error_to_clib_error(int error)
sll srl srl sll sra u16x4 i
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
vlib_node_registration_t flow_report_process_node
(constructor) VLIB_REGISTER_NODE (flow_report_process_node)
u16 udp_checksum(udp_header_t *uh, u32 udp_len, void *ih, u8 version)
vnet_main_t * vnet_get_main(void)
static f64 vlib_time_now(vlib_main_t *vm)
static clib_error_t * ipfix_flush_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
ip4_address_t src_address
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
ip4_address_t ipfix_collector
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
void vnet_stream_reset(flow_report_main_t *frm, u32 stream_index)
flow_report_stream_t * streams
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define static_always_inline
#define VLIB_INIT_FUNCTION(x)
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
#define VLIB_BUFFER_TOTAL_LENGTH_VALID
vnet_flow_rewrite_callback_t * rewrite_callback
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
#define VLIB_BUFFER_DEFAULT_FREE_LIST_BYTES
static uword flow_report_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
flow_report_main_t flow_report_main
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
u16 current_length
Nbytes between current data and the end of this buffer.
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX
#define VLIB_BUFFER_FLOW_REPORT
int send_template_packet(flow_report_main_t *frm, flow_report_t *fr, u32 *buffer_indexp)
static_always_inline flow_report_stream_t * add_stream(void)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
#define clib_memcpy(a, b, c)
static clib_error_t * set_ipfix_exporter_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
static_always_inline u8 stream_index_valid(u32 index)
#define VLIB_CLI_COMMAND(x,...)
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define vec_delete(V, N, M)
Delete N elements starting at element M.
static_always_inline void delete_stream(u32 index)
void vnet_flow_reports_reset(flow_report_main_t *frm)
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
vnet_flow_data_callback_t * flow_data_callback
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_BUFFER_TRACE_TRAJECTORY_INIT(b)
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.
vnet_flow_data_callback_t * flow_data_callback
static i32 find_stream(u32 domain_id, u16 src_port)
static void vlib_buffer_init_for_free_list(vlib_buffer_t *dst, vlib_buffer_free_list_t *fl)
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
vnet_flow_rewrite_callback_t * rewrite_callback
#define vec_foreach(var, vec)
Vector iterator.
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
static vlib_buffer_free_list_t * vlib_buffer_get_free_list(vlib_main_t *vm, u32 free_list_index)
u32 flags
buffer flags: 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.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static 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)
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a)