#include <vnet/ip/ip6_hop_by_hop.h>
#include <vnet/ip/ip_source_and_port_range_check.h>
#include <vnet/policer/xlate.h>
+#include <vnet/span/span.h>
#include <vnet/policer/policer.h>
#include <vnet/policer/police.h>
_(set_ipfix_classify_stream_reply) \
_(ipfix_classify_table_add_del_reply) \
_(flow_classify_set_interface_reply) \
+_(sw_interface_span_enable_disable_reply) \
_(pg_capture_reply) \
_(pg_enable_disable_reply) \
_(ip_source_and_port_range_check_add_del_reply) \
_(IPFIX_CLASSIFY_TABLE_DETAILS, ipfix_classify_table_details) \
_(FLOW_CLASSIFY_SET_INTERFACE_REPLY, flow_classify_set_interface_reply) \
_(FLOW_CLASSIFY_DETAILS, flow_classify_details) \
+_(SW_INTERFACE_SPAN_ENABLE_DISABLE_REPLY, sw_interface_span_enable_disable_reply) \
+_(SW_INTERFACE_SPAN_DETAILS, sw_interface_span_details) \
_(GET_NEXT_INDEX_REPLY, get_next_index_reply) \
_(PG_CREATE_INTERFACE_REPLY, pg_create_interface_reply) \
_(PG_CAPTURE_REPLY, pg_capture_reply) \
u32 memory_size = 32 << 20;
u8 *mask = 0;
f64 timeout;
+ u32 current_data_flag = 0;
+ int current_data_offset = 0;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
else if (unformat (i, "acl-miss-next %U", unformat_acl_next_index,
&miss_next_index))
;
+ else if (unformat (i, "current-data-flag %d", ¤t_data_flag))
+ ;
+ else if (unformat (i, "current-data-offset %d", ¤t_data_offset))
+ ;
else
break;
}
mp->match_n_vectors = ntohl (match);
mp->next_table_index = ntohl (next_table_index);
mp->miss_next_index = ntohl (miss_next_index);
+ mp->current_data_flag = ntohl (current_data_flag);
+ mp->current_data_offset = ntohl (current_data_offset);
clib_memcpy (mp->mask, mask, vec_len (mask));
vec_free (mask);
f64 timeout;
u32 skip_n_vectors = 0;
u32 match_n_vectors = 0;
+ u32 action = 0;
+ u32 metadata = 0;
/*
* Warning: you have to supply skip_n and match_n
;
else if (unformat (i, "table-index %d", &table_index))
;
+ else if (unformat (i, "action set-ip4-fib-id %d", &metadata))
+ action = 1;
+ else if (unformat (i, "action set-ip6-fib-id %d", &metadata))
+ action = 2;
+ else if (unformat (i, "action %d", &action))
+ ;
+ else if (unformat (i, "metadata %d", &metadata))
+ ;
else
break;
}
mp->hit_next_index = ntohl (hit_next_index);
mp->opaque_index = ntohl (opaque_index);
mp->advance = ntohl (advance);
+ mp->action = action;
+ mp->metadata = ntohl (metadata);
clib_memcpy (mp->match, match, vec_len (match));
vec_free (match);
mp->transport_protocol);
}
+static int
+api_sw_interface_span_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_sw_interface_span_enable_disable_t *mp;
+ f64 timeout;
+ u32 src_sw_if_index = ~0;
+ u32 dst_sw_if_index = ~0;
+ u8 enable = 1;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "src %U", unformat_sw_if_index, vam, &src_sw_if_index))
+ ;
+ else if (unformat (i, "src_sw_if_index %d", &src_sw_if_index))
+ ;
+ else
+ if (unformat
+ (i, "dst %U", unformat_sw_if_index, vam, &dst_sw_if_index))
+ ;
+ else if (unformat (i, "dst_sw_if_index %d", &dst_sw_if_index))
+ ;
+ else if (unformat (i, "disable"))
+ enable = 0;
+ else
+ break;
+ }
+
+ M (SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable);
+
+ mp->sw_if_index_from = htonl (src_sw_if_index);
+ mp->sw_if_index_to = htonl (dst_sw_if_index);
+ mp->enable = enable;
+
+ S;
+ W;
+ /* NOTREACHED */
+ return 0;
+}
+
+static void
+vl_api_sw_interface_span_details_t_handler (vl_api_sw_interface_span_details_t
+ * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ fformat (vam->ofp, "%u => %u\n",
+ ntohl (mp->sw_if_index_from), ntohl (mp->sw_if_index_to));
+}
+
+static void
+ vl_api_sw_interface_span_details_t_handler_json
+ (vl_api_sw_interface_span_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t *node = NULL;
+
+ if (VAT_JSON_ARRAY != vam->json_tree.type)
+ {
+ ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+ vat_json_init_array (&vam->json_tree);
+ }
+ node = vat_json_array_add (&vam->json_tree);
+
+ vat_json_init_object (node);
+ vat_json_object_add_uint (node, "src-if-index",
+ ntohl (mp->sw_if_index_from));
+ vat_json_object_add_uint (node, "dst-if-index", ntohl (mp->sw_if_index_to));
+}
+
+static int
+api_sw_interface_span_dump (vat_main_t * vam)
+{
+ vl_api_sw_interface_span_dump_t *mp;
+ f64 timeout;
+
+ M (SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump);
+ S;
+
+ /* Use a control ping for synchronization */
+ {
+ vl_api_control_ping_t *mp;
+ M (CONTROL_PING, control_ping);
+ S;
+ }
+ W;
+}
+
int
api_pg_create_interface (vat_main_t * vam)
{
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
+ if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index))
+ ;
if (unformat (i, "sw_if_index %d", &sw_if_index))
;
else
"address [ip6 multicast address] sr-policy [policy name] [del]") \
_(classify_add_del_table, \
"buckets <nn> [skip <n>] [match <n>] [memory_size <nn-bytes>]\n" \
- "[del] mask <mask-value>\n" \
- " [l2-miss-next | miss-next | acl-miss-next] <name|nn>") \
+ " [del] mask <mask-value>\n" \
+ " [l2-miss-next | miss-next | acl-miss-next] <name|nn>\n" \
+ " [current-data-flag <n>] [current-data-offset <nn>] [table <nn>]") \
_(classify_add_del_session, \
"[hit-next|l2-hit-next|acl-hit-next|policer-hit-next] <name|nn>\n" \
" table-index <nn> skip_n <nn> match_n <nn> match [hex] [l2]\n" \
- " [l3 [ip4|ip6]]") \
+ " [l3 [ip4|ip6]] [action set-ip4-fib-id <nn>]\n" \
+ " [action set-ip6-fib-id <nn> | action <n> metadata <nn>] [del]") \
_(classify_set_interface_ip_table, \
"<intfc> | sw_if_index <nn> table <nn>") \
_(classify_set_interface_l2_tables, \
_(ipfix_classify_stream_dump, "") \
_(ipfix_classify_table_add_del, "table <table-index> ip4|ip6 [tcp|udp]")\
_(ipfix_classify_table_dump, "") \
+_(sw_interface_span_enable_disable, "[src <intfc> | src_sw_if_index <id>] [[dst <intfc> | dst_sw_if_index <id>] | disable]") \
+_(sw_interface_span_dump, "") \
_(get_next_index, "node-name <node-name> next-node-name <node-name>") \
_(pg_create_interface, "if_id <nn>") \
_(pg_capture, "if_id <nnn> pcap <file_name> count <nnn> [disable]") \
_(ipsec_gre_add_del_tunnel, \
"src <addr> dst <addr> local_sa <sa-id> remote_sa <sa-id> [del]") \
_(ipsec_gre_tunnel_dump, "[sw_if_index <nn>]") \
-_(delete_subif,"sub_sw_if_index <nn> sub_if_id <nn>") \
+_(delete_subif,"<intfc> | sw_if_index <nn>") \
_(l2_interface_pbb_tag_rewrite, \
"<intfc> | sw_if_index <nn> \n" \
"[disable | push | pop | translate_pbb_stag <outer_tag>] \n" \