|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
98 VLIB_NODE_STATE_DISABLED);
127 b0->
flags |= (VLIB_BUFFER_TOTAL_LENGTH_VALID | VNET_BUFFER_F_FLOW_REPORT);
137 h->export_time = (
u32)
140 h->export_time = clib_host_to_net_u32 (
h->export_time);
158 *buffer_indexp = bi0;
172 u32 n_elts,
u32 * stream_indexp)
209 ip->ip_version_and_header_length = 0x45;
211 ip->protocol = IP_PROTOCOL_UDP;
213 ip->dst_address.as_u32 = collector_address->
as_u32;
215 udp->
dst_port = clib_host_to_net_u16 (collector_port);
219 h->domain_id = clib_host_to_net_u32 (stream->
domain_id);
223 for (
i = 0;
i < n_elts;
i++)
245 ip->length = clib_host_to_net_u16 ((
u8 *)
f - (
u8 *)
ip);
257 u32 ip4_lookup_node_index;
264 f64 def_wait_time = 5.0;
267 uword *event_data = 0;
273 clib_warning (
"bogus kickoff event received, %d", event_type);
280 wait_time = def_wait_time;
289 wait_time = def_wait_time;
312 wait_time =
clib_min (wait_time, next_template);
318 if (template_bi != ~0)
320 to_next[0] = template_bi;
326 nf, to_next, ip4_lookup_node_index);
339 .name =
"flow-report-process",
349 int found_index = ~0;
356 return VNET_API_ERROR_INVALID_VALUE;
357 if (
si == -1 &&
a->is_add == 0)
358 return VNET_API_ERROR_NO_SUCH_ENTRY;
376 if (found_index != ~0)
385 return VNET_API_ERROR_NO_SUCH_ENTRY;
388 if (found_index != ~0)
389 return VNET_API_ERROR_VALUE_EXIST;
430 case VNET_API_ERROR_NO_SUCH_ENTRY:
432 case VNET_API_ERROR_VALUE_EXIST:
434 case VNET_API_ERROR_INVALID_VALUE:
436 "for both domain_id and src_port "
437 "or already used values for both fields");
478 u32 old_domain_id,
u16 old_src_port,
479 u32 new_domain_id,
u16 new_src_port)
482 if (stream_index < 0)
487 if (old_domain_id != new_domain_id || old_src_port != new_src_port)
499 u16 collector_port = UDP_DST_PORT_ipfix;
506 u32 template_interval = 20;
518 else if (
unformat (input,
"fib-id %u", &fib_id))
528 else if (
unformat (input,
"template-interval %u", &template_interval))
530 else if (
unformat (input,
"udp-checksum"))
536 if (collector.
as_u32 != 0 &&
src.as_u32 == 0)
561 "fib index %d, path MTU %u, "
562 "template resend interval %us, "
566 fib_index,
path_mtu, template_interval,
578 .path =
"set ipfix exporter",
579 .short_help =
"set ipfix exporter "
580 "collector <ip4-address> [port <port>] "
581 "src <ip4-address> [fib-id <fib-id>] "
582 "[path-mtu <path-mtu>] "
583 "[template-interval <template-interval>] "
601 .path =
"ipfix flush",
602 .short_help =
"flush the current ipfix data [for make test]",
static_always_inline u8 stream_index_valid(u32 index)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
vnet_interface_main_t * im
flow_report_main_t flow_report_main
static u32 ipfix_e_id_length(int e, u16 id, u16 length)
ip4_main_t ip4_main
Global ip4 main structure.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
#define clib_error_return(e, args...)
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)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#define vec_delete(V, N, M)
Delete N elements starting at element M.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
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,...
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static_always_inline void delete_stream(u32 index)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
void vnet_flow_reports_reset(flow_report_main_t *frm)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static clib_error_t * set_ipfix_exporter_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.
static __clib_warn_unused_result u32 vlib_buffer_alloc(vlib_main_t *vm, u32 *buffers, u32 n_buffers)
Allocate buffers into supplied array.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_main_t * vnet_get_main(void)
u8 * vnet_flow_rewrite_generic_callback(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 *report_elts, u32 n_elts, u32 *stream_indexp)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
#define static_always_inline
ip4_address_t ipfix_collector
unformat_function_t unformat_udp_port
vl_api_ip_port_and_mask_t src_port
void vnet_stream_reset(flow_report_main_t *frm, u32 stream_index)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static u32 version_length(u16 length)
flow_report_stream_t * streams
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_cli_command_t ipfix_flush_command
(constructor) VLIB_CLI_COMMAND (ipfix_flush_command)
u16 current_length
Nbytes between current data and the end of this buffer.
static i32 find_stream(u32 domain_id, u16 src_port)
static clib_error_t * flow_report_init(vlib_main_t *vm)
#define vec_free(V)
Free vector's memory (no header).
static u32 ipfix_id_count(u16 id, u16 count)
ip4_address_t src_address
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
clib_error_t * flow_report_add_del_error_to_clib_error(int error)
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...
vnet_flow_rewrite_callback_t * rewrite_callback
static_always_inline u32 vlib_buffer_get_default_data_size(vlib_main_t *vm)
#define VLIB_INIT_FUNCTION(x)
#define vec_foreach(var, vec)
Vector iterator.
ipfix_report_element_t * report_elements
static clib_error_t * ipfix_flush_command_fn(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.
vnet_interface_output_runtime_t * rt
static u16 ip4_header_checksum(ip4_header_t *i)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
vlib_node_registration_t flow_report_process_node
(constructor) VLIB_REGISTER_NODE (flow_report_process_node)
static u32 ipfix_set_id_length(u16 set_id, u16 length)
#define clib_warning(format, args...)
int send_template_packet(flow_report_main_t *frm, flow_report_t *fr, u32 *buffer_indexp)
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a, u16 *template_id)
static f64 vlib_time_now(vlib_main_t *vm)
u16 udp_checksum(udp_header_t *uh, u32 udp_len, void *ih, u8 version)
vl_api_address_union_t src_address
static_always_inline flow_report_stream_t * add_stream(void)
static vlib_cli_command_t set_ipfix_exporter_command
(constructor) VLIB_CLI_COMMAND (set_ipfix_exporter_command)
vnet_flow_data_callback_t * flow_data_callback
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
static uword flow_report_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)