summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/flow/flow_api.c2
-rw-r--r--src/vnet/flow/flow_report.c21
-rw-r--r--src/vnet/flow/flow_report.h3
-rw-r--r--src/vnet/flow/flow_report_classify.c2
-rw-r--r--src/vnet/ip/ip6_packet.h6
5 files changed, 23 insertions, 11 deletions
diff --git a/src/vnet/flow/flow_api.c b/src/vnet/flow/flow_api.c
index b975dda199f..52a608ca6e7 100644
--- a/src/vnet/flow/flow_api.c
+++ b/src/vnet/flow/flow_api.c
@@ -296,7 +296,7 @@ static void
args.domain_id = fcm->domain_id;
args.src_port = fcm->src_port;
- rv = vnet_flow_report_add_del (frm, &args);
+ rv = vnet_flow_report_add_del (frm, &args, NULL);
/* If deleting, or add failed */
if (is_add == 0 || (rv && is_add))
diff --git a/src/vnet/flow/flow_report.c b/src/vnet/flow/flow_report.c
index c78a78a9680..ccc84235695 100644
--- a/src/vnet/flow/flow_report.c
+++ b/src/vnet/flow/flow_report.c
@@ -87,7 +87,6 @@ int send_template_packet (flow_report_main_t *frm,
if (frm->ipfix_collector.as_u32 == 0
|| frm->src_address.as_u32 == 0)
{
- clib_warning ("no collector: disabling flow collector process");
vlib_node_set_state (frm->vlib_main, flow_report_process_node.index,
VLIB_NODE_STATE_DISABLED);
return -1;
@@ -238,7 +237,8 @@ VLIB_REGISTER_NODE (flow_report_process_node) = {
};
int vnet_flow_report_add_del (flow_report_main_t *frm,
- vnet_flow_report_add_del_args_t *a)
+ vnet_flow_report_add_del_args_t *a,
+ u16 *template_id)
{
int i;
int found_index = ~0;
@@ -260,6 +260,8 @@ int vnet_flow_report_add_del (flow_report_main_t *frm,
&& fr->flow_data_callback == a->flow_data_callback)
{
found_index = i;
+ if (template_id)
+ *template_id = fr->template_id;
break;
}
}
@@ -304,7 +306,10 @@ int vnet_flow_report_add_del (flow_report_main_t *frm,
fr->opaque = a->opaque;
fr->rewrite_callback = a->rewrite_callback;
fr->flow_data_callback = a->flow_data_callback;
-
+
+ if (template_id)
+ *template_id = fr->template_id;
+
return 0;
}
@@ -415,10 +420,7 @@ set_ipfix_exporter_command_fn (vlib_main_t * vm,
break;
}
- if (collector.as_u32 == 0)
- return clib_error_return (0, "collector address required");
-
- if (src.as_u32 == 0)
+ if (collector.as_u32 != 0 && src.as_u32 == 0)
return clib_error_return (0, "src address required");
if (path_mtu > 1450 /* vpp does not support fragmentation */)
@@ -441,7 +443,8 @@ set_ipfix_exporter_command_fn (vlib_main_t * vm,
frm->template_interval = template_interval;
frm->udp_checksum = udp_checksum;
- vlib_cli_output (vm, "Collector %U, src address %U, "
+ if (collector.as_u32)
+ vlib_cli_output (vm, "Collector %U, src address %U, "
"fib index %d, path MTU %u, "
"template resend interval %us, "
"udp checksum %s",
@@ -449,6 +452,8 @@ set_ipfix_exporter_command_fn (vlib_main_t * vm,
format_ip4_address, &frm->src_address,
fib_index, path_mtu, template_interval,
udp_checksum ? "enabled" : "disabled");
+ else
+ vlib_cli_output (vm, "IPFIX Collector is disabled");
/* Turn on the flow reporting process */
vlib_process_signal_event (vm, flow_report_process_node.index,
diff --git a/src/vnet/flow/flow_report.h b/src/vnet/flow/flow_report.h
index e8ed3818534..01859ce5888 100644
--- a/src/vnet/flow/flow_report.h
+++ b/src/vnet/flow/flow_report.h
@@ -130,7 +130,8 @@ typedef struct {
} vnet_flow_report_add_del_args_t;
int vnet_flow_report_add_del (flow_report_main_t *frm,
- vnet_flow_report_add_del_args_t *a);
+ vnet_flow_report_add_del_args_t *a,
+ u16 *template_id);
clib_error_t * flow_report_add_del_error_to_clib_error (int error);
diff --git a/src/vnet/flow/flow_report_classify.c b/src/vnet/flow/flow_report_classify.c
index 27f03ddcd68..d4c30492e2d 100644
--- a/src/vnet/flow/flow_report_classify.c
+++ b/src/vnet/flow/flow_report_classify.c
@@ -458,7 +458,7 @@ ipfix_classify_table_add_del_command_fn (vlib_main_t * vm,
args.domain_id = fcm->domain_id;
args.src_port = fcm->src_port;
- rv = vnet_flow_report_add_del (frm, &args);
+ rv = vnet_flow_report_add_del (frm, &args, NULL);
error = flow_report_add_del_error_to_clib_error(rv);
diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h
index cdd7eed5a82..c0c745e27fe 100644
--- a/src/vnet/ip/ip6_packet.h
+++ b/src/vnet/ip/ip6_packet.h
@@ -341,6 +341,12 @@ typedef struct
ip6_address_t src_address, dst_address;
} ip6_header_t;
+always_inline u8
+ip6_traffic_class (ip6_header_t * i)
+{
+ return (i->ip_version_traffic_class_and_flow_label & 0x0FF00000) >> 20;
+}
+
always_inline void *
ip6_next_header (ip6_header_t * i)
{