3 * Routines for the disassembly of fd.io vpp project
6 * Copyright (c) 2018 Cisco and/or its affiliates.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at:
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * This version is not to be upstreamed as-is, since it hooks up the
20 * vpp dissector to WTAP_ENCAP_USER13, a test encap type.
25 #include <epan/packet.h>
26 #include <epan/expert.h>
27 #include <epan/to_str.h>
28 #include <epan/in_cksum.h>
29 #include <epan/nlpid.h>
30 #include <epan/etypes.h>
32 #include <wsutil/ws_printf.h>
34 void proto_register_vpp(void);
35 void proto_reg_handoff_vpp(void);
37 static int proto_vpp = -1;
38 static int proto_vpp_opaque = -1;
39 static int proto_vpp_trace = -1;
40 static int hf_vpp_nodename = -1;
41 static int hf_vpp_buffer_index = -1;
43 static int hf_vpp_buffer_current_data = -1;
44 static int hf_vpp_buffer_current_length = -1;
46 static int hf_vpp_buffer_flags = -1;
47 static int hf_vpp_buffer_flag_non_default_freelist = -1;
48 static int hf_vpp_buffer_flag_traced = -1;
49 static int hf_vpp_buffer_flag_next_present = -1;
50 static int hf_vpp_buffer_flag_total_length_valid = -1;
51 static int hf_vpp_buffer_flag_ext_hdr_valid = -1;
52 static int hf_vpp_buffer_flag_l4_checksum_computed = -1;
53 static int hf_vpp_buffer_flag_l4_checksum_correct = -1;
54 static int hf_vpp_buffer_flag_vlan_2_deep = -1;
55 static int hf_vpp_buffer_flag_vlan_1_deep = -1;
56 static int hf_vpp_buffer_flag_span_clone = -1;
57 static int hf_vpp_buffer_flag_loop_counter_valid = -1;
58 static int hf_vpp_buffer_flag_locally_originated = -1;
59 static int hf_vpp_buffer_flag_is_ip4 = -1;
60 static int hf_vpp_buffer_flag_is_ip6 = -1;
61 static int hf_vpp_buffer_flag_offload_ip_checksum = -1;
62 static int hf_vpp_buffer_flag_offload_tcp_checksum = -1;
63 static int hf_vpp_buffer_flag_offload_udp_checksum = -1;
64 static int hf_vpp_buffer_flag_is_natted = -1;
65 static int hf_vpp_buffer_flag_l2_hdr_offset_valid = -1;
66 static int hf_vpp_buffer_flag_l3_hdr_offset_valid = -1;
67 static int hf_vpp_buffer_flag_l4_hdr_offset_valid = -1;
68 static int hf_vpp_buffer_flag_flow_report = -1;
69 static int hf_vpp_buffer_flag_is_dvr = -1;
70 static int hf_vpp_buffer_flag_qos_data_valid = -1;
71 static int hf_vpp_buffer_flow_id = -1;
72 static int hf_vpp_buffer_next_buffer = -1;
73 static int hf_vpp_buffer_current_config_index = -1;
74 static int hf_vpp_buffer_error_index = -1;
75 static int hf_vpp_buffer_n_add_refs = -1;
76 static int hf_vpp_buffer_buffer_pool_index = -1;
78 static int hf_vpp_buffer_opaque_raw = -1;
79 static int hf_vpp_buffer_opaque_opaque = -1;
81 static int hf_vpp_buffer_trace = -1;
83 static gint ett_vpp = -1;
84 static gint ett_vpp_opaque = -1;
85 static gint ett_vpp_trace = -1;
87 static dissector_handle_t vpp_dissector_handle;
88 static dissector_handle_t vpp_opaque_dissector_handle;
89 static dissector_handle_t vpp_trace_dissector_handle;
91 static dissector_table_t vpp_subdissector_table;
93 /* List of next dissector names that we know about */
94 #define foreach_next_dissector \
100 #define _(a) static dissector_handle_t a##_dissector_handle;
101 foreach_next_dissector;
105 * node-name, next dissector name pairs
107 * Unfortunately, -Werror=c++-compat causes
108 * the node names "ipX-not-enabled" to throw a shoe if
109 * not explicitly quoted. Never mind that the first macro
110 * arg is [only] used as a string (#xxx).
114 * Note: in addition to these direct mappings, we
115 * send traces w/ b->data[b->current_data] = 0x45 to
116 * the ip dissector, and 0x60 to the ipv6 dissector.
118 * It pays to add direct mappings for common places which
119 * may receive broken packets during development. ip4-lookup and
120 * ip6-lookup are obvious places where people send
121 * hand-crafted packets which may turn out to be broken.
123 #define foreach_node_to_dissector_pair \
124 _("ethernet-input", eth_maybefcs) \
126 _("ip4-icmp-error", ip) \
128 _("ip4-input-no-checksum", ip) \
130 _("ip4-lookup", ip) \
131 _("ip4-udp-lookup", ip) \
132 _("ip6-lookup", ipv6) \
133 _("tcp4-output", tcp) \
134 _("tcp6-output", tcp)
137 add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start,
145 line_len = tvb_find_line_end(tvb, start, len, &next, FALSE);
146 data_len = next - start;
147 proto_tree_add_string(tree, hf, tvb, start, data_len,
148 tvb_format_stringzpad(tvb, start, line_len));
155 dissect_vpp_trace (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
160 proto_tree *trace_tree;
161 gint trace_string_length;
163 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP-Trace");
164 col_clear(pinfo->cinfo, COL_INFO);
166 ti = proto_tree_add_item(tree, proto_vpp_trace, tvb, offset, -1, ENC_NA);
167 trace_tree = proto_item_add_subtree(ti, ett_vpp_trace);
169 /* How long is the trace string? */
170 (void ) tvb_get_stringz_enc (wmem_packet_scope(), tvb, 0,
171 &trace_string_length, ENC_ASCII);
173 add_multi_line_string_to_tree (trace_tree, tvb, 0,
175 hf_vpp_buffer_trace);
176 return tvb_captured_length(tvb);
180 * BIG FAT WARNING: it's impossible to #include the vpp header files,
181 * so this is a private copy of .../src/vnet/buffer.h, with
182 * some vpp typedefs thrown in for good measure.
185 typedef unsigned int u32;
186 typedef unsigned short int u16;
187 typedef short int i16;
188 typedef unsigned char u8;
189 typedef unsigned long long u64;
197 u8 feature_arc_index;
202 /* IP4/6 buffer opaque. */
205 /* Adjacency from destination IP address lookup [VLIB_TX].
206 Adjacency from source IP address lookup [VLIB_RX].
207 This gets set to ~0 until source lookup is performed. */
214 /* Flow hash value for this packet computed from IP src/dst address
215 protocol and ports. */
223 /* Hint for transport protocols */
228 u32 save_rewrite_length;
245 /* in/out variables */
248 u32 next_index; /* index of next node - ignored if "feature" node */
249 u16 estimated_mtu; /* estimated MTU calculated during reassembly */
251 /* internal variables used during reassembly */
259 u16 ip6_frag_hdr_offset;
268 * data copied from the MPLS header that was popped from the packet
269 * during the look-up.
273 /* do not overlay w/ ip.adj_index[0,1] nor flow hash */
279 u32 save_rewrite_length;
281 * BIER - the number of bytes in the header.
282 * the len field in the header is not authoritative. It's the
283 * value in the table that counts.
291 /* l2 bridging path, only valid there */
295 u16 bd_index; /* bridge-domain index */
296 u8 l2_len; /* ethernet header length */
297 u8 shg; /* split-horizon group */
298 u16 l2fib_sn; /* l2fib bd/int seq_num */
299 u8 bd_age; /* aging enabled */
302 /* l2tpv3 softwire encap, only valid there */
305 u32 pad[4]; /* do not overlay w/ ip.adj_index[0,1] */
313 struct opaque_l2 pad;
325 u32 pad[8 - 2 - 1]; /* to end of opaque */
329 /* interface output features */
345 u32 map_domain_index;
349 u16 frag_offset; //Fragmentation header offset
350 u16 l4_offset; //L4 header overall offset
351 u8 l4_protocol; //The final protocol number
352 } v6; //Used by ip6_map_t only
353 u16 checksum_offset; //L4 checksum overall offset
357 /* IP Fragmentation */
360 u32 pad[2]; /* do not overlay w/ ip.adj_index[0,1] */
363 u8 flags; //See ip_frag.h
366 /* COP - configurable junk filter(s) */
369 /* Current configuration index. */
370 u32 current_config_index;
376 /* overlay address family */
383 u32 connection_index;
387 u16 hdr_offset; /**< offset relative to ip hdr */
388 u16 data_offset; /**< offset relative to ip hdr */
389 u16 data_len; /**< data len */
396 u32 connection_index;
397 u16 sid; /**< Stream ID */
398 u16 ssn; /**< Stream Sequence Number */
399 u32 tsn; /**< Transmission Sequence Number */
400 u16 hdr_offset; /**< offset relative to ip hdr */
401 u16 data_offset; /**< offset relative to ip hdr */
402 u16 data_len; /**< data len */
403 u8 subconn_idx; /**< index of the sub_connection being used */
415 } vnet_buffer_opaque_t;
418 #define PTAS proto_tree_add_string(opaque_tree, \
419 hf_vpp_buffer_opaque_opaque, \
420 tvb, 0, strlen(tmpbuf), tmpbuf)
423 dissect_vpp_opaque (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
428 proto_tree *opaque_tree;
432 vnet_buffer_opaque_t _o, *o = &_o;
436 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP-Opaque");
437 col_clear(pinfo->cinfo, COL_INFO);
439 ti = proto_tree_add_item(tree, proto_vpp_opaque, tvb, offset, -1, ENC_NA);
440 opaque_tree = proto_item_add_subtree(ti, ett_vpp_opaque);
443 for (i = 0; i < 10; i++) {
444 opaque[i] = tvb_get_guint32 (tvb, offset + 4*i, ENC_LITTLE_ENDIAN);
445 snprintf (tmpbuf + print_offset, sizeof(tmpbuf) - print_offset,
447 print_offset = strlen (tmpbuf);
451 proto_tree_add_string (opaque_tree, hf_vpp_buffer_opaque_raw, tvb, 0,
452 strlen(tmpbuf), tmpbuf);
454 memset (o, 0, sizeof (*o));
455 memcpy (o, opaque, sizeof (opaque));
457 snprintf (tmpbuf, sizeof(tmpbuf),
458 "sw_if_index[VLIB_RX]: %d, sw_if_index[VLIB_TX]: %d",
459 o->sw_if_index[0], o->sw_if_index[1]);
462 snprintf (tmpbuf, sizeof(tmpbuf),
463 "L2 offset %d, L3 offset %d, L4 offset %d, feature arc index %d",
464 (u32)(o->l2_hdr_offset),
465 (u32)(o->l3_hdr_offset),
466 (u32)(o->l4_hdr_offset),
467 (u32)(o->feature_arc_index));
470 snprintf (tmpbuf, sizeof(tmpbuf),
471 "ip.adj_index[VLIB_RX]: %d, ip.adj_index[VLIB_TX]: %d",
472 (u32)(o->ip.adj_index[0]),
473 (u32)(o->ip.adj_index[1]));
476 snprintf (tmpbuf, sizeof(tmpbuf),
477 "ip.flow_hash: 0x%x, ip.save_protocol: 0x%x, ip.fib_index: %d",
478 o->ip.flow_hash, o->ip.save_protocol, o->ip.fib_index);
481 snprintf (tmpbuf, sizeof(tmpbuf),
482 "ip.save_rewrite_length: %d, ip.rpf_id: %d",
483 o->ip.save_rewrite_length, o->ip.rpf_id);
486 snprintf (tmpbuf, sizeof(tmpbuf),
487 "ip.icmp.type: %d ip.icmp.code: %d, ip.icmp.data: 0x%x",
488 (u32)(o->ip.icmp.type),
489 (u32)(o->ip.icmp.code),
493 snprintf (tmpbuf, sizeof(tmpbuf),
494 "ip.reass.next_index: %d, ip.reass.estimated_mtu: %d",
495 o->ip.reass.next_index, (u32)(o->ip.reass.estimated_mtu));
497 snprintf (tmpbuf, sizeof(tmpbuf),
498 "ip.reass.fragment_first: %d ip.reass.fragment_last: %d",
499 (u32)(o->ip.reass.fragment_first),
500 (u32)(o->ip.reass.fragment_last));
502 snprintf (tmpbuf, sizeof(tmpbuf),
503 "ip.reass.range_first: %d ip.reass.range_last: %d",
504 (u32)(o->ip.reass.range_first),
505 (u32)(o->ip.reass.range_last));
508 snprintf (tmpbuf, sizeof(tmpbuf),
509 "ip.reass.next_range_bi: 0x%x, ip.reass.ip6_frag_hdr_offset: %d",
510 o->ip.reass.next_range_bi,
511 (u32)(o->ip.reass.ip6_frag_hdr_offset));
514 snprintf (tmpbuf, sizeof(tmpbuf),
515 "mpls.ttl: %d, mpls.exp: %d, mpls.first: %d, "
516 "mpls.save_rewrite_length: %d, mpls.bier.n_bytes: %d",
517 (u32)(o->mpls.ttl), (u32)(o->mpls.exp), (u32)(o->mpls.first),
518 o->mpls.save_rewrite_length, (u32)(o->mpls.bier.n_bytes));
521 snprintf (tmpbuf, sizeof(tmpbuf),
522 "l2.feature_bitmap: %08x, l2.bd_index: %d, l2.l2_len: %d, "
523 "l2.shg: %d, l2.l2fib_sn: %d, l2.bd_age: %d",
524 o->l2.feature_bitmap, (u32)(o->l2.bd_index),
525 (u32)(o->l2.l2_len), (u32)(o->l2.shg), (u32)(o->l2.l2fib_sn),
526 (u32)(o->l2.bd_age));
529 snprintf (tmpbuf, sizeof(tmpbuf),
530 "l2t.next_index: %d, l2t.session_index: %d",
531 (u32)(o->l2t.next_index), o->l2t.session_index);
534 snprintf (tmpbuf, sizeof(tmpbuf),
535 "l2_classify.table_index: %d, l2_classify.opaque_index: %d, "
536 "l2_classify.hash: 0x%llx",
537 o->l2_classify.table_index,
538 o->l2_classify.opaque_index,
539 o->l2_classify.hash);
542 snprintf (tmpbuf, sizeof(tmpbuf),
543 "policer.index: %d", o->policer.index);
546 snprintf (tmpbuf, sizeof(tmpbuf),
547 "ipsec.flags: 0x%x, ipsec.sad_index: %d",
548 o->ipsec.flags, o->ipsec.sad_index);
551 snprintf (tmpbuf, sizeof(tmpbuf),
552 "map.mtu: %d", (u32)(o->map.mtu));
555 snprintf (tmpbuf, sizeof(tmpbuf),
556 "map_t.v6.saddr: 0x%x, map_t.v6.daddr: 0x%x, "
557 "map_t.v6.frag_offset: %d, map_t.v6.l4_offset: %d",
560 (u32)(o->map_t.v6.frag_offset),
561 (u32)(o->map_t.v6.l4_offset));
563 snprintf (tmpbuf, sizeof(tmpbuf),
564 "map_t.v6.l4_protocol: %d, map_t.checksum_offset: %d, "
566 (u32)(o->map_t.v6.l4_protocol),
567 (u32)(o->map_t.checksum_offset),
568 (u32)(o->map_t.mtu));
571 snprintf (tmpbuf, sizeof(tmpbuf),
572 "ip_frag.mtu: %d, ip_frag.next_index: %d, ip_frag.flags: 0x%x",
573 (u32)(o->ip_frag.mtu),
574 (u32)(o->ip_frag.next_index),
575 (u32)(o->ip_frag.flags));
578 snprintf (tmpbuf, sizeof(tmpbuf),
579 "cop.current_config_index: %d",
580 o->cop.current_config_index);
583 snprintf (tmpbuf, sizeof(tmpbuf),
584 "lisp.overlay_afi: %d",
585 (u32)(o->lisp.overlay_afi));
588 snprintf (tmpbuf, sizeof(tmpbuf),
589 "tcp.connection_index: %d, tcp.seq_number: %d, tcp.seq_end: %d, "
590 "tcp.ack_number: %d, tcp.hdr_offset: %d, tcp.data_offset: %d",
591 o->tcp.connection_index,
595 (u32)(o->tcp.hdr_offset),
596 (u32)(o->tcp.data_offset));
599 snprintf (tmpbuf, sizeof(tmpbuf),
600 "tcp.data_len: %d, tcp.flags: 0x%x",
601 (u32)(o->tcp.data_len),
602 (u32)(o->tcp.flags));
605 snprintf (tmpbuf, sizeof(tmpbuf),
606 "sctp.connection_index: %d, sctp.sid: %d, sctp.ssn: %d, "
607 "sctp.tsn: %d, sctp.hdr_offset: %d",
608 o->sctp.connection_index,
612 (u32)(o->sctp.hdr_offset));
614 snprintf (tmpbuf, sizeof(tmpbuf),
615 "sctp.data_offset: %d, sctp.data_len: %d, sctp.subconn_idx: %d, "
617 (u32)(o->sctp.data_offset),
618 (u32)(o->sctp.data_len),
619 (u32)(o->sctp.subconn_idx),
620 (u32)(o->sctp.flags));
623 snprintf (tmpbuf, sizeof(tmpbuf),
628 return tvb_captured_length(tvb);
633 dissect_vpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
636 proto_tree *vpp_tree;
637 tvbuff_t *opaque_tvb, *eth_tvb, *trace_tvb;
639 guint8 major_version, minor_version;
642 guint16 trace_length;
644 static const int *buffer_flags[] = {
645 &hf_vpp_buffer_flag_non_default_freelist,
646 &hf_vpp_buffer_flag_traced,
647 &hf_vpp_buffer_flag_next_present,
648 &hf_vpp_buffer_flag_total_length_valid,
649 &hf_vpp_buffer_flag_ext_hdr_valid,
650 &hf_vpp_buffer_flag_l4_checksum_computed,
651 &hf_vpp_buffer_flag_l4_checksum_correct,
652 &hf_vpp_buffer_flag_vlan_2_deep,
653 &hf_vpp_buffer_flag_vlan_1_deep,
654 &hf_vpp_buffer_flag_span_clone,
655 &hf_vpp_buffer_flag_loop_counter_valid,
656 &hf_vpp_buffer_flag_locally_originated,
657 &hf_vpp_buffer_flag_is_ip4,
658 &hf_vpp_buffer_flag_is_ip6,
659 &hf_vpp_buffer_flag_offload_ip_checksum,
660 &hf_vpp_buffer_flag_offload_tcp_checksum,
661 &hf_vpp_buffer_flag_offload_udp_checksum,
662 &hf_vpp_buffer_flag_is_natted,
663 &hf_vpp_buffer_flag_l2_hdr_offset_valid,
664 &hf_vpp_buffer_flag_l3_hdr_offset_valid,
665 &hf_vpp_buffer_flag_l4_hdr_offset_valid,
666 &hf_vpp_buffer_flag_flow_report,
667 &hf_vpp_buffer_flag_is_dvr,
668 &hf_vpp_buffer_flag_qos_data_valid,
672 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP");
673 col_clear(pinfo->cinfo, COL_INFO);
675 ti = proto_tree_add_item(tree, proto_vpp, tvb, offset, -1, ENC_NA);
676 vpp_tree = proto_item_add_subtree(ti, ett_vpp);
678 major_version = tvb_get_guint8 (tvb, offset);
681 minor_version = tvb_get_guint8 (tvb, offset);
684 if (major_version != 1 || minor_version != 0)
685 ws_debug_printf ("WARNING: version mismatch (%d, %d)",
686 major_version, minor_version);
688 /* Skip the buffer index */
691 /* Recover the node name */
692 name_length = tvb_get_guint8 (tvb, offset);
695 name = (guint8 *) g_malloc (name_length + 1);
696 for (i = 0; i < name_length; i++, offset++) {
697 name[i] = tvb_get_guint8 (tvb, offset);
702 proto_tree_add_string(vpp_tree, hf_vpp_nodename, tvb, 5, name_length,
704 proto_tree_add_item(vpp_tree, hf_vpp_buffer_index, tvb,
705 0 /* bi at offset 0 */, 4, ENC_LITTLE_ENDIAN);
707 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_data, tvb,
708 offset, 2, ENC_LITTLE_ENDIAN);
710 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_length, tvb,
711 offset, 2, ENC_LITTLE_ENDIAN);
714 proto_tree_add_bitmask(vpp_tree, tvb, offset,
715 hf_vpp_buffer_flags, ett_vpp,
716 buffer_flags, ENC_LITTLE_ENDIAN);
719 proto_tree_add_item(vpp_tree, hf_vpp_buffer_flow_id, tvb,
720 offset, 4, ENC_LITTLE_ENDIAN);
723 proto_tree_add_item(vpp_tree, hf_vpp_buffer_next_buffer, tvb,
724 offset, 4, ENC_LITTLE_ENDIAN);
727 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_config_index, tvb,
728 offset, 4, ENC_LITTLE_ENDIAN);
731 proto_tree_add_item(vpp_tree, hf_vpp_buffer_error_index, tvb,
732 offset, 2, ENC_LITTLE_ENDIAN);
735 proto_tree_add_item(vpp_tree, hf_vpp_buffer_n_add_refs, tvb,
736 offset, 1, ENC_LITTLE_ENDIAN);
739 proto_tree_add_item(vpp_tree, hf_vpp_buffer_buffer_pool_index, tvb,
740 offset, 1, ENC_LITTLE_ENDIAN);
743 opaque_tvb = tvb_new_subset_remaining (tvb, offset);
744 call_dissector (vpp_opaque_dissector_handle, opaque_tvb, pinfo, tree);
748 /* skip second opaque line */
751 trace_length = tvb_get_guint16 (tvb, offset, ENC_LITTLE_ENDIAN);
754 if (trace_length > 0) {
755 trace_tvb = tvb_new_subset_remaining (tvb, offset);
756 offset += trace_length;
758 call_dissector (vpp_trace_dissector_handle, trace_tvb, pinfo, tree);
761 eth_tvb = tvb_new_subset_remaining (tvb, offset);
764 * Delegate the rest of the packet dissection to the per-node
765 * next dissector in the foreach_node_to_dissector_pair list
767 * Failing that, pretend its an ethernet packet
769 if (!dissector_try_string (vpp_subdissector_table, name, eth_tvb,
770 pinfo, tree, NULL)) {
771 guint8 maybe_protocol_id;
772 dissector_handle_t best_guess_dissector_handle
773 = eth_maybefcs_dissector_handle;
775 maybe_protocol_id = tvb_get_guint8 (tvb, offset);
777 switch (maybe_protocol_id) {
779 best_guess_dissector_handle = ip_dissector_handle;
782 best_guess_dissector_handle = ipv6_dissector_handle;
787 call_dissector (best_guess_dissector_handle, eth_tvb, pinfo, tree);
791 return tvb_captured_length(tvb);
795 proto_register_vpp(void)
797 static hf_register_info hf[] = {
798 { &hf_vpp_buffer_index,
799 { "BufferIndex", "vpp.bufferindex", FT_UINT32, BASE_HEX, NULL, 0x0,
803 { "NodeName", "vpp.nodename", FT_STRINGZ, BASE_NONE, NULL, 0x0,
806 { &hf_vpp_buffer_current_data,
807 { "CurrentData", "vpp.current_data", FT_INT16, BASE_DEC, NULL, 0x0,
810 { &hf_vpp_buffer_current_length,
811 { "CurrentLength", "vpp.current_length", FT_UINT16, BASE_DEC, NULL, 0x0,
816 * Warning: buffer flag bits are not cast in concrete, and it's
817 * impossible to imagine trying to compile WS with even a subset
818 * of the actual header files.
820 * See .../src/vlib/buffer.h, .../src/vnet/buffer.h in
821 * the fd.io vpp source tree.
824 { &hf_vpp_buffer_flags,
825 { "BufferFlags", "vpp.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
829 { &hf_vpp_buffer_flag_non_default_freelist,
830 { "NonDefaultFreelist", "vpp.flags.non_default_freelist",
831 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x1, NULL, HFILL },
833 { &hf_vpp_buffer_flag_traced,
834 { "Traced", "vpp.flags.traced",
835 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x2, NULL, HFILL },
837 { &hf_vpp_buffer_flag_next_present,
838 { "NextPresent", "vpp.flags.next_present",
839 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x4, NULL, HFILL },
841 { &hf_vpp_buffer_flag_total_length_valid,
842 { "TotalLengthValid", "vpp.flags.total_length_valid",
843 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x8, NULL, HFILL },
845 { &hf_vpp_buffer_flag_ext_hdr_valid,
846 { "ExtHeaderValid", "vpp.flags.ext_hdr_valid",
847 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x10, NULL, HFILL },
850 { &hf_vpp_buffer_flag_l4_checksum_computed,
851 { "L4ChecksumComputed", "vpp.flags.l4_checksum_computed",
852 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x80000000, NULL, HFILL },
854 { &hf_vpp_buffer_flag_l4_checksum_correct,
855 { "L4ChecksumCorrect", "vpp.flags.l4_checksum_correct",
856 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x40000000, NULL, HFILL },
858 { &hf_vpp_buffer_flag_vlan_2_deep,
859 { "Vlan2Deep", "vpp.flags.vlan_2_deep",
860 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x20000000, NULL, HFILL },
862 { &hf_vpp_buffer_flag_vlan_1_deep,
863 { "Vlan1Deep", "vpp.flags.vlan_1_deep",
864 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x10000000, NULL, HFILL },
866 { &hf_vpp_buffer_flag_span_clone,
867 { "SpanClone", "vpp.flags.span_clone",
868 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x08000000, NULL, HFILL },
870 { &hf_vpp_buffer_flag_loop_counter_valid,
871 { "LoopCounterValid", "vpp.flags.loop_counter_valid",
872 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x04000000, NULL, HFILL },
874 { &hf_vpp_buffer_flag_locally_originated,
875 { "LocallyOriginated", "vpp.flags.locally_originated",
876 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x02000000, NULL, HFILL },
878 { &hf_vpp_buffer_flag_is_ip4,
879 { "IsIP4", "vpp.flags.is_ip4",
880 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x01000000, NULL, HFILL },
882 { &hf_vpp_buffer_flag_is_ip6,
883 { "IsIP4", "vpp.flags.is_ip6",
884 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00800000, NULL, HFILL },
886 { &hf_vpp_buffer_flag_offload_ip_checksum,
887 { "OffloadIPChecksum", "vpp.flags.offload_ip_checksum",
888 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00400000, NULL, HFILL },
890 { &hf_vpp_buffer_flag_offload_tcp_checksum,
891 { "OffloadTCPChecksum", "vpp.flags.offload_tcp_checksum",
892 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00200000, NULL, HFILL },
894 { &hf_vpp_buffer_flag_offload_udp_checksum,
895 { "OffloadUDPChecksum", "vpp.flags.offload_udp_checksum",
896 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00100000, NULL, HFILL },
898 { &hf_vpp_buffer_flag_is_natted,
899 { "IsNATted", "vpp.flags.is_natted",
900 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00080000, NULL, HFILL },
902 { &hf_vpp_buffer_flag_l2_hdr_offset_valid,
903 { "L2HdrOffsetValid", "vpp.flags.l2_hdr_offset_valid",
904 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00040000, NULL, HFILL },
906 { &hf_vpp_buffer_flag_l3_hdr_offset_valid,
907 { "L3HdrOffsetValid", "vpp.flags.l3_hdr_offset_valid",
908 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00020000, NULL, HFILL },
910 { &hf_vpp_buffer_flag_l4_hdr_offset_valid,
911 { "L4HdrOffsetValid", "vpp.flags.l4_hdr_offset_valid",
912 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00010000, NULL, HFILL },
914 { &hf_vpp_buffer_flag_flow_report,
915 { "FlowReport", "vpp.flags.flow_report",
916 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00008000, NULL, HFILL },
918 { &hf_vpp_buffer_flag_is_dvr,
919 { "IsDVR", "vpp.flags.is_dvr",
920 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00004000, NULL, HFILL },
922 { &hf_vpp_buffer_flag_qos_data_valid,
923 { "QOSDataValid", "vpp.flags.qos_data_valid",
924 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00002000, NULL, HFILL },
927 { &hf_vpp_buffer_flow_id,
928 { "FlowID", "vpp.flow_id", FT_UINT32, BASE_DEC, NULL, 0x0,
931 { &hf_vpp_buffer_next_buffer,
932 { "NextBuffer", "vpp.next_buffer", FT_UINT32, BASE_DEC, NULL, 0x0,
935 { &hf_vpp_buffer_current_config_index,
936 { "CurrentConfigIndex", "vpp.current_config_index",
937 FT_UINT32, BASE_DEC, NULL, 0x0,
940 { &hf_vpp_buffer_error_index,
941 { "ErrorIndex", "vpp.error_index",
942 FT_UINT16, BASE_DEC, NULL, 0x0,
945 { &hf_vpp_buffer_n_add_refs,
946 { "AddRefs", "vpp.n_add_refs_index",
947 FT_UINT8, BASE_DEC, NULL, 0x0,
950 { &hf_vpp_buffer_buffer_pool_index,
951 { "BufferPoolIndex", "vpp.buffer_pool_index",
952 FT_UINT8, BASE_DEC, NULL, 0x0,
957 static hf_register_info opaque_hf[] = {
958 { &hf_vpp_buffer_opaque_raw,
959 { "Raw ", "vppMetadata.opaque_raw", FT_STRINGZ, BASE_NONE, NULL, 0x0,
962 { &hf_vpp_buffer_opaque_opaque,
963 { "Opaque", "vppMetadata.opaque",
964 FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL },
968 static hf_register_info trace_hf[] = {
969 { &hf_vpp_buffer_trace,
970 { "Trace", "vppTrace.trace", FT_STRINGZ, BASE_NONE, NULL, 0x0,
975 static gint *ett[] = {
978 static gint *ett_opaque[] = {
981 static gint *ett_trace[] = {
985 proto_vpp = proto_register_protocol("VPP Buffer Metadata", "VPP", "vpp");
986 proto_register_field_array(proto_vpp, hf, array_length(hf));
987 proto_register_subtree_array (ett, array_length(ett));
988 register_dissector("vpp", dissect_vpp, proto_vpp);
990 proto_vpp_opaque = proto_register_protocol("VPP Buffer Opaque", "VPP-Opaque",
992 proto_register_field_array(proto_vpp_opaque, opaque_hf,
993 array_length(opaque_hf));
994 proto_register_subtree_array (ett_opaque, array_length(ett_opaque));
995 register_dissector("vppOpaque", dissect_vpp_opaque, proto_vpp_opaque);
997 proto_vpp_trace = proto_register_protocol("VPP Buffer Trace", "VPP-Trace",
999 proto_register_field_array(proto_vpp_trace, trace_hf,
1000 array_length(trace_hf));
1001 proto_register_subtree_array (ett_trace, array_length(ett_trace));
1002 register_dissector("vppTrace", dissect_vpp_trace, proto_vpp_trace);
1004 vpp_subdissector_table = register_dissector_table
1005 ("vpp", "VPP per-node next dissector table", proto_vpp,
1006 FT_STRING, BASE_NONE);
1009 d##_dissector_handle = find_dissector(#d); \
1010 dissector_add_string ("vpp", n, d##_dissector_handle);
1011 foreach_node_to_dissector_pair;
1016 proto_reg_handoff_vpp(void)
1018 vpp_dissector_handle = find_dissector("vpp");
1019 vpp_opaque_dissector_handle = find_dissector("vppOpaque");
1020 vpp_trace_dissector_handle = find_dissector("vppTrace");
1021 dissector_add_uint("wtap_encap", WTAP_ENCAP_USER13, vpp_dissector_handle);
1025 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1030 * indent-tabs-mode: nil
1033 * vi: set shiftwidth=4 tabstop=8 expandtab:
1034 * :indentSize=4:tabSize=8:noTabs=true: