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).
113 #define foreach_node_to_dissector_pair \
114 _("ip6-lookup", ipv6) \
116 _("ip4-not-enabled", ip) \
117 _("ip4-input-no-checksum", ip) \
118 _("ip4-lookup", ip) \
120 _("ip4-udp-lookup", udp) \
121 _("ip4-icmp-error", ip) \
123 _("ethernet-input", eth_maybefcs)
126 add_multi_line_string_to_tree(proto_tree *tree, tvbuff_t *tvb, gint start,
134 line_len = tvb_find_line_end(tvb, start, len, &next, FALSE);
135 data_len = next - start;
136 proto_tree_add_string(tree, hf, tvb, start, data_len,
137 tvb_format_stringzpad(tvb, start, line_len));
144 dissect_vpp_trace (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
149 proto_tree *trace_tree;
150 gint trace_string_length;
152 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP-Trace");
153 col_clear(pinfo->cinfo, COL_INFO);
155 ti = proto_tree_add_item(tree, proto_vpp_trace, tvb, offset, -1, ENC_NA);
156 trace_tree = proto_item_add_subtree(ti, ett_vpp_trace);
158 /* How long is the trace string? */
159 (void ) tvb_get_stringz_enc (wmem_packet_scope(), tvb, 0,
160 &trace_string_length, ENC_ASCII);
162 add_multi_line_string_to_tree (trace_tree, tvb, 0,
164 hf_vpp_buffer_trace);
165 return tvb_captured_length(tvb);
169 * BIG FAT WARNING: it's impossible to #include the vpp header files,
170 * so this is a private copy of .../src/vnet/buffer.h, with
171 * some vpp typedefs thrown in for good measure.
174 typedef unsigned int u32;
175 typedef unsigned short int u16;
176 typedef short int i16;
177 typedef unsigned char u8;
178 typedef unsigned long long u64;
186 u8 feature_arc_index;
191 /* IP4/6 buffer opaque. */
194 /* Adjacency from destination IP address lookup [VLIB_TX].
195 Adjacency from source IP address lookup [VLIB_RX].
196 This gets set to ~0 until source lookup is performed. */
203 /* Flow hash value for this packet computed from IP src/dst address
204 protocol and ports. */
212 /* Hint for transport protocols */
217 u32 save_rewrite_length;
234 /* in/out variables */
237 u32 next_index; /* index of next node - ignored if "feature" node */
238 u16 estimated_mtu; /* estimated MTU calculated during reassembly */
240 /* internal variables used during reassembly */
248 u16 ip6_frag_hdr_offset;
257 * data copied from the MPLS header that was popped from the packet
258 * during the look-up.
262 /* do not overlay w/ ip.adj_index[0,1] nor flow hash */
268 u32 save_rewrite_length;
270 * BIER - the number of bytes in the header.
271 * the len field in the header is not authoritative. It's the
272 * value in the table that counts.
280 /* l2 bridging path, only valid there */
284 u16 bd_index; /* bridge-domain index */
285 u8 l2_len; /* ethernet header length */
286 u8 shg; /* split-horizon group */
287 u16 l2fib_sn; /* l2fib bd/int seq_num */
288 u8 bd_age; /* aging enabled */
291 /* l2tpv3 softwire encap, only valid there */
294 u32 pad[4]; /* do not overlay w/ ip.adj_index[0,1] */
302 struct opaque_l2 pad;
314 u32 pad[8 - 2 - 1]; /* to end of opaque */
318 /* interface output features */
334 u32 map_domain_index;
338 u16 frag_offset; //Fragmentation header offset
339 u16 l4_offset; //L4 header overall offset
340 u8 l4_protocol; //The final protocol number
341 } v6; //Used by ip6_map_t only
342 u16 checksum_offset; //L4 checksum overall offset
346 /* IP Fragmentation */
349 u32 pad[2]; /* do not overlay w/ ip.adj_index[0,1] */
352 u8 flags; //See ip_frag.h
355 /* COP - configurable junk filter(s) */
358 /* Current configuration index. */
359 u32 current_config_index;
365 /* overlay address family */
372 u32 connection_index;
376 u16 hdr_offset; /**< offset relative to ip hdr */
377 u16 data_offset; /**< offset relative to ip hdr */
378 u16 data_len; /**< data len */
385 u32 connection_index;
386 u16 sid; /**< Stream ID */
387 u16 ssn; /**< Stream Sequence Number */
388 u32 tsn; /**< Transmission Sequence Number */
389 u16 hdr_offset; /**< offset relative to ip hdr */
390 u16 data_offset; /**< offset relative to ip hdr */
391 u16 data_len; /**< data len */
392 u8 subconn_idx; /**< index of the sub_connection being used */
404 } vnet_buffer_opaque_t;
407 #define PTAS proto_tree_add_string(opaque_tree, \
408 hf_vpp_buffer_opaque_opaque, \
409 tvb, 0, strlen(tmpbuf), tmpbuf)
412 dissect_vpp_opaque (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
417 proto_tree *opaque_tree;
421 vnet_buffer_opaque_t _o, *o = &_o;
425 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP-Opaque");
426 col_clear(pinfo->cinfo, COL_INFO);
428 ti = proto_tree_add_item(tree, proto_vpp_opaque, tvb, offset, -1, ENC_NA);
429 opaque_tree = proto_item_add_subtree(ti, ett_vpp_opaque);
432 for (i = 0; i < 10; i++) {
433 opaque[i] = tvb_get_guint32 (tvb, offset + 4*i, ENC_LITTLE_ENDIAN);
434 snprintf (tmpbuf + print_offset, sizeof(tmpbuf) - print_offset,
436 print_offset = strlen (tmpbuf);
440 proto_tree_add_string (opaque_tree, hf_vpp_buffer_opaque_raw, tvb, 0,
441 strlen(tmpbuf), tmpbuf);
443 memset (o, 0, sizeof (*o));
444 memcpy (o, opaque, sizeof (opaque));
446 snprintf (tmpbuf, sizeof(tmpbuf),
447 "sw_if_index[VLIB_RX]: %d, sw_if_index[VLIB_TX]: %d",
448 o->sw_if_index[0], o->sw_if_index[1]);
451 snprintf (tmpbuf, sizeof(tmpbuf),
452 "L2 offset %d, L3 offset %d, L4 offset %d, feature arc index %d",
453 (u32)(o->l2_hdr_offset),
454 (u32)(o->l3_hdr_offset),
455 (u32)(o->l4_hdr_offset),
456 (u32)(o->feature_arc_index));
459 snprintf (tmpbuf, sizeof(tmpbuf),
460 "ip.adj_index[VLIB_RX]: %d, ip.adj_index[VLIB_TX]: %d",
461 (u32)(o->ip.adj_index[0]),
462 (u32)(o->ip.adj_index[1]));
465 snprintf (tmpbuf, sizeof(tmpbuf),
466 "ip.flow_hash: 0x%x, ip.save_protocol: 0x%x, ip.fib_index: %d",
467 o->ip.flow_hash, o->ip.save_protocol, o->ip.fib_index);
470 snprintf (tmpbuf, sizeof(tmpbuf),
471 "ip.save_rewrite_length: %d, ip.rpf_id: %d",
472 o->ip.save_rewrite_length, o->ip.rpf_id);
475 snprintf (tmpbuf, sizeof(tmpbuf),
476 "ip.icmp.type: %d ip.icmp.code: %d, ip.icmp.data: 0x%x",
477 (u32)(o->ip.icmp.type),
478 (u32)(o->ip.icmp.code),
482 snprintf (tmpbuf, sizeof(tmpbuf),
483 "ip.reass.next_index: %d, ip.reass.estimated_mtu: %d",
484 o->ip.reass.next_index, (u32)(o->ip.reass.estimated_mtu));
486 snprintf (tmpbuf, sizeof(tmpbuf),
487 "ip.reass.fragment_first: %d ip.reass.fragment_last: %d",
488 (u32)(o->ip.reass.fragment_first),
489 (u32)(o->ip.reass.fragment_last));
491 snprintf (tmpbuf, sizeof(tmpbuf),
492 "ip.reass.range_first: %d ip.reass.range_last: %d",
493 (u32)(o->ip.reass.range_first),
494 (u32)(o->ip.reass.range_last));
497 snprintf (tmpbuf, sizeof(tmpbuf),
498 "ip.reass.next_range_bi: 0x%x, ip.reass.ip6_frag_hdr_offset: %d",
499 o->ip.reass.next_range_bi,
500 (u32)(o->ip.reass.ip6_frag_hdr_offset));
503 snprintf (tmpbuf, sizeof(tmpbuf),
504 "mpls.ttl: %d, mpls.exp: %d, mpls.first: %d, "
505 "mpls.save_rewrite_length: %d, mpls.bier.n_bytes: %d",
506 (u32)(o->mpls.ttl), (u32)(o->mpls.exp), (u32)(o->mpls.first),
507 o->mpls.save_rewrite_length, (u32)(o->mpls.bier.n_bytes));
510 snprintf (tmpbuf, sizeof(tmpbuf),
511 "l2.feature_bitmap: %08x, l2.bd_index: %d, l2.l2_len: %d, "
512 "l2.shg: %d, l2.l2fib_sn: %d, l2.bd_age: %d",
513 o->l2.feature_bitmap, (u32)(o->l2.bd_index),
514 (u32)(o->l2.l2_len), (u32)(o->l2.shg), (u32)(o->l2.l2fib_sn),
515 (u32)(o->l2.bd_age));
518 snprintf (tmpbuf, sizeof(tmpbuf),
519 "l2t.next_index: %d, l2t.session_index: %d",
520 (u32)(o->l2t.next_index), o->l2t.session_index);
523 snprintf (tmpbuf, sizeof(tmpbuf),
524 "l2_classify.table_index: %d, l2_classify.opaque_index: %d, "
525 "l2_classify.hash: 0x%llx",
526 o->l2_classify.table_index,
527 o->l2_classify.opaque_index,
528 o->l2_classify.hash);
531 snprintf (tmpbuf, sizeof(tmpbuf),
532 "policer.index: %d", o->policer.index);
535 snprintf (tmpbuf, sizeof(tmpbuf),
536 "ipsec.flags: 0x%x, ipsec.sad_index: %d",
537 o->ipsec.flags, o->ipsec.sad_index);
540 snprintf (tmpbuf, sizeof(tmpbuf),
541 "map.mtu: %d", (u32)(o->map.mtu));
544 snprintf (tmpbuf, sizeof(tmpbuf),
545 "map_t.v6.saddr: 0x%x, map_t.v6.daddr: 0x%x, "
546 "map_t.v6.frag_offset: %d, map_t.v6.l4_offset: %d",
549 (u32)(o->map_t.v6.frag_offset),
550 (u32)(o->map_t.v6.l4_offset));
552 snprintf (tmpbuf, sizeof(tmpbuf),
553 "map_t.v6.l4_protocol: %d, map_t.checksum_offset: %d, "
555 (u32)(o->map_t.v6.l4_protocol),
556 (u32)(o->map_t.checksum_offset),
557 (u32)(o->map_t.mtu));
560 snprintf (tmpbuf, sizeof(tmpbuf),
561 "ip_frag.mtu: %d, ip_frag.next_index: %d, ip_frag.flags: 0x%x",
562 (u32)(o->ip_frag.mtu),
563 (u32)(o->ip_frag.next_index),
564 (u32)(o->ip_frag.flags));
567 snprintf (tmpbuf, sizeof(tmpbuf),
568 "cop.current_config_index: %d",
569 o->cop.current_config_index);
572 snprintf (tmpbuf, sizeof(tmpbuf),
573 "lisp.overlay_afi: %d",
574 (u32)(o->lisp.overlay_afi));
577 snprintf (tmpbuf, sizeof(tmpbuf),
578 "tcp.connection_index: %d, tcp.seq_number: %d, tcp.seq_end: %d, "
579 "tcp.ack_number: %d, tcp.hdr_offset: %d, tcp.data_offset: %d",
580 o->tcp.connection_index,
584 (u32)(o->tcp.hdr_offset),
585 (u32)(o->tcp.data_offset));
588 snprintf (tmpbuf, sizeof(tmpbuf),
589 "tcp.data_len: %d, tcp.flags: 0x%x",
590 (u32)(o->tcp.data_len),
591 (u32)(o->tcp.flags));
594 snprintf (tmpbuf, sizeof(tmpbuf),
595 "sctp.connection_index: %d, sctp.sid: %d, sctp.ssn: %d, "
596 "sctp.tsn: %d, sctp.hdr_offset: %d",
597 o->sctp.connection_index,
601 (u32)(o->sctp.hdr_offset));
603 snprintf (tmpbuf, sizeof(tmpbuf),
604 "sctp.data_offset: %d, sctp.data_len: %d, sctp.subconn_idx: %d, "
606 (u32)(o->sctp.data_offset),
607 (u32)(o->sctp.data_len),
608 (u32)(o->sctp.subconn_idx),
609 (u32)(o->sctp.flags));
612 snprintf (tmpbuf, sizeof(tmpbuf),
617 return tvb_captured_length(tvb);
622 dissect_vpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
625 proto_tree *vpp_tree;
626 tvbuff_t *opaque_tvb, *eth_tvb, *trace_tvb;
628 guint8 major_version, minor_version;
631 guint16 trace_length;
633 static const int *buffer_flags[] = {
634 &hf_vpp_buffer_flag_non_default_freelist,
635 &hf_vpp_buffer_flag_traced,
636 &hf_vpp_buffer_flag_next_present,
637 &hf_vpp_buffer_flag_total_length_valid,
638 &hf_vpp_buffer_flag_ext_hdr_valid,
639 &hf_vpp_buffer_flag_l4_checksum_computed,
640 &hf_vpp_buffer_flag_l4_checksum_correct,
641 &hf_vpp_buffer_flag_vlan_2_deep,
642 &hf_vpp_buffer_flag_vlan_1_deep,
643 &hf_vpp_buffer_flag_span_clone,
644 &hf_vpp_buffer_flag_loop_counter_valid,
645 &hf_vpp_buffer_flag_locally_originated,
646 &hf_vpp_buffer_flag_is_ip4,
647 &hf_vpp_buffer_flag_is_ip6,
648 &hf_vpp_buffer_flag_offload_ip_checksum,
649 &hf_vpp_buffer_flag_offload_tcp_checksum,
650 &hf_vpp_buffer_flag_offload_udp_checksum,
651 &hf_vpp_buffer_flag_is_natted,
652 &hf_vpp_buffer_flag_l2_hdr_offset_valid,
653 &hf_vpp_buffer_flag_l3_hdr_offset_valid,
654 &hf_vpp_buffer_flag_l4_hdr_offset_valid,
655 &hf_vpp_buffer_flag_flow_report,
656 &hf_vpp_buffer_flag_is_dvr,
657 &hf_vpp_buffer_flag_qos_data_valid,
661 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VPP");
662 col_clear(pinfo->cinfo, COL_INFO);
664 ti = proto_tree_add_item(tree, proto_vpp, tvb, offset, -1, ENC_NA);
665 vpp_tree = proto_item_add_subtree(ti, ett_vpp);
667 major_version = tvb_get_guint8 (tvb, offset);
670 minor_version = tvb_get_guint8 (tvb, offset);
673 if (major_version != 1 || minor_version != 0)
674 ws_debug_printf ("WARNING: version mismatch (%d, %d)",
675 major_version, minor_version);
677 /* Skip the buffer index */
680 /* Recover the node name */
681 name_length = tvb_get_guint8 (tvb, offset);
684 name = (guint8 *) g_malloc (name_length + 1);
685 for (i = 0; i < name_length; i++, offset++) {
686 name[i] = tvb_get_guint8 (tvb, offset);
691 proto_tree_add_string(vpp_tree, hf_vpp_nodename, tvb, 5, name_length,
693 proto_tree_add_item(vpp_tree, hf_vpp_buffer_index, tvb,
694 0 /* bi at offset 0 */, 4, ENC_LITTLE_ENDIAN);
696 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_data, tvb,
697 offset, 2, ENC_LITTLE_ENDIAN);
699 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_length, tvb,
700 offset, 2, ENC_LITTLE_ENDIAN);
703 proto_tree_add_bitmask(vpp_tree, tvb, offset,
704 hf_vpp_buffer_flags, ett_vpp,
705 buffer_flags, ENC_LITTLE_ENDIAN);
708 proto_tree_add_item(vpp_tree, hf_vpp_buffer_flow_id, tvb,
709 offset, 4, ENC_LITTLE_ENDIAN);
712 proto_tree_add_item(vpp_tree, hf_vpp_buffer_next_buffer, tvb,
713 offset, 4, ENC_LITTLE_ENDIAN);
716 proto_tree_add_item(vpp_tree, hf_vpp_buffer_current_config_index, tvb,
717 offset, 4, ENC_LITTLE_ENDIAN);
720 proto_tree_add_item(vpp_tree, hf_vpp_buffer_error_index, tvb,
721 offset, 2, ENC_LITTLE_ENDIAN);
724 proto_tree_add_item(vpp_tree, hf_vpp_buffer_n_add_refs, tvb,
725 offset, 1, ENC_LITTLE_ENDIAN);
728 proto_tree_add_item(vpp_tree, hf_vpp_buffer_buffer_pool_index, tvb,
729 offset, 1, ENC_LITTLE_ENDIAN);
732 opaque_tvb = tvb_new_subset_remaining (tvb, offset);
733 call_dissector (vpp_opaque_dissector_handle, opaque_tvb, pinfo, tree);
737 /* skip second opaque line */
740 trace_length = tvb_get_guint16 (tvb, offset, ENC_LITTLE_ENDIAN);
743 if (trace_length > 0) {
744 trace_tvb = tvb_new_subset_remaining (tvb, offset);
745 offset += trace_length;
747 call_dissector (vpp_trace_dissector_handle, trace_tvb, pinfo, tree);
750 eth_tvb = tvb_new_subset_remaining (tvb, offset);
753 * Delegate the rest of the packet dissection to the per-node
754 * next dissector in the foreach_node_to_dissector_pair list
756 * Failing that, pretend its an ethernet packet
758 if (!dissector_try_string (vpp_subdissector_table, name, eth_tvb,
760 call_dissector (eth_maybefcs_dissector_handle, eth_tvb, pinfo, tree);
763 return tvb_captured_length(tvb);
767 proto_register_vpp(void)
769 static hf_register_info hf[] = {
770 { &hf_vpp_buffer_index,
771 { "BufferIndex", "vpp.bufferindex", FT_UINT32, BASE_HEX, NULL, 0x0,
775 { "NodeName", "vpp.nodename", FT_STRINGZ, BASE_NONE, NULL, 0x0,
778 { &hf_vpp_buffer_current_data,
779 { "CurrentData", "vpp.current_data", FT_INT16, BASE_DEC, NULL, 0x0,
782 { &hf_vpp_buffer_current_length,
783 { "CurrentLength", "vpp.current_length", FT_UINT16, BASE_DEC, NULL, 0x0,
788 * Warning: buffer flag bits are not cast in concrete, and it's
789 * impossible to imagine trying to compile WS with even a subset
790 * of the actual header files.
792 * See .../src/vlib/buffer.h, .../src/vnet/buffer.h in
793 * the fd.io vpp source tree.
796 { &hf_vpp_buffer_flags,
797 { "BufferFlags", "vpp.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
801 { &hf_vpp_buffer_flag_non_default_freelist,
802 { "NonDefaultFreelist", "vpp.flags.non_default_freelist",
803 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x1, NULL, HFILL },
805 { &hf_vpp_buffer_flag_traced,
806 { "Traced", "vpp.flags.traced",
807 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x2, NULL, HFILL },
809 { &hf_vpp_buffer_flag_next_present,
810 { "NextPresent", "vpp.flags.next_present",
811 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x4, NULL, HFILL },
813 { &hf_vpp_buffer_flag_total_length_valid,
814 { "TotalLengthValid", "vpp.flags.total_length_valid",
815 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x8, NULL, HFILL },
817 { &hf_vpp_buffer_flag_ext_hdr_valid,
818 { "ExtHeaderValid", "vpp.flags.ext_hdr_valid",
819 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x10, NULL, HFILL },
822 { &hf_vpp_buffer_flag_l4_checksum_computed,
823 { "L4ChecksumComputed", "vpp.flags.l4_checksum_computed",
824 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x80000000, NULL, HFILL },
826 { &hf_vpp_buffer_flag_l4_checksum_correct,
827 { "L4ChecksumCorrect", "vpp.flags.l4_checksum_correct",
828 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x40000000, NULL, HFILL },
830 { &hf_vpp_buffer_flag_vlan_2_deep,
831 { "Vlan2Deep", "vpp.flags.vlan_2_deep",
832 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x20000000, NULL, HFILL },
834 { &hf_vpp_buffer_flag_vlan_1_deep,
835 { "Vlan1Deep", "vpp.flags.vlan_1_deep",
836 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x10000000, NULL, HFILL },
838 { &hf_vpp_buffer_flag_span_clone,
839 { "SpanClone", "vpp.flags.span_clone",
840 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x08000000, NULL, HFILL },
842 { &hf_vpp_buffer_flag_loop_counter_valid,
843 { "LoopCounterValid", "vpp.flags.loop_counter_valid",
844 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x04000000, NULL, HFILL },
846 { &hf_vpp_buffer_flag_locally_originated,
847 { "LocallyOriginated", "vpp.flags.locally_originated",
848 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x02000000, NULL, HFILL },
850 { &hf_vpp_buffer_flag_is_ip4,
851 { "IsIP4", "vpp.flags.is_ip4",
852 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x01000000, NULL, HFILL },
854 { &hf_vpp_buffer_flag_is_ip6,
855 { "IsIP4", "vpp.flags.is_ip6",
856 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00800000, NULL, HFILL },
858 { &hf_vpp_buffer_flag_offload_ip_checksum,
859 { "OffloadIPChecksum", "vpp.flags.offload_ip_checksum",
860 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00400000, NULL, HFILL },
862 { &hf_vpp_buffer_flag_offload_tcp_checksum,
863 { "OffloadTCPChecksum", "vpp.flags.offload_tcp_checksum",
864 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00200000, NULL, HFILL },
866 { &hf_vpp_buffer_flag_offload_udp_checksum,
867 { "OffloadUDPChecksum", "vpp.flags.offload_udp_checksum",
868 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00100000, NULL, HFILL },
870 { &hf_vpp_buffer_flag_is_natted,
871 { "IsNATted", "vpp.flags.is_natted",
872 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00080000, NULL, HFILL },
874 { &hf_vpp_buffer_flag_l2_hdr_offset_valid,
875 { "L2HdrOffsetValid", "vpp.flags.l2_hdr_offset_valid",
876 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00040000, NULL, HFILL },
878 { &hf_vpp_buffer_flag_l3_hdr_offset_valid,
879 { "L3HdrOffsetValid", "vpp.flags.l3_hdr_offset_valid",
880 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00020000, NULL, HFILL },
882 { &hf_vpp_buffer_flag_l4_hdr_offset_valid,
883 { "L4HdrOffsetValid", "vpp.flags.l4_hdr_offset_valid",
884 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00010000, NULL, HFILL },
886 { &hf_vpp_buffer_flag_flow_report,
887 { "FlowReport", "vpp.flags.flow_report",
888 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00008000, NULL, HFILL },
890 { &hf_vpp_buffer_flag_is_dvr,
891 { "IsDVR", "vpp.flags.is_dvr",
892 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00004000, NULL, HFILL },
894 { &hf_vpp_buffer_flag_qos_data_valid,
895 { "QOSDataValid", "vpp.flags.qos_data_valid",
896 FT_BOOLEAN, 32, TFS(&tfs_true_false), 0x00002000, NULL, HFILL },
899 { &hf_vpp_buffer_flow_id,
900 { "FlowID", "vpp.flow_id", FT_UINT32, BASE_DEC, NULL, 0x0,
903 { &hf_vpp_buffer_next_buffer,
904 { "NextBuffer", "vpp.next_buffer", FT_UINT32, BASE_DEC, NULL, 0x0,
907 { &hf_vpp_buffer_current_config_index,
908 { "CurrentConfigIndex", "vpp.current_config_index",
909 FT_UINT32, BASE_DEC, NULL, 0x0,
912 { &hf_vpp_buffer_error_index,
913 { "ErrorIndex", "vpp.error_index",
914 FT_UINT16, BASE_DEC, NULL, 0x0,
917 { &hf_vpp_buffer_n_add_refs,
918 { "AddRefs", "vpp.n_add_refs_index",
919 FT_UINT8, BASE_DEC, NULL, 0x0,
922 { &hf_vpp_buffer_buffer_pool_index,
923 { "BufferPoolIndex", "vpp.buffer_pool_index",
924 FT_UINT8, BASE_DEC, NULL, 0x0,
929 static hf_register_info opaque_hf[] = {
930 { &hf_vpp_buffer_opaque_raw,
931 { "Raw ", "vppMetadata.opaque_raw", FT_STRINGZ, BASE_NONE, NULL, 0x0,
934 { &hf_vpp_buffer_opaque_opaque,
935 { "Opaque", "vppMetadata.opaque",
936 FT_STRINGZ, BASE_NONE, NULL, 0x0, NULL, HFILL },
940 static hf_register_info trace_hf[] = {
941 { &hf_vpp_buffer_trace,
942 { "Trace", "vppTrace.trace", FT_STRINGZ, BASE_NONE, NULL, 0x0,
947 static gint *ett[] = {
950 static gint *ett_opaque[] = {
953 static gint *ett_trace[] = {
957 proto_vpp = proto_register_protocol("VPP Buffer Metadata", "VPP", "vpp");
958 proto_register_field_array(proto_vpp, hf, array_length(hf));
959 proto_register_subtree_array (ett, array_length(ett));
960 register_dissector("vpp", dissect_vpp, proto_vpp);
962 proto_vpp_opaque = proto_register_protocol("VPP Buffer Opaque", "VPP-Opaque",
964 proto_register_field_array(proto_vpp_opaque, opaque_hf,
965 array_length(opaque_hf));
966 proto_register_subtree_array (ett_opaque, array_length(ett_opaque));
967 register_dissector("vppOpaque", dissect_vpp_opaque, proto_vpp_opaque);
969 proto_vpp_trace = proto_register_protocol("VPP Buffer Trace", "VPP-Trace",
971 proto_register_field_array(proto_vpp_trace, trace_hf,
972 array_length(trace_hf));
973 proto_register_subtree_array (ett_trace, array_length(ett_trace));
974 register_dissector("vppTrace", dissect_vpp_trace, proto_vpp_trace);
976 vpp_subdissector_table = register_dissector_table
977 ("vpp", "VPP per-node next dissector table", proto_vpp,
978 FT_STRING, BASE_NONE);
981 d##_dissector_handle = find_dissector(#d); \
982 dissector_add_string ("vpp", n, d##_dissector_handle);
983 foreach_node_to_dissector_pair;
988 proto_reg_handoff_vpp(void)
990 vpp_dissector_handle = find_dissector("vpp");
991 vpp_opaque_dissector_handle = find_dissector("vppOpaque");
992 vpp_trace_dissector_handle = find_dissector("vppTrace");
993 dissector_add_uint("wtap_encap", WTAP_ENCAP_USER13, vpp_dissector_handle);
997 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1002 * indent-tabs-mode: nil
1005 * vi: set shiftwidth=4 tabstop=8 expandtab:
1006 * :indentSize=4:tabSize=8:noTabs=true: