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_handle_t eth_dissector_handle;
92 static dissector_handle_t ip4_dissector_handle;
93 static dissector_handle_t ip6_dissector_handle;
94 static dissector_handle_t udp_dissector_handle;
96 #define foreach_node_to_dissector_handle \
97 _("ip6-lookup", "ipv6", ip6_dissector_handle) \
98 _("ip4-input-no-checksum", "ip", ip4_dissector_handle) \
99 _("ip4-lookup", "ip", ip4_dissector_handle) \
100 _("ip4-local", "ip", ip4_dissector_handle) \
101 _("ip4-udp-lookup", "ip", udp_dissector_handle) \
102 _("ip4-icmp-error", "ip", ip4_dissector_handle) \
103 _("ip4-glean", "ip", ip4_dissector_handle) \
104 _("ethernet-input", "eth_maybefcs", eth_dissector_handle)
107 add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start,
115 line_len = tvb_find_line_end(tvb, start, len, &next, FALSE);
116 data_len = next - start;
117 proto_tree_add_string(tree, hf, tvb, start, data_len,
118 tvb_format_stringzpad(tvb, start, line_len));
125 dissect_vpp_trace (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
130 proto_tree *trace_tree;
131 gint trace_string_length;
133 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP-Trace");
134 col_clear(pinfo->cinfo, COL_INFO);
136 ti = proto_tree_add_item(tree, proto_vpp_trace, tvb, offset, -1, ENC_NA);
137 trace_tree = proto_item_add_subtree(ti, ett_vpp_trace);
139 /* How long is the trace string? */
140 (void ) tvb_get_stringz_enc (wmem_packet_scope(), tvb, 0,
141 &trace_string_length, ENC_ASCII);
143 add_multi_line_string_to_tree (trace_tree, tvb, 0,
145 hf_vpp_buffer_trace);
146 return tvb_captured_length(tvb);
150 * BIG FAT WARNING: it's impossible to #include the vpp header files,
151 * so this is a private copy of .../src/vnet/buffer.h, with
152 * some vpp typedefs thrown in for good measure.
155 typedef unsigned int u32;
156 typedef unsigned short int u16;
157 typedef short int i16;
158 typedef unsigned char u8;
159 typedef unsigned long long u64;
167 u8 feature_arc_index;
172 /* IP4/6 buffer opaque. */
175 /* Adjacency from destination IP address lookup [VLIB_TX].
176 Adjacency from source IP address lookup [VLIB_RX].
177 This gets set to ~0 until source lookup is performed. */
184 /* Flow hash value for this packet computed from IP src/dst address
185 protocol and ports. */
193 /* Hint for transport protocols */
198 u32 save_rewrite_length;
215 /* in/out variables */
218 u32 next_index; /* index of next node - ignored if "feature" node */
219 u16 estimated_mtu; /* estimated MTU calculated during reassembly */
221 /* internal variables used during reassembly */
229 u16 ip6_frag_hdr_offset;
238 * data copied from the MPLS header that was popped from the packet
239 * during the look-up.
243 /* do not overlay w/ ip.adj_index[0,1] nor flow hash */
249 u32 save_rewrite_length;
251 * BIER - the number of bytes in the header.
252 * the len field in the header is not authoritative. It's the
253 * value in the table that counts.
261 /* l2 bridging path, only valid there */
265 u16 bd_index; /* bridge-domain index */
266 u8 l2_len; /* ethernet header length */
267 u8 shg; /* split-horizon group */
268 u16 l2fib_sn; /* l2fib bd/int seq_num */
269 u8 bd_age; /* aging enabled */
272 /* l2tpv3 softwire encap, only valid there */
275 u32 pad[4]; /* do not overlay w/ ip.adj_index[0,1] */
283 struct opaque_l2 pad;
295 u32 pad[8 - 2 - 1]; /* to end of opaque */
299 /* interface output features */
315 u32 map_domain_index;
319 u16 frag_offset; //Fragmentation header offset
320 u16 l4_offset; //L4 header overall offset
321 u8 l4_protocol; //The final protocol number
322 } v6; //Used by ip6_map_t only
323 u16 checksum_offset; //L4 checksum overall offset
327 /* IP Fragmentation */
330 u32 pad[2]; /* do not overlay w/ ip.adj_index[0,1] */
333 u8 flags; //See ip_frag.h
336 /* COP - configurable junk filter(s) */
339 /* Current configuration index. */
340 u32 current_config_index;
346 /* overlay address family */
353 u32 connection_index;
357 u16 hdr_offset; /**< offset relative to ip hdr */
358 u16 data_offset; /**< offset relative to ip hdr */
359 u16 data_len; /**< data len */
366 u32 connection_index;
367 u16 sid; /**< Stream ID */
368 u16 ssn; /**< Stream Sequence Number */
369 u32 tsn; /**< Transmission Sequence Number */
370 u16 hdr_offset; /**< offset relative to ip hdr */
371 u16 data_offset; /**< offset relative to ip hdr */
372 u16 data_len; /**< data len */
373 u8 subconn_idx; /**< index of the sub_connection being used */
385 } vnet_buffer_opaque_t;
388 #define PTAS proto_tree_add_string(opaque_tree, \
389 hf_vpp_buffer_opaque_opaque, \
390 tvb, 0, strlen(tmpbuf), tmpbuf)
393 dissect_vpp_opaque (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
398 proto_tree *opaque_tree;
402 vnet_buffer_opaque_t _o, *o = &_o;
406 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP-Opaque");
407 col_clear(pinfo->cinfo, COL_INFO);
409 ti = proto_tree_add_item(tree, proto_vpp_opaque, tvb, offset, -1, ENC_NA);
410 opaque_tree = proto_item_add_subtree(ti, ett_vpp_opaque);
413 for (i = 0; i < 10; i++) {
414 opaque[i] = tvb_get_guint32 (tvb, offset + 4*i, ENC_LITTLE_ENDIAN);
415 snprintf (tmpbuf + print_offset, sizeof(tmpbuf) - print_offset,
417 print_offset = strlen (tmpbuf);
421 proto_tree_add_string (opaque_tree, hf_vpp_buffer_opaque_raw, tvb, 0,
422 strlen(tmpbuf), tmpbuf);
424 memset (o, 0, sizeof (*o));
425 memcpy (o, opaque, sizeof (opaque));
427 snprintf (tmpbuf, sizeof(tmpbuf),
428 "sw_if_index[VLIB_RX]: %d, sw_if_index[VLIB_TX]: %d",
429 o->sw_if_index[0], o->sw_if_index[1]);
432 snprintf (tmpbuf, sizeof(tmpbuf),
433 "L2 offset %d, L3 offset %d, L4 offset %d, feature arc index %d",
434 (u32)(o->l2_hdr_offset),
435 (u32)(o->l3_hdr_offset),
436 (u32)(o->l4_hdr_offset),
437 (u32)(o->feature_arc_index));
440 snprintf (tmpbuf, sizeof(tmpbuf),
441 "ip.adj_index[VLIB_RX]: %d, ip.adj_index[VLIB_TX]: %d",
442 (u32)(o->ip.adj_index[0]),
443 (u32)(o->ip.adj_index[1]));
446 snprintf (tmpbuf, sizeof(tmpbuf),
447 "ip.flow_hash: 0x%x, ip.save_protocol: 0x%x, ip.fib_index: %d",
448 o->ip.flow_hash, o->ip.save_protocol, o->ip.fib_index);
451 snprintf (tmpbuf, sizeof(tmpbuf),
452 "ip.save_rewrite_length: %d, ip.rpf_id: %d",
453 o->ip.save_rewrite_length, o->ip.rpf_id);
456 snprintf (tmpbuf, sizeof(tmpbuf),
457 "ip.icmp.type: %d ip.icmp.code: %d, ip.icmp.data: 0x%x",
458 (u32)(o->ip.icmp.type),
459 (u32)(o->ip.icmp.code),
463 snprintf (tmpbuf, sizeof(tmpbuf),
464 "ip.reass.next_index: %d, ip.reass.estimated_mtu: %d",
465 o->ip.reass.next_index, (u32)(o->ip.reass.estimated_mtu));
467 snprintf (tmpbuf, sizeof(tmpbuf),
468 "ip.reass.fragment_first: %d ip.reass.fragment_last: %d",
469 (u32)(o->ip.reass.fragment_first),
470 (u32)(o->ip.reass.fragment_last));
472 snprintf (tmpbuf, sizeof(tmpbuf),
473 "ip.reass.range_first: %d ip.reass.range_last: %d",
474 (u32)(o->ip.reass.range_first),
475 (u32)(o->ip.reass.range_last));
478 snprintf (tmpbuf, sizeof(tmpbuf),
479 "ip.reass.next_range_bi: 0x%x, ip.reass.ip6_frag_hdr_offset: %d",
480 o->ip.reass.next_range_bi,
481 (u32)(o->ip.reass.ip6_frag_hdr_offset));
484 snprintf (tmpbuf, sizeof(tmpbuf),
485 "mpls.ttl: %d, mpls.exp: %d, mpls.first: %d, "
486 "mpls.save_rewrite_length: %d, mpls.bier.n_bytes: %d",
487 (u32)(o->mpls.ttl), (u32)(o->mpls.exp), (u32)(o->mpls.first),
488 o->mpls.save_rewrite_length, (u32)(o->mpls.bier.n_bytes));
491 snprintf (tmpbuf, sizeof(tmpbuf),
492 "l2.feature_bitmap: %08x, l2.bd_index: %d, l2.l2_len: %d, "
493 "l2.shg: %d, l2.l2fib_sn: %d, l2.bd_age: %d",
494 o->l2.feature_bitmap, (u32)(o->l2.bd_index),
495 (u32)(o->l2.l2_len), (u32)(o->l2.shg), (u32)(o->l2.l2fib_sn),
496 (u32)(o->l2.bd_age));
499 snprintf (tmpbuf, sizeof(tmpbuf),
500 "l2t.next_index: %d, l2t.session_index: %d",
501 (u32)(o->l2t.next_index), o->l2t.session_index);
504 snprintf (tmpbuf, sizeof(tmpbuf),
505 "l2_classify.table_index: %d, l2_classify.opaque_index: %d, "
506 "l2_classify.hash: 0x%llx",
507 o->l2_classify.table_index,
508 o->l2_classify.opaque_index,
509 o->l2_classify.hash);
512 snprintf (tmpbuf, sizeof(tmpbuf),
513 "policer.index: %d", o->policer.index);
516 snprintf (tmpbuf, sizeof(tmpbuf),
517 "ipsec.flags: 0x%x, ipsec.sad_index: %d",
518 o->ipsec.flags, o->ipsec.sad_index);
521 snprintf (tmpbuf, sizeof(tmpbuf),
522 "map.mtu: %d", (u32)(o->map.mtu));
525 snprintf (tmpbuf, sizeof(tmpbuf),
526 "map_t.v6.saddr: 0x%x, map_t.v6.daddr: 0x%x, "
527 "map_t.v6.frag_offset: %d, map_t.v6.l4_offset: %d",
530 (u32)(o->map_t.v6.frag_offset),
531 (u32)(o->map_t.v6.l4_offset));
533 snprintf (tmpbuf, sizeof(tmpbuf),
534 "map_t.v6.l4_protocol: %d, map_t.checksum_offset: %d, "
536 (u32)(o->map_t.v6.l4_protocol),
537 (u32)(o->map_t.checksum_offset),
538 (u32)(o->map_t.mtu));
541 snprintf (tmpbuf, sizeof(tmpbuf),
542 "ip_frag.mtu: %d, ip_frag.next_index: %d, ip_frag.flags: 0x%x",
543 (u32)(o->ip_frag.mtu),
544 (u32)(o->ip_frag.next_index),
545 (u32)(o->ip_frag.flags));
548 snprintf (tmpbuf, sizeof(tmpbuf),
549 "cop.current_config_index: %d",
550 o->cop.current_config_index);
553 snprintf (tmpbuf, sizeof(tmpbuf),
554 "lisp.overlay_afi: %d",
555 (u32)(o->lisp.overlay_afi));
558 snprintf (tmpbuf, sizeof(tmpbuf),
559 "tcp.connection_index: %d, tcp.seq_number: %d, tcp.seq_end: %d, "
560 "tcp.ack_number: %d, tcp.hdr_offset: %d, tcp.data_offset: %d",
561 o->tcp.connection_index,
565 (u32)(o->tcp.hdr_offset),
566 (u32)(o->tcp.data_offset));
569 snprintf (tmpbuf, sizeof(tmpbuf),
570 "tcp.data_len: %d, tcp.flags: 0x%x",
571 (u32)(o->tcp.data_len),
572 (u32)(o->tcp.flags));
575 snprintf (tmpbuf, sizeof(tmpbuf),
576 "sctp.connection_index: %d, sctp.sid: %d, sctp.ssn: %d, "
577 "sctp.tsn: %d, sctp.hdr_offset: %d",
578 o->sctp.connection_index,
582 (u32)(o->sctp.hdr_offset));
584 snprintf (tmpbuf, sizeof(tmpbuf),
585 "sctp.data_offset: %d, sctp.data_len: %d, sctp.subconn_idx: %d, "
587 (u32)(o->sctp.data_offset),
588 (u32)(o->sctp.data_len),
589 (u32)(o->sctp.subconn_idx),
590 (u32)(o->sctp.flags));
593 snprintf (tmpbuf, sizeof(tmpbuf),
598 return tvb_captured_length(tvb);
603 dissect_vpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
606 proto_tree *vpp_tree;
607 tvbuff_t *opaque_tvb, *eth_tvb, *trace_tvb;
609 guint8 major_version, minor_version;
612 guint16 trace_length;
614 static const int *buffer_flags[] = {
615 &hf_vpp_buffer_flag_non_default_freelist,
616 &hf_vpp_buffer_flag_traced,
617 &hf_vpp_buffer_flag_next_present,
618 &hf_vpp_buffer_flag_total_length_valid,
619 &hf_vpp_buffer_flag_ext_hdr_valid,
620 &hf_vpp_buffer_flag_l4_checksum_computed,
621 &hf_vpp_buffer_flag_l4_checksum_correct,
622 &hf_vpp_buffer_flag_vlan_2_deep,
623 &hf_vpp_buffer_flag_vlan_1_deep,
624 &hf_vpp_buffer_flag_span_clone,
625 &hf_vpp_buffer_flag_loop_counter_valid,
626 &hf_vpp_buffer_flag_locally_originated,
627 &hf_vpp_buffer_flag_is_ip4,
628 &hf_vpp_buffer_flag_is_ip6,
629 &hf_vpp_buffer_flag_offload_ip_checksum,
630 &hf_vpp_buffer_flag_offload_tcp_checksum,
631 &hf_vpp_buffer_flag_offload_udp_checksum,
632 &hf_vpp_buffer_flag_is_natted,
633 &hf_vpp_buffer_flag_l2_hdr_offset_valid,
634 &hf_vpp_buffer_flag_l3_hdr_offset_valid,
635 &hf_vpp_buffer_flag_l4_hdr_offset_valid,
636 &hf_vpp_buffer_flag_flow_report,
637 &hf_vpp_buffer_flag_is_dvr,
638 &hf_vpp_buffer_flag_qos_data_valid,
642 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP");
643 col_clear(pinfo->cinfo, COL_INFO);
645 ti = proto_tree_add_item(tree, proto_vpp, tvb, offset, -1, ENC_NA);
646 vpp_tree = proto_item_add_subtree(ti, ett_vpp);
648 major_version = tvb_get_guint8 (tvb, offset);
651 minor_version = tvb_get_guint8 (tvb, offset);
654 if (major_version != 1 || minor_version != 0)
655 ws_debug_printf ("WARNING: version mismatch (%d, %d)",
656 major_version, minor_version);
658 /* Skip the buffer index */
661 /* Recover the node name */
662 name_length = tvb_get_guint8 (tvb, offset);
665 name = (guint8 *) g_malloc (name_length + 1);
666 for (i = 0; i < name_length; i++, offset++) {
667 name[i] = tvb_get_guint8 (tvb, offset);
672 proto_tree_add_string(vpp_tree, hf_vpp_nodename, tvb, 5, name_length,
674 proto_tree_add_item(vpp_tree, hf_vpp_buffer_index, tvb,
675 0 /* bi at offset 0 */, 4, ENC_LITTLE_ENDIAN);
677 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_data, tvb,
678 offset, 2, ENC_LITTLE_ENDIAN);
680 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_length, tvb,
681 offset, 2, ENC_LITTLE_ENDIAN);
684 proto_tree_add_bitmask(vpp_tree, tvb, offset,
685 hf_vpp_buffer_flags, ett_vpp,
686 buffer_flags, ENC_LITTLE_ENDIAN);
689 proto_tree_add_item(vpp_tree, hf_vpp_buffer_flow_id, tvb,
690 offset, 4, ENC_LITTLE_ENDIAN);
693 proto_tree_add_item(vpp_tree, hf_vpp_buffer_next_buffer, tvb,
694 offset, 4, ENC_LITTLE_ENDIAN);
697 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_config_index, tvb,
698 offset, 4, ENC_LITTLE_ENDIAN);
701 proto_tree_add_item(vpp_tree, hf_vpp_buffer_error_index, tvb,
702 offset, 2, ENC_LITTLE_ENDIAN);
705 proto_tree_add_item(vpp_tree, hf_vpp_buffer_n_add_refs, tvb,
706 offset, 1, ENC_LITTLE_ENDIAN);
709 proto_tree_add_item(vpp_tree, hf_vpp_buffer_buffer_pool_index, tvb,
710 offset, 1, ENC_LITTLE_ENDIAN);
713 opaque_tvb = tvb_new_subset_remaining (tvb, offset);
714 call_dissector (vpp_opaque_dissector_handle, opaque_tvb, pinfo, tree);
718 /* skip second opaque line */
721 trace_length = tvb_get_guint16 (tvb, offset, ENC_LITTLE_ENDIAN);
724 if (trace_length > 0) {
725 trace_tvb = tvb_new_subset_remaining (tvb, offset);
726 offset += trace_length;
728 call_dissector (vpp_trace_dissector_handle, trace_tvb, pinfo, tree);
731 eth_tvb = tvb_new_subset_remaining (tvb, offset);
737 if (!strcmp (name, a)) { \
738 call_dissector (c, eth_tvb, pinfo, tree); \
742 foreach_node_to_dissector_handle;
745 call_dissector (eth_dissector_handle, eth_tvb, pinfo, tree);
748 return tvb_captured_length(tvb);
752 proto_register_vpp(void)
754 static hf_register_info hf[] = {
755 { &hf_vpp_buffer_index,
756 { "BufferIndex", "vpp.bufferindex", FT_UINT32, BASE_HEX, NULL, 0x0,
760 { "NodeName", "vpp.nodename", FT_STRINGZ, BASE_NONE, NULL, 0x0,
763 { &hf_vpp_buffer_current_data,
764 { "CurrentData", "vpp.current_data", FT_INT16, BASE_DEC, NULL, 0x0,
767 { &hf_vpp_buffer_current_length,
768 { "CurrentLength", "vpp.current_length", FT_UINT16, BASE_DEC, NULL, 0x0,
773 * Warning: buffer flag bits are not cast in concrete, and it's
774 * impossible to imagine trying to compile WS with even a subset
775 * of the actual header files.
777 * See .../src/vlib/buffer.h, .../src/vnet/buffer.h in
778 * the fd.io vpp source tree.
781 { &hf_vpp_buffer_flags,
782 { "BufferFlags", "vpp.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
786 { &hf_vpp_buffer_flag_non_default_freelist,
787 { "NonDefaultFreelist", "vpp.flags.non_default_freelist",
788 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x1, NULL, HFILL },
790 { &hf_vpp_buffer_flag_traced,
791 { "Traced", "vpp.flags.traced",
792 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x2, NULL, HFILL },
794 { &hf_vpp_buffer_flag_next_present,
795 { "NextPresent", "vpp.flags.next_present",
796 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x4, NULL, HFILL },
798 { &hf_vpp_buffer_flag_total_length_valid,
799 { "TotalLengthValid", "vpp.flags.total_length_valid",
800 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x8, NULL, HFILL },
802 { &hf_vpp_buffer_flag_ext_hdr_valid,
803 { "ExtHeaderValid", "vpp.flags.ext_hdr_valid",
804 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x10, NULL, HFILL },
807 { &hf_vpp_buffer_flag_l4_checksum_computed,
808 { "L4ChecksumComputed", "vpp.flags.l4_checksum_computed",
809 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x80000000, NULL, HFILL },
811 { &hf_vpp_buffer_flag_l4_checksum_correct,
812 { "L4ChecksumCorrect", "vpp.flags.l4_checksum_correct",
813 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x40000000, NULL, HFILL },
815 { &hf_vpp_buffer_flag_vlan_2_deep,
816 { "Vlan2Deep", "vpp.flags.vlan_2_deep",
817 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x20000000, NULL, HFILL },
819 { &hf_vpp_buffer_flag_vlan_1_deep,
820 { "Vlan1Deep", "vpp.flags.vlan_1_deep",
821 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x10000000, NULL, HFILL },
823 { &hf_vpp_buffer_flag_span_clone,
824 { "SpanClone", "vpp.flags.span_clone",
825 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x08000000, NULL, HFILL },
827 { &hf_vpp_buffer_flag_loop_counter_valid,
828 { "LoopCounterValid", "vpp.flags.loop_counter_valid",
829 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x04000000, NULL, HFILL },
831 { &hf_vpp_buffer_flag_locally_originated,
832 { "LocallyOriginated", "vpp.flags.locally_originated",
833 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x02000000, NULL, HFILL },
835 { &hf_vpp_buffer_flag_is_ip4,
836 { "IsIP4", "vpp.flags.is_ip4",
837 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x01000000, NULL, HFILL },
839 { &hf_vpp_buffer_flag_is_ip6,
840 { "IsIP4", "vpp.flags.is_ip6",
841 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00800000, NULL, HFILL },
843 { &hf_vpp_buffer_flag_offload_ip_checksum,
844 { "OffloadIPChecksum", "vpp.flags.offload_ip_checksum",
845 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00400000, NULL, HFILL },
847 { &hf_vpp_buffer_flag_offload_tcp_checksum,
848 { "OffloadTCPChecksum", "vpp.flags.offload_tcp_checksum",
849 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00200000, NULL, HFILL },
851 { &hf_vpp_buffer_flag_offload_udp_checksum,
852 { "OffloadUDPChecksum", "vpp.flags.offload_udp_checksum",
853 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00100000, NULL, HFILL },
855 { &hf_vpp_buffer_flag_is_natted,
856 { "IsNATted", "vpp.flags.is_natted",
857 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00080000, NULL, HFILL },
859 { &hf_vpp_buffer_flag_l2_hdr_offset_valid,
860 { "L2HdrOffsetValid", "vpp.flags.l2_hdr_offset_valid",
861 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00040000, NULL, HFILL },
863 { &hf_vpp_buffer_flag_l3_hdr_offset_valid,
864 { "L3HdrOffsetValid", "vpp.flags.l3_hdr_offset_valid",
865 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00020000, NULL, HFILL },
867 { &hf_vpp_buffer_flag_l4_hdr_offset_valid,
868 { "L4HdrOffsetValid", "vpp.flags.l4_hdr_offset_valid",
869 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00010000, NULL, HFILL },
871 { &hf_vpp_buffer_flag_flow_report,
872 { "FlowReport", "vpp.flags.flow_report",
873 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00008000, NULL, HFILL },
875 { &hf_vpp_buffer_flag_is_dvr,
876 { "IsDVR", "vpp.flags.is_dvr",
877 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00004000, NULL, HFILL },
879 { &hf_vpp_buffer_flag_qos_data_valid,
880 { "QOSDataValid", "vpp.flags.qos_data_valid",
881 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00002000, NULL, HFILL },
884 { &hf_vpp_buffer_flow_id,
885 { "FlowID", "vpp.flow_id", FT_UINT32, BASE_DEC, NULL, 0x0,
888 { &hf_vpp_buffer_next_buffer,
889 { "NextBuffer", "vpp.next_buffer", FT_UINT32, BASE_DEC, NULL, 0x0,
892 { &hf_vpp_buffer_current_config_index,
893 { "CurrentConfigIndex", "vpp.current_config_index",
894 FT_UINT32, BASE_DEC, NULL, 0x0,
897 { &hf_vpp_buffer_error_index,
898 { "ErrorIndex", "vpp.error_index",
899 FT_UINT16, BASE_DEC, NULL, 0x0,
902 { &hf_vpp_buffer_n_add_refs,
903 { "AddRefs", "vpp.n_add_refs_index",
904 FT_UINT8, BASE_DEC, NULL, 0x0,
907 { &hf_vpp_buffer_buffer_pool_index,
908 { "BufferPoolIndex", "vpp.buffer_pool_index",
909 FT_UINT8, BASE_DEC, NULL, 0x0,
914 static hf_register_info opaque_hf[] = {
915 { &hf_vpp_buffer_opaque_raw,
916 { "Raw ", "vppMetadata.opaque_raw", FT_STRINGZ, BASE_NONE, NULL, 0x0,
919 { &hf_vpp_buffer_opaque_opaque,
920 { "Opaque", "vppMetadata.opaque",
921 FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL },
925 static hf_register_info trace_hf[] = {
926 { &hf_vpp_buffer_trace,
927 { "Trace", "vppTrace.trace", FT_STRINGZ, BASE_NONE, NULL, 0x0,
932 static gint *ett[] = {
935 static gint *ett_opaque[] = {
938 static gint *ett_trace[] = {
942 proto_vpp = proto_register_protocol("VPP Buffer Metadata", "VPP", "vpp");
943 proto_register_field_array(proto_vpp, hf, array_length(hf));
944 proto_register_subtree_array (ett, array_length(ett));
945 register_dissector("vpp", dissect_vpp, proto_vpp);
947 proto_vpp_opaque = proto_register_protocol("VPP Buffer Opaque", "VPP-Opaque",
949 proto_register_field_array(proto_vpp_opaque, opaque_hf,
950 array_length(opaque_hf));
951 proto_register_subtree_array (ett_opaque, array_length(ett_opaque));
952 register_dissector("vppOpaque", dissect_vpp_opaque, proto_vpp_opaque);
954 proto_vpp_trace = proto_register_protocol("VPP Buffer Trace", "VPP-Trace",
956 proto_register_field_array(proto_vpp_trace, trace_hf,
957 array_length(trace_hf));
958 proto_register_subtree_array (ett_trace, array_length(ett_trace));
959 register_dissector("vppTrace", dissect_vpp_trace, proto_vpp_trace);
961 #define _(a,b,c) c = find_dissector(b);
962 foreach_node_to_dissector_handle;
967 proto_reg_handoff_vpp(void)
969 vpp_dissector_handle = find_dissector("vpp");
970 vpp_opaque_dissector_handle = find_dissector("vppOpaque");
971 vpp_trace_dissector_handle = find_dissector("vppTrace");
972 dissector_add_uint("wtap_encap", WTAP_ENCAP_USER13, vpp_dissector_handle);
976 * Editor modelines - http://www.wireshark.org/tools/modelines.html
981 * indent-tabs-mode: nil
984 * vi: set shiftwidth=4 tabstop=8 expandtab:
985 * :indentSize=4:tabSize=8:noTabs=true: