Make IPFIX src port configurable
Make src port configurable in flow report sample code Change-Id: Ic7d3c3de17b83821106a827fb65e79381044da7e Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
This commit is contained in:

committed by
Damjan Marion

parent
905a7f5520
commit
483f668eda
@ -203,6 +203,7 @@ int vnet_flow_report_add_del (flow_report_main_t *frm,
|
||||
|
||||
fr->sequence_number = 0;
|
||||
fr->domain_id = a->domain_id;
|
||||
fr->src_port = a->src_port;
|
||||
fr->update_rewrite = 1;
|
||||
fr->opaque = a->opaque;
|
||||
fr->rewrite_callback = a->rewrite_callback;
|
||||
|
@ -56,6 +56,7 @@ typedef struct flow_report {
|
||||
u8 * rewrite;
|
||||
u32 sequence_number;
|
||||
u32 domain_id;
|
||||
u16 src_port;
|
||||
f64 last_template_sent;
|
||||
int update_rewrite;
|
||||
|
||||
@ -108,6 +109,7 @@ typedef struct {
|
||||
void * opaque;
|
||||
int is_add;
|
||||
u32 domain_id;
|
||||
u16 src_port;
|
||||
} vnet_flow_report_add_del_args_t;
|
||||
|
||||
int vnet_flow_report_add_del (flow_report_main_t *frm,
|
||||
|
@ -92,7 +92,7 @@ static u8 * template_rewrite (flow_report_main_t * frm,
|
||||
ip->protocol = IP_PROTOCOL_UDP;
|
||||
ip->src_address.as_u32 = src_address->as_u32;
|
||||
ip->dst_address.as_u32 = collector_address->as_u32;
|
||||
udp->src_port = clib_host_to_net_u16 (4739 /* $$FIXME */);
|
||||
udp->src_port = clib_host_to_net_u16 (fr->src_port);
|
||||
udp->dst_port = clib_host_to_net_u16 (collector_port);
|
||||
udp->length = clib_host_to_net_u16 (vec_len(rewrite) - sizeof (*ip));
|
||||
|
||||
@ -353,6 +353,7 @@ flow_sample_command_fn (vlib_main_t * vm,
|
||||
int rv;
|
||||
int is_add = 1;
|
||||
u32 domain_id = 0;
|
||||
u32 src_port = UDP_DST_PORT_ipfix;
|
||||
|
||||
domain_id = 0;
|
||||
fsm->classify_table_index = ~0;
|
||||
@ -363,6 +364,8 @@ flow_sample_command_fn (vlib_main_t * vm,
|
||||
;
|
||||
else if (unformat (input, "domain %d", &domain_id))
|
||||
;
|
||||
else if (unformat (input, "src-port %d", &src_port))
|
||||
;
|
||||
else if (unformat (input, "del"))
|
||||
is_add = 0;
|
||||
else
|
||||
@ -378,6 +381,7 @@ flow_sample_command_fn (vlib_main_t * vm,
|
||||
args.flow_data_callback = send_flows;
|
||||
args.is_add = is_add;
|
||||
args.domain_id = domain_id;
|
||||
args.src_port = (u16)src_port;
|
||||
|
||||
rv = vnet_flow_report_add_del (frm, &args);
|
||||
|
||||
|
Reference in New Issue
Block a user