diff options
author | Juraj Sloboda <jsloboda@cisco.com> | 2016-07-06 17:04:06 -0700 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-07-08 11:23:48 +0000 |
commit | 483f668eda5382912d99b81e94a1e34311ded1ed (patch) | |
tree | 89e6c69e5a55e7f0c35b469fbe5ea0967ab6fbc2 /vnet | |
parent | 905a7f5520a64aad545c8dd02796b56f88ed2d38 (diff) |
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>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/flow/flow_report.c | 1 | ||||
-rw-r--r-- | vnet/vnet/flow/flow_report.h | 2 | ||||
-rw-r--r-- | vnet/vnet/flow/flow_report_sample.c | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/vnet/vnet/flow/flow_report.c b/vnet/vnet/flow/flow_report.c index 8cfbd59a900..77f92b132fe 100644 --- a/vnet/vnet/flow/flow_report.c +++ b/vnet/vnet/flow/flow_report.c @@ -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; diff --git a/vnet/vnet/flow/flow_report.h b/vnet/vnet/flow/flow_report.h index 8b08e47e22b..50e15449d53 100644 --- a/vnet/vnet/flow/flow_report.h +++ b/vnet/vnet/flow/flow_report.h @@ -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, diff --git a/vnet/vnet/flow/flow_report_sample.c b/vnet/vnet/flow/flow_report_sample.c index 761e47caa15..69f0491f3d3 100644 --- a/vnet/vnet/flow/flow_report_sample.c +++ b/vnet/vnet/flow/flow_report_sample.c @@ -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); |