/src/wireshark/epan/dissectors/packet-ipv6.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* packet-ipv6.c |
2 | | * Routines for IPv6 packet disassembly |
3 | | * |
4 | | * Wireshark - Network traffic analyzer |
5 | | * By Gerald Combs <gerald@wireshark.org> |
6 | | * Copyright 1998 Gerald Combs |
7 | | * |
8 | | * SHIM6 support added by Matthijs Mekking <matthijs@NLnetLabs.nl> |
9 | | * |
10 | | * MobileIPv6 support added by Tomislav Borosa <tomislav.borosa@siemens.hr> |
11 | | * |
12 | | * Added support for new IPv6 Hop by Hop PMTU Option <bob.hinden@gmail.com> |
13 | | * |
14 | | * SPDX-License-Identifier: GPL-2.0-or-later |
15 | | */ |
16 | | |
17 | | #include "config.h" |
18 | | |
19 | | #include <math.h> |
20 | | #include <epan/packet.h> |
21 | | #include <epan/capture_dissectors.h> |
22 | | #include <epan/expert.h> |
23 | | #include <epan/ip_opts.h> |
24 | | #include <epan/addr_resolv.h> |
25 | | #include <epan/maxmind_db.h> |
26 | | #include <epan/prefs.h> |
27 | | #include <epan/uat.h> |
28 | | #include <epan/conversation_table.h> |
29 | | #include <epan/conversation_filter.h> |
30 | | #include <epan/reassemble.h> |
31 | | #include <epan/ipproto.h> |
32 | | #include <epan/etypes.h> |
33 | | #include <epan/ppptypes.h> |
34 | | #include <epan/aftypes.h> |
35 | | #include <epan/nlpid.h> |
36 | | #include <epan/arcnet_pids.h> |
37 | | #include <epan/decode_as.h> |
38 | | #include <epan/proto_data.h> |
39 | | #include <epan/to_str.h> |
40 | | #include <epan/exported_pdu.h> |
41 | | #include <epan/exceptions.h> |
42 | | #include <epan/iana-ip.h> |
43 | | #include <epan/tfs.h> |
44 | | #include <epan/unit_strings.h> |
45 | | |
46 | | #include <wiretap/erf_record.h> |
47 | | #include "packet-ip.h" |
48 | | #include "packet-juniper.h" |
49 | | #include "packet-sflow.h" |
50 | | #include "packet-vxlan.h" |
51 | | #include "packet-mpls.h" |
52 | | #include "packet-nsh.h" |
53 | | |
54 | | void proto_register_ipv6(void); |
55 | | void proto_reg_handoff_ipv6(void); |
56 | | |
57 | | /* Offsets of fields within an IPv6 header. */ |
58 | 162k | #define IP6H_CTL_VFC 0 |
59 | 23.0k | #define IP6H_CTL_FLOW 0 |
60 | 46.0k | #define IP6H_CTL_PLEN 4 |
61 | 46.0k | #define IP6H_CTL_NXT 6 |
62 | 46.0k | #define IP6H_CTL_HLIM 7 |
63 | 136k | #define IP6H_SRC 8 |
64 | 136k | #define IP6H_DST 24 |
65 | | |
66 | | /* Option types and related macros */ |
67 | 32.5k | #define IP6OPT_PAD1 0x00 /* 00 0 00000 = 0 */ |
68 | 7.63k | #define IP6OPT_PADN 0x01 /* 00 0 00001 = 1 */ |
69 | 346 | #define IP6OPT_TEL 0x04 /* 00 0 00100 = 4 */ |
70 | 201 | #define IP6OPT_RTALERT 0x05 /* 00 0 00101 = 5 */ |
71 | 75 | #define IP6OPT_CALIPSO 0x07 /* 00 0 00111 = 7 */ |
72 | 453 | #define IP6OPT_SMF_DPD 0x08 /* 00 0 01000 = 8 */ |
73 | 77 | #define IP6OPT_PDM 0x0F /* 00 0 01111 = 15 */ |
74 | 192 | #define IP6OPT_APN6 0x13 /* 00 0 10011 = 19 */ |
75 | 48 | #define IP6OPT_EXP_1E 0x1E /* 00 0 11110 = 30 */ |
76 | 185 | #define IP6OPT_RPL 0x23 /* 00 1 00011 = 35 */ |
77 | 275 | #define IP6OPT_QUICKSTART 0x26 /* 00 1 00110 = 38 */ |
78 | 227 | #define IP6OPT_PMTU 0x30 /* 00 1 10000 = 48 */ |
79 | 657 | #define IP6OPT_IOAM 0x31 /* 00 1 10001 = 49 */ |
80 | 95 | #define IP6OPT_EXP_3E 0x3E /* 00 1 11110 = 62 */ |
81 | 112 | #define IP6OPT_TPF 0x41 /* 01 0 00001 = 65 */ |
82 | 121 | #define IP6OPT_EXP_5E 0x5E /* 01 0 11110 = 94 */ |
83 | 306 | #define IP6OPT_RPL_OLD 0x63 /* 01 1 00011 = 99 */ /* DEPRECATED */ |
84 | 150 | #define IP6OPT_MPL 0x6D /* 01 1 01101 = 109 */ |
85 | 157 | #define IP6OPT_EXP_7E 0x7E /* 01 1 11110 = 126 */ |
86 | 26 | #define IP6OPT_ENDI 0x8A /* 10 0 01010 = 138 */ /* DEPRECATED */ |
87 | 30 | #define IP6OPT_ILNP_NONCE 0x8B /* 10 0 01011 = 139 */ |
88 | 56 | #define IP6OPT_LIO 0x8C /* 10 0 01100 = 140 */ |
89 | 191 | #define IP6OPT_EXP_9E 0x9E /* 10 0 11110 = 158 */ |
90 | 231 | #define IP6OPT_EXP_BE 0xBE /* 10 1 11110 = 190 */ |
91 | 593 | #define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */ |
92 | 42 | #define IP6OPT_HOME_ADDRESS 0xC9 /* 11 0 01001 = 201 */ |
93 | 249 | #define IP6OPT_EXP_DE 0xDE /* 11 0 11110 = 222 */ |
94 | 146 | #define IP6OPT_IP_DFF 0xEE /* 11 1 01110 = 238 */ |
95 | 283 | #define IP6OPT_EXP_FE 0xFE /* 11 1 11110 = 254 */ |
96 | | |
97 | | #define IP6OPT_RTALERT_MLD 0 /* Datagram contains MLD msg */ |
98 | | #define IP6OPT_RTALERT_RSVP 1 /* Datagram contains RSVP msg */ |
99 | | #define IP6OPT_RTALERT_ACTNET 2 /* Datagram contains ACTNET msg */ |
100 | | |
101 | | /* RPL Routing header */ |
102 | 14 | #define IP6RRPL_BITMASK_CMPRI 0xF0000000 |
103 | 14 | #define IP6RRPL_BITMASK_CMPRE 0x0F000000 |
104 | 14 | #define IP6RRPL_BITMASK_PAD 0x00F00000 |
105 | 14 | #define IP6RRPL_BITMASK_RESERVED 0x000FFFFF |
106 | | |
107 | | /* IOAM Option-Types */ |
108 | 297 | #define IP6IOAM_PRE_TRACE 0 /* Pre-allocated Trace */ |
109 | 371 | #define IP6IOAM_INC_TRACE 1 /* Incremental Trace */ |
110 | 2 | #define IP6IOAM_POT 2 /* Proof of Transit */ |
111 | 1 | #define IP6IOAM_E2E 3 /* Edge to Edge */ |
112 | 65 | #define IP6IOAM_DEX 4 /* Direct Export */ |
113 | | |
114 | | /* IOAM Trace Types */ |
115 | 668 | #define IP6IOAM_TRACE_MASK_BIT0 (1 << 23) /* Hop_lim + Node ID */ |
116 | 668 | #define IP6IOAM_TRACE_MASK_BIT1 (1 << 22) /* Ingress and Egress IDs */ |
117 | 668 | #define IP6IOAM_TRACE_MASK_BIT2 (1 << 21) /* Timestamp seconds */ |
118 | 668 | #define IP6IOAM_TRACE_MASK_BIT3 (1 << 20) /* Timestamp fraction */ |
119 | 668 | #define IP6IOAM_TRACE_MASK_BIT4 (1 << 19) /* Transit delay */ |
120 | 668 | #define IP6IOAM_TRACE_MASK_BIT5 (1 << 18) /* IOAM-Namespace data */ |
121 | 668 | #define IP6IOAM_TRACE_MASK_BIT6 (1 << 17) /* Queue depth */ |
122 | 668 | #define IP6IOAM_TRACE_MASK_BIT7 (1 << 16) /* Checksum complement */ |
123 | 668 | #define IP6IOAM_TRACE_MASK_BIT8 (1 << 15) /* (wide) Hop_lim + Node ID */ |
124 | 668 | #define IP6IOAM_TRACE_MASK_BIT9 (1 << 14) /* (wide) Ingress and Egress IDs */ |
125 | 668 | #define IP6IOAM_TRACE_MASK_BIT10 (1 << 13) /* (wide) IOAM-Namespace data */ |
126 | 668 | #define IP6IOAM_TRACE_MASK_BIT11 (1 << 12) /* Buffer occupancy */ |
127 | 668 | #define IP6IOAM_TRACE_MASK_BIT12 (1 << 11) /* Undefined */ |
128 | 668 | #define IP6IOAM_TRACE_MASK_BIT13 (1 << 10) /* Undefined */ |
129 | 668 | #define IP6IOAM_TRACE_MASK_BIT14 (1 << 9) /* Undefined */ |
130 | 668 | #define IP6IOAM_TRACE_MASK_BIT15 (1 << 8) /* Undefined */ |
131 | 668 | #define IP6IOAM_TRACE_MASK_BIT16 (1 << 7) /* Undefined */ |
132 | 668 | #define IP6IOAM_TRACE_MASK_BIT17 (1 << 6) /* Undefined */ |
133 | 668 | #define IP6IOAM_TRACE_MASK_BIT18 (1 << 5) /* Undefined */ |
134 | 668 | #define IP6IOAM_TRACE_MASK_BIT19 (1 << 4) /* Undefined */ |
135 | 668 | #define IP6IOAM_TRACE_MASK_BIT20 (1 << 3) /* Undefined */ |
136 | 668 | #define IP6IOAM_TRACE_MASK_BIT21 (1 << 2) /* Undefined */ |
137 | 730 | #define IP6IOAM_TRACE_MASK_BIT22 (1 << 1) /* Opaque state snapshot */ |
138 | | |
139 | | /* Protocol specific data indices */ |
140 | 25.4k | #define IPV6_PROTO_VALUE 1 |
141 | 58.1k | #define IPV6_PROTO_PINFO 2 |
142 | | |
143 | | static int ipv6_tap; |
144 | | |
145 | | static int exported_pdu_tap; |
146 | | |
147 | | static int proto_ipv6; |
148 | | static int proto_ipv6_hopopts; |
149 | | static int proto_ipv6_routing; |
150 | | static int proto_ipv6_fraghdr; |
151 | | static int proto_ipv6_dstopts; |
152 | | |
153 | | static int proto_ipv6_routing_rt0; |
154 | | static int proto_ipv6_routing_mipv6; |
155 | | static int proto_ipv6_routing_rpl; |
156 | | static int proto_ipv6_routing_srh; |
157 | | static int proto_ipv6_routing_crh; |
158 | | |
159 | | static int hf_ipv6_version; |
160 | | static int hf_ip_version; |
161 | | static int hf_ipv6_tclass; |
162 | | static int hf_ipv6_tclass_dscp; |
163 | | static int hf_ipv6_tclass_ecn; |
164 | | static int hf_ipv6_flow; |
165 | | static int hf_ipv6_stream; |
166 | | static int hf_ipv6_plen; |
167 | | static int hf_ipv6_nxt; |
168 | | static int hf_ipv6_hlim; |
169 | | static int hf_ipv6_src; |
170 | | static int hf_ipv6_src_addr_space; |
171 | | static int hf_ipv6_src_multicast_flags; |
172 | | static int hf_ipv6_src_multicast_flags_reserved; |
173 | | static int hf_ipv6_src_multicast_flags_transient; |
174 | | static int hf_ipv6_src_multicast_flags_network_prefix; |
175 | | static int hf_ipv6_src_multicast_flags_embed_rp; |
176 | | static int hf_ipv6_src_special_purpose; |
177 | | static int hf_ipv6_src_special_purpose_source; |
178 | | static int hf_ipv6_src_special_purpose_destination; |
179 | | static int hf_ipv6_src_special_purpose_forwardable; |
180 | | static int hf_ipv6_src_special_purpose_global; |
181 | | static int hf_ipv6_src_special_purpose_reserved; |
182 | | static int hf_ipv6_src_multicast_scope; |
183 | | static int hf_ipv6_src_host; |
184 | | static int hf_ipv6_src_slaac_mac; |
185 | | static int hf_ipv6_src_isatap_ipv4; |
186 | | static int hf_ipv6_src_6to4_gateway_ipv4; |
187 | | static int hf_ipv6_src_6to4_sla_id; |
188 | | static int hf_ipv6_src_teredo_server_ipv4; |
189 | | static int hf_ipv6_src_teredo_port; |
190 | | static int hf_ipv6_src_teredo_client_ipv4; |
191 | | static int hf_ipv6_src_embed_ipv4; |
192 | | static int hf_ipv6_dst; |
193 | | static int hf_ipv6_dst_addr_space; |
194 | | static int hf_ipv6_dst_multicast_flags; |
195 | | static int hf_ipv6_dst_multicast_flags_reserved; |
196 | | static int hf_ipv6_dst_multicast_flags_transient; |
197 | | static int hf_ipv6_dst_multicast_flags_network_prefix; |
198 | | static int hf_ipv6_dst_multicast_flags_embed_rp; |
199 | | static int hf_ipv6_dst_multicast_scope; |
200 | | static int hf_ipv6_dst_special_purpose; |
201 | | static int hf_ipv6_dst_special_purpose_source; |
202 | | static int hf_ipv6_dst_special_purpose_destination; |
203 | | static int hf_ipv6_dst_special_purpose_forwardable; |
204 | | static int hf_ipv6_dst_special_purpose_global; |
205 | | static int hf_ipv6_dst_special_purpose_reserved; |
206 | | static int hf_ipv6_dst_host; |
207 | | static int hf_ipv6_dst_slaac_mac; |
208 | | static int hf_ipv6_dst_isatap_ipv4; |
209 | | static int hf_ipv6_dst_6to4_gateway_ipv4; |
210 | | static int hf_ipv6_dst_6to4_sla_id; |
211 | | static int hf_ipv6_dst_teredo_server_ipv4; |
212 | | static int hf_ipv6_dst_teredo_port; |
213 | | static int hf_ipv6_dst_teredo_client_ipv4; |
214 | | static int hf_ipv6_dst_embed_ipv4; |
215 | | static int hf_ipv6_addr; |
216 | | static int hf_ipv6_addr_space; |
217 | | static int hf_ipv6_multicast_flags; |
218 | | static int hf_ipv6_multicast_flags_reserved; |
219 | | static int hf_ipv6_multicast_flags_transient; |
220 | | static int hf_ipv6_multicast_flags_network_prefix; |
221 | | static int hf_ipv6_multicast_flags_embed_rp; |
222 | | static int hf_ipv6_multicast_scope; |
223 | | static int hf_ipv6_addr_special_purpose; |
224 | | static int hf_ipv6_addr_special_purpose_source; |
225 | | static int hf_ipv6_addr_special_purpose_destination; |
226 | | static int hf_ipv6_addr_special_purpose_forwardable; |
227 | | static int hf_ipv6_addr_special_purpose_global; |
228 | | static int hf_ipv6_addr_special_purpose_reserved; |
229 | | static int hf_ipv6_host; |
230 | | static int hf_ipv6_slaac_mac; |
231 | | static int hf_ipv6_isatap_ipv4; |
232 | | static int hf_ipv6_6to4_gateway_ipv4; |
233 | | static int hf_ipv6_6to4_sla_id; |
234 | | static int hf_ipv6_teredo_server_ipv4; |
235 | | static int hf_ipv6_teredo_port; |
236 | | static int hf_ipv6_teredo_client_ipv4; |
237 | | static int hf_ipv6_embed_ipv4_prefix; |
238 | | static int hf_ipv6_embed_ipv4; |
239 | | static int hf_ipv6_embed_ipv4_u; |
240 | | static int hf_ipv6_embed_ipv4_suffix; |
241 | | static int hf_ipv6_opt; |
242 | | static int hf_ipv6_opt_type; |
243 | | static int hf_ipv6_opt_type_action; |
244 | | static int hf_ipv6_opt_type_change; |
245 | | static int hf_ipv6_opt_type_rest; |
246 | | static int hf_ipv6_opt_length; |
247 | | static int hf_ipv6_opt_pad1; |
248 | | static int hf_ipv6_opt_padn; |
249 | | static int hf_ipv6_opt_tel; |
250 | | static int hf_ipv6_opt_rtalert; |
251 | | static int hf_ipv6_opt_pmtu_min; |
252 | | static int hf_ipv6_opt_pmtu_rtn; |
253 | | static int hf_ipv6_opt_pmtu_rtn_flag; |
254 | | static int hf_ipv6_opt_apn_id_type; |
255 | | static int hf_ipv6_opt_apn_flags; |
256 | | static int hf_ipv6_opt_apn_param_type; |
257 | | static int hf_ipv6_opt_apn_id_part1; |
258 | | static int hf_ipv6_opt_apn_id_part2; |
259 | | static int hf_ipv6_opt_apn_id_part3; |
260 | | static int hf_ipv6_opt_apn_id_part4; |
261 | | static int hf_ipv6_opt_jumbo; |
262 | | static int hf_ipv6_opt_calipso_doi; |
263 | | static int hf_ipv6_opt_calipso_cmpt_length; |
264 | | static int hf_ipv6_opt_calipso_sens_level; |
265 | | static int hf_ipv6_opt_calipso_checksum; |
266 | | static int hf_ipv6_opt_calipso_cmpt_bitmap; |
267 | | static int hf_ipv6_opt_smf_dpd_hash_bit; |
268 | | static int hf_ipv6_opt_smf_dpd_tid_type; |
269 | | static int hf_ipv6_opt_smf_dpd_tid_len; |
270 | | static int hf_ipv6_opt_smf_dpd_tagger_id; |
271 | | static int hf_ipv6_opt_smf_dpd_ident; |
272 | | static int hf_ipv6_opt_smf_dpd_hav; |
273 | | static int hf_ipv6_opt_pdm_scale_dtlr; |
274 | | static int hf_ipv6_opt_pdm_scale_dtls; |
275 | | static int hf_ipv6_opt_pdm_psn_this_pkt; |
276 | | static int hf_ipv6_opt_pdm_psn_last_recv; |
277 | | static int hf_ipv6_opt_pdm_delta_last_recv; |
278 | | static int hf_ipv6_opt_pdm_delta_last_sent; |
279 | | static int hf_ipv6_opt_qs_func; |
280 | | static int hf_ipv6_opt_qs_rate; |
281 | | static int hf_ipv6_opt_qs_ttl; |
282 | | static int hf_ipv6_opt_qs_ttl_diff; |
283 | | static int hf_ipv6_opt_qs_unused; |
284 | | static int hf_ipv6_opt_qs_nonce; |
285 | | static int hf_ipv6_opt_qs_reserved; |
286 | | static int hf_ipv6_opt_ioam_rsv; |
287 | | static int hf_ipv6_opt_ioam_opt_type; |
288 | | static int hf_ipv6_opt_ioam_trace_ns; |
289 | | static int hf_ipv6_opt_ioam_trace_nodelen; |
290 | | static int hf_ipv6_opt_ioam_trace_flags; |
291 | | static int hf_ipv6_opt_ioam_trace_flag_o; |
292 | | static int hf_ipv6_opt_ioam_trace_flag_l; |
293 | | static int hf_ipv6_opt_ioam_trace_flag_a; |
294 | | static int hf_ipv6_opt_ioam_trace_flag_rsv; |
295 | | static int hf_ipv6_opt_ioam_trace_remlen; |
296 | | static int hf_ipv6_opt_ioam_trace_type; |
297 | | static int hf_ipv6_opt_ioam_trace_type_bit0; |
298 | | static int hf_ipv6_opt_ioam_trace_type_bit1; |
299 | | static int hf_ipv6_opt_ioam_trace_type_bit2; |
300 | | static int hf_ipv6_opt_ioam_trace_type_bit3; |
301 | | static int hf_ipv6_opt_ioam_trace_type_bit4; |
302 | | static int hf_ipv6_opt_ioam_trace_type_bit5; |
303 | | static int hf_ipv6_opt_ioam_trace_type_bit6; |
304 | | static int hf_ipv6_opt_ioam_trace_type_bit7; |
305 | | static int hf_ipv6_opt_ioam_trace_type_bit8; |
306 | | static int hf_ipv6_opt_ioam_trace_type_bit9; |
307 | | static int hf_ipv6_opt_ioam_trace_type_bit10; |
308 | | static int hf_ipv6_opt_ioam_trace_type_bit11; |
309 | | static int hf_ipv6_opt_ioam_trace_type_undef; |
310 | | static int hf_ipv6_opt_ioam_trace_type_bit22; |
311 | | static int hf_ipv6_opt_ioam_trace_type_rsv; |
312 | | static int hf_ipv6_opt_ioam_trace_rsv; |
313 | | static int hf_ipv6_opt_ioam_trace_free_space; |
314 | | static int hf_ipv6_opt_ioam_trace_node_hlim; |
315 | | static int hf_ipv6_opt_ioam_trace_node_id; |
316 | | static int hf_ipv6_opt_ioam_trace_node_iif; |
317 | | static int hf_ipv6_opt_ioam_trace_node_eif; |
318 | | static int hf_ipv6_opt_ioam_trace_node_tss; |
319 | | static int hf_ipv6_opt_ioam_trace_node_tsf; |
320 | | static int hf_ipv6_opt_ioam_trace_node_trdelay; |
321 | | static int hf_ipv6_opt_ioam_trace_node_nsdata; |
322 | | static int hf_ipv6_opt_ioam_trace_node_qdepth; |
323 | | static int hf_ipv6_opt_ioam_trace_node_csum; |
324 | | static int hf_ipv6_opt_ioam_trace_node_id_wide; |
325 | | static int hf_ipv6_opt_ioam_trace_node_iif_wide; |
326 | | static int hf_ipv6_opt_ioam_trace_node_eif_wide; |
327 | | static int hf_ipv6_opt_ioam_trace_node_nsdata_wide; |
328 | | static int hf_ipv6_opt_ioam_trace_node_bufoccup; |
329 | | static int hf_ipv6_opt_ioam_trace_node_undefined; |
330 | | static int hf_ipv6_opt_ioam_trace_node_oss_len; |
331 | | static int hf_ipv6_opt_ioam_trace_node_oss_scid; |
332 | | static int hf_ipv6_opt_ioam_trace_node_oss_data; |
333 | | static int hf_ipv6_opt_ioam_dex_ns; |
334 | | static int hf_ipv6_opt_ioam_dex_flags; |
335 | | static int hf_ipv6_opt_ioam_dex_extflags; |
336 | | static int hf_ipv6_opt_ioam_dex_extflag_flag_rsv; |
337 | | static int hf_ipv6_opt_ioam_dex_extflag_flag_seqnum; |
338 | | static int hf_ipv6_opt_ioam_dex_extflag_flag_flowid; |
339 | | static int hf_ipv6_opt_ioam_dex_extflag_seqnum; |
340 | | static int hf_ipv6_opt_ioam_dex_extflag_flowid; |
341 | | static int hf_ipv6_opt_ioam_dex_rsv; |
342 | | static int hf_ipv6_opt_tpf_information; |
343 | | static int hf_ipv6_opt_mipv6_home_address; |
344 | | static int hf_ipv6_opt_rpl_flag; |
345 | | static int hf_ipv6_opt_rpl_flag_o; |
346 | | static int hf_ipv6_opt_rpl_flag_r; |
347 | | static int hf_ipv6_opt_rpl_flag_f; |
348 | | static int hf_ipv6_opt_rpl_flag_rsv; |
349 | | static int hf_ipv6_opt_rpl_instance_id; |
350 | | static int hf_ipv6_opt_rpl_senderrank; |
351 | | static int hf_ipv6_opt_ilnp_nonce; |
352 | | static int hf_ipv6_opt_lio_len; |
353 | | static int hf_ipv6_opt_lio_id; |
354 | | static int hf_ipv6_opt_mpl_flag; |
355 | | static int hf_ipv6_opt_mpl_flag_s; |
356 | | static int hf_ipv6_opt_mpl_flag_m; |
357 | | static int hf_ipv6_opt_mpl_flag_v; |
358 | | static int hf_ipv6_opt_mpl_flag_rsv; |
359 | | static int hf_ipv6_opt_mpl_sequence; |
360 | | static int hf_ipv6_opt_mpl_seed_id; |
361 | | static int hf_ipv6_opt_dff_flags; |
362 | | static int hf_ipv6_opt_dff_flag_ver; |
363 | | static int hf_ipv6_opt_dff_flag_dup; |
364 | | static int hf_ipv6_opt_dff_flag_ret; |
365 | | static int hf_ipv6_opt_dff_flag_rsv; |
366 | | static int hf_ipv6_opt_dff_seqnum; |
367 | | static int hf_ipv6_opt_experimental; |
368 | | static int hf_ipv6_opt_unknown_data; |
369 | | static int hf_ipv6_opt_unknown; |
370 | | static int hf_ipv6_dstopts_nxt; |
371 | | static int hf_ipv6_dstopts_len; |
372 | | static int hf_ipv6_dstopts_len_oct; |
373 | | static int hf_ipv6_hopopts_nxt; |
374 | | static int hf_ipv6_hopopts_len; |
375 | | static int hf_ipv6_hopopts_len_oct; |
376 | | static int hf_ipv6_routing_nxt; |
377 | | static int hf_ipv6_routing_len; |
378 | | static int hf_ipv6_routing_len_oct; |
379 | | static int hf_ipv6_routing_type; |
380 | | static int hf_ipv6_routing_segleft; |
381 | | static int hf_ipv6_routing_unknown_data; |
382 | | static int hf_ipv6_fraghdr_nxt; |
383 | | static int hf_ipv6_fraghdr_reserved_octet; |
384 | | static int hf_ipv6_fraghdr_offset; |
385 | | static int hf_ipv6_fraghdr_reserved_bits; |
386 | | static int hf_ipv6_fraghdr_more; |
387 | | static int hf_ipv6_fraghdr_ident; |
388 | | static int hf_ipv6_fragment; |
389 | | static int hf_ipv6_fragment_overlap; |
390 | | static int hf_ipv6_fragment_overlap_conflict; |
391 | | static int hf_ipv6_fragment_multiple_tails; |
392 | | static int hf_ipv6_fragment_too_long_fragment; |
393 | | static int hf_ipv6_fragment_error; |
394 | | static int hf_ipv6_fragment_count; |
395 | | static int hf_ipv6_fragments; |
396 | | static int hf_ipv6_reassembled_in; |
397 | | static int hf_ipv6_reassembled_length; |
398 | | static int hf_ipv6_reassembled_data; |
399 | | |
400 | | static int hf_ipv6_routing_src_reserved; |
401 | | static int hf_ipv6_routing_src_addr; |
402 | | |
403 | | static int hf_ipv6_routing_mipv6_reserved; |
404 | | static int hf_ipv6_routing_mipv6_home_address; |
405 | | |
406 | | static int hf_ipv6_routing_rpl_cmprI; |
407 | | static int hf_ipv6_routing_rpl_cmprE; |
408 | | static int hf_ipv6_routing_rpl_pad; |
409 | | static int hf_ipv6_routing_rpl_reserved; |
410 | | static int hf_ipv6_routing_rpl_addr_count; |
411 | | static int hf_ipv6_routing_rpl_addr; |
412 | | static int hf_ipv6_routing_rpl_fulladdr; |
413 | | |
414 | | static int hf_ipv6_routing_srh_last_entry; |
415 | | static int hf_ipv6_routing_srh_flags; |
416 | | static int hf_ipv6_routing_srh_tag; |
417 | | static int hf_ipv6_routing_srh_addr; |
418 | | |
419 | | static int hf_ipv6_routing_crh16_current_sid; |
420 | | static int hf_ipv6_routing_crh32_current_sid; |
421 | | static int hf_ipv6_routing_crh16_segment_id; |
422 | | static int hf_ipv6_routing_crh32_segment_id; |
423 | | |
424 | | struct ipv6_addr_info_s { |
425 | | int *hf_addr; |
426 | | int *hf_addr_space; |
427 | | int *hf_multicast_flags; |
428 | | int *const *hf_multicast_flags_bits; |
429 | | int *hf_multicast_scope; |
430 | | int *hf_special_purpose; |
431 | | int *hf_special_purpose_source; |
432 | | int *hf_special_purpose_destination; |
433 | | int *hf_special_purpose_forwardable; |
434 | | int *hf_special_purpose_global; |
435 | | int *hf_special_purpose_reserved; |
436 | | int *hf_host; |
437 | | }; |
438 | | |
439 | | static int *const ipv6_src_multicast_flags_bits[5] = { |
440 | | &hf_ipv6_src_multicast_flags_reserved, |
441 | | &hf_ipv6_src_multicast_flags_embed_rp, |
442 | | &hf_ipv6_src_multicast_flags_network_prefix, |
443 | | &hf_ipv6_src_multicast_flags_transient, |
444 | | NULL |
445 | | }; |
446 | | |
447 | | static struct ipv6_addr_info_s ipv6_src_info = { |
448 | | &hf_ipv6_src, |
449 | | &hf_ipv6_src_addr_space, |
450 | | &hf_ipv6_src_multicast_flags, |
451 | | ipv6_src_multicast_flags_bits, |
452 | | &hf_ipv6_src_multicast_scope, |
453 | | &hf_ipv6_src_special_purpose, |
454 | | &hf_ipv6_src_special_purpose_source, |
455 | | &hf_ipv6_src_special_purpose_destination, |
456 | | &hf_ipv6_src_special_purpose_forwardable, |
457 | | &hf_ipv6_src_special_purpose_global, |
458 | | &hf_ipv6_src_special_purpose_reserved, |
459 | | &hf_ipv6_src_host, |
460 | | }; |
461 | | |
462 | | static int *const ipv6_dst_multicast_flags_bits[5] = { |
463 | | &hf_ipv6_dst_multicast_flags_reserved, |
464 | | &hf_ipv6_dst_multicast_flags_embed_rp, |
465 | | &hf_ipv6_dst_multicast_flags_network_prefix, |
466 | | &hf_ipv6_dst_multicast_flags_transient, |
467 | | NULL |
468 | | }; |
469 | | |
470 | | static struct ipv6_addr_info_s ipv6_dst_info = { |
471 | | &hf_ipv6_dst, |
472 | | &hf_ipv6_dst_addr_space, |
473 | | &hf_ipv6_dst_multicast_flags, |
474 | | ipv6_dst_multicast_flags_bits, |
475 | | &hf_ipv6_dst_multicast_scope, |
476 | | &hf_ipv6_dst_special_purpose, |
477 | | &hf_ipv6_dst_special_purpose_source, |
478 | | &hf_ipv6_dst_special_purpose_destination, |
479 | | &hf_ipv6_dst_special_purpose_forwardable, |
480 | | &hf_ipv6_dst_special_purpose_global, |
481 | | &hf_ipv6_dst_special_purpose_reserved, |
482 | | &hf_ipv6_dst_host, |
483 | | }; |
484 | | |
485 | | static int hf_geoip_country; |
486 | | static int hf_geoip_country_iso; |
487 | | static int hf_geoip_city; |
488 | | static int hf_geoip_as_number; |
489 | | static int hf_geoip_as_org; |
490 | | static int hf_geoip_latitude; |
491 | | static int hf_geoip_longitude; |
492 | | static int hf_geoip_src_summary; |
493 | | static int hf_geoip_src_country; |
494 | | static int hf_geoip_src_country_iso; |
495 | | static int hf_geoip_src_city; |
496 | | static int hf_geoip_src_as_number; |
497 | | static int hf_geoip_src_as_org; |
498 | | static int hf_geoip_src_latitude; |
499 | | static int hf_geoip_src_longitude; |
500 | | static int hf_geoip_dst_summary; |
501 | | static int hf_geoip_dst_country; |
502 | | static int hf_geoip_dst_country_iso; |
503 | | static int hf_geoip_dst_city; |
504 | | static int hf_geoip_dst_as_number; |
505 | | static int hf_geoip_dst_as_org; |
506 | | static int hf_geoip_dst_latitude; |
507 | | static int hf_geoip_dst_longitude; |
508 | | |
509 | | static int ett_ipv6_proto; |
510 | | static int ett_ipv6_detail; |
511 | | static int ett_ipv6_detail_special_purpose; |
512 | | static int ett_ipv6_multicast_flags; |
513 | | static int ett_ipv6_traffic_class; |
514 | | static int ett_ipv6_opt; |
515 | | static int ett_ipv6_opt_type; |
516 | | static int ett_ipv6_opt_rpl; |
517 | | static int ett_ipv6_opt_mpl; |
518 | | static int ett_ipv6_opt_dff_flags; |
519 | | static int ett_ipv6_opt_ioam_trace_flags; |
520 | | static int ett_ipv6_opt_ioam_trace_types; |
521 | | static int ett_ipv6_opt_ioam_dex_extflags; |
522 | | static int ett_ipv6_hopopts_proto; |
523 | | static int ett_ipv6_fraghdr_proto; |
524 | | static int ett_ipv6_routing_proto; |
525 | | static int ett_ipv6_routing_srh_vect; |
526 | | static int ett_ipv6_fragments; |
527 | | static int ett_ipv6_fragment; |
528 | | static int ett_ipv6_dstopts_proto; |
529 | | |
530 | | static int ett_geoip_info; |
531 | | |
532 | | static uint32_t ipv6_stream_count; |
533 | | |
534 | | static expert_field ei_ipv6_routing_invalid_length; |
535 | | static expert_field ei_ipv6_routing_invalid_segleft; |
536 | | static expert_field ei_ipv6_routing_undecoded; |
537 | | static expert_field ei_ipv6_dst_addr_not_unspecified; |
538 | | static expert_field ei_ipv6_src_addr_not_multicast; |
539 | | static expert_field ei_ipv6_dst_addr_not_multicast; |
540 | | static expert_field ei_ipv6_src_route_list_mult_inst_same_addr; |
541 | | static expert_field ei_ipv6_src_route_list_src_addr; |
542 | | static expert_field ei_ipv6_src_route_list_dst_addr; |
543 | | static expert_field ei_ipv6_src_route_list_multicast_addr; |
544 | | static expert_field ei_ipv6_routing_rpl_cmpri_cmpre_pad; |
545 | | static expert_field ei_ipv6_routing_rpl_addr_count_ge0; |
546 | | static expert_field ei_ipv6_routing_rpl_reserved; |
547 | | static expert_field ei_ipv6_routing_deprecated; |
548 | | static expert_field ei_ipv6_opt_jumbo_missing; |
549 | | static expert_field ei_ipv6_opt_jumbo_prohibited; |
550 | | static expert_field ei_ipv6_opt_jumbo_truncated; |
551 | | static expert_field ei_ipv6_opt_jumbo_fragment; |
552 | | static expert_field ei_ipv6_opt_invalid_len; |
553 | | static expert_field ei_ipv6_opt_apn_invalid_id_type; |
554 | | static expert_field ei_ipv6_opt_unknown_data; |
555 | | static expert_field ei_ipv6_opt_deprecated; |
556 | | static expert_field ei_ipv6_opt_mpl_ipv6_src_seed_id; |
557 | | static expert_field ei_ipv6_hopopts_not_first; |
558 | | static expert_field ei_ipv6_plen_exceeds_framing; |
559 | | static expert_field ei_ipv6_plen_zero; |
560 | | static expert_field ei_ipv6_bogus_ipv6_version; |
561 | | static expert_field ei_ipv6_invalid_header; |
562 | | static expert_field ei_ipv6_opt_header_mismatch; |
563 | | static expert_field ei_ipv6_opt_ioam_invalid_nodelen; |
564 | | static expert_field ei_ipv6_opt_ioam_invalid_remlen; |
565 | | static expert_field ei_ipv6_opt_ioam_invalid_trace_type; |
566 | | static expert_field ei_ipv6_embed_ipv4_u_value; |
567 | | |
568 | | static dissector_handle_t ipv6_handle; |
569 | | static dissector_handle_t ilnp_handle; |
570 | | |
571 | | /* Reassemble fragmented datagrams */ |
572 | | static bool ipv6_reassemble = true; |
573 | | |
574 | | /* Place IPv6 summary in proto tree */ |
575 | | static bool ipv6_summary_in_tree = true; |
576 | | |
577 | | /* Show expanded information about IPv6 address */ |
578 | | static bool ipv6_address_detail = true; |
579 | | |
580 | | /* Perform strict RFC adherence checking */ |
581 | | static bool g_ipv6_rpl_srh_strict_rfc_checking; |
582 | | |
583 | | /* Use heuristics to determine subdissector */ |
584 | | static bool try_heuristic_first; |
585 | | |
586 | | /* Display IPv6 extension headers under the root tree */ |
587 | | static bool ipv6_exthdr_under_root; |
588 | | |
589 | | /* Hide extension header generated field for length */ |
590 | | static bool ipv6_exthdr_hide_len_oct_field; |
591 | | |
592 | | /* Assume TSO and correct zero-length IP packets */ |
593 | | static bool ipv6_tso_supported; |
594 | | |
595 | | /* Assign unique ID numbers to each IPv6 conversation. This increases |
596 | | * resource US because of having to lookup and create conversations |
597 | | * (which aren't otherwise needed.) |
598 | | */ |
599 | | static bool ipv6_track_conv_id = true; |
600 | | |
601 | | #define set_address_ipv6(dst, src_ip6) \ |
602 | 2.58k | set_address((dst), AT_IPv6, IPv6_ADDR_SIZE, (src_ip6)) |
603 | | |
604 | | #define set_address_ipv6_tvb(dst, tvb, offset) \ |
605 | | set_address_tvb((dst), AT_IPv6, IPv6_ADDR_SIZE, (tvb), (offset)) |
606 | | |
607 | | #define alloc_address_wmem_ipv6(scope, dst, src_ip6) \ |
608 | 92.9k | alloc_address_wmem((scope), (dst), AT_IPv6, IPv6_ADDR_SIZE, (src_ip6)) |
609 | | |
610 | | #define alloc_address_tvb_ipv6(scope, dst, tvb, offset) \ |
611 | 42 | alloc_address_tvb((scope), (dst), AT_IPv6, IPv6_ADDR_SIZE, (tvb), (offset)) |
612 | | |
613 | | extern const ws_in6_addr *tvb_get_ptr_ipv6(tvbuff_t tvb, int offset); |
614 | | #define tvb_get_ptr_ipv6(tvb, offset) \ |
615 | 91.9k | ((const ws_in6_addr *)tvb_get_ptr(tvb, offset, IPv6_ADDR_SIZE)) |
616 | | |
617 | | ipv6_pinfo_t *p_get_ipv6_pinfo(packet_info *pinfo) |
618 | 35.1k | { |
619 | 35.1k | return (ipv6_pinfo_t *)p_get_proto_data(pinfo->pool, pinfo, proto_ipv6, IPV6_PROTO_PINFO); |
620 | 35.1k | } |
621 | | |
622 | | /* Return tree pointer (for tree root preference) */ |
623 | | proto_tree *p_ipv6_pinfo_select_root(packet_info *pinfo, proto_tree *tree) |
624 | 4.71k | { |
625 | 4.71k | ipv6_pinfo_t *p; |
626 | | |
627 | 4.71k | if ((p = p_get_ipv6_pinfo(pinfo)) != NULL && p->ipv6_tree != NULL) |
628 | 1.54k | return p->ipv6_tree; |
629 | 3.17k | return tree; |
630 | 4.71k | } |
631 | | |
632 | | ipv6_pinfo_t *p_ipv6_pinfo_add_len(packet_info *pinfo, int exthdr_len) |
633 | 4.71k | { |
634 | 4.71k | ipv6_pinfo_t *p; |
635 | | |
636 | 4.71k | if ((p = p_get_ipv6_pinfo(pinfo)) == NULL) |
637 | 2.80k | return NULL; |
638 | | |
639 | 1.90k | p->frag_plen -= exthdr_len; |
640 | 1.90k | p->ipv6_item_len += exthdr_len; |
641 | 1.90k | return p; |
642 | 4.71k | } |
643 | | |
644 | | static void p_add_ipv6_nxt(packet_info *pinfo, uint8_t nxt) |
645 | 25.4k | { |
646 | 25.4k | uint8_t *ptr; |
647 | | |
648 | 25.4k | ptr = (uint8_t *)wmem_memdup(pinfo->pool, &nxt, sizeof(uint8_t)); |
649 | 25.4k | p_add_proto_data(pinfo->pool, pinfo, proto_ipv6, |
650 | 25.4k | (pinfo->curr_layer_num<<8) | IPV6_PROTO_VALUE, ptr); |
651 | 25.4k | } |
652 | | |
653 | | static uint8_t *p_get_ipv6_nxt(packet_info *pinfo) |
654 | 0 | { |
655 | 0 | return (uint8_t *)p_get_proto_data(pinfo->pool, pinfo, proto_ipv6, |
656 | 0 | (pinfo->curr_layer_num<<8) | IPV6_PROTO_VALUE); |
657 | 0 | } |
658 | | |
659 | | static void *ipv6_value(packet_info *pinfo) |
660 | 0 | { |
661 | 0 | uint8_t *nxt = p_get_ipv6_nxt(pinfo); |
662 | |
|
663 | 0 | if (nxt == NULL) { |
664 | 0 | return GUINT_TO_POINTER(255); /* Reserved IP Protocol */ |
665 | 0 | } |
666 | 0 | return GUINT_TO_POINTER((unsigned)*nxt); |
667 | 0 | } |
668 | | |
669 | | static void ipv6_prompt(packet_info *pinfo, char *result) |
670 | 0 | { |
671 | 0 | void *value = ipv6_value(pinfo); |
672 | |
|
673 | 0 | snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "IP protocol %u as", GPOINTER_TO_UINT(value)); |
674 | 0 | } |
675 | | |
676 | | static const char* ipv6_conv_get_filter_type(conv_item_t* conv, conv_filter_type_e filter) |
677 | 0 | { |
678 | 0 | if ((filter == CONV_FT_SRC_ADDRESS) && (conv->src_address.type == AT_IPv6)) |
679 | 0 | return "ipv6.src"; |
680 | | |
681 | 0 | if ((filter == CONV_FT_DST_ADDRESS) && (conv->dst_address.type == AT_IPv6)) |
682 | 0 | return "ipv6.dst"; |
683 | | |
684 | 0 | if ((filter == CONV_FT_ANY_ADDRESS) && (conv->src_address.type == AT_IPv6)) |
685 | 0 | return "ipv6.addr"; |
686 | | |
687 | 0 | return CONV_FILTER_INVALID; |
688 | 0 | } |
689 | | |
690 | | static ct_dissector_info_t ipv6_ct_dissector_info = {&ipv6_conv_get_filter_type}; |
691 | | |
692 | | static tap_packet_status |
693 | | ipv6_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip, tap_flags_t flags) |
694 | 0 | { |
695 | 0 | conv_hash_t *hash = (conv_hash_t*) pct; |
696 | 0 | hash->flags = flags; |
697 | |
|
698 | 0 | const ipv6_tap_info_t *ip6 = (const ipv6_tap_info_t *)vip; |
699 | |
|
700 | 0 | if (!ipv6_track_conv_id) { |
701 | 0 | add_conversation_table_data(hash, &ip6->ip6_src, &ip6->ip6_dst, 0, 0, |
702 | 0 | 1, pinfo->fd->pkt_len, &pinfo->rel_ts, &pinfo->abs_ts, |
703 | 0 | &ipv6_ct_dissector_info, CONVERSATION_IPV6); |
704 | 0 | } else { |
705 | 0 | add_conversation_table_data_with_conv_id(hash, &ip6->ip6_src, &ip6->ip6_dst, 0, 0, |
706 | 0 | (conv_id_t)ip6->ip6_stream, 1, pinfo->fd->pkt_len, |
707 | 0 | &pinfo->rel_ts, &pinfo->abs_ts, &ipv6_ct_dissector_info, CONVERSATION_IPV6); |
708 | 0 | } |
709 | |
|
710 | 0 | return TAP_PACKET_REDRAW; |
711 | 0 | } |
712 | | |
713 | | static const char* ipv6_endpoint_get_filter_type(endpoint_item_t* endpoint, conv_filter_type_e filter) |
714 | 0 | { |
715 | 0 | if ((filter == CONV_FT_ANY_ADDRESS) && (endpoint->myaddress.type == AT_IPv6)) |
716 | 0 | return "ipv6.addr"; |
717 | | |
718 | 0 | return CONV_FILTER_INVALID; |
719 | 0 | } |
720 | | |
721 | | static et_dissector_info_t ipv6_endpoint_dissector_info = {&ipv6_endpoint_get_filter_type}; |
722 | | |
723 | | static tap_packet_status |
724 | | ipv6_endpoint_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip, tap_flags_t flags) |
725 | 0 | { |
726 | 0 | conv_hash_t *hash = (conv_hash_t*) pit; |
727 | 0 | hash->flags = flags; |
728 | |
|
729 | 0 | const ipv6_tap_info_t *ip6 = (const ipv6_tap_info_t *)vip; |
730 | |
|
731 | 0 | add_endpoint_table_data(hash, &ip6->ip6_src, 0, true, 1, |
732 | 0 | pinfo->fd->pkt_len, &ipv6_endpoint_dissector_info, ENDPOINT_NONE); |
733 | 0 | add_endpoint_table_data(hash, &ip6->ip6_dst, 0, false, 1, |
734 | 0 | pinfo->fd->pkt_len, &ipv6_endpoint_dissector_info, ENDPOINT_NONE); |
735 | |
|
736 | 0 | return TAP_PACKET_REDRAW; |
737 | 0 | } |
738 | | |
739 | | static bool |
740 | | ipv6_filter_valid(packet_info *pinfo, void *user_data _U_) |
741 | 0 | { |
742 | 0 | return proto_is_frame_protocol(pinfo->layers, "ipv6"); |
743 | 0 | } |
744 | | |
745 | | static char* |
746 | | ipv6_build_filter(packet_info *pinfo, void *user_data _U_) |
747 | 0 | { |
748 | 0 | return ws_strdup_printf("ipv6.addr eq %s and ipv6.addr eq %s", |
749 | 0 | address_to_str(pinfo->pool, &pinfo->net_src), |
750 | 0 | address_to_str(pinfo->pool, &pinfo->net_dst)); |
751 | 0 | } |
752 | | |
753 | | |
754 | | /* UAT for providing a list of NAT64 prefixes */ |
755 | | |
756 | | struct nat64_prefix_data { |
757 | | char *ipaddr; |
758 | | uint8_t prefix_len; |
759 | | uint32_t prefix_wildcard_len; |
760 | | }; |
761 | | |
762 | | |
763 | | static uat_t *nat64_prefix_uat; |
764 | | static struct nat64_prefix_data *nat64_prefix_uats; |
765 | | static unsigned number_of_nat64_prefix; |
766 | | |
767 | | |
768 | | UAT_CSTRING_CB_DEF(nat64_prefix_uats, ipaddr, struct nat64_prefix_data) |
769 | | |
770 | | static bool |
771 | | nat64_prefix_uat_fld_ip_chk_cb(void *r _U_, const char *ipaddr, unsigned len _U_, const void *u1 _U_, const void *u2 _U_, char **err) |
772 | 0 | { |
773 | | /* Check for a valid IPv6 address */ |
774 | 0 | ws_in6_addr addr; |
775 | |
|
776 | 0 | if (ws_inet_pton6(ipaddr, &addr)) { |
777 | 0 | *err = NULL; |
778 | 0 | return true; |
779 | 0 | } |
780 | | |
781 | 0 | *err = ws_strdup_printf("No valid IPv6 address given."); |
782 | 0 | return false; |
783 | 0 | } |
784 | | |
785 | | static const value_string nat64_prefix_length_vals[] = |
786 | | { |
787 | | { 32, "32" }, |
788 | | { 40, "40" }, |
789 | | { 48, "48" }, |
790 | | { 56, "56" }, |
791 | | { 64, "64" }, |
792 | | { 96, "96" }, |
793 | | { 0, NULL } |
794 | | }; |
795 | | |
796 | | UAT_VS_DEF(nat64_prefix_uats, prefix_len, struct nat64_prefix_data, uint8_t, 96, "96") |
797 | | |
798 | | static const value_string nat64_prefix_wildcard_length_vals[] = |
799 | | { |
800 | | { 0, "0" }, |
801 | | { 8, "8" }, |
802 | | { 16, "16" }, |
803 | | { 32, "32" }, |
804 | | { 64, "64" }, |
805 | | { 0, NULL } |
806 | | }; |
807 | | |
808 | | UAT_VS_DEF(nat64_prefix_uats, prefix_wildcard_len, struct nat64_prefix_data, uint8_t, 0, "0") |
809 | | |
810 | | |
811 | | static void |
812 | | nat64_prefix_free_cb(void *data) |
813 | 0 | { |
814 | 0 | struct nat64_prefix_data *h = (struct nat64_prefix_data *)data; |
815 | |
|
816 | 0 | g_free(h->ipaddr); |
817 | 0 | } |
818 | | |
819 | | static void * |
820 | | nat64_prefix_copy_cb(void *dst_, const void *src_, size_t len _U_) |
821 | 0 | { |
822 | 0 | const struct nat64_prefix_data *src = (const struct nat64_prefix_data *)src_; |
823 | 0 | struct nat64_prefix_data *dst = (struct nat64_prefix_data *)dst_; |
824 | |
|
825 | 0 | dst->ipaddr = g_strdup(src->ipaddr); |
826 | 0 | dst->prefix_len = src->prefix_len; |
827 | 0 | dst->prefix_wildcard_len = src->prefix_wildcard_len; |
828 | |
|
829 | 0 | return dst; |
830 | 0 | } |
831 | | |
832 | | |
833 | | static int |
834 | | ipv6_previous_layer_id(packet_info *pinfo) |
835 | 3.32k | { |
836 | 3.32k | wmem_list_frame_t *layer; |
837 | | |
838 | 3.32k | layer = wmem_list_tail(pinfo->layers); |
839 | 3.32k | DISSECTOR_ASSERT(layer); |
840 | 3.32k | layer = wmem_list_frame_prev(layer); |
841 | 3.32k | if (layer != NULL) { |
842 | 3.32k | return GPOINTER_TO_INT(wmem_list_frame_data(layer)); |
843 | 3.32k | } |
844 | 0 | return -1; |
845 | 3.32k | } |
846 | | |
847 | | static const fragment_items ipv6_frag_items = { |
848 | | &ett_ipv6_fragment, |
849 | | &ett_ipv6_fragments, |
850 | | &hf_ipv6_fragments, |
851 | | &hf_ipv6_fragment, |
852 | | &hf_ipv6_fragment_overlap, |
853 | | &hf_ipv6_fragment_overlap_conflict, |
854 | | &hf_ipv6_fragment_multiple_tails, |
855 | | &hf_ipv6_fragment_too_long_fragment, |
856 | | &hf_ipv6_fragment_error, |
857 | | &hf_ipv6_fragment_count, |
858 | | &hf_ipv6_reassembled_in, |
859 | | &hf_ipv6_reassembled_length, |
860 | | &hf_ipv6_reassembled_data, |
861 | | "IPv6 fragments" |
862 | | }; |
863 | | |
864 | | static dissector_table_t ip_dissector_table; |
865 | | static dissector_table_t ipv6_routing_dissector_table; |
866 | | |
867 | | /* |
868 | | * defragmentation of IPv6 |
869 | | */ |
870 | | static reassembly_table ipv6_reassembly_table; |
871 | | |
872 | | /* http://www.iana.org/assignments/ipv6-parameters (last updated 2015-07-07) */ |
873 | | static const value_string ipv6_opt_type_vals[] = { |
874 | | { IP6OPT_PAD1, "Pad1" }, |
875 | | { IP6OPT_PADN, "PadN" }, |
876 | | { IP6OPT_TEL, "Tunnel Encapsulation Limit" }, |
877 | | { IP6OPT_RTALERT, "Router Alert" }, |
878 | | { IP6OPT_CALIPSO, "CALIPSO" }, |
879 | | { IP6OPT_SMF_DPD, "SMF_DPD" }, |
880 | | { IP6OPT_PDM, "Performance and Diagnostic Metrics" }, |
881 | | { IP6OPT_APN6, "Application-Aware IPv6 Networking (APN6)" }, |
882 | | { IP6OPT_EXP_1E, "Experimental (0x1E)" }, |
883 | | { IP6OPT_RPL, "RPL Option" }, |
884 | | { IP6OPT_QUICKSTART, "Quick-Start" }, |
885 | | { IP6OPT_PMTU, "Path MTU Option" }, |
886 | | { IP6OPT_IOAM, "IOAM Option" }, |
887 | | { IP6OPT_EXP_3E, "Experimental (0x3E)" }, |
888 | | { IP6OPT_TPF, "Tunnel Payload Forwarding (TPF) Information" }, |
889 | | { IP6OPT_EXP_5E, "Experimental (0x5E)" }, |
890 | | { IP6OPT_RPL_OLD, "RPL Option (deprecated)" }, |
891 | | { IP6OPT_MPL, "MPL Option" }, |
892 | | { IP6OPT_EXP_7E, "Experimental (0x7E)" }, |
893 | | { IP6OPT_ENDI, "Endpoint Identification" }, |
894 | | { IP6OPT_ILNP_NONCE, "ILNP Nonce" }, |
895 | | { IP6OPT_LIO, "Line-Identification Option" }, |
896 | | { IP6OPT_EXP_9E, "Experimental (0x9E)" }, |
897 | | { IP6OPT_EXP_BE, "Experimental (0xBE)" }, |
898 | | { IP6OPT_JUMBO, "Jumbo Payload" }, |
899 | | { IP6OPT_HOME_ADDRESS, "Home Address" }, |
900 | | { IP6OPT_EXP_DE, "Experimental (0xDE)" }, |
901 | | { IP6OPT_IP_DFF, "IP_DFF" }, |
902 | | { IP6OPT_EXP_FE, "Experimental (0xFE)" }, |
903 | | { 0, NULL } |
904 | | }; |
905 | | static value_string_ext ipv6_opt_type_vals_ext = VALUE_STRING_EXT_INIT(ipv6_opt_type_vals); |
906 | | |
907 | | static const value_string ipv6_opt_rtalert_vals[] = { |
908 | | { IP6OPT_RTALERT_MLD, "MLD" }, |
909 | | { IP6OPT_RTALERT_RSVP, "RSVP" }, |
910 | | { IP6OPT_RTALERT_ACTNET, "Active Network" }, |
911 | | { 0, NULL } |
912 | | }; |
913 | | |
914 | | enum { |
915 | | IP6OPT_SMF_DPD_NULL = 0, |
916 | | IP6OPT_SMF_DPD_DFLT, |
917 | | IP6OPT_SMF_DPD_IPv4, |
918 | | IP6OPT_SMF_DPD_IPv6 |
919 | | }; |
920 | | |
921 | | static const value_string ipv6_opt_smf_dpd_tidty_vals[] = { |
922 | | { IP6OPT_SMF_DPD_NULL, "NULL" }, |
923 | | { IP6OPT_SMF_DPD_DFLT, "DEFAULT" }, |
924 | | { IP6OPT_SMF_DPD_IPv4, "IPv4" }, |
925 | | { IP6OPT_SMF_DPD_IPv6, "IPv6" }, |
926 | | { 0, NULL } |
927 | | }; |
928 | | |
929 | | enum { |
930 | | IPv6_OPT_ACTION_SKIP = 0, |
931 | | IPv6_OPT_ACTION_DISC, |
932 | | IPv6_OPT_ACTION_ICMP, |
933 | | IPv6_OPT_ACTION_MCST, |
934 | | }; |
935 | | |
936 | | static const value_string ipv6_opt_type_action_vals[] = { |
937 | | { IPv6_OPT_ACTION_SKIP, "Skip and continue" }, |
938 | | { IPv6_OPT_ACTION_DISC, "Discard" }, |
939 | | { IPv6_OPT_ACTION_ICMP, "Discard and send ICMP Parameter Problem" }, |
940 | | { IPv6_OPT_ACTION_MCST, "Discard and send ICMP if not multicast" }, |
941 | | { 0, NULL } |
942 | | }; |
943 | | |
944 | | enum { |
945 | | IPv6_OPT_HDR_HBH = 0, |
946 | | IPv6_OPT_HDR_DST, |
947 | | IPv6_OPT_HDR_ANY |
948 | | }; |
949 | | |
950 | | static const int _ipv6_opt_type_hdr[][2] = { |
951 | | { IP6OPT_TEL, IPv6_OPT_HDR_DST }, |
952 | | { IP6OPT_RTALERT, IPv6_OPT_HDR_HBH }, |
953 | | { IP6OPT_PMTU, IPv6_OPT_HDR_HBH }, |
954 | | { IP6OPT_APN6, IPv6_OPT_HDR_ANY }, |
955 | | { IP6OPT_CALIPSO, IPv6_OPT_HDR_HBH }, |
956 | | { IP6OPT_SMF_DPD, IPv6_OPT_HDR_HBH }, |
957 | | { IP6OPT_PDM, IPv6_OPT_HDR_DST }, |
958 | | { IP6OPT_RPL, IPv6_OPT_HDR_HBH }, |
959 | | { IP6OPT_QUICKSTART, IPv6_OPT_HDR_HBH }, |
960 | | { IP6OPT_IOAM, IPv6_OPT_HDR_HBH }, |
961 | | { IP6OPT_TPF, IPv6_OPT_HDR_DST }, |
962 | | { IP6OPT_RPL_OLD, IPv6_OPT_HDR_HBH }, |
963 | | { IP6OPT_MPL, IPv6_OPT_HDR_HBH }, |
964 | | { IP6OPT_ILNP_NONCE, IPv6_OPT_HDR_DST }, |
965 | | { IP6OPT_LIO, IPv6_OPT_HDR_DST }, |
966 | | { IP6OPT_JUMBO, IPv6_OPT_HDR_HBH }, |
967 | | { IP6OPT_HOME_ADDRESS, IPv6_OPT_HDR_DST }, |
968 | | { IP6OPT_IP_DFF, IPv6_OPT_HDR_HBH }, |
969 | | { 0, IPv6_OPT_HDR_ANY } |
970 | | }; |
971 | | |
972 | | static inline int |
973 | | ipv6_opt_type_hdr(int type) |
974 | 7.51k | { |
975 | 7.51k | static const int (*p)[2] = _ipv6_opt_type_hdr; |
976 | | |
977 | 7.51k | for (; (*p)[1] != IPv6_OPT_HDR_ANY; p++) { |
978 | 6 | if ((*p)[0] == type) { |
979 | 0 | return (*p)[1]; |
980 | 0 | } |
981 | 6 | } |
982 | 7.51k | return IPv6_OPT_HDR_ANY; |
983 | 7.51k | } |
984 | | |
985 | | enum { |
986 | | IPv6_RT_HEADER_SOURCE_ROUTING = 0, /* DEPRECATED */ |
987 | | IPv6_RT_HEADER_NIMROD = 1, /* DEPRECATED */ |
988 | | IPv6_RT_HEADER_MOBILE_IP = 2, |
989 | | IPv6_RT_HEADER_RPL = 3, |
990 | | IPv6_RT_HEADER_SEGMENT_ROUTING = 4, |
991 | | IPv6_RT_HEADER_COMPACT_16 = 5, |
992 | | IPv6_RT_HEADER_COMPACT_32 = 6, |
993 | | IPv6_RT_HEADER_EXP1 = 253, |
994 | | IPv6_RT_HEADER_EXP2 = 254 |
995 | | }; |
996 | | |
997 | | /* Routing Header Types */ |
998 | | static const value_string routing_header_type[] = { |
999 | | { IPv6_RT_HEADER_SOURCE_ROUTING, "Source Route" }, |
1000 | | { IPv6_RT_HEADER_NIMROD, "Nimrod" }, |
1001 | | { IPv6_RT_HEADER_MOBILE_IP, "Type 2 Routing" }, |
1002 | | { IPv6_RT_HEADER_RPL, "RPL Source Route" }, |
1003 | | { IPv6_RT_HEADER_SEGMENT_ROUTING, "Segment Routing" }, |
1004 | | { IPv6_RT_HEADER_COMPACT_16, "Compact Routing Header 16" }, |
1005 | | { IPv6_RT_HEADER_COMPACT_32, "Compact Routing Header 32" }, |
1006 | | { IPv6_RT_HEADER_EXP1, "Experiment 1" }, |
1007 | | { IPv6_RT_HEADER_EXP2, "Experiment 2" }, |
1008 | | { 0, NULL } |
1009 | | }; |
1010 | | |
1011 | | static const value_string mpl_seed_id_len_vals[] = { |
1012 | | { 0, "0" }, |
1013 | | { 1, "16-bit unsigned integer" }, |
1014 | | { 2, "64-bit unsigned integer" }, |
1015 | | { 3, "128-bit unsigned integer" }, |
1016 | | { 0, NULL } |
1017 | | }; |
1018 | | |
1019 | | static const value_string ipv6_multicast_scope_vals[] = { |
1020 | | { 0x0, "Reserved" }, |
1021 | | { 0x1, "Interface-Local scope" }, |
1022 | | { 0x2, "Link-Local scope" }, |
1023 | | { 0x3, "Realm-Local scope" }, |
1024 | | { 0x4, "Admin-Local scope" }, |
1025 | | { 0x5, "Site-Local scope" }, |
1026 | | { 0x6, "Unassigned" }, |
1027 | | { 0x7, "Unassigned" }, |
1028 | | { 0x8, "Organization-Local scope" }, |
1029 | | { 0x9, "Unassigned" }, |
1030 | | { 0xA, "Unassigned" }, |
1031 | | { 0xB, "Unassigned" }, |
1032 | | { 0xC, "Unassigned" }, |
1033 | | { 0xD, "Unassigned" }, |
1034 | | { 0xE, "Global scope" }, |
1035 | | { 0xF, "Reserved" }, |
1036 | | { 0, NULL } |
1037 | | }; |
1038 | | |
1039 | 576 | #define APN_ID_32BIT 1 |
1040 | 192 | #define APN_ID_64BIT 2 |
1041 | 346 | #define APN_ID_128BIT 3 |
1042 | | static const value_string apn_id_type_strs[] = { |
1043 | | { 0, "Invalid" }, |
1044 | | { APN_ID_32BIT, "32-bit" }, |
1045 | | { APN_ID_64BIT, "64-bit" }, |
1046 | | { APN_ID_128BIT, "128-bit" }, |
1047 | | { 0, NULL } |
1048 | | }; |
1049 | | |
1050 | | static bool |
1051 | | capture_ipv6(const unsigned char *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header) |
1052 | 0 | { |
1053 | 0 | uint8_t nxt; |
1054 | |
|
1055 | 0 | if (!BYTES_ARE_IN_FRAME(offset, len, IPv6_HDR_SIZE)) |
1056 | 0 | return false; |
1057 | | |
1058 | 0 | capture_dissector_increment_count(cpinfo, proto_ipv6); |
1059 | |
|
1060 | 0 | nxt = pd[offset+6]; /* get the "next header" value */ |
1061 | 0 | offset += IPv6_HDR_SIZE; /* skip past the IPv6 header */ |
1062 | |
|
1063 | 0 | return try_capture_dissector("ip.proto", nxt, pd, offset, len, cpinfo, pseudo_header); |
1064 | 0 | } |
1065 | | |
1066 | | static bool |
1067 | | capture_ipv6_exthdr(const unsigned char *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header) |
1068 | 0 | { |
1069 | 0 | uint8_t nxt; |
1070 | 0 | int advance; |
1071 | |
|
1072 | 0 | if (!BYTES_ARE_IN_FRAME(offset, len, 2)) |
1073 | 0 | return false; |
1074 | 0 | nxt = pd[offset]; |
1075 | 0 | switch (nxt) { |
1076 | 0 | case IP_PROTO_FRAGMENT: |
1077 | 0 | advance = IPv6_FRAGMENT_HDR_SIZE; |
1078 | 0 | break; |
1079 | 0 | default: |
1080 | 0 | advance = (pd[offset+1] + 1) << 3; |
1081 | 0 | break; |
1082 | 0 | } |
1083 | 0 | if (!BYTES_ARE_IN_FRAME(offset, len, advance)) |
1084 | 0 | return false; |
1085 | 0 | offset += advance; |
1086 | |
|
1087 | 0 | return try_capture_dissector("ip.proto", nxt, pd, offset, len, cpinfo, pseudo_header); |
1088 | 0 | } |
1089 | | |
1090 | | static void |
1091 | | add_geoip_info_entry(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, const ws_in6_addr *ip6, bool isdst) |
1092 | 45.3k | { |
1093 | 45.3k | const mmdb_lookup_t *lookup = maxmind_db_lookup_ipv6(ip6); |
1094 | 45.3k | if (!lookup->found) return; |
1095 | | |
1096 | 0 | wmem_strbuf_t *summary = wmem_strbuf_new(pinfo->pool, ""); |
1097 | 0 | if (lookup->city) { |
1098 | 0 | wmem_strbuf_append(summary, lookup->city); |
1099 | 0 | } |
1100 | 0 | if (lookup->country_iso) { |
1101 | 0 | if (wmem_strbuf_get_len(summary) > 0) wmem_strbuf_append(summary, ", "); |
1102 | 0 | wmem_strbuf_append(summary, lookup->country_iso); |
1103 | 0 | } else if (lookup->country) { |
1104 | 0 | if (wmem_strbuf_get_len(summary) > 0) wmem_strbuf_append(summary, ", "); |
1105 | 0 | wmem_strbuf_append(summary, lookup->country); |
1106 | 0 | } |
1107 | 0 | if (lookup->as_number > 0) { |
1108 | 0 | if (wmem_strbuf_get_len(summary) > 0) wmem_strbuf_append(summary, ", "); |
1109 | 0 | wmem_strbuf_append_printf(summary, "ASN %u", lookup->as_number); |
1110 | 0 | } |
1111 | 0 | if (lookup->as_org) { |
1112 | 0 | if (wmem_strbuf_get_len(summary) > 0) wmem_strbuf_append(summary, ", "); |
1113 | 0 | wmem_strbuf_append(summary, lookup->as_org); |
1114 | 0 | } |
1115 | |
|
1116 | 0 | int addr_offset = offset + (isdst ? IP6H_DST : IP6H_SRC); |
1117 | 0 | int dir_hf = isdst ? hf_geoip_dst_summary : hf_geoip_src_summary; |
1118 | 0 | proto_item *geoip_info_item = proto_tree_add_string(tree, dir_hf, tvb, addr_offset, 16, wmem_strbuf_finalize(summary)); |
1119 | 0 | proto_item_set_generated(geoip_info_item); |
1120 | 0 | proto_tree *geoip_info_tree = proto_item_add_subtree(geoip_info_item, ett_geoip_info); |
1121 | |
|
1122 | 0 | proto_item *item; |
1123 | |
|
1124 | 0 | if (lookup->city) { |
1125 | 0 | dir_hf = isdst ? hf_geoip_dst_city : hf_geoip_src_city; |
1126 | 0 | item = proto_tree_add_string(geoip_info_tree, dir_hf, tvb, addr_offset, 16, lookup->city); |
1127 | 0 | proto_item_set_generated(item); |
1128 | 0 | item = proto_tree_add_string(geoip_info_tree, hf_geoip_city, tvb, addr_offset, 16, lookup->city); |
1129 | 0 | proto_item_set_generated(item); |
1130 | 0 | } |
1131 | |
|
1132 | 0 | if (lookup->country) { |
1133 | 0 | dir_hf = isdst ? hf_geoip_dst_country : hf_geoip_src_country; |
1134 | 0 | item = proto_tree_add_string(geoip_info_tree, dir_hf, tvb, addr_offset, 16, lookup->country); |
1135 | 0 | proto_item_set_generated(item); |
1136 | 0 | item = proto_tree_add_string(geoip_info_tree, hf_geoip_country, tvb, addr_offset, 16, lookup->country); |
1137 | 0 | proto_item_set_generated(item); |
1138 | 0 | } |
1139 | |
|
1140 | 0 | if (lookup->country_iso) { |
1141 | 0 | dir_hf = isdst ? hf_geoip_dst_country_iso : hf_geoip_src_country_iso; |
1142 | 0 | item = proto_tree_add_string(geoip_info_tree, dir_hf, tvb, addr_offset, 16, lookup->country_iso); |
1143 | 0 | proto_item_set_generated(item); |
1144 | 0 | item = proto_tree_add_string(geoip_info_tree, hf_geoip_country_iso, tvb, addr_offset, 16, lookup->country_iso); |
1145 | 0 | proto_item_set_generated(item); |
1146 | 0 | } |
1147 | |
|
1148 | 0 | if (lookup->as_number > 0) { |
1149 | 0 | dir_hf = isdst ? hf_geoip_dst_as_number : hf_geoip_src_as_number; |
1150 | 0 | item = proto_tree_add_uint(geoip_info_tree, dir_hf, tvb, addr_offset, 16, lookup->as_number); |
1151 | 0 | proto_item_set_generated(item); |
1152 | 0 | item = proto_tree_add_uint(geoip_info_tree, hf_geoip_as_number, tvb, addr_offset, 16, lookup->as_number); |
1153 | 0 | proto_item_set_generated(item); |
1154 | 0 | } |
1155 | |
|
1156 | 0 | if (lookup->as_org) { |
1157 | 0 | dir_hf = isdst ? hf_geoip_dst_as_org : hf_geoip_src_as_org; |
1158 | 0 | item = proto_tree_add_string(geoip_info_tree, dir_hf, tvb, addr_offset, 16, lookup->as_org); |
1159 | 0 | proto_item_set_generated(item); |
1160 | 0 | item = proto_tree_add_string(geoip_info_tree, hf_geoip_as_org, tvb, addr_offset, 16, lookup->as_org); |
1161 | 0 | proto_item_set_generated(item); |
1162 | 0 | } |
1163 | |
|
1164 | 0 | if (lookup->latitude >= -90.0 && lookup->latitude <= 90.0) { |
1165 | 0 | dir_hf = isdst ? hf_geoip_dst_latitude : hf_geoip_src_latitude; |
1166 | 0 | item = proto_tree_add_double(geoip_info_tree, dir_hf, tvb, addr_offset, 16, lookup->latitude); |
1167 | 0 | proto_item_set_generated(item); |
1168 | 0 | item = proto_tree_add_double(geoip_info_tree, hf_geoip_latitude, tvb, addr_offset, 16, lookup->latitude); |
1169 | 0 | proto_item_set_generated(item); |
1170 | 0 | } |
1171 | |
|
1172 | 0 | if (lookup->longitude >= -180.0 && lookup->longitude <= 180.0) { |
1173 | 0 | dir_hf = isdst ? hf_geoip_dst_longitude : hf_geoip_src_longitude; |
1174 | 0 | item = proto_tree_add_double(geoip_info_tree, dir_hf, tvb, addr_offset, 16, lookup->longitude); |
1175 | 0 | proto_item_set_generated(item); |
1176 | 0 | item = proto_tree_add_double(geoip_info_tree, hf_geoip_longitude, tvb, addr_offset, 16, lookup->longitude); |
1177 | 0 | proto_item_set_generated(item); |
1178 | 0 | } |
1179 | 0 | } |
1180 | | |
1181 | | static void |
1182 | | add_geoip_info(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, const ws_in6_addr *src, const ws_in6_addr *dst) |
1183 | 22.6k | { |
1184 | 22.6k | add_geoip_info_entry(tree, pinfo, tvb, offset, src, false); |
1185 | 22.6k | add_geoip_info_entry(tree, pinfo, tvb, offset, dst, true); |
1186 | 22.6k | } |
1187 | | |
1188 | | /* Returns true if reassembled */ |
1189 | | static bool |
1190 | | ipv6_reassemble_do(tvbuff_t **tvb_ptr, int *offset_ptr, packet_info *pinfo, proto_tree *ipv6_tree, |
1191 | | uint32_t plen, uint16_t frag_off, bool frag_flg, uint32_t frag_ident, |
1192 | | bool *show_data_ptr) |
1193 | 7 | { |
1194 | 7 | fragment_head *ipfd_head; |
1195 | 7 | tvbuff_t *next_tvb; |
1196 | 7 | bool update_col_info = true; |
1197 | | |
1198 | 7 | pinfo->fragmented = true; |
1199 | 7 | *show_data_ptr = true; |
1200 | 7 | if (!ipv6_reassemble) { |
1201 | | /* not reassembling */ |
1202 | 7 | if (frag_off == 0) { |
1203 | | /* first fragment */ |
1204 | 2 | *show_data_ptr = false; |
1205 | 2 | } |
1206 | 7 | return false; |
1207 | 7 | } |
1208 | | |
1209 | | /* reassembling */ |
1210 | 0 | if (tvb_bytes_exist(*tvb_ptr, *offset_ptr, plen)) { |
1211 | 0 | ipfd_head = fragment_add_check(&ipv6_reassembly_table, |
1212 | 0 | *tvb_ptr, *offset_ptr, pinfo, frag_ident, NULL, |
1213 | 0 | frag_off, plen, frag_flg); |
1214 | 0 | next_tvb = process_reassembled_data(*tvb_ptr, *offset_ptr, pinfo, "Reassembled IPv6", |
1215 | 0 | ipfd_head, &ipv6_frag_items, &update_col_info, ipv6_tree); |
1216 | 0 | if (next_tvb) { |
1217 | | /* Process post-fragment headers after reassembly */ |
1218 | 0 | *offset_ptr = 0; |
1219 | 0 | *tvb_ptr = next_tvb; |
1220 | 0 | pinfo->fragmented = false; |
1221 | 0 | *show_data_ptr = false; |
1222 | 0 | return true; |
1223 | 0 | } |
1224 | 0 | } |
1225 | 0 | return false; |
1226 | 0 | } |
1227 | | |
1228 | | static proto_item * |
1229 | | _proto_tree_add_ipv6_vector_address(proto_tree *tree, packet_info *pinfo, int hfindex, tvbuff_t *tvb, int start, |
1230 | | int length, const ws_in6_addr *value_ptr, int idx) |
1231 | 2.58k | { |
1232 | 2.58k | address addr; |
1233 | 2.58k | char *str; |
1234 | | |
1235 | 2.58k | set_address_ipv6(&addr, value_ptr); |
1236 | 2.58k | str = address_with_resolution_to_str(pinfo->pool, &addr); |
1237 | 2.58k | return proto_tree_add_ipv6_format(tree, hfindex, tvb, start, length, |
1238 | 2.58k | value_ptr, "Address[%d]: %s", idx, str); |
1239 | 2.58k | } |
1240 | | |
1241 | | /* IPv6 Source Routing Header (Type 0) */ |
1242 | | static int |
1243 | | dissect_routing6_rt0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
1244 | 95 | { |
1245 | 95 | struct ws_rthdr *rt = (struct ws_rthdr *)data; |
1246 | 95 | proto_item *ti; |
1247 | 95 | int offset = 0; |
1248 | 95 | int idx; |
1249 | 95 | int rt0_addr_count; |
1250 | 95 | const ws_in6_addr *addr = NULL; |
1251 | | |
1252 | 95 | proto_tree_add_item(tree, hf_ipv6_routing_src_reserved, tvb, offset, 4, ENC_NA); |
1253 | 95 | offset += 4; |
1254 | | |
1255 | 95 | if (rt->hdr.ip6r_len % 2 != 0) { |
1256 | 30 | expert_add_info_format(pinfo, rt->ti_len, &ei_ipv6_routing_invalid_length, |
1257 | 30 | "IPv6 Routing Header extension header length must not be odd"); |
1258 | 30 | } |
1259 | 95 | rt0_addr_count = rt->hdr.ip6r_len / 2; |
1260 | 95 | if (rt->hdr.ip6r_segleft > rt0_addr_count) { |
1261 | 32 | expert_add_info_format(pinfo, rt->ti_segleft, &ei_ipv6_routing_invalid_segleft, |
1262 | 32 | "IPv6 Type 0 Routing Header segments left field must not exceed address count (%u)", rt0_addr_count); |
1263 | 32 | } |
1264 | | |
1265 | 477 | for (idx = 1; idx <= rt0_addr_count; idx++) { |
1266 | 382 | addr = tvb_get_ptr_ipv6(tvb, offset); |
1267 | 382 | ti = _proto_tree_add_ipv6_vector_address(tree, pinfo, hf_ipv6_routing_src_addr, tvb, |
1268 | 382 | offset, IPv6_ADDR_SIZE, addr, idx); |
1269 | 382 | offset += IPv6_ADDR_SIZE; |
1270 | 382 | if (in6_addr_is_multicast(addr)) { |
1271 | 68 | expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_multicast_addr); |
1272 | 68 | } |
1273 | 382 | } |
1274 | | |
1275 | 95 | if (addr != NULL && pinfo->dst.type == AT_IPv6 && rt->hdr.ip6r_segleft > 0) { |
1276 | 4 | alloc_address_wmem_ipv6(pinfo->pool, &pinfo->dst, addr); |
1277 | 4 | } |
1278 | | |
1279 | 95 | expert_add_info(pinfo, rt->ti_type, &ei_ipv6_routing_deprecated); |
1280 | 95 | return tvb_captured_length(tvb); |
1281 | 95 | } |
1282 | | |
1283 | | /* Mobile IPv6 Routing Header (Type 2) */ |
1284 | | static int |
1285 | | dissect_routing6_mipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
1286 | 12 | { |
1287 | 12 | struct ws_rthdr *rt = (struct ws_rthdr *)data; |
1288 | 12 | proto_item *ti; |
1289 | 12 | int offset = 0; |
1290 | 12 | const ws_in6_addr *addr; |
1291 | | |
1292 | 12 | proto_tree_add_item(tree, hf_ipv6_routing_mipv6_reserved, tvb, offset, 4, ENC_NA); |
1293 | 12 | offset += 4; |
1294 | | |
1295 | 12 | if (rt->hdr.ip6r_len != 2) { |
1296 | 8 | expert_add_info_format(pinfo, rt->ti_len, &ei_ipv6_routing_invalid_length, |
1297 | 8 | "IPv6 Type 2 Routing Header extension header length must equal 2"); |
1298 | 8 | } |
1299 | 12 | if (rt->hdr.ip6r_segleft != 1) { |
1300 | 9 | expert_add_info_format(pinfo, rt->ti_segleft, &ei_ipv6_routing_invalid_segleft, |
1301 | 9 | "IPv6 Type 2 Routing Header segments left field must equal 1"); |
1302 | 9 | } |
1303 | | |
1304 | 12 | addr = tvb_get_ptr_ipv6(tvb, offset); |
1305 | 12 | ti = _proto_tree_add_ipv6_vector_address(tree, pinfo, hf_ipv6_routing_mipv6_home_address, tvb, |
1306 | 12 | offset, IPv6_ADDR_SIZE, addr, 1); |
1307 | 12 | if (in6_addr_is_multicast(addr)) { |
1308 | 2 | expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_multicast_addr); |
1309 | 2 | } |
1310 | | |
1311 | 12 | if (pinfo->dst.type == AT_IPv6 && rt->hdr.ip6r_segleft > 0) { |
1312 | 3 | alloc_address_wmem_ipv6(pinfo->pool, &pinfo->dst, addr); |
1313 | 3 | } |
1314 | | |
1315 | 12 | return tvb_captured_length(tvb); |
1316 | 12 | } |
1317 | | |
1318 | | /* RPL Source Routing Header (Type 3) */ |
1319 | | static int |
1320 | | dissect_routing6_rpl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
1321 | 78 | { |
1322 | 78 | struct ws_rthdr *rt = (struct ws_rthdr *)data; |
1323 | 78 | proto_item *ti; |
1324 | 78 | int offset = 0; |
1325 | 78 | uint8_t cmprI, cmprE, cmprX, pad; |
1326 | 78 | uint32_t reserved; |
1327 | 78 | int idx; |
1328 | 78 | int rpl_addr_count; |
1329 | 78 | ws_in6_addr rpl_fulladdr; |
1330 | 78 | const ws_in6_addr *ip6_dst_addr, *ip6_src_addr; |
1331 | 78 | wmem_array_t *rpl_addr_vector = NULL; |
1332 | 78 | unsigned i; |
1333 | | |
1334 | | /* Must be IPv6 addresses */ |
1335 | 78 | if ((pinfo->dst.type != AT_IPv6) || (pinfo->src.type != AT_IPv6)) |
1336 | 2 | return 0; |
1337 | | |
1338 | | /* IPv6 destination address used for elided bytes */ |
1339 | 76 | ip6_dst_addr = (const ws_in6_addr *)pinfo->dst.data; |
1340 | | /* IPv6 source address used for strict checking */ |
1341 | 76 | ip6_src_addr = (const ws_in6_addr *)pinfo->src.data; |
1342 | | |
1343 | | /* from RFC6554: Multicast addresses MUST NOT appear in the IPv6 Destination Address field */ |
1344 | 76 | if (in6_addr_is_multicast(ip6_dst_addr)) { |
1345 | 25 | expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_ipv6_dst_addr_not_multicast); |
1346 | 25 | } |
1347 | | |
1348 | 76 | proto_tree_add_item(tree, hf_ipv6_routing_rpl_cmprI, tvb, offset, 4, ENC_BIG_ENDIAN); |
1349 | 76 | proto_tree_add_item(tree, hf_ipv6_routing_rpl_cmprE, tvb, offset, 4, ENC_BIG_ENDIAN); |
1350 | 76 | ti = proto_tree_add_item(tree, hf_ipv6_routing_rpl_pad, tvb, offset, 4, ENC_BIG_ENDIAN); |
1351 | | |
1352 | 76 | cmprI = tvb_get_uint8(tvb, offset) & 0xF0; |
1353 | 76 | cmprE = tvb_get_uint8(tvb, offset) & 0x0F; |
1354 | 76 | pad = tvb_get_uint8(tvb, offset + 1) & 0xF0; |
1355 | | |
1356 | | /* Shift bytes over */ |
1357 | 76 | cmprI >>= 4; |
1358 | 76 | pad >>= 4; |
1359 | | |
1360 | | /* from RFC6554: when CmprI and CmprE are both 0, Pad MUST carry a value of 0 */ |
1361 | 76 | if (cmprI == 0 && cmprE == 0 && pad != 0) { |
1362 | 2 | expert_add_info_format(pinfo, ti, &ei_ipv6_routing_rpl_cmpri_cmpre_pad, "When cmprI equals 0 and cmprE equals 0, pad MUST equal 0 but instead was %d", pad); |
1363 | 2 | } |
1364 | | |
1365 | 76 | ti = proto_tree_add_item(tree, hf_ipv6_routing_rpl_reserved, tvb, offset, 4, ENC_BIG_ENDIAN); |
1366 | 76 | reserved = tvb_get_bits32(tvb, ((offset + 1) * 8) + 4, 20, ENC_BIG_ENDIAN); |
1367 | | |
1368 | 76 | if (reserved != 0) { |
1369 | 67 | expert_add_info_format(pinfo, ti, &ei_ipv6_routing_rpl_reserved, "Reserved field must equal 0 but instead was %d", reserved); |
1370 | 67 | } |
1371 | | |
1372 | | /* From RFC6554: |
1373 | | * n = (((Hdr Ext Len * 8) - Pad - (16 - CmprE)) / (16 - CmprI)) + 1 |
1374 | | */ |
1375 | 76 | rpl_addr_count = 0; |
1376 | 76 | if (rt->hdr.ip6r_len > 0) { |
1377 | 71 | rpl_addr_count = (((rt->hdr.ip6r_len * 8) - pad - (16 - cmprE)) / (16 - cmprI)) + 1; |
1378 | 71 | } |
1379 | 76 | ti = proto_tree_add_int(tree, hf_ipv6_routing_rpl_addr_count, tvb, offset, 2, rpl_addr_count); |
1380 | 76 | proto_item_set_generated(ti); |
1381 | 76 | if (rpl_addr_count < 0) { |
1382 | | /* This error should always be reported */ |
1383 | 1 | expert_add_info_format(pinfo, ti, &ei_ipv6_routing_rpl_addr_count_ge0, "Calculated total address count must be greater than or equal to 0, instead was %d", rpl_addr_count); |
1384 | 1 | } |
1385 | 75 | else if (rt->hdr.ip6r_segleft > (unsigned)rpl_addr_count) { |
1386 | 18 | expert_add_info_format(pinfo, rt->ti_segleft, &ei_ipv6_routing_invalid_segleft, |
1387 | 18 | "IPv6 RPL Routing Header segments left field must not exceed address count (%d)", rpl_addr_count); |
1388 | 18 | } |
1389 | | |
1390 | 76 | if (rpl_addr_count > 0) { |
1391 | 70 | offset += 4; |
1392 | | |
1393 | 70 | if (g_ipv6_rpl_srh_strict_rfc_checking) |
1394 | 0 | rpl_addr_vector = wmem_array_sized_new(pinfo->pool, IPv6_ADDR_SIZE, rpl_addr_count); |
1395 | | |
1396 | | /* We use cmprI for internal (e.g.: not last) address for how many bytes to elide, so actual bytes present = 16-CmprI */ |
1397 | 2.26k | for (idx = 1; idx <= rpl_addr_count; idx++) { |
1398 | 2.19k | if (idx == rpl_addr_count) |
1399 | 11 | cmprX = 16 - cmprE; |
1400 | 2.18k | else |
1401 | 2.18k | cmprX = 16 - cmprI; |
1402 | 2.19k | proto_tree_add_item(tree, hf_ipv6_routing_rpl_addr, tvb, offset, cmprX, ENC_NA); |
1403 | | /* Display Full Address */ |
1404 | 2.19k | memcpy(&rpl_fulladdr, ip6_dst_addr, IPv6_ADDR_SIZE); |
1405 | 2.19k | tvb_memcpy(tvb, &rpl_fulladdr.bytes[16-cmprX], offset, cmprX); |
1406 | 2.19k | ti = _proto_tree_add_ipv6_vector_address(tree, pinfo, hf_ipv6_routing_rpl_fulladdr, tvb, |
1407 | 2.19k | offset, cmprX, &rpl_fulladdr, idx); |
1408 | 2.19k | proto_item_set_generated(ti); |
1409 | 2.19k | offset += cmprX; |
1410 | | |
1411 | | /* IPv6 Source and Destination addresses of the encapsulating datagram (MUST) not appear in the SRH*/ |
1412 | 2.19k | if (memcmp(&rpl_fulladdr, ip6_src_addr, IPv6_ADDR_SIZE) == 0) { |
1413 | 25 | expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_src_addr); |
1414 | 25 | } |
1415 | 2.19k | if (memcmp(&rpl_fulladdr, ip6_dst_addr, IPv6_ADDR_SIZE) == 0) { |
1416 | 214 | expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_dst_addr); |
1417 | 214 | } |
1418 | | |
1419 | | /* Multicast addresses MUST NOT appear in the in SRH */ |
1420 | 2.19k | if (in6_addr_is_multicast(&rpl_fulladdr)) { |
1421 | 1.11k | expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_multicast_addr); |
1422 | 1.11k | } |
1423 | | |
1424 | 2.19k | if (g_ipv6_rpl_srh_strict_rfc_checking) { |
1425 | | /* from RFC6554: */ |
1426 | | /* The SRH MUST NOT specify a path that visits a node more than once. */ |
1427 | | /* To do this, we will just check the current 'addr' against the previous addresses */ |
1428 | 0 | for (i = 0; i < wmem_array_get_count(rpl_addr_vector); i++) { |
1429 | | /* Compare the addresses */ |
1430 | 0 | if (memcmp(&rpl_fulladdr, wmem_array_index(rpl_addr_vector, i), IPv6_ADDR_SIZE) == 0) { |
1431 | | /* Found a previous that is the same */ |
1432 | 0 | expert_add_info(pinfo, ti, &ei_ipv6_src_route_list_mult_inst_same_addr); |
1433 | 0 | break; |
1434 | 0 | } |
1435 | 0 | } |
1436 | 0 | wmem_array_append(rpl_addr_vector, &rpl_fulladdr, 1); |
1437 | 0 | } |
1438 | | |
1439 | 2.19k | if (pinfo->dst.type == AT_IPv6 && rt->hdr.ip6r_segleft > 0) { |
1440 | 890 | alloc_address_wmem_ipv6(pinfo->pool, &pinfo->dst, &rpl_fulladdr); |
1441 | 890 | } |
1442 | 2.19k | } |
1443 | 70 | } |
1444 | | |
1445 | 76 | return tvb_captured_length(tvb); |
1446 | 78 | } |
1447 | | |
1448 | | /* Segment Routing Header (Type 4) */ |
1449 | | static int |
1450 | | dissect_routing6_srh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
1451 | 18 | { |
1452 | 18 | struct ws_rthdr *rt = (struct ws_rthdr *)data; |
1453 | 18 | int offset = 0; |
1454 | 18 | int addr_offset; |
1455 | 18 | uint32_t last_entry, addr_count; |
1456 | | |
1457 | 18 | proto_tree_add_item_ret_uint(tree, hf_ipv6_routing_srh_last_entry, |
1458 | 18 | tvb, offset, 1, ENC_BIG_ENDIAN, |
1459 | 18 | &last_entry); |
1460 | 18 | addr_count = last_entry + 1; |
1461 | 18 | offset += 1; |
1462 | | |
1463 | 18 | proto_tree_add_item(tree, hf_ipv6_routing_srh_flags, tvb, offset, 1, ENC_BIG_ENDIAN); |
1464 | 18 | offset += 1; |
1465 | | |
1466 | 18 | proto_tree_add_item(tree, hf_ipv6_routing_srh_tag, tvb, offset, 2, ENC_NA); |
1467 | 18 | offset += 2; |
1468 | | |
1469 | 18 | if (rt->hdr.ip6r_segleft > addr_count) { |
1470 | 4 | expert_add_info_format(pinfo, rt->ti_segleft, &ei_ipv6_routing_invalid_segleft, |
1471 | 4 | "IPv6 Type 4 Routing Header segments left field must not exceed address count (%u)", addr_count); |
1472 | 4 | } |
1473 | | |
1474 | 18 | if (pinfo->dst.type == AT_IPv6 && rt->hdr.ip6r_segleft > 0) { |
1475 | 5 | alloc_address_wmem_ipv6(pinfo->pool, &pinfo->dst, tvb_get_ptr_ipv6(tvb, offset)); |
1476 | 5 | } |
1477 | | |
1478 | 122 | for (unsigned i = 0; i < addr_count; i++) { |
1479 | 104 | addr_offset = offset + i * IPv6_ADDR_SIZE; |
1480 | 104 | _proto_tree_add_ipv6_vector_address(tree, pinfo, hf_ipv6_routing_srh_addr, tvb, |
1481 | 104 | addr_offset, IPv6_ADDR_SIZE, tvb_get_ptr_ipv6(tvb, addr_offset), i); |
1482 | 104 | } |
1483 | | |
1484 | | /* TODO: dissect TLVs */ |
1485 | | |
1486 | 18 | return tvb_captured_length(tvb); |
1487 | 18 | } |
1488 | | |
1489 | | /* Compact Routing Header 16 (Type 5) and Compact Routing Header 32 (Type 6). |
1490 | | https://tools.ietf.org/html/draft-bonica-6man-comp-rtg-hdr-23. */ |
1491 | | static int dissect_routing6_crh(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data) |
1492 | 50 | { |
1493 | 50 | int offset, minimum_crh_length; |
1494 | 50 | int sid; |
1495 | | |
1496 | 50 | unsigned sid_count; |
1497 | 50 | unsigned octets_per_sid; |
1498 | 50 | unsigned sids_beyond_first_word; |
1499 | 50 | unsigned sids_per_word; |
1500 | 50 | struct ws_rthdr* rt = (struct ws_rthdr*)data; |
1501 | 50 | bool is_crh16 = rt->hdr.ip6r_type == IPv6_RT_HEADER_COMPACT_16; |
1502 | 50 | uint8_t segments_left = rt->hdr.ip6r_segleft; |
1503 | | |
1504 | | /* Compute the minimum CRH length measured in 8-octet units, not including |
1505 | | the first 8 octets */ |
1506 | 50 | minimum_crh_length = -1; |
1507 | 50 | switch (rt->hdr.ip6r_type) { |
1508 | 20 | case IPv6_RT_HEADER_COMPACT_16: |
1509 | 20 | octets_per_sid = 2; |
1510 | 20 | sids_per_word = 4; |
1511 | 20 | sid_count = rt->hdr.ip6r_len * 4 + 2; |
1512 | 20 | if (segments_left <= 2) |
1513 | 8 | minimum_crh_length = 0; |
1514 | 20 | sids_beyond_first_word = segments_left - 2; |
1515 | 20 | break; |
1516 | 30 | case IPv6_RT_HEADER_COMPACT_32: |
1517 | 30 | octets_per_sid = 4; |
1518 | 30 | sids_per_word = 2; |
1519 | 30 | sid_count = rt->hdr.ip6r_len * 2 + 1; |
1520 | 30 | if (segments_left <= 1) |
1521 | 13 | minimum_crh_length = 0; |
1522 | 30 | sids_beyond_first_word = segments_left - 1; |
1523 | 30 | break; |
1524 | 0 | default: |
1525 | 0 | DISSECTOR_ASSERT_NOT_REACHED(); |
1526 | 50 | } |
1527 | 50 | if (minimum_crh_length) { |
1528 | 29 | minimum_crh_length = sids_beyond_first_word / sids_per_word; |
1529 | 29 | if (sids_beyond_first_word % sids_per_word) |
1530 | 24 | minimum_crh_length++; |
1531 | 29 | } |
1532 | 50 | if (minimum_crh_length > rt->hdr.ip6r_len) { |
1533 | 3 | expert_add_info_format(pinfo, rt->ti_len, &ei_ipv6_routing_invalid_length, |
1534 | 3 | "IPv6 Compact Routing Header minimum length must not exceed header length (%u)", |
1535 | 3 | rt->hdr.ip6r_len); |
1536 | 3 | } |
1537 | | |
1538 | 50 | offset = 0; |
1539 | 50 | if (is_crh16) { |
1540 | 20 | proto_item* current_sid_item = proto_tree_add_item(tree, hf_ipv6_routing_crh16_current_sid, |
1541 | 20 | tvb, offset + (octets_per_sid * segments_left), octets_per_sid, ENC_BIG_ENDIAN); |
1542 | 20 | proto_item_set_generated(current_sid_item); |
1543 | 30 | } else { |
1544 | 30 | proto_item* current_sid_item = proto_tree_add_item(tree, hf_ipv6_routing_crh32_current_sid, |
1545 | 30 | tvb, offset + (octets_per_sid * segments_left), octets_per_sid, ENC_BIG_ENDIAN); |
1546 | 30 | proto_item_set_generated(current_sid_item); |
1547 | 30 | } |
1548 | 50 | sid = is_crh16 ? tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN) |
1549 | 50 | : tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN); |
1550 | 50 | proto_tree* segment_ids |
1551 | 50 | = proto_tree_add_subtree(tree, tvb, 0, -1, 0, NULL, "Segment Identifiers"); |
1552 | 565 | for (unsigned i = 0; i < sid_count && sid; i++) { |
1553 | 515 | if (is_crh16) { |
1554 | 109 | proto_tree_add_uint_format(segment_ids, hf_ipv6_routing_crh16_segment_id, tvb, offset, |
1555 | 109 | octets_per_sid, sid, "SID[%d] = %d", i, sid); |
1556 | 406 | } else { |
1557 | 406 | proto_tree_add_uint_format(segment_ids, hf_ipv6_routing_crh32_segment_id, tvb, offset, |
1558 | 406 | octets_per_sid, sid, "SID[%d] = %d", i, sid); |
1559 | 406 | } |
1560 | 515 | offset += octets_per_sid; |
1561 | 515 | sid = is_crh16 ? tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN) |
1562 | 515 | : tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN); |
1563 | 515 | } |
1564 | | |
1565 | 50 | return tvb_captured_length(tvb); |
1566 | 50 | } |
1567 | | |
1568 | | /* |
1569 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1570 | | | Next Header | Hdr Ext Len | Routing Type | Segments Left | |
1571 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1572 | | | | |
1573 | | . . |
1574 | | . type-specific data . |
1575 | | . . |
1576 | | | | |
1577 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1578 | | */ |
1579 | | static int |
1580 | 294 | dissect_routing6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { |
1581 | 294 | struct ws_rthdr rt; |
1582 | 294 | unsigned nxt, hdr_len, total_len; |
1583 | 294 | proto_tree *rt_tree, *root_tree; |
1584 | 294 | proto_item *pi, *ti, *ti_hdr_len, *ti_type, *ti_segs; |
1585 | 294 | int offset = 0; |
1586 | 294 | tvbuff_t *next_tvb; |
1587 | 294 | int type, type_len; |
1588 | 294 | dissector_handle_t type_dissector; |
1589 | | |
1590 | 294 | col_append_sep_str(pinfo->cinfo, COL_INFO, " , ", "IPv6 routing"); |
1591 | | |
1592 | 294 | root_tree = p_ipv6_pinfo_select_root(pinfo, tree); |
1593 | | |
1594 | 294 | pi = proto_tree_add_item(root_tree, proto_ipv6_routing, tvb, offset, -1, ENC_NA); |
1595 | 294 | rt_tree = proto_item_add_subtree(pi, ett_ipv6_routing_proto); |
1596 | | |
1597 | 294 | proto_tree_add_item(rt_tree, hf_ipv6_routing_nxt, tvb, offset, 1, ENC_BIG_ENDIAN); |
1598 | 294 | nxt = tvb_get_uint8(tvb, offset); |
1599 | 294 | offset += 1; |
1600 | | |
1601 | 294 | ti_hdr_len = proto_tree_add_item(rt_tree, hf_ipv6_routing_len, tvb, offset, 1, ENC_BIG_ENDIAN); |
1602 | 294 | hdr_len = tvb_get_uint8(tvb, offset); |
1603 | | /* |
1604 | | Hdr Ext Len 8-bit unsigned integer. Length of the Routing |
1605 | | header in 8-octet units, not including the |
1606 | | first 8 octets. |
1607 | | */ |
1608 | 294 | total_len = (hdr_len + 1) * 8; |
1609 | 294 | type_len = total_len - 4; |
1610 | | |
1611 | 294 | proto_item_set_len(pi, total_len); |
1612 | 294 | ti = proto_tree_add_uint(rt_tree, hf_ipv6_routing_len_oct, tvb, offset, 1, total_len); |
1613 | 294 | proto_item_set_generated(ti); |
1614 | 294 | if (ipv6_exthdr_hide_len_oct_field) { |
1615 | 0 | proto_item_set_hidden(ti); |
1616 | 0 | proto_item_append_text(ti_hdr_len, " (%d bytes)", total_len); |
1617 | 0 | } |
1618 | 294 | p_ipv6_pinfo_add_len(pinfo, total_len); |
1619 | 294 | offset += 1; |
1620 | | |
1621 | 294 | ti_type = proto_tree_add_item(rt_tree, hf_ipv6_routing_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
1622 | 294 | type = tvb_get_uint8(tvb, offset); |
1623 | 294 | proto_item_append_text(pi, " (%s)", val_to_str(type, routing_header_type, "Unknown type %u")); |
1624 | 294 | offset += 1; |
1625 | | |
1626 | 294 | ti_segs = proto_tree_add_item(rt_tree, hf_ipv6_routing_segleft, tvb, offset, 1, ENC_BIG_ENDIAN); |
1627 | 294 | offset += 1; |
1628 | | |
1629 | 294 | type_dissector = dissector_get_uint_handle(ipv6_routing_dissector_table, type); |
1630 | 294 | if (type_dissector != NULL) { |
1631 | 253 | tvb_memcpy(tvb, &(rt.hdr), 0, 4); |
1632 | 253 | rt.ti_len = ti_hdr_len; |
1633 | 253 | rt.ti_type = ti_type; |
1634 | 253 | rt.ti_segleft = ti_segs; |
1635 | 253 | call_dissector_with_data(type_dissector, tvb_new_subset_length(tvb, offset, type_len), pinfo, rt_tree, &rt); |
1636 | 253 | } |
1637 | 41 | else { |
1638 | | /* Unknown Routing Header Type */ |
1639 | 41 | ti = proto_tree_add_item(rt_tree, hf_ipv6_routing_unknown_data, tvb, offset, type_len, ENC_NA); |
1640 | 41 | expert_add_info(pinfo, ti, &ei_ipv6_routing_undecoded); |
1641 | 41 | } |
1642 | | |
1643 | 294 | p_add_ipv6_nxt(pinfo, nxt); |
1644 | | |
1645 | 294 | next_tvb = tvb_new_subset_remaining(tvb, total_len); |
1646 | 294 | ipv6_dissect_next(nxt, next_tvb, pinfo, tree, (ws_ip6 *)data); |
1647 | 294 | return tvb_captured_length(tvb); |
1648 | 294 | } |
1649 | | |
1650 | | static int |
1651 | 121 | dissect_fraghdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { |
1652 | 121 | proto_item *pi, *ti; |
1653 | 121 | proto_tree *frag_tree, *root_tree; |
1654 | 121 | uint8_t nxt; |
1655 | 121 | uint16_t offlg; |
1656 | 121 | uint16_t frag_off; |
1657 | 121 | bool frag_flg; |
1658 | 121 | uint32_t frag_ident; |
1659 | 121 | int offset = 0; |
1660 | 121 | ipv6_pinfo_t *ipv6_pinfo; |
1661 | 121 | bool show_data = false; |
1662 | 121 | bool reassembled; |
1663 | 121 | tvbuff_t *next_tvb; |
1664 | | |
1665 | 121 | nxt = tvb_get_uint8(tvb, offset); |
1666 | 121 | offlg = tvb_get_ntohs(tvb, offset + 2); |
1667 | 121 | frag_off = offlg & IP6F_OFF_MASK; /* offset in bytes */ |
1668 | 121 | frag_flg = offlg & IP6F_MORE_FRAG; |
1669 | 121 | frag_ident = tvb_get_ntohl(tvb, offset + 4); |
1670 | 121 | col_add_fstr(pinfo->cinfo, COL_INFO, "IPv6 fragment (off=%u more=%s ident=0x%08x nxt=%u)", |
1671 | 121 | frag_off, frag_flg ? "y" : "n", frag_ident, nxt); |
1672 | | |
1673 | 121 | root_tree = p_ipv6_pinfo_select_root(pinfo, tree); |
1674 | 121 | ipv6_pinfo = p_ipv6_pinfo_add_len(pinfo, IPv6_FRAGMENT_HDR_SIZE); |
1675 | | |
1676 | | /* IPv6 Fragmentation Header has fixed length of 8 bytes */ |
1677 | 121 | pi = proto_tree_add_item(root_tree, proto_ipv6_fraghdr, tvb, offset, IPv6_FRAGMENT_HDR_SIZE, ENC_NA); |
1678 | 121 | if (ipv6_pinfo != NULL && ipv6_pinfo->jumbo_plen != 0) { |
1679 | 0 | expert_add_info(pinfo, pi, &ei_ipv6_opt_jumbo_fragment); |
1680 | 0 | } |
1681 | | |
1682 | 121 | frag_tree = proto_item_add_subtree(pi, ett_ipv6_fraghdr_proto); |
1683 | | |
1684 | 121 | proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_nxt, tvb, offset, 1, ENC_BIG_ENDIAN); |
1685 | 121 | offset += 1; |
1686 | | |
1687 | 121 | proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_reserved_octet, tvb, offset, 1, ENC_BIG_ENDIAN); |
1688 | 121 | offset += 1; |
1689 | | |
1690 | 121 | ti = proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_offset, tvb, offset, 2, ENC_BIG_ENDIAN); |
1691 | 121 | proto_item_append_text(ti, " (%d bytes)", frag_off); |
1692 | | |
1693 | 121 | proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_reserved_bits, tvb, offset, 2, ENC_BIG_ENDIAN); |
1694 | | |
1695 | 121 | proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_more, tvb, offset, 2, ENC_BIG_ENDIAN); |
1696 | 121 | offset += 2; |
1697 | | |
1698 | 121 | proto_tree_add_item(frag_tree, hf_ipv6_fraghdr_ident, tvb, offset, 4, ENC_BIG_ENDIAN); |
1699 | 121 | offset += 4; |
1700 | | |
1701 | 121 | if (ipv6_pinfo != NULL && ipv6_pinfo->frag_plen > 0) { |
1702 | 21 | if ((frag_off != 0) || frag_flg) { |
1703 | 7 | reassembled = ipv6_reassemble_do(&tvb, &offset, pinfo, root_tree, ipv6_pinfo->frag_plen, |
1704 | 7 | frag_off, frag_flg, frag_ident, &show_data); |
1705 | 7 | if (show_data) { |
1706 | 5 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
1707 | 5 | call_data_dissector(next_tvb, pinfo, tree); |
1708 | 5 | return tvb_captured_length(tvb); |
1709 | 5 | } |
1710 | 2 | if (reassembled) { |
1711 | 0 | ipv6_pinfo->frag_plen = 0; |
1712 | 0 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
1713 | 0 | ipv6_dissect_next(nxt, next_tvb, pinfo, tree, (ws_ip6 *)data); |
1714 | 0 | return tvb_captured_length(tvb); |
1715 | 0 | } |
1716 | 2 | } |
1717 | 21 | } |
1718 | | |
1719 | 116 | p_add_ipv6_nxt(pinfo, nxt); |
1720 | | |
1721 | 116 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
1722 | 116 | ipv6_dissect_next(nxt, next_tvb, pinfo, tree, (ws_ip6 *)data); |
1723 | 116 | return tvb_captured_length(tvb); |
1724 | 121 | } |
1725 | | |
1726 | | struct opt_proto_item { |
1727 | | proto_item *type, *len; |
1728 | | proto_tree *root_tree; |
1729 | | }; |
1730 | | |
1731 | | /* |
1732 | | * Jumbo Payload Option |
1733 | | * |
1734 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1735 | | | Option Type | Opt Data Len | |
1736 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1737 | | | Jumbo Payload Length | |
1738 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1739 | | */ |
1740 | | static int |
1741 | | dissect_opt_jumbo(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
1742 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
1743 | 221 | { |
1744 | 221 | proto_item *pi = proto_tree_get_parent(opt_tree); |
1745 | 221 | proto_item *ti; |
1746 | 221 | uint32_t jumbo_plen = 0; |
1747 | 221 | ipv6_pinfo_t *ipv6_pinfo = p_get_ipv6_pinfo(pinfo); |
1748 | | |
1749 | 221 | if (opt_len != 4) { |
1750 | 211 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1751 | 211 | "Jumbo Payload: Invalid length (%u bytes)", opt_len); |
1752 | 211 | } |
1753 | 221 | ti = proto_tree_add_item_ret_uint(opt_tree, hf_ipv6_opt_jumbo, tvb, offset, 4, ENC_BIG_ENDIAN, &jumbo_plen); |
1754 | 221 | offset += 4; |
1755 | | |
1756 | 221 | if (ipv6_pinfo != NULL && ipv6_pinfo->ip6_plen != 0) { |
1757 | 96 | expert_add_info(pinfo, pi, &ei_ipv6_opt_jumbo_prohibited); |
1758 | 96 | } |
1759 | 221 | if (jumbo_plen < 65536) { |
1760 | 34 | expert_add_info(pinfo, ti, &ei_ipv6_opt_jumbo_truncated); |
1761 | 34 | } |
1762 | | |
1763 | 221 | return offset; |
1764 | 221 | } |
1765 | | |
1766 | | /* |
1767 | | * RPL Option |
1768 | | * |
1769 | | 0 1 2 3 |
1770 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
1771 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1772 | | | Option Type | Opt Data Len | |
1773 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1774 | | |O|R|F|0|0|0|0|0| RPLInstanceID | SenderRank | |
1775 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1776 | | | (sub-TLVs) | |
1777 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1778 | | */ |
1779 | | static int |
1780 | | dissect_opt_rpl(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
1781 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
1782 | 306 | { |
1783 | 306 | static int * const rpl_flags[] = { |
1784 | 306 | &hf_ipv6_opt_rpl_flag_o, |
1785 | 306 | &hf_ipv6_opt_rpl_flag_r, |
1786 | 306 | &hf_ipv6_opt_rpl_flag_f, |
1787 | 306 | &hf_ipv6_opt_rpl_flag_rsv, |
1788 | 306 | NULL |
1789 | 306 | }; |
1790 | | |
1791 | 306 | if (opt_len < 4) { |
1792 | 77 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1793 | 77 | "RPL Option: Invalid length (%u bytes)", opt_len); |
1794 | 77 | } |
1795 | 306 | proto_tree_add_bitmask(opt_tree, tvb, offset, hf_ipv6_opt_rpl_flag, ett_ipv6_opt_rpl, rpl_flags, ENC_NA); |
1796 | 306 | offset += 1; |
1797 | 306 | proto_tree_add_item(opt_tree, hf_ipv6_opt_rpl_instance_id, tvb, offset, 1, ENC_NA); |
1798 | 306 | offset += 1; |
1799 | 306 | proto_tree_add_item(opt_tree, hf_ipv6_opt_rpl_senderrank, tvb, offset, 2, ENC_BIG_ENDIAN); |
1800 | 306 | offset += 2; |
1801 | | |
1802 | | /* TODO: Add dissection of sub-TLVs */ |
1803 | | |
1804 | 306 | return offset; |
1805 | 306 | } |
1806 | | |
1807 | | /* |
1808 | | * Tunnel Encapsulation Limit Option |
1809 | | * |
1810 | | Option Type Opt Data Len Opt Data Len |
1811 | | 0 1 2 3 4 5 6 7 |
1812 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1813 | | |0 0 0 0 0 1 0 0| 1 | Tun Encap Lim | |
1814 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1815 | | */ |
1816 | | static int |
1817 | | dissect_opt_tel(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
1818 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
1819 | 346 | { |
1820 | 346 | if (opt_len != 1) { |
1821 | 330 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1822 | 330 | "Tunnel Encapsulation Limit: Invalid length (%u bytes)", opt_len); |
1823 | 330 | } |
1824 | 346 | proto_tree_add_item(opt_tree, hf_ipv6_opt_tel, tvb, offset, 1, ENC_BIG_ENDIAN); |
1825 | 346 | offset += 1; |
1826 | | |
1827 | 346 | return offset; |
1828 | 346 | } |
1829 | | |
1830 | | /* |
1831 | | * IPv6 Minimum Path MTU Hop by Hop Option |
1832 | | * |
1833 | | |
1834 | | Option Option Option |
1835 | | Type Data Len Data |
1836 | | +--------+--------+--------+--------+---------+-------+-+ |
1837 | | |BBCTTTTT|00000100| Min-PMTU | Rtn-PMTU |R| |
1838 | | +--------+--------+--------+--------+---------+-------+-+ |
1839 | | |
1840 | | Option Type: |
1841 | | |
1842 | | BB 00 Skip over this option and continue processing. |
1843 | | |
1844 | | C 1 Option data can change en route to the packet's final |
1845 | | destination. |
1846 | | |
1847 | | TTTTT 10000 Option Type assigned from IANA [IANA-HBH]. |
1848 | | |
1849 | | Length: 4 The size of the each value field in Option Data |
1850 | | field supports Path MTU values from 0 to 65,535 octets. |
1851 | | |
1852 | | Min-PMTU: n 16-bits. The minimum PMTU in octets, reflecting the |
1853 | | smallest link MTU that the packet experienced across |
1854 | | the path. This is called the Reported PMTU. A value |
1855 | | less than the IPv6 minimum link MTU [RFC8200] |
1856 | | should be ignored. |
1857 | | |
1858 | | Rtn-PMTU: n 15-bits. The returned minimum PMTU, carrying the 15 |
1859 | | most significant bits of the latest received Min-PMTU |
1860 | | field. The value zero means that no Reported MTU is |
1861 | | being returned. |
1862 | | |
1863 | | R n 1-bit. R-Flag. Set by the source to signal that |
1864 | | the destination should include the received |
1865 | | Reported PMTU in Rtn-PMTU field. |
1866 | | |
1867 | | [IANA-HBH] |
1868 | | "Destination Options and Hop-by-Hop Options", |
1869 | | <https://www.iana.org/assignments/ipv6-parameters/ |
1870 | | ipv6-parameters.xhtml#ipv6-parameters-2> |
1871 | | */ |
1872 | | static int |
1873 | | dissect_opt_pmtu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
1874 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
1875 | 227 | { |
1876 | 227 | uint16_t val; |
1877 | | |
1878 | 227 | if (opt_len != 4) { |
1879 | 205 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1880 | 205 | "PMTU Option: Invalid Length (%u bytes)", opt_len); |
1881 | 205 | } |
1882 | | |
1883 | 227 | proto_tree_add_item(opt_tree, hf_ipv6_opt_pmtu_min, tvb, offset, 2, ENC_BIG_ENDIAN); |
1884 | 227 | offset += 2; |
1885 | 227 | val = tvb_get_ntohs(tvb, offset); |
1886 | 227 | proto_tree_add_uint(opt_tree, hf_ipv6_opt_pmtu_rtn, tvb, offset, 2, val & 0xFFFE); |
1887 | 227 | offset += 1; |
1888 | 227 | proto_tree_add_boolean(opt_tree, hf_ipv6_opt_pmtu_rtn_flag, tvb, offset, 1, val & 0x0001); |
1889 | 227 | offset += 1; |
1890 | | |
1891 | 227 | return offset; |
1892 | 227 | } |
1893 | | |
1894 | | /* |
1895 | | * IETF APN6 |
1896 | | * |
1897 | | * Application-Aware IPv6 Networking (APN6) |
1898 | | * |
1899 | | * https://datatracker.ietf.org/wg/apn/about/ |
1900 | | * https://datatracker.ietf.org/doc/draft-li-apn-header/ |
1901 | | * https://datatracker.ietf.org/doc/draft-li-apn-ipv6-encap/ |
1902 | | * |
1903 | | * 0 1 2 3 |
1904 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
1905 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1906 | | | APN-ID-Type | Flags | APN-Para-Type | |
1907 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1908 | | | APN-ID | |
1909 | | | (32-bit/64-bit/128-bit) | |
1910 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1911 | | * */ |
1912 | | static int |
1913 | | dissect_opt_apn6(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
1914 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
1915 | 192 | { |
1916 | 192 | if (opt_len < 8) { |
1917 | 67 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1918 | 67 | "APN6 Option: Invalid Length (%u bytes) for basic APN header and shortest APN ID(32-bit)", opt_len); |
1919 | 67 | } |
1920 | | |
1921 | 192 | uint32_t parsed_offset = 0; // offset is for DOH header; parsed_offset is for APN option. |
1922 | 192 | proto_tree *sub_tree = proto_tree_add_subtree(opt_tree, tvb, offset, opt_len, 0, NULL, "APN Header"); |
1923 | | |
1924 | 192 | uint8_t apn_id_type = tvb_get_uint8(tvb, offset); |
1925 | 192 | proto_item *apn_id_type_i = proto_tree_add_item(sub_tree, hf_ipv6_opt_apn_id_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
1926 | | |
1927 | 192 | offset++; |
1928 | 192 | parsed_offset++; |
1929 | | |
1930 | 192 | if (apn_id_type < APN_ID_32BIT || apn_id_type > APN_ID_128BIT) { |
1931 | 152 | expert_add_info_format(pinfo, apn_id_type_i, &ei_ipv6_opt_apn_invalid_id_type, |
1932 | 152 | "APN6 Option: Invalid APN ID Type (%u)", apn_id_type); |
1933 | 152 | } |
1934 | | |
1935 | | |
1936 | 192 | proto_tree_add_item(sub_tree, hf_ipv6_opt_apn_flags, tvb, offset, 1, ENC_BIG_ENDIAN); |
1937 | 192 | offset++; |
1938 | 192 | parsed_offset++; |
1939 | | |
1940 | 192 | proto_tree_add_item(sub_tree, hf_ipv6_opt_apn_param_type, tvb, offset, 2, ENC_BIG_ENDIAN); |
1941 | 192 | offset += 2; |
1942 | 192 | parsed_offset += 2; |
1943 | | |
1944 | | |
1945 | 192 | if (apn_id_type >= APN_ID_32BIT) { |
1946 | 151 | proto_tree_add_item(sub_tree, hf_ipv6_opt_apn_id_part1, tvb, offset, 4, ENC_BIG_ENDIAN); |
1947 | 151 | offset += 4; |
1948 | 151 | parsed_offset += 4; |
1949 | 151 | } |
1950 | 192 | if (apn_id_type >= APN_ID_64BIT) { |
1951 | 120 | if (opt_len - parsed_offset < 4) { |
1952 | 6 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1953 | 6 | "APN6 Option: Invalid Length (%u bytes) for 64-bit APN ID, parsed offset %u", |
1954 | 6 | opt_len, parsed_offset); |
1955 | 6 | } |
1956 | 120 | proto_tree_add_item(sub_tree, hf_ipv6_opt_apn_id_part2, tvb, offset, 4, ENC_BIG_ENDIAN); |
1957 | 120 | offset += 4; |
1958 | 120 | parsed_offset += 4; |
1959 | 120 | } |
1960 | 192 | if (apn_id_type >= APN_ID_128BIT) { |
1961 | 110 | if (opt_len - parsed_offset < 8) { |
1962 | 85 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1963 | 85 | "APN6 Option: Invalid Length (%u bytes) for 128-bit APN ID, parsed offset %u", |
1964 | 85 | opt_len, parsed_offset); |
1965 | 85 | } |
1966 | | |
1967 | 110 | proto_tree_add_item(sub_tree, hf_ipv6_opt_apn_id_part3, tvb, offset, 4, ENC_BIG_ENDIAN); |
1968 | 110 | offset += 4; |
1969 | | |
1970 | 110 | proto_tree_add_item(sub_tree, hf_ipv6_opt_apn_id_part4, tvb, offset, 4, ENC_BIG_ENDIAN); |
1971 | 110 | offset += 4; |
1972 | 110 | } |
1973 | | |
1974 | 192 | return offset; |
1975 | 192 | } |
1976 | | |
1977 | | |
1978 | | /* |
1979 | | * IPv6 Router Alert Option |
1980 | | * |
1981 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1982 | | |0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) | |
1983 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1984 | | length = 2 |
1985 | | */ |
1986 | | static int |
1987 | | dissect_opt_rtalert(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
1988 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
1989 | 201 | { |
1990 | 201 | if (opt_len != 2) { |
1991 | 186 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
1992 | 186 | "Router alert: Invalid Length (%u bytes)", opt_len); |
1993 | 186 | } |
1994 | 201 | proto_tree_add_item(opt_tree, hf_ipv6_opt_rtalert, tvb, offset, 2, ENC_BIG_ENDIAN); |
1995 | 201 | offset += 2; |
1996 | | |
1997 | 201 | return offset; |
1998 | 201 | } |
1999 | | |
2000 | | /* |
2001 | | * Quick-Start Option for IPv6 |
2002 | | * |
2003 | | 0 1 2 3 |
2004 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2005 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2006 | | | Option | Length=6 | Func. | Rate | Not Used | |
2007 | | | | | 1000 | Report| | |
2008 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2009 | | | QS Nonce | R | |
2010 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2011 | | */ |
2012 | | static int |
2013 | | dissect_opt_quickstart(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
2014 | | struct opt_proto_item *opt_ti, uint8_t opt_len, ws_ip6 *iph) |
2015 | 275 | { |
2016 | 275 | proto_item *pi = proto_tree_get_parent(opt_tree); |
2017 | 275 | proto_item *ti; |
2018 | 275 | uint8_t command, function, rate; |
2019 | 275 | uint32_t qs_ttl = 0; |
2020 | | |
2021 | 275 | if (opt_len != 6) { |
2022 | 266 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2023 | 266 | "Quick-Start: Invalid Length (%u bytes)", opt_len); |
2024 | 266 | } |
2025 | | |
2026 | 275 | command = tvb_get_uint8(tvb, offset); |
2027 | 275 | function = command >> 4; |
2028 | 275 | rate = command & QS_RATE_MASK; |
2029 | | |
2030 | 275 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_func, tvb, offset, 1, ENC_BIG_ENDIAN); |
2031 | | |
2032 | 275 | switch (function) { |
2033 | 78 | case QS_RATE_REQUEST: |
2034 | 78 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_rate, tvb, offset, 1, ENC_BIG_ENDIAN); |
2035 | 78 | offset += 1; |
2036 | 78 | proto_tree_add_item_ret_uint(opt_tree, hf_ipv6_opt_qs_ttl, tvb, offset, 1, ENC_BIG_ENDIAN, &qs_ttl); |
2037 | 78 | proto_item_append_text(pi, ", %s, QS TTL %u", |
2038 | 78 | val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown (%u)"), |
2039 | 78 | qs_ttl); |
2040 | 78 | if (iph != NULL) { |
2041 | 63 | uint8_t ttl_diff; |
2042 | | |
2043 | 63 | ttl_diff = (iph->ip6_hop - qs_ttl) % 256; |
2044 | 63 | ti = proto_tree_add_uint(opt_tree, hf_ipv6_opt_qs_ttl_diff, tvb, offset, 1, ttl_diff); |
2045 | 63 | proto_item_set_generated(ti); |
2046 | 63 | proto_item_append_text(pi, ", QS TTL diff %u", ttl_diff); |
2047 | 63 | } |
2048 | 78 | offset += 1; |
2049 | 78 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_nonce, tvb, offset, 4, ENC_BIG_ENDIAN); |
2050 | 78 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_reserved, tvb, offset, 4, ENC_BIG_ENDIAN); |
2051 | 78 | offset += 4; |
2052 | 78 | break; |
2053 | 11 | case QS_RATE_REPORT: |
2054 | 11 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_rate, tvb, offset, 1, ENC_BIG_ENDIAN); |
2055 | 11 | proto_item_append_text(pi, ", %s", val_to_str_ext(rate, &qs_rate_vals_ext, "Unknown (%u)")); |
2056 | 11 | offset += 1; |
2057 | 11 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_unused, tvb, offset, 1, ENC_BIG_ENDIAN); |
2058 | 11 | offset += 1; |
2059 | 11 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_nonce, tvb, offset, 4, ENC_BIG_ENDIAN); |
2060 | 11 | proto_tree_add_item(opt_tree, hf_ipv6_opt_qs_reserved, tvb, offset, 4, ENC_BIG_ENDIAN); |
2061 | 11 | offset += 4; |
2062 | 11 | break; |
2063 | 185 | default: |
2064 | 185 | break; |
2065 | 275 | } |
2066 | | |
2067 | 266 | return offset; |
2068 | 275 | } |
2069 | | |
2070 | | static const value_string ipv6_ioam_opt_types[] = { |
2071 | | { IP6IOAM_PRE_TRACE, "Pre-allocated Trace" }, |
2072 | | { IP6IOAM_INC_TRACE, "Incremental Trace" }, |
2073 | | { IP6IOAM_POT, "Proof of Transit" }, |
2074 | | { IP6IOAM_E2E, "Edge to Edge" }, |
2075 | | { IP6IOAM_DEX, "Direct Export" }, |
2076 | | { 0, NULL} |
2077 | | }; |
2078 | | |
2079 | | static int |
2080 | | dissect_opt_ioam_trace_node(tvbuff_t *tvb, int offset, |
2081 | | proto_tree *opt_tree, uint32_t trace_type) |
2082 | 668 | { |
2083 | 668 | proto_tree* sub_tree; |
2084 | | |
2085 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT0) { |
2086 | 85 | sub_tree = proto_tree_add_subtree(opt_tree, tvb, offset, 4, 0, NULL, |
2087 | 85 | "Hop_Lim and Node ID (short)"); |
2088 | 85 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_hlim, |
2089 | 85 | tvb, offset, 1, ENC_NA); |
2090 | 85 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_id, |
2091 | 85 | tvb, offset + 1, 3, ENC_BIG_ENDIAN); |
2092 | 85 | offset += 4; |
2093 | 85 | } |
2094 | | |
2095 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT1) { |
2096 | 36 | sub_tree = proto_tree_add_subtree(opt_tree, tvb, offset, 4, 0, NULL, |
2097 | 36 | "Ingress and Egress IDs (short)"); |
2098 | 36 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_iif, |
2099 | 36 | tvb, offset, 2, ENC_BIG_ENDIAN); |
2100 | 36 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_eif, |
2101 | 36 | tvb, offset + 2, 2, ENC_BIG_ENDIAN); |
2102 | 36 | offset += 4; |
2103 | 36 | } |
2104 | | |
2105 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT2) { |
2106 | 68 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_tss, |
2107 | 68 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2108 | 68 | offset += 4; |
2109 | 68 | } |
2110 | | |
2111 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT3) { |
2112 | 24 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_tsf, |
2113 | 24 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2114 | 24 | offset += 4; |
2115 | 24 | } |
2116 | | |
2117 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT4) { |
2118 | 52 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_trdelay, |
2119 | 52 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2120 | 52 | offset += 4; |
2121 | 52 | } |
2122 | | |
2123 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT5) { |
2124 | 47 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_nsdata, |
2125 | 47 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2126 | 47 | offset += 4; |
2127 | 47 | } |
2128 | | |
2129 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT6) { |
2130 | 108 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_qdepth, |
2131 | 108 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2132 | 108 | offset += 4; |
2133 | 108 | } |
2134 | | |
2135 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT7) { |
2136 | 111 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_csum, |
2137 | 111 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2138 | 111 | offset += 4; |
2139 | 111 | } |
2140 | | |
2141 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT8) { |
2142 | 26 | sub_tree = proto_tree_add_subtree(opt_tree, tvb, offset, 8, 0, NULL, |
2143 | 26 | "Hop_Lim and Node ID (wide)"); |
2144 | 26 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_hlim, |
2145 | 26 | tvb, offset, 1, ENC_NA); |
2146 | 26 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_id_wide, |
2147 | 26 | tvb, offset + 1, 7, ENC_BIG_ENDIAN); |
2148 | 26 | offset += 8; |
2149 | 26 | } |
2150 | | |
2151 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT9) { |
2152 | 24 | sub_tree = proto_tree_add_subtree(opt_tree, tvb, offset, 8, 0, NULL, |
2153 | 24 | "Ingress and Egress IDs (wide)"); |
2154 | 24 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_iif_wide, |
2155 | 24 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2156 | 24 | proto_tree_add_item(sub_tree, hf_ipv6_opt_ioam_trace_node_eif_wide, |
2157 | 24 | tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
2158 | 24 | offset += 8; |
2159 | 24 | } |
2160 | | |
2161 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT10) { |
2162 | 65 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_nsdata_wide, |
2163 | 65 | tvb, offset, 8, ENC_BIG_ENDIAN); |
2164 | 65 | offset += 8; |
2165 | 65 | } |
2166 | | |
2167 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT11) { |
2168 | 27 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_bufoccup, |
2169 | 27 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2170 | 27 | offset += 4; |
2171 | 27 | } |
2172 | | |
2173 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT12) { |
2174 | 53 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2175 | 53 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2176 | 53 | offset += 4; |
2177 | 53 | } |
2178 | | |
2179 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT13) { |
2180 | 65 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2181 | 65 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2182 | 65 | offset += 4; |
2183 | 65 | } |
2184 | | |
2185 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT14) { |
2186 | 87 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2187 | 87 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2188 | 87 | offset += 4; |
2189 | 87 | } |
2190 | | |
2191 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT15) { |
2192 | 128 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2193 | 128 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2194 | 128 | offset += 4; |
2195 | 128 | } |
2196 | | |
2197 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT16) { |
2198 | 66 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2199 | 66 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2200 | 66 | offset += 4; |
2201 | 66 | } |
2202 | | |
2203 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT17) { |
2204 | 123 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2205 | 123 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2206 | 123 | offset += 4; |
2207 | 123 | } |
2208 | | |
2209 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT18) { |
2210 | 60 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2211 | 60 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2212 | 60 | offset += 4; |
2213 | 60 | } |
2214 | | |
2215 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT19) { |
2216 | 89 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2217 | 89 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2218 | 89 | offset += 4; |
2219 | 89 | } |
2220 | | |
2221 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT20) { |
2222 | 53 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2223 | 53 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2224 | 53 | offset += 4; |
2225 | 53 | } |
2226 | | |
2227 | 668 | if (trace_type & IP6IOAM_TRACE_MASK_BIT21) { |
2228 | 91 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_node_undefined, |
2229 | 91 | tvb, offset, 4, ENC_BIG_ENDIAN); |
2230 | 91 | offset += 4; |
2231 | 91 | } |
2232 | | |
2233 | 668 | return offset; |
2234 | 668 | } |
2235 | | |
2236 | | /* |
2237 | | * IOAM Trace Option Header |
2238 | | * |
2239 | | 0 1 2 3 |
2240 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2241 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2242 | | | Namespace-ID | NodeLen | Flags | RemainingLen| |
2243 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2244 | | | IOAM-Trace-Type | Reserved | |
2245 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<-+ |
2246 | | | | | |
2247 | | | node data list [0] | | |
2248 | | | | | |
2249 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ D |
2250 | | | | a |
2251 | | | node data list [1] | t |
2252 | | | | a |
2253 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2254 | | ~ ........ ~ S |
2255 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ p |
2256 | | | | a |
2257 | | | node data list [n-1] | c |
2258 | | | | e |
2259 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
2260 | | | | | |
2261 | | | node data list [n] | | |
2262 | | | | | |
2263 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<-+ |
2264 | | */ |
2265 | | static int |
2266 | | dissect_opt_ioam_trace(tvbuff_t *tvb, int offset, packet_info *pinfo, |
2267 | | proto_tree *opt_tree, struct opt_proto_item *opt_ti, uint8_t opt_len) |
2268 | 371 | { |
2269 | 371 | proto_item *ti; |
2270 | 371 | uint32_t trace_type, oss_scid; |
2271 | 371 | uint16_t len; |
2272 | 371 | uint8_t remlen, nodelen, oss_len, i = 0; |
2273 | 371 | int new_offset; |
2274 | | |
2275 | 371 | static int * const ioam_trace_flags[] = { |
2276 | 371 | &hf_ipv6_opt_ioam_trace_flag_o, |
2277 | 371 | &hf_ipv6_opt_ioam_trace_flag_l, |
2278 | 371 | &hf_ipv6_opt_ioam_trace_flag_a, |
2279 | 371 | &hf_ipv6_opt_ioam_trace_flag_rsv, |
2280 | 371 | NULL |
2281 | 371 | }; |
2282 | | |
2283 | 371 | static int * const ioam_trace_types[] = { |
2284 | 371 | &hf_ipv6_opt_ioam_trace_type_bit0, |
2285 | 371 | &hf_ipv6_opt_ioam_trace_type_bit1, |
2286 | 371 | &hf_ipv6_opt_ioam_trace_type_bit2, |
2287 | 371 | &hf_ipv6_opt_ioam_trace_type_bit3, |
2288 | 371 | &hf_ipv6_opt_ioam_trace_type_bit4, |
2289 | 371 | &hf_ipv6_opt_ioam_trace_type_bit5, |
2290 | 371 | &hf_ipv6_opt_ioam_trace_type_bit6, |
2291 | 371 | &hf_ipv6_opt_ioam_trace_type_bit7, |
2292 | 371 | &hf_ipv6_opt_ioam_trace_type_bit8, |
2293 | 371 | &hf_ipv6_opt_ioam_trace_type_bit9, |
2294 | 371 | &hf_ipv6_opt_ioam_trace_type_bit10, |
2295 | 371 | &hf_ipv6_opt_ioam_trace_type_bit11, |
2296 | 371 | &hf_ipv6_opt_ioam_trace_type_undef, |
2297 | 371 | &hf_ipv6_opt_ioam_trace_type_bit22, |
2298 | 371 | &hf_ipv6_opt_ioam_trace_type_rsv, |
2299 | 371 | NULL |
2300 | 371 | }; |
2301 | | |
2302 | 371 | if (opt_len < 10) { |
2303 | 171 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2304 | 171 | "IOAM Option: Invalid length (%u bytes)", opt_len); |
2305 | 171 | } |
2306 | | |
2307 | 371 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_ns, tvb, offset, 2, ENC_BIG_ENDIAN); |
2308 | 371 | offset += 2; |
2309 | | |
2310 | 371 | nodelen = tvb_get_bits8(tvb, offset * 8, 5); |
2311 | 371 | proto_tree_add_bits_item(opt_tree, hf_ipv6_opt_ioam_trace_nodelen, tvb, |
2312 | 371 | offset * 8, 5, ENC_BIG_ENDIAN); |
2313 | | |
2314 | 371 | proto_tree_add_bitmask(opt_tree, tvb, offset, hf_ipv6_opt_ioam_trace_flags, |
2315 | 371 | ett_ipv6_opt_ioam_trace_flags, ioam_trace_flags, ENC_BIG_ENDIAN); |
2316 | | |
2317 | 371 | remlen = tvb_get_bits8(tvb, offset * 8 + 9, 7); |
2318 | 371 | ti = proto_tree_add_bits_item(opt_tree, hf_ipv6_opt_ioam_trace_remlen, tvb, |
2319 | 371 | offset * 8 + 9, 7, ENC_BIG_ENDIAN); |
2320 | 371 | if (remlen * 4 > opt_len - 10) { |
2321 | 186 | expert_add_info_format(pinfo, ti, &ei_ipv6_opt_ioam_invalid_remlen, |
2322 | 186 | "IOAM RemLen: Invalid length (%u bytes)", remlen * 4); |
2323 | 186 | } |
2324 | | |
2325 | 371 | offset += 2; |
2326 | | |
2327 | 371 | trace_type = tvb_get_bits32(tvb, offset * 8, 24, ENC_BIG_ENDIAN); |
2328 | 371 | ti = proto_tree_add_bitmask(opt_tree, tvb, offset, hf_ipv6_opt_ioam_trace_type, |
2329 | 371 | ett_ipv6_opt_ioam_trace_types, ioam_trace_types, ENC_BIG_ENDIAN); |
2330 | 371 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_rsv, tvb, offset + 3, 1, ENC_NA); |
2331 | 371 | offset += 4; |
2332 | | |
2333 | | /* node data list parsing starts here */ |
2334 | 371 | if (!nodelen && trace_type != IP6IOAM_TRACE_MASK_BIT22) { |
2335 | 103 | expert_add_info(pinfo, ti, &ei_ipv6_opt_ioam_invalid_nodelen); |
2336 | 103 | return offset; |
2337 | 103 | } |
2338 | 268 | if (remlen * 4 > opt_len - 10) |
2339 | 87 | return offset; |
2340 | | |
2341 | 181 | proto_tree* trace_tree |
2342 | 181 | = proto_tree_add_subtree(opt_tree, tvb, offset, opt_len - 10, 0, NULL, "Trace Data"); |
2343 | | |
2344 | 181 | if (remlen) { |
2345 | 38 | proto_tree_add_item(trace_tree, hf_ipv6_opt_ioam_trace_free_space, tvb, |
2346 | 38 | offset, remlen * 4, ENC_NA); |
2347 | 38 | offset += remlen * 4; |
2348 | 38 | } |
2349 | | |
2350 | 181 | len = opt_len - 10 - remlen * 4; |
2351 | 767 | while (len && len >= nodelen * 4) { |
2352 | 668 | proto_tree* node_tree |
2353 | 668 | = proto_tree_add_subtree_format(trace_tree, tvb, offset, |
2354 | 668 | nodelen * 4, 0, NULL, "Node %u", ++i); |
2355 | | |
2356 | 668 | new_offset = dissect_opt_ioam_trace_node(tvb, offset, node_tree, trace_type); |
2357 | 668 | if (new_offset - offset != nodelen * 4) { |
2358 | 60 | expert_add_info(pinfo, ti, &ei_ipv6_opt_ioam_invalid_trace_type); |
2359 | 60 | return offset; |
2360 | 60 | } |
2361 | | |
2362 | 608 | offset = new_offset; |
2363 | 608 | len -= nodelen * 4; |
2364 | | |
2365 | | /* Opaque State Snapshot */ |
2366 | 608 | if (trace_type & IP6IOAM_TRACE_MASK_BIT22) { |
2367 | 148 | if (len < 4) { |
2368 | 6 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2369 | 6 | "IOAM Option: Invalid length (%u bytes)", opt_len); |
2370 | 6 | return offset; |
2371 | 6 | } |
2372 | | |
2373 | 142 | oss_len = tvb_get_uint8(tvb, offset); |
2374 | | |
2375 | 142 | proto_tree* oss_tree |
2376 | 142 | = proto_tree_add_subtree(node_tree, tvb, offset, (oss_len + 1) * 4, |
2377 | 142 | 0, NULL, "Opaque State Snapshot"); |
2378 | 142 | proto_tree_add_item(oss_tree, hf_ipv6_opt_ioam_trace_node_oss_len, |
2379 | 142 | tvb, offset, 1, ENC_NA); |
2380 | 142 | proto_tree_add_item_ret_uint(oss_tree, hf_ipv6_opt_ioam_trace_node_oss_scid, |
2381 | 142 | tvb, offset + 1, 3, ENC_BIG_ENDIAN, &oss_scid); |
2382 | 142 | offset += 4; |
2383 | | |
2384 | 142 | len -= 4; |
2385 | 142 | if (len < oss_len * 4) { |
2386 | 16 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2387 | 16 | "IOAM Option: Invalid length (%u bytes)", opt_len); |
2388 | 16 | return offset; |
2389 | 16 | } |
2390 | | |
2391 | 126 | if (oss_len > 0) { |
2392 | 25 | proto_tree_add_item(oss_tree, hf_ipv6_opt_ioam_trace_node_oss_data, |
2393 | 25 | tvb, offset, oss_len * 4, ENC_NA); |
2394 | | |
2395 | 25 | len -= oss_len * 4; |
2396 | 25 | offset += oss_len * 4; |
2397 | 25 | } |
2398 | 126 | } |
2399 | 608 | } |
2400 | | |
2401 | 99 | if (len) { |
2402 | 33 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2403 | 33 | "IOAM Option: Invalid length (%u bytes)", opt_len); |
2404 | 33 | } |
2405 | | |
2406 | 99 | return offset; |
2407 | 181 | } |
2408 | | |
2409 | | /* |
2410 | | * IOAM Direct Export Option Header |
2411 | | * |
2412 | | 0 1 2 3 |
2413 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2414 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2415 | | | Namespace-ID | Flags |Extension-Flags| |
2416 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2417 | | | IOAM-Trace-Type | Reserved | |
2418 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2419 | | | Flow ID (Optional) | |
2420 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2421 | | | Sequence Number (Optional) | |
2422 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2423 | | */ |
2424 | | static int |
2425 | | dissect_opt_ioam_dex(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
2426 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
2427 | 65 | { |
2428 | 65 | uint8_t extflags; |
2429 | | |
2430 | 65 | static int * const ioam_dex_extflags[] = { |
2431 | 65 | &hf_ipv6_opt_ioam_dex_extflag_flag_rsv, |
2432 | 65 | &hf_ipv6_opt_ioam_dex_extflag_flag_seqnum, |
2433 | 65 | &hf_ipv6_opt_ioam_dex_extflag_flag_flowid, |
2434 | 65 | NULL |
2435 | 65 | }; |
2436 | | |
2437 | 65 | static int * const ioam_dex_trace_types[] = { |
2438 | 65 | &hf_ipv6_opt_ioam_trace_type_bit0, |
2439 | 65 | &hf_ipv6_opt_ioam_trace_type_bit1, |
2440 | 65 | &hf_ipv6_opt_ioam_trace_type_bit2, |
2441 | 65 | &hf_ipv6_opt_ioam_trace_type_bit3, |
2442 | 65 | &hf_ipv6_opt_ioam_trace_type_bit4, |
2443 | 65 | &hf_ipv6_opt_ioam_trace_type_bit5, |
2444 | 65 | &hf_ipv6_opt_ioam_trace_type_bit6, |
2445 | 65 | &hf_ipv6_opt_ioam_trace_type_bit7, |
2446 | 65 | &hf_ipv6_opt_ioam_trace_type_bit8, |
2447 | 65 | &hf_ipv6_opt_ioam_trace_type_bit9, |
2448 | 65 | &hf_ipv6_opt_ioam_trace_type_bit10, |
2449 | 65 | &hf_ipv6_opt_ioam_trace_type_bit11, |
2450 | 65 | &hf_ipv6_opt_ioam_trace_type_undef, |
2451 | 65 | &hf_ipv6_opt_ioam_trace_type_bit22, |
2452 | 65 | &hf_ipv6_opt_ioam_trace_type_rsv, |
2453 | 65 | NULL |
2454 | 65 | }; |
2455 | | |
2456 | 65 | if (opt_len < 10) { |
2457 | 45 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2458 | 45 | "IOAM Option: Invalid length (%u bytes)", opt_len); |
2459 | 45 | } |
2460 | | |
2461 | 65 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_dex_ns, tvb, offset, 2, ENC_BIG_ENDIAN); |
2462 | 65 | offset += 2; |
2463 | | |
2464 | 65 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_dex_flags, tvb, offset, 1, ENC_NA); |
2465 | 65 | offset++; |
2466 | | |
2467 | 65 | extflags = tvb_get_bits8(tvb, offset*8, 8); |
2468 | 65 | proto_tree_add_bitmask(opt_tree, tvb, offset, hf_ipv6_opt_ioam_dex_extflags, |
2469 | 65 | ett_ipv6_opt_ioam_dex_extflags, ioam_dex_extflags, ENC_BIG_ENDIAN); |
2470 | 65 | offset++; |
2471 | | |
2472 | 65 | proto_tree_add_bitmask(opt_tree, tvb, offset, hf_ipv6_opt_ioam_trace_type, |
2473 | 65 | ett_ipv6_opt_ioam_trace_types, ioam_dex_trace_types, ENC_BIG_ENDIAN); |
2474 | 65 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_trace_rsv, tvb, offset + 3, 1, ENC_NA); |
2475 | 65 | offset += 4; |
2476 | | |
2477 | 65 | if (extflags & 0x80) { |
2478 | 13 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_dex_extflag_flowid, tvb, offset, 4, ENC_BIG_ENDIAN); |
2479 | 13 | offset+=4; |
2480 | 13 | } |
2481 | | |
2482 | 65 | if (extflags & 0x40) { |
2483 | 26 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_dex_extflag_seqnum, tvb, offset, 4, ENC_BIG_ENDIAN); |
2484 | 26 | offset+=4; |
2485 | 26 | } |
2486 | | |
2487 | 65 | return offset; |
2488 | 65 | } |
2489 | | |
2490 | | /* |
2491 | | * IOAM Option Header |
2492 | | * |
2493 | | 0 1 2 3 |
2494 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2495 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2496 | | | Option Type | Opt Data Len | Reserved | IOAM Type | |
2497 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2498 | | */ |
2499 | | static int |
2500 | | dissect_opt_ioam(tvbuff_t *tvb, int offset, packet_info *pinfo, |
2501 | | proto_tree *opt_tree, struct opt_proto_item *opt_ti, uint8_t opt_len) |
2502 | 657 | { |
2503 | 657 | uint32_t opt_type; |
2504 | | |
2505 | 657 | if (opt_len < 2) { |
2506 | 198 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2507 | 198 | "IOAM Option: Invalid length (%u bytes)", opt_len); |
2508 | 198 | } |
2509 | | |
2510 | 657 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ioam_rsv, tvb, offset, 1, ENC_NA); |
2511 | 657 | proto_tree_add_item_ret_uint(opt_tree, hf_ipv6_opt_ioam_opt_type, tvb, |
2512 | 657 | offset + 1, 1, ENC_NA, &opt_type); |
2513 | 657 | offset += 2; |
2514 | | |
2515 | 657 | proto_tree* opt_type_tree |
2516 | 657 | = proto_tree_add_subtree(opt_tree, tvb, offset, opt_len - 2, 0, NULL, |
2517 | 657 | val_to_str_const(opt_type, ipv6_ioam_opt_types, |
2518 | 657 | "Unknown Option-Type")); |
2519 | | |
2520 | 657 | switch (opt_type) { |
2521 | 297 | case IP6IOAM_PRE_TRACE: |
2522 | 371 | case IP6IOAM_INC_TRACE: |
2523 | 371 | offset = dissect_opt_ioam_trace(tvb, offset, pinfo, opt_type_tree, opt_ti, opt_len); |
2524 | 371 | break; |
2525 | 2 | case IP6IOAM_POT: |
2526 | 2 | break; |
2527 | 1 | case IP6IOAM_E2E: |
2528 | 1 | break; |
2529 | 65 | case IP6IOAM_DEX: |
2530 | 65 | offset = dissect_opt_ioam_dex(tvb, offset, pinfo, opt_type_tree, opt_ti, opt_len); |
2531 | 657 | } |
2532 | | |
2533 | 588 | return offset; |
2534 | 657 | } |
2535 | | |
2536 | | /* |
2537 | | * Tunnel Payload Forwarding Option for IPv6 |
2538 | | * |
2539 | | 0 1 2 3 |
2540 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2541 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2542 | | | Option Type | Option Length | |
2543 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2544 | | | TPF Information | |
2545 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2546 | | */ |
2547 | | static int |
2548 | | dissect_opt_tpf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
2549 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
2550 | 112 | { |
2551 | 112 | if (opt_len != 4) { |
2552 | 107 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2553 | 107 | "TPF: Invalid Length (%u bytes)", opt_len); |
2554 | 107 | } |
2555 | 112 | proto_tree_add_item(opt_tree, hf_ipv6_opt_tpf_information, tvb, offset, 4, ENC_BIG_ENDIAN); |
2556 | 112 | offset += 4; |
2557 | | |
2558 | 112 | return offset; |
2559 | 112 | } |
2560 | | |
2561 | | /* |
2562 | | ------------------------------------------------------------ |
2563 | | | Next Header | Hdr Ext Len | Option Type | Option Length| |
2564 | | +-------------+---------------+-------------+--------------+ |
2565 | | | CALIPSO Domain of Interpretation | |
2566 | | +-------------+---------------+-------------+--------------+ |
2567 | | | Cmpt Length | Sens Level | Checksum (CRC-16) | |
2568 | | +-------------+---------------+-------------+--------------+ |
2569 | | | Compartment Bitmap (Optional; variable length) | |
2570 | | +-------------+---------------+-------------+--------------+ |
2571 | | */ |
2572 | | static int |
2573 | | dissect_opt_calipso(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
2574 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
2575 | 75 | { |
2576 | 75 | uint32_t cmpt_length = 0; |
2577 | | |
2578 | 75 | if (opt_len < 8) { |
2579 | 53 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2580 | 53 | "CALIPSO: Invalid Length (%u bytes)", opt_len); |
2581 | 53 | } |
2582 | | |
2583 | 75 | proto_tree_add_item(opt_tree, hf_ipv6_opt_calipso_doi, tvb, |
2584 | 75 | offset, 4, ENC_BIG_ENDIAN); |
2585 | 75 | offset += 4; |
2586 | | |
2587 | 75 | proto_tree_add_item_ret_uint(opt_tree, hf_ipv6_opt_calipso_cmpt_length, tvb, |
2588 | 75 | offset, 1, ENC_BIG_ENDIAN, &cmpt_length); |
2589 | 75 | offset += 1; |
2590 | | |
2591 | 75 | proto_tree_add_item(opt_tree, hf_ipv6_opt_calipso_sens_level, tvb, |
2592 | 75 | offset, 1, ENC_BIG_ENDIAN); |
2593 | 75 | offset += 1; |
2594 | | |
2595 | 75 | proto_tree_add_checksum(opt_tree, tvb, offset, hf_ipv6_opt_calipso_checksum, -1, |
2596 | 75 | NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); |
2597 | 75 | offset += 2; |
2598 | | |
2599 | 75 | proto_tree_add_item(opt_tree, hf_ipv6_opt_calipso_cmpt_bitmap, tvb, |
2600 | 75 | offset, cmpt_length*4, ENC_NA); |
2601 | 75 | offset += cmpt_length*4; |
2602 | | |
2603 | 75 | return offset; |
2604 | 75 | } |
2605 | | |
2606 | | /* |
2607 | | * IPv6 SMF_DPD Option Header |
2608 | | * |
2609 | | 0 1 2 3 |
2610 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2611 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2612 | | ... |0|0|0| 01000 | Opt. Data Len | |
2613 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2614 | | |0|TidTy| TidLen| TaggerId (optional) ... | |
2615 | | +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2616 | | | | Identifier ... |
2617 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2618 | | |
2619 | | Figure 3: IPv6 SMF_DPD Option Header in I-DPD mode |
2620 | | |
2621 | | 0 1 2 3 |
2622 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2623 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2624 | | ... |0|0|0| OptType | Opt. Data Len | |
2625 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2626 | | |1| Hash Assist Value (HAV) ... |
2627 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2628 | | |
2629 | | Figure 4: IPv6 SMF_DPD Option Header in H-DPD Mode |
2630 | | */ |
2631 | | static int |
2632 | | dissect_opt_smf_dpd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *opt_tree, |
2633 | | struct opt_proto_item *opt_ti _U_, uint8_t opt_len) |
2634 | 453 | { |
2635 | 453 | uint8_t hash_tid; |
2636 | 453 | uint8_t tid_len; |
2637 | 453 | int ident_len; |
2638 | | |
2639 | 453 | proto_tree_add_item(opt_tree, hf_ipv6_opt_smf_dpd_hash_bit, tvb, offset, 1, ENC_BIG_ENDIAN); |
2640 | 453 | hash_tid = tvb_get_uint8(tvb, offset); |
2641 | | |
2642 | 453 | if (hash_tid & 0x80) { |
2643 | | /* H-DPD Mode */ |
2644 | 81 | proto_tree_add_item(opt_tree, hf_ipv6_opt_smf_dpd_hav, tvb, offset, opt_len, ENC_NA); |
2645 | 81 | return offset + opt_len; |
2646 | 81 | } |
2647 | | |
2648 | | /* I-DPD Mode */ |
2649 | 372 | proto_tree_add_item(opt_tree, hf_ipv6_opt_smf_dpd_tid_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
2650 | 372 | proto_tree_add_item(opt_tree, hf_ipv6_opt_smf_dpd_tid_len, tvb, offset, 1, ENC_BIG_ENDIAN); |
2651 | 372 | offset += 1; |
2652 | 372 | ident_len = opt_len - 1; |
2653 | 372 | if (hash_tid & 0x70) { |
2654 | 109 | tid_len = (hash_tid & 0x0f) + 1; |
2655 | 109 | proto_tree_add_item(opt_tree, hf_ipv6_opt_smf_dpd_tagger_id, tvb, offset, tid_len, ENC_NA); |
2656 | 109 | offset += tid_len; |
2657 | 109 | ident_len -= tid_len; |
2658 | 109 | } |
2659 | 372 | if (ident_len > 0) { |
2660 | 182 | proto_tree_add_item(opt_tree, hf_ipv6_opt_smf_dpd_ident, tvb, offset, ident_len, ENC_NA); |
2661 | 182 | offset += ident_len; |
2662 | 182 | } |
2663 | | |
2664 | 372 | return offset; |
2665 | 453 | } |
2666 | | |
2667 | | /* |
2668 | | * Performance and Diagnostic Metrics Destination Option (ietf-ippm-6man-pdm-option-13) |
2669 | | * |
2670 | | 0 1 2 3 |
2671 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2672 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2673 | | | Option Type | Option Length | ScaleDTLR | ScaleDTLS | |
2674 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2675 | | | PSN This Packet | PSN Last Received | |
2676 | | |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2677 | | | Delta Time Last Received | Delta Time Last Sent | |
2678 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2679 | | */ |
2680 | | static int |
2681 | | dissect_opt_pdm(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *opt_tree, |
2682 | | struct opt_proto_item *opt_ti _U_, uint8_t opt_len) |
2683 | 77 | { |
2684 | 77 | if (opt_len != 10) { |
2685 | 75 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2686 | 75 | "PDM: Invalid length (%u bytes)", opt_len); |
2687 | 75 | } |
2688 | 77 | proto_tree_add_item(opt_tree, hf_ipv6_opt_pdm_scale_dtlr, tvb, offset, 1, ENC_BIG_ENDIAN); |
2689 | 77 | offset += 1; |
2690 | 77 | proto_tree_add_item(opt_tree, hf_ipv6_opt_pdm_scale_dtls, tvb, offset, 1, ENC_BIG_ENDIAN); |
2691 | 77 | offset += 1; |
2692 | 77 | proto_tree_add_item(opt_tree, hf_ipv6_opt_pdm_psn_this_pkt, tvb, offset, 2, ENC_BIG_ENDIAN); |
2693 | 77 | offset += 2; |
2694 | 77 | proto_tree_add_item(opt_tree, hf_ipv6_opt_pdm_psn_last_recv, tvb, offset, 2, ENC_BIG_ENDIAN); |
2695 | 77 | offset += 2; |
2696 | 77 | proto_tree_add_item(opt_tree, hf_ipv6_opt_pdm_delta_last_recv, tvb, offset, 2, ENC_BIG_ENDIAN); |
2697 | 77 | offset += 2; |
2698 | 77 | proto_tree_add_item(opt_tree, hf_ipv6_opt_pdm_delta_last_sent, tvb, offset, 2, ENC_BIG_ENDIAN); |
2699 | 77 | offset += 2; |
2700 | | |
2701 | 77 | return offset; |
2702 | 77 | } |
2703 | | |
2704 | | /* |
2705 | | * Home Address Option |
2706 | | * |
2707 | | 0 1 2 3 |
2708 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2709 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2710 | | | Option Type | Option Length | |
2711 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2712 | | | | |
2713 | | + + |
2714 | | | | |
2715 | | + Home Address + |
2716 | | | | |
2717 | | + + |
2718 | | | | |
2719 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2720 | | */ |
2721 | | static int |
2722 | | dissect_opt_home_address(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
2723 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
2724 | 42 | { |
2725 | 42 | if (opt_len != 16) { |
2726 | 39 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2727 | 39 | "Home Address: Invalid length (%u bytes)", opt_len); |
2728 | 39 | } |
2729 | 42 | proto_tree_add_item(opt_tree, hf_ipv6_opt_mipv6_home_address, tvb, offset, IPv6_ADDR_SIZE, ENC_NA); |
2730 | 42 | alloc_address_tvb_ipv6(pinfo->pool, &pinfo->src, tvb, offset); |
2731 | 42 | offset += IPv6_ADDR_SIZE; |
2732 | | |
2733 | 42 | return offset; |
2734 | 42 | } |
2735 | | |
2736 | | /* |
2737 | | * ILNP Nonce Option |
2738 | | * |
2739 | | |
2740 | | 0 1 2 3 |
2741 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2742 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2743 | | | Next Header | Hdr Ext Len | Option Type | Option Length | |
2744 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2745 | | / Nonce Value / |
2746 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2747 | | */ |
2748 | | static int |
2749 | | dissect_opt_ilnp_nonce(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *opt_tree, |
2750 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
2751 | 30 | { |
2752 | 30 | proto_tree_add_item(opt_tree, hf_ipv6_opt_ilnp_nonce, tvb, offset, opt_len, ENC_NA); |
2753 | | |
2754 | | // Make a new tvb for the ILNP protocol |
2755 | 30 | tvbuff_t* tvb_ilnp = tvb_new_subset_length(tvb, offset, opt_len); |
2756 | 30 | call_dissector_with_data(ilnp_handle, tvb_ilnp, pinfo, proto_tree_get_parent(opt_ti->root_tree), NULL); |
2757 | | |
2758 | 30 | offset += opt_len; |
2759 | 30 | return offset; |
2760 | 30 | } |
2761 | | |
2762 | | /* |
2763 | | * Line-Identification Option |
2764 | | * |
2765 | | 0 1 2 3 |
2766 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2767 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2768 | | | Option Type | Option Length | |
2769 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2770 | | | LineIDLen | Line ID... |
2771 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2772 | | */ |
2773 | | static int |
2774 | | dissect_opt_lio(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *opt_tree, |
2775 | | struct opt_proto_item *opt_ti _U_, uint8_t opt_len) |
2776 | 56 | { |
2777 | 56 | uint32_t lid_len = 0; |
2778 | | |
2779 | 56 | proto_tree_add_item_ret_uint(opt_tree, hf_ipv6_opt_lio_len, tvb, offset, 1, ENC_BIG_ENDIAN, &lid_len); |
2780 | 56 | offset += 1; |
2781 | | |
2782 | 56 | if (lid_len + 1 > opt_len) { |
2783 | | /* XXX Add expert info */ |
2784 | 42 | lid_len = opt_len - 1; |
2785 | 42 | } |
2786 | 56 | proto_tree_add_item(opt_tree, hf_ipv6_opt_lio_id, tvb, offset, lid_len, ENC_BIG_ENDIAN|ENC_ASCII); |
2787 | 56 | offset += lid_len; |
2788 | | |
2789 | 56 | return offset; |
2790 | 56 | } |
2791 | | |
2792 | | /* |
2793 | | * MPL Option |
2794 | | * |
2795 | | 0 1 2 3 |
2796 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2797 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2798 | | | Option Type | Opt Data Len | |
2799 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2800 | | | S |M|V| rsv | sequence | seed-id (optional) | |
2801 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2802 | | */ |
2803 | | static int |
2804 | | dissect_opt_mpl(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *opt_tree, |
2805 | | struct opt_proto_item *opt_ti _U_, uint8_t opt_len _U_) |
2806 | 150 | { |
2807 | 150 | static int * const mpl_flags[] = { |
2808 | 150 | &hf_ipv6_opt_mpl_flag_s, |
2809 | 150 | &hf_ipv6_opt_mpl_flag_m, |
2810 | 150 | &hf_ipv6_opt_mpl_flag_v, |
2811 | 150 | &hf_ipv6_opt_mpl_flag_rsv, |
2812 | 150 | NULL |
2813 | 150 | }; |
2814 | 150 | static const uint8_t seed_id_len_arr[4] = {0, 2, 8, 16}; |
2815 | 150 | uint8_t seed_id_len; |
2816 | | |
2817 | 150 | proto_tree_add_bitmask(opt_tree, tvb, offset, hf_ipv6_opt_mpl_flag, ett_ipv6_opt_mpl, mpl_flags, ENC_NA); |
2818 | 150 | seed_id_len = seed_id_len_arr[tvb_get_uint8(tvb, offset) >> 6]; |
2819 | 150 | offset +=1; |
2820 | | |
2821 | 150 | proto_tree_add_item(opt_tree, hf_ipv6_opt_mpl_sequence, tvb, offset, 1, ENC_NA); |
2822 | 150 | offset +=1; |
2823 | 150 | if (seed_id_len > 0) { |
2824 | 108 | proto_tree_add_item(opt_tree, hf_ipv6_opt_mpl_seed_id, tvb, offset, seed_id_len, ENC_NA); |
2825 | 108 | offset += seed_id_len; |
2826 | 108 | } |
2827 | 42 | else { |
2828 | 42 | expert_add_info(pinfo, opt_ti->type, &ei_ipv6_opt_mpl_ipv6_src_seed_id); |
2829 | 42 | } |
2830 | | |
2831 | 150 | return offset; |
2832 | 150 | } |
2833 | | |
2834 | | /* |
2835 | | * IPv6 DFF Header |
2836 | | * |
2837 | | 1 2 3 |
2838 | | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
2839 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2840 | | | Next Header | Hdr Ext Len | OptTypeDFF | OptDataLenDFF | |
2841 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2842 | | |VER|D|R|0|0|0|0| Sequence Number | Pad1 | |
2843 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
2844 | | */ |
2845 | | static int |
2846 | | dissect_opt_dff(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
2847 | | struct opt_proto_item *opt_ti, uint8_t opt_len) |
2848 | 146 | { |
2849 | 146 | static int * const dff_flags[] = { |
2850 | 146 | &hf_ipv6_opt_dff_flag_ver, |
2851 | 146 | &hf_ipv6_opt_dff_flag_dup, |
2852 | 146 | &hf_ipv6_opt_dff_flag_ret, |
2853 | 146 | &hf_ipv6_opt_dff_flag_rsv, |
2854 | 146 | NULL |
2855 | 146 | }; |
2856 | | |
2857 | | /* Option length is 3 octets */ |
2858 | | /* http://www.rfc-editor.org/errata_search.php?eid=3937 */ |
2859 | 146 | if (opt_len != 3) { |
2860 | 140 | expert_add_info_format(pinfo, opt_ti->len, &ei_ipv6_opt_invalid_len, |
2861 | 140 | "IPv6 DFF: Invalid length (%u bytes)", opt_len); |
2862 | 140 | } |
2863 | 146 | proto_tree_add_bitmask(opt_tree, tvb, offset, hf_ipv6_opt_dff_flags, |
2864 | 146 | ett_ipv6_opt_dff_flags, dff_flags, ENC_NA); |
2865 | 146 | offset += 1; |
2866 | 146 | proto_tree_add_item(opt_tree, hf_ipv6_opt_dff_seqnum, tvb, offset, 2, ENC_BIG_ENDIAN); |
2867 | 146 | offset += 2; |
2868 | | |
2869 | 146 | return offset; |
2870 | 146 | } |
2871 | | |
2872 | | static int |
2873 | | dissect_opt_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *opt_tree, |
2874 | | struct opt_proto_item *opt_ti _U_, uint8_t opt_len) |
2875 | 3.19k | { |
2876 | 3.19k | proto_item *ti; |
2877 | | |
2878 | 3.19k | ti = proto_tree_add_item(opt_tree, hf_ipv6_opt_unknown, tvb, |
2879 | 3.19k | offset, opt_len, ENC_NA); |
2880 | 3.19k | expert_add_info(pinfo, ti, &ei_ipv6_opt_unknown_data); |
2881 | | |
2882 | 3.19k | return offset + opt_len; |
2883 | 3.19k | } |
2884 | | |
2885 | | static int |
2886 | | dissect_opts(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo, ws_ip6 *iph, const int exthdr_proto) |
2887 | 3.46k | { |
2888 | 3.46k | int len, offset_end; |
2889 | 3.46k | uint8_t nxt; |
2890 | 3.46k | proto_tree *exthdr_tree, *opt_tree, *opt_type_tree, *root_tree; |
2891 | 3.46k | proto_item *pi, *ti, *ti_len; |
2892 | 3.46k | int hf_exthdr_item_nxt, hf_exthdr_item_len, hf_exthdr_item_len_oct; |
2893 | 3.46k | int ett_exthdr_proto; |
2894 | 3.46k | uint8_t opt_type, opt_len, opt_start; |
2895 | 3.46k | int opt_hdr_type; |
2896 | 3.46k | const char *opt_name; |
2897 | 3.46k | bool hopopts; |
2898 | 3.46k | struct opt_proto_item opt_ti; |
2899 | 3.46k | tvbuff_t *next_tvb; |
2900 | | |
2901 | 3.46k | hopopts = (exthdr_proto == proto_ipv6_hopopts); |
2902 | | |
2903 | 3.46k | nxt = tvb_get_uint8(tvb, offset); |
2904 | 3.46k | len = (tvb_get_uint8(tvb, offset + 1) + 1) << 3; |
2905 | 3.46k | offset_end = offset + len; |
2906 | | |
2907 | 3.46k | root_tree = p_ipv6_pinfo_select_root(pinfo, tree); |
2908 | 3.46k | p_ipv6_pinfo_add_len(pinfo, len); |
2909 | | |
2910 | | /* !!! specify length */ |
2911 | 3.46k | ti = proto_tree_add_item(root_tree, exthdr_proto, tvb, offset, len, ENC_NA); |
2912 | | |
2913 | 3.46k | if (hopopts && ipv6_previous_layer_id(pinfo) != proto_ipv6) { |
2914 | | /* IPv6 Hop-by-Hop must appear immediately after IPv6 header (RFC 2460) */ |
2915 | 2.97k | expert_add_info(pinfo, ti, &ei_ipv6_hopopts_not_first); |
2916 | 2.97k | } |
2917 | | |
2918 | 3.46k | if (exthdr_proto == proto_ipv6_hopopts) { |
2919 | 3.32k | hf_exthdr_item_nxt = hf_ipv6_hopopts_nxt; |
2920 | 3.32k | hf_exthdr_item_len = hf_ipv6_hopopts_len; |
2921 | 3.32k | hf_exthdr_item_len_oct = hf_ipv6_hopopts_len_oct; |
2922 | 3.32k | ett_exthdr_proto = ett_ipv6_hopopts_proto; |
2923 | 3.32k | } else if (exthdr_proto == proto_ipv6_dstopts) { |
2924 | 13 | hf_exthdr_item_nxt = hf_ipv6_dstopts_nxt; |
2925 | 13 | hf_exthdr_item_len = hf_ipv6_dstopts_len; |
2926 | 13 | hf_exthdr_item_len_oct = hf_ipv6_dstopts_len_oct; |
2927 | 13 | ett_exthdr_proto = ett_ipv6_dstopts_proto; |
2928 | 124 | } else { |
2929 | 124 | DISSECTOR_ASSERT_NOT_REACHED(); |
2930 | 124 | } |
2931 | | |
2932 | 3.46k | exthdr_tree = proto_item_add_subtree(ti, ett_exthdr_proto); |
2933 | | |
2934 | 3.46k | proto_tree_add_item(exthdr_tree, hf_exthdr_item_nxt, tvb, offset, 1, ENC_BIG_ENDIAN); |
2935 | 3.46k | offset += 1; |
2936 | | |
2937 | 3.46k | ti_len = proto_tree_add_item(exthdr_tree, hf_exthdr_item_len, tvb, offset, 1, ENC_BIG_ENDIAN); |
2938 | 3.46k | ti = proto_tree_add_uint(exthdr_tree, hf_exthdr_item_len_oct, tvb, offset, 1, len); |
2939 | 3.46k | proto_item_set_generated(ti); |
2940 | 3.46k | if (ipv6_exthdr_hide_len_oct_field) { |
2941 | 0 | proto_item_set_hidden(ti); |
2942 | 0 | proto_item_append_text(ti_len, " (%d bytes)", len); |
2943 | 0 | } |
2944 | 3.46k | offset += 1; |
2945 | | |
2946 | 34.3k | while (offset < offset_end) { |
2947 | | /* there are more options */ |
2948 | | |
2949 | 31.5k | opt_type = tvb_get_uint8(tvb, offset); |
2950 | 31.5k | opt_len = tvb_get_uint8(tvb, offset + 1); |
2951 | 31.5k | opt_name = val_to_str_ext(opt_type, &ipv6_opt_type_vals_ext, "Unknown IPv6 Option (%u)"); |
2952 | | |
2953 | 31.5k | pi = proto_tree_add_none_format(exthdr_tree, hf_ipv6_opt, tvb, offset, 2 + opt_len, |
2954 | 31.5k | "%s", opt_name); |
2955 | 31.5k | opt_tree = proto_item_add_subtree(pi, ett_ipv6_opt); |
2956 | | |
2957 | 31.5k | opt_ti.type = proto_tree_add_item(opt_tree, hf_ipv6_opt_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
2958 | | //Allow options to have access to the IP tree |
2959 | 31.5k | opt_ti.root_tree = tree; |
2960 | | |
2961 | 31.5k | if (opt_type == IP6OPT_PAD1) { |
2962 | | /* The Pad1 option is a special case, and contains no data. */ |
2963 | 23.9k | proto_tree_add_item(opt_tree, hf_ipv6_opt_pad1, tvb, offset, 1, ENC_NA); |
2964 | 23.9k | offset += 1; |
2965 | 23.9k | continue; |
2966 | 23.9k | } |
2967 | | |
2968 | 7.63k | if ((opt_hdr_type = ipv6_opt_type_hdr(opt_type)) != IPv6_OPT_HDR_ANY) { |
2969 | 0 | if (hopopts && (opt_hdr_type == IPv6_OPT_HDR_DST)) { |
2970 | 0 | expert_add_info_format(pinfo, opt_ti.type, &ei_ipv6_opt_header_mismatch, |
2971 | 0 | "%s must use a destination options header", opt_name); |
2972 | 0 | } |
2973 | 0 | else if (!hopopts && (opt_hdr_type == IPv6_OPT_HDR_HBH)) { |
2974 | 0 | expert_add_info_format(pinfo, opt_ti.type, &ei_ipv6_opt_header_mismatch, |
2975 | 0 | "%s must use a hop-by-hop options header", opt_name); |
2976 | 0 | } |
2977 | 0 | } |
2978 | | |
2979 | 7.63k | opt_type_tree = proto_item_add_subtree(opt_ti.type, ett_ipv6_opt_type); |
2980 | 7.63k | proto_tree_add_item(opt_type_tree, hf_ipv6_opt_type_action, tvb, offset, 1, ENC_BIG_ENDIAN); |
2981 | 7.63k | proto_tree_add_item(opt_type_tree, hf_ipv6_opt_type_change, tvb, offset, 1, ENC_BIG_ENDIAN); |
2982 | 7.63k | proto_tree_add_item(opt_type_tree, hf_ipv6_opt_type_rest, tvb, offset, 1, ENC_BIG_ENDIAN); |
2983 | 7.63k | offset += 1; |
2984 | | |
2985 | 7.63k | opt_ti.len = proto_tree_add_item(opt_tree, hf_ipv6_opt_length, tvb, offset, 1, ENC_BIG_ENDIAN); |
2986 | 7.63k | offset += 1; |
2987 | | |
2988 | 7.63k | if (opt_type == IP6OPT_PADN) { |
2989 | | /* RFC 2460 states : |
2990 | | * "The PadN option is used to insert two or more octets of |
2991 | | * padding into the Options area of a header. For N octets of |
2992 | | * padding, the Opt Data Len field contains the value N-2, and |
2993 | | * the Option Data consists of N-2 zero-valued octets." |
2994 | | */ |
2995 | 470 | proto_tree_add_item(opt_tree, hf_ipv6_opt_padn, tvb, offset, opt_len, ENC_NA); |
2996 | 470 | offset += opt_len; |
2997 | 470 | continue; |
2998 | 470 | } |
2999 | | |
3000 | 7.16k | opt_start = offset; |
3001 | 7.16k | switch (opt_type) { |
3002 | 221 | case IP6OPT_JUMBO: |
3003 | 221 | offset = dissect_opt_jumbo(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3004 | 221 | break; |
3005 | 185 | case IP6OPT_RPL: |
3006 | 306 | case IP6OPT_RPL_OLD: |
3007 | 306 | offset = dissect_opt_rpl(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3008 | 306 | break; |
3009 | 346 | case IP6OPT_TEL: |
3010 | 346 | offset = dissect_opt_tel(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3011 | 346 | break; |
3012 | 201 | case IP6OPT_RTALERT: |
3013 | 201 | offset = dissect_opt_rtalert(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3014 | 201 | break; |
3015 | 227 | case IP6OPT_PMTU: |
3016 | 227 | offset = dissect_opt_pmtu(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3017 | 227 | break; |
3018 | 192 | case IP6OPT_APN6: |
3019 | 192 | offset = dissect_opt_apn6(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3020 | 192 | break; |
3021 | 275 | case IP6OPT_QUICKSTART: |
3022 | 275 | offset = dissect_opt_quickstart(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len, iph); |
3023 | 275 | break; |
3024 | 657 | case IP6OPT_IOAM: |
3025 | 657 | offset = dissect_opt_ioam(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3026 | 657 | break; |
3027 | 112 | case IP6OPT_TPF: |
3028 | 112 | offset = dissect_opt_tpf(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3029 | 112 | break; |
3030 | 75 | case IP6OPT_CALIPSO: |
3031 | 75 | offset = dissect_opt_calipso(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3032 | 75 | break; |
3033 | 453 | case IP6OPT_SMF_DPD: |
3034 | 453 | offset = dissect_opt_smf_dpd(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3035 | 453 | break; |
3036 | 77 | case IP6OPT_PDM: |
3037 | 77 | offset = dissect_opt_pdm(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3038 | 77 | break; |
3039 | 42 | case IP6OPT_HOME_ADDRESS: |
3040 | 42 | offset = dissect_opt_home_address(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3041 | 42 | break; |
3042 | 30 | case IP6OPT_ILNP_NONCE: |
3043 | 30 | offset = dissect_opt_ilnp_nonce(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3044 | 30 | break; |
3045 | 56 | case IP6OPT_LIO: |
3046 | 56 | offset = dissect_opt_lio(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3047 | 56 | break; |
3048 | 150 | case IP6OPT_MPL: |
3049 | 150 | offset = dissect_opt_mpl(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3050 | 150 | break; |
3051 | 146 | case IP6OPT_IP_DFF: |
3052 | 146 | offset = dissect_opt_dff(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3053 | 146 | break; |
3054 | 26 | case IP6OPT_ENDI: |
3055 | 26 | offset = dissect_opt_unknown(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3056 | 26 | expert_add_info(pinfo, opt_ti.type, &ei_ipv6_opt_deprecated); |
3057 | 26 | break; |
3058 | 48 | case IP6OPT_EXP_1E: |
3059 | 95 | case IP6OPT_EXP_3E: |
3060 | 121 | case IP6OPT_EXP_5E: |
3061 | 157 | case IP6OPT_EXP_7E: |
3062 | 191 | case IP6OPT_EXP_9E: |
3063 | 231 | case IP6OPT_EXP_BE: |
3064 | 249 | case IP6OPT_EXP_DE: |
3065 | 283 | case IP6OPT_EXP_FE: |
3066 | 283 | proto_tree_add_item(opt_tree, hf_ipv6_opt_experimental, tvb, |
3067 | 283 | offset, opt_len, ENC_NA); |
3068 | 283 | offset += opt_len; |
3069 | 283 | break; |
3070 | 3.16k | default: |
3071 | 3.16k | offset = dissect_opt_unknown(tvb, offset, pinfo, opt_tree, &opt_ti, opt_len); |
3072 | 3.16k | break; |
3073 | 7.16k | } |
3074 | 6.50k | if (offset < opt_start + opt_len) { |
3075 | 723 | ti = proto_tree_add_item(opt_tree, hf_ipv6_opt_unknown_data, tvb, |
3076 | 723 | offset, opt_start + opt_len - offset, ENC_NA); |
3077 | 723 | expert_add_info(pinfo, ti, &ei_ipv6_opt_unknown_data); |
3078 | 723 | offset = opt_start + opt_len; |
3079 | 723 | } |
3080 | 6.50k | } |
3081 | | |
3082 | 2.80k | p_add_ipv6_nxt(pinfo, nxt); |
3083 | | |
3084 | 2.80k | next_tvb = tvb_new_subset_remaining(tvb, len); |
3085 | 2.80k | ipv6_dissect_next(nxt, next_tvb, pinfo, tree, iph); |
3086 | 2.80k | return tvb_captured_length(tvb); |
3087 | 3.46k | } |
3088 | | |
3089 | | static int |
3090 | | dissect_hopopts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
3091 | 3.44k | { |
3092 | 3.44k | col_append_sep_str(pinfo->cinfo, COL_INFO, " , ", "IPv6 hop-by-hop options"); |
3093 | | |
3094 | 3.44k | return dissect_opts(tvb, 0, tree, pinfo, (ws_ip6 *)data, proto_ipv6_hopopts); |
3095 | 3.44k | } |
3096 | | |
3097 | | static int |
3098 | | dissect_dstopts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) |
3099 | 14 | { |
3100 | 14 | col_append_sep_str(pinfo->cinfo, COL_INFO, " , ", "IPv6 destination options"); |
3101 | | |
3102 | 14 | return dissect_opts(tvb, 0, tree, pinfo, (ws_ip6 *)data, proto_ipv6_dstopts); |
3103 | 14 | } |
3104 | | |
3105 | | /* return value is > UINT16_MAX, else zero */ |
3106 | | /* tvb + offset contains the Hbh header */ |
3107 | | static uint32_t |
3108 | | ipv6_get_jumbo_plen(tvbuff_t *tvb, int offset) |
3109 | 95 | { |
3110 | 95 | int offset_end, hdr_len; |
3111 | 95 | int opt_type, opt_len; |
3112 | 95 | uint32_t jumbo_plen; |
3113 | | |
3114 | 95 | if (!tvb_bytes_exist(tvb, offset, 2)) { |
3115 | 20 | return 0; |
3116 | 20 | } |
3117 | 75 | hdr_len = (tvb_get_uint8(tvb, offset + 1) + 1) * 8; |
3118 | 75 | offset_end = offset + hdr_len; |
3119 | 75 | offset +=2; |
3120 | | |
3121 | 1.06k | while (offset < offset_end && tvb_bytes_exist(tvb, offset, 6)) { |
3122 | 986 | opt_type = tvb_get_uint8(tvb, offset); |
3123 | 986 | offset += 1; |
3124 | 986 | if (opt_type == IP6OPT_PAD1) { |
3125 | 800 | continue; |
3126 | 800 | } |
3127 | 186 | opt_len = tvb_get_uint8(tvb, offset); |
3128 | 186 | offset += 1; |
3129 | 186 | if (opt_type == IP6OPT_JUMBO && opt_len == 4) { |
3130 | 0 | jumbo_plen = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN); |
3131 | 0 | if (jumbo_plen > UINT16_MAX) { |
3132 | 0 | return jumbo_plen; |
3133 | 0 | } |
3134 | 0 | return 0; |
3135 | 0 | } |
3136 | 186 | offset += opt_len; |
3137 | 186 | } |
3138 | 75 | return 0; |
3139 | 75 | } |
3140 | | |
3141 | | static void |
3142 | | add_ipv6_address_detail(packet_info *pinfo, proto_item *vis, proto_item *invis, |
3143 | | tvbuff_t *tvb, int offset, struct ipv6_addr_info_s *addr_info) |
3144 | 45.4k | { |
3145 | 45.4k | proto_item *ti; |
3146 | 45.4k | proto_tree *vtree; /* visible tree */ |
3147 | 45.4k | proto_tree *itree; /* invisible tree */ |
3148 | | |
3149 | 45.4k | vtree = proto_item_add_subtree(vis, ett_ipv6_detail); |
3150 | 45.4k | itree = proto_item_add_subtree(invis, ett_ipv6_detail); |
3151 | | |
3152 | | /* |
3153 | | * Internet Protocol Version 6 Address Space |
3154 | | * https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml |
3155 | | */ |
3156 | 45.4k | if (tvb_get_uint8(tvb, offset) == 0xFF) { |
3157 | | /* RFC 4291 section 2.4: multicast prefix */ |
3158 | 2.67k | ti = proto_tree_add_string(vtree, *addr_info->hf_addr_space, tvb, offset, 1, "Multicast"); |
3159 | 2.67k | proto_item_set_generated(ti); |
3160 | 2.67k | if (addr_info == &ipv6_src_info) { |
3161 | | /* "Shouldn't" see this one as a source */ |
3162 | 866 | expert_add_info(pinfo, ti, &ei_ipv6_src_addr_not_multicast); |
3163 | 866 | } |
3164 | | |
3165 | 2.67k | ti = proto_tree_add_string(itree, hf_ipv6_addr_space, tvb, offset, 1, "Multicast"); |
3166 | 2.67k | proto_item_set_generated(ti); |
3167 | | |
3168 | | /* |
3169 | | * Multicast address scope and flags. |
3170 | | * |
3171 | | * RFC 4291 Section 2.7: |
3172 | | * https://www.rfc-editor.org/rfc/rfc4291#section-2.7 |
3173 | | * |
3174 | | * RFC 7346: |
3175 | | * https://www.rfc-editor.org/rfc/rfc7346.html |
3176 | | * |
3177 | | * IANA Registry: |
3178 | | * https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml#ipv6-scope |
3179 | | */ |
3180 | | |
3181 | 2.67k | static int *const hf_ipv6_multicast_flags_bits[] = { |
3182 | 2.67k | &hf_ipv6_multicast_flags_reserved, |
3183 | 2.67k | &hf_ipv6_multicast_flags_embed_rp, |
3184 | 2.67k | &hf_ipv6_multicast_flags_network_prefix, |
3185 | 2.67k | &hf_ipv6_multicast_flags_transient, |
3186 | 2.67k | NULL |
3187 | 2.67k | }; |
3188 | | |
3189 | | /* Add multicast address flags. */ |
3190 | 2.67k | ti = proto_tree_add_bitmask(vtree, tvb, offset, *addr_info->hf_multicast_flags, |
3191 | 2.67k | ett_ipv6_multicast_flags, addr_info->hf_multicast_flags_bits, ENC_BIG_ENDIAN); |
3192 | 2.67k | proto_item_set_generated(ti); |
3193 | 2.67k | ti = proto_tree_add_bitmask(itree, tvb, offset, hf_ipv6_multicast_flags, |
3194 | 2.67k | ett_ipv6_multicast_flags, hf_ipv6_multicast_flags_bits, ENC_BIG_ENDIAN); |
3195 | 2.67k | proto_item_set_generated(ti); |
3196 | | |
3197 | | /* Add multicast address scope. */ |
3198 | 2.67k | ti = proto_tree_add_item(vtree, *addr_info->hf_multicast_scope, tvb, offset, 2, ENC_BIG_ENDIAN); |
3199 | 2.67k | proto_item_set_generated(ti); |
3200 | 2.67k | ti = proto_tree_add_item(itree, hf_ipv6_multicast_scope, tvb, offset, 2, ENC_BIG_ENDIAN); |
3201 | 2.67k | proto_item_set_generated(ti); |
3202 | 2.67k | } |
3203 | 42.7k | else if ((tvb_get_ntohs(tvb, offset) & 0xFFC0) == 0xFE80) { |
3204 | 807 | ti = proto_tree_add_string(vtree, *addr_info->hf_addr_space, tvb, offset, 2, "Link-Local Unicast"); |
3205 | 807 | proto_item_set_generated(ti); |
3206 | 807 | ti = proto_tree_add_string(itree, hf_ipv6_addr_space, tvb, offset, 2, "Link-Local Unicast"); |
3207 | 807 | proto_item_set_generated(ti); |
3208 | 807 | } |
3209 | 41.9k | else if ((tvb_get_uint8(tvb, offset) & 0x30) == 0x20) { |
3210 | 9.26k | ti = proto_tree_add_string(vtree, *addr_info->hf_addr_space, tvb, offset, 2, "Global Unicast"); |
3211 | 9.26k | proto_item_set_generated(ti); |
3212 | 9.26k | ti = proto_tree_add_string(itree, hf_ipv6_addr_space, tvb, offset, 2, "Global Unicast"); |
3213 | 9.26k | proto_item_set_generated(ti); |
3214 | 9.26k | } |
3215 | 32.7k | else if ((tvb_get_uint8(tvb, offset) & 0xFE) == 0xFC) { |
3216 | 463 | ti = proto_tree_add_string(vtree, *addr_info->hf_addr_space, tvb, offset, 2, "Unique Local Unicast"); |
3217 | 463 | proto_item_set_generated(ti); |
3218 | 463 | ti = proto_tree_add_string(itree, hf_ipv6_addr_space, tvb, offset, 2, "Unique Local Unicast"); |
3219 | 463 | proto_item_set_generated(ti); |
3220 | 463 | } |
3221 | 32.2k | else { |
3222 | 32.2k | ti = proto_tree_add_string(vtree, *addr_info->hf_addr_space, tvb, offset, 2, "Reserved by IETF"); |
3223 | 32.2k | proto_item_set_generated(ti); |
3224 | 32.2k | ti = proto_tree_add_string(itree, hf_ipv6_addr_space, tvb, offset, 2, "Reserved by IETF"); |
3225 | 32.2k | proto_item_set_generated(ti); |
3226 | 32.2k | } |
3227 | | |
3228 | | /* Check for IPv6 address special-purpose ranges. */ |
3229 | 45.4k | const ws_in6_addr *addr = tvb_get_ptr_ipv6(tvb, offset); |
3230 | 45.4k | const struct ws_iana_ip_special_block *block; |
3231 | 45.4k | proto_tree *vtree2; |
3232 | 45.4k | proto_tree *itree2; |
3233 | | |
3234 | 45.4k | if ((block = ws_iana_ipv6_special_block_lookup(addr)) != NULL) { |
3235 | 1.77k | ti = proto_tree_add_string(vtree, *addr_info->hf_special_purpose, tvb, offset, IPv6_ADDR_SIZE, block->name); |
3236 | 1.77k | proto_item_set_generated(ti); |
3237 | 1.77k | vtree2 = proto_item_add_subtree(ti, ett_ipv6_detail_special_purpose); |
3238 | | |
3239 | 1.77k | ti = proto_tree_add_string(itree, hf_ipv6_addr_special_purpose, tvb, offset, IPv6_ADDR_SIZE, block->name); |
3240 | 1.77k | proto_item_set_generated(ti); |
3241 | 1.77k | itree2 = proto_item_add_subtree(ti, ett_ipv6_detail_special_purpose); |
3242 | | |
3243 | 1.77k | if (block->source >= 0) { |
3244 | 1.77k | ti = proto_tree_add_boolean(vtree2, *addr_info->hf_special_purpose_source, tvb, offset, IPv6_ADDR_SIZE, block->source); |
3245 | 1.77k | proto_item_set_generated(ti); |
3246 | 1.77k | ti = proto_tree_add_boolean(itree2, hf_ipv6_addr_special_purpose_source, tvb, offset, IPv6_ADDR_SIZE, block->source); |
3247 | 1.77k | proto_item_set_generated(ti); |
3248 | 1.77k | } |
3249 | 1.77k | if (block->destination >= 0) { |
3250 | 1.77k | ti = proto_tree_add_boolean(vtree2, *addr_info->hf_special_purpose_destination, tvb, offset, IPv6_ADDR_SIZE, block->destination); |
3251 | 1.77k | proto_item_set_generated(ti); |
3252 | 1.77k | ti = proto_tree_add_boolean(itree2, hf_ipv6_addr_special_purpose_destination, tvb, offset, IPv6_ADDR_SIZE, block->destination); |
3253 | 1.77k | proto_item_set_generated(ti); |
3254 | 1.77k | } |
3255 | 1.77k | if (block->forwardable >= 0) { |
3256 | 1.77k | ti = proto_tree_add_boolean(vtree2, *addr_info->hf_special_purpose_forwardable, tvb, offset, IPv6_ADDR_SIZE, block->forwardable); |
3257 | 1.77k | proto_item_set_generated(ti); |
3258 | 1.77k | ti = proto_tree_add_boolean(itree2, hf_ipv6_addr_special_purpose_forwardable, tvb, offset, IPv6_ADDR_SIZE, block->forwardable); |
3259 | 1.77k | proto_item_set_generated(ti); |
3260 | 1.77k | } |
3261 | 1.77k | if (block->global >= 0) { |
3262 | 1.28k | ti = proto_tree_add_boolean(vtree2, *addr_info->hf_special_purpose_global, tvb, offset, IPv6_ADDR_SIZE, block->global); |
3263 | 1.28k | proto_item_set_generated(ti); |
3264 | 1.28k | ti = proto_tree_add_boolean(itree2, hf_ipv6_addr_special_purpose_global, tvb, offset, IPv6_ADDR_SIZE, block->global); |
3265 | 1.28k | proto_item_set_generated(ti); |
3266 | 1.28k | } |
3267 | 1.77k | if (block->reserved >= 0) { |
3268 | 1.77k | ti = proto_tree_add_boolean(vtree2, *addr_info->hf_special_purpose_reserved, tvb, offset, IPv6_ADDR_SIZE, block->reserved); |
3269 | 1.77k | proto_item_set_generated(ti); |
3270 | 1.77k | ti = proto_tree_add_boolean(itree2, hf_ipv6_addr_special_purpose_reserved, tvb, offset, IPv6_ADDR_SIZE, block->reserved); |
3271 | 1.77k | proto_item_set_generated(ti); |
3272 | 1.77k | } |
3273 | 1.77k | } |
3274 | 45.4k | } |
3275 | | |
3276 | | static void |
3277 | | add_ipv6_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, |
3278 | | struct ipv6_addr_info_s *addr_info) |
3279 | 45.7k | { |
3280 | 45.7k | ws_in6_addr addr; |
3281 | 45.7k | const char *name; |
3282 | 45.7k | proto_item *ti, *vis, *invis; |
3283 | | |
3284 | 45.7k | vis = proto_tree_add_item(tree, *addr_info->hf_addr, tvb, offset, IPv6_ADDR_SIZE, ENC_NA); |
3285 | 45.7k | invis = proto_tree_add_item(tree, hf_ipv6_addr, tvb, offset, IPv6_ADDR_SIZE, ENC_NA); |
3286 | 45.7k | proto_item_set_hidden(invis); |
3287 | | |
3288 | 45.7k | if (ipv6_address_detail) { |
3289 | 45.4k | add_ipv6_address_detail(pinfo, vis, invis, tvb, offset, addr_info); |
3290 | 45.4k | } |
3291 | | |
3292 | 45.7k | if (!proto_field_is_referenced(tree, *addr_info->hf_host) && |
3293 | 45.7k | !proto_field_is_referenced(tree, hf_ipv6_host)) { |
3294 | | |
3295 | 1.85k | return; |
3296 | 1.85k | } |
3297 | | |
3298 | 43.8k | tvb_get_ipv6(tvb, offset, &addr); |
3299 | 43.8k | name = get_hostname6_wmem(pinfo->pool, &addr); |
3300 | 43.8k | ti = proto_tree_add_string(tree, *addr_info->hf_host, tvb, offset, IPv6_ADDR_SIZE, name); |
3301 | 43.8k | proto_item_set_generated(ti); |
3302 | 43.8k | proto_item_set_hidden(ti); |
3303 | 43.8k | ti = proto_tree_add_string(tree, hf_ipv6_host, tvb, offset, IPv6_ADDR_SIZE, name); |
3304 | 43.8k | proto_item_set_generated(ti); |
3305 | 43.8k | proto_item_set_hidden(ti); |
3306 | 43.8k | } |
3307 | | |
3308 | | #define ADDRESS_SET_GENERATED_HIDDEN(ti) \ |
3309 | 172 | G_STMT_START { \ |
3310 | 172 | proto_item_set_generated(ti); \ |
3311 | 172 | if (i > 0) proto_item_set_hidden(ti); \ |
3312 | 172 | } G_STMT_END |
3313 | | |
3314 | | /* RFC 3056 section 2 */ |
3315 | | static void |
3316 | | add_ipv6_address_6to4(proto_tree *tree, tvbuff_t *tvb, int offset, |
3317 | | int hf_gateway, int hf_sla_id) |
3318 | 45.3k | { |
3319 | 45.3k | if (tvb_get_ntohs(tvb, offset) != 0x2002) |
3320 | 45.2k | return; |
3321 | | |
3322 | 27 | struct { int gateway, sla_id; } hf[2] = { |
3323 | 27 | { hf_gateway, hf_sla_id}, |
3324 | 27 | { hf_ipv6_6to4_gateway_ipv4, hf_ipv6_6to4_sla_id} |
3325 | 27 | }; |
3326 | 27 | proto_item *ti; |
3327 | 81 | for (int i = 0; i < 2; i++) { |
3328 | 54 | ti = proto_tree_add_item(tree, hf[i].gateway, tvb, offset + 2, 4, ENC_BIG_ENDIAN); |
3329 | 54 | ADDRESS_SET_GENERATED_HIDDEN(ti); |
3330 | 54 | ti = proto_tree_add_item(tree, hf[i].sla_id, tvb, offset + 6, 2, ENC_BIG_ENDIAN); |
3331 | 54 | ADDRESS_SET_GENERATED_HIDDEN(ti); |
3332 | 54 | } |
3333 | 27 | } |
3334 | | |
3335 | | /* RFC 4380 section 4 */ |
3336 | | static void |
3337 | | add_ipv6_address_teredo(proto_tree *tree, tvbuff_t *tvb, int offset, |
3338 | | int hf_server, int hf_port, int hf_client) |
3339 | 45.3k | { |
3340 | 45.3k | if (tvb_get_ntohl(tvb, offset) != 0x20010000) |
3341 | 45.2k | return; |
3342 | | |
3343 | 4 | uint16_t mapped_port = tvb_get_ntohs(tvb, offset + 10) ^ 0xffff; |
3344 | 4 | uint32_t client_v4 = tvb_get_ipv4(tvb, offset + 12) ^ 0xffffffff; |
3345 | | |
3346 | 4 | struct { int server, port, client; } hf[2] = { |
3347 | 4 | { hf_server, hf_port, hf_client }, |
3348 | 4 | { hf_ipv6_teredo_server_ipv4, hf_ipv6_teredo_port, hf_ipv6_teredo_client_ipv4 } |
3349 | 4 | }; |
3350 | 4 | proto_item *ti; |
3351 | 12 | for (int i = 0; i < 2; i++) { |
3352 | 8 | ti = proto_tree_add_item(tree, hf[i].server, tvb, offset + 4, 4, ENC_BIG_ENDIAN); |
3353 | 8 | ADDRESS_SET_GENERATED_HIDDEN(ti); |
3354 | 8 | ti = proto_tree_add_uint(tree, hf[i].port, tvb, offset + 10, 2, mapped_port); |
3355 | 8 | ADDRESS_SET_GENERATED_HIDDEN(ti); |
3356 | 8 | ti = proto_tree_add_ipv4(tree, hf[i].client, tvb, offset + 12, 4, client_v4); |
3357 | 8 | ADDRESS_SET_GENERATED_HIDDEN(ti); |
3358 | 8 | } |
3359 | 4 | } |
3360 | | |
3361 | | /* RFC 4291 appendix A */ |
3362 | | static void |
3363 | | add_ipv6_address_slaac(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, int hf_slaac) |
3364 | 45.3k | { |
3365 | 45.3k | if (!(tvb_get_uint8(tvb, offset + 8) & 0x02) || |
3366 | 45.3k | !(tvb_get_ntohs(tvb, offset + 11) == 0xfffe)) { |
3367 | 45.2k | return; |
3368 | 45.2k | } |
3369 | | |
3370 | 20 | uint8_t *mac_addr = (uint8_t *)wmem_alloc(pinfo->pool, 6); |
3371 | 20 | tvb_memcpy(tvb, mac_addr, offset + 8, 3); |
3372 | 20 | tvb_memcpy(tvb, mac_addr+3, offset + 13, 3); |
3373 | 20 | mac_addr[0] &= ~0x02; |
3374 | | |
3375 | 20 | struct { int mac; } hf[2] = { |
3376 | 20 | { hf_slaac }, |
3377 | 20 | { hf_ipv6_slaac_mac } |
3378 | 20 | }; |
3379 | 20 | proto_item *ti; |
3380 | 60 | for (int i = 0; i < 2; i++) { |
3381 | 40 | ti = proto_tree_add_ether(tree, hf[i].mac, tvb, offset + 8, 8, mac_addr); |
3382 | 40 | ADDRESS_SET_GENERATED_HIDDEN(ti); |
3383 | 40 | } |
3384 | 20 | } |
3385 | | |
3386 | | /* RFC 5214 section 6.1 */ |
3387 | | static void |
3388 | | add_ipv6_address_isatap(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_isatap) |
3389 | 45.3k | { |
3390 | 45.3k | if ((tvb_get_ntohl(tvb, offset + 8) & 0xfcffffff) != 0x00005efe) |
3391 | 45.3k | return; |
3392 | | |
3393 | 0 | struct { int ipv4; } hf[2] = { |
3394 | 0 | { hf_isatap }, |
3395 | 0 | { hf_ipv6_isatap_ipv4 } |
3396 | 0 | }; |
3397 | 0 | proto_item *ti; |
3398 | 0 | for (int i = 0; i < 2; i++) { |
3399 | 0 | ti = proto_tree_add_item(tree, hf[i].ipv4, tvb, offset + 12, 4, ENC_BIG_ENDIAN); |
3400 | 0 | ADDRESS_SET_GENERATED_HIDDEN(ti); |
3401 | 0 | } |
3402 | 0 | } |
3403 | | |
3404 | | /* RFC 6052 */ |
3405 | | static void |
3406 | | add_ipv6_address_embed_ipv4(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, int hf_embed) |
3407 | 45.3k | { |
3408 | | /* Section 2.1: Well-Known Prefix for IPv4-Embedded IPv6 Address: 64:FF9B::/96 */ |
3409 | 45.3k | static const uint8_t well_known_prefix[] = { |
3410 | 45.3k | 0x00, 0x64, 0xFF, 0x9B, |
3411 | 45.3k | 0x00, 0x00, 0x00, 0x00, |
3412 | 45.3k | 0x00, 0x00, 0x00, 0x00 |
3413 | 45.3k | }; |
3414 | | |
3415 | 45.3k | ws_in6_addr ipv6_addr; |
3416 | 45.3k | ws_in4_addr ipv4_addr; |
3417 | 45.3k | int ipv4_prefix; |
3418 | 45.3k | int ipv4_offset; |
3419 | 45.3k | bool ipv6_embed_ipv4 = false; |
3420 | | |
3421 | 45.3k | if (tvb_memeql(tvb, offset, well_known_prefix, sizeof well_known_prefix) == 0) { |
3422 | 130 | ipv4_addr = tvb_get_bits32(tvb, (offset * 8) + 96, 32, ENC_BIG_ENDIAN); |
3423 | 130 | ipv4_prefix = 96; |
3424 | 130 | ipv4_offset = 96; |
3425 | 130 | ipv6_embed_ipv4 = true; |
3426 | 45.1k | } else { |
3427 | 45.1k | for (size_t j = 0; j < number_of_nat64_prefix; j++) { |
3428 | 0 | if (nat64_prefix_uats[j].prefix_len <= nat64_prefix_uats[j].prefix_wildcard_len) { |
3429 | 0 | continue; |
3430 | 0 | } |
3431 | | |
3432 | 0 | if (ws_inet_pton6(nat64_prefix_uats[j].ipaddr, &ipv6_addr)) { |
3433 | 0 | if (tvb_memeql(tvb, offset, (const uint8_t *)&ipv6_addr, |
3434 | 0 | (nat64_prefix_uats[j].prefix_len - nat64_prefix_uats[j].prefix_wildcard_len) / 8) == 0) { |
3435 | 0 | switch (nat64_prefix_uats[j].prefix_len) |
3436 | 0 | { |
3437 | 0 | case 32: |
3438 | 0 | ipv4_addr = tvb_get_bits32(tvb, (offset * 8) + 32, 32, ENC_BIG_ENDIAN); |
3439 | 0 | break; |
3440 | 0 | case 40: |
3441 | 0 | ipv4_addr = tvb_get_bits32(tvb, (offset * 8) + 40, 24, ENC_BIG_ENDIAN) << 8; |
3442 | 0 | ipv4_addr |= tvb_get_bits32(tvb, (offset * 8) + 72, 8, ENC_BIG_ENDIAN); |
3443 | 0 | break; |
3444 | 0 | case 48: |
3445 | 0 | ipv4_addr = tvb_get_bits32(tvb, (offset * 8) + 48, 16, ENC_BIG_ENDIAN) << 16; |
3446 | 0 | ipv4_addr |= tvb_get_bits32(tvb, (offset * 8) + 72, 16, ENC_BIG_ENDIAN); |
3447 | 0 | break; |
3448 | 0 | case 56: |
3449 | 0 | ipv4_addr = tvb_get_bits32(tvb, (offset * 8) + 56, 8, ENC_BIG_ENDIAN) << 24; |
3450 | 0 | ipv4_addr |= tvb_get_bits32(tvb, (offset * 8) + 72, 24, ENC_BIG_ENDIAN); |
3451 | 0 | break; |
3452 | 0 | case 64: |
3453 | 0 | ipv4_addr = tvb_get_bits32(tvb, (offset * 8) + 72, 32, ENC_BIG_ENDIAN); |
3454 | 0 | break; |
3455 | 0 | case 96: |
3456 | 0 | ipv4_addr = tvb_get_bits32(tvb, (offset * 8) + 96, 32, ENC_BIG_ENDIAN); |
3457 | 0 | break; |
3458 | 0 | default: |
3459 | 0 | DISSECTOR_ASSERT_NOT_REACHED(); |
3460 | 0 | } |
3461 | | |
3462 | 0 | ipv4_prefix = nat64_prefix_uats[j].prefix_len; |
3463 | 0 | if (ipv4_prefix != 64) { |
3464 | 0 | ipv4_offset = ipv4_prefix; |
3465 | 0 | } else { |
3466 | 0 | ipv4_offset = 72; |
3467 | 0 | } |
3468 | 0 | ipv6_embed_ipv4 = true; |
3469 | 0 | break; |
3470 | 0 | } |
3471 | 0 | } |
3472 | 0 | } |
3473 | 45.1k | } |
3474 | | |
3475 | 45.3k | if (ipv6_embed_ipv4) { |
3476 | 130 | proto_item *ti; |
3477 | | |
3478 | | // The prefix |
3479 | 130 | ti = proto_tree_add_item(tree, hf_ipv6_embed_ipv4_prefix, tvb, offset, ipv4_prefix / 8, ENC_NA); |
3480 | 130 | proto_item_set_generated(ti); |
3481 | | |
3482 | | // Majority of IPv4 address is after u-field |
3483 | 130 | if (ipv4_prefix >= 56) { |
3484 | 130 | if (ipv4_prefix < 96) { |
3485 | 0 | ti = proto_tree_add_item(tree, hf_ipv6_embed_ipv4_u, tvb, offset + 8, 1, ENC_NA); |
3486 | 0 | proto_item_set_generated(ti); |
3487 | 0 | } |
3488 | 130 | if (tvb_get_uint8(tvb, offset + 8)) { |
3489 | 0 | expert_add_info(pinfo, ti, &ei_ipv6_embed_ipv4_u_value); |
3490 | 0 | } |
3491 | 130 | } |
3492 | | |
3493 | | // IPv4 embedded address |
3494 | 130 | ipv4_addr = g_ntohl(ipv4_addr); |
3495 | 130 | ti = proto_tree_add_ipv4(tree, hf_embed, tvb, |
3496 | 130 | offset + (ipv4_offset / 8), |
3497 | 130 | (ipv4_offset > 32 && ipv4_offset < 64) ? 5 : 4, ipv4_addr); |
3498 | 130 | proto_item_set_generated(ti); |
3499 | | |
3500 | 130 | ti = proto_tree_add_ipv4(tree, hf_ipv6_embed_ipv4, tvb, |
3501 | 130 | offset + (ipv4_offset / 8), |
3502 | 130 | (ipv4_offset > 32 && ipv4_offset < 64) ? 5 : 4, ipv4_addr); |
3503 | 130 | proto_item_set_generated(ti); |
3504 | | |
3505 | | // Majority of IPv4 address is before u-field |
3506 | 130 | if (ipv4_prefix < 56) { |
3507 | 0 | ti = proto_tree_add_item(tree, hf_ipv6_embed_ipv4_u, tvb, offset + 8, 1, ENC_NA); |
3508 | 0 | proto_item_set_generated(ti); |
3509 | 0 | if (tvb_get_uint8(tvb, offset + 8)) { |
3510 | 0 | expert_add_info(pinfo, ti, &ei_ipv6_embed_ipv4_u_value); |
3511 | 0 | } |
3512 | 0 | } |
3513 | | |
3514 | | // Suffix, if present |
3515 | 130 | if (ipv4_prefix < 96) { |
3516 | 0 | ti = proto_tree_add_item(tree, hf_ipv6_embed_ipv4_suffix, tvb, |
3517 | 0 | offset + ((72 + ipv4_prefix - 32) / 8), |
3518 | 0 | (56 - (ipv4_prefix - 32)) / 8, |
3519 | 0 | ENC_NA); |
3520 | 0 | proto_item_set_generated(ti); |
3521 | 0 | } |
3522 | 130 | } |
3523 | 45.3k | } |
3524 | | |
3525 | | static void |
3526 | | export_pdu(tvbuff_t *tvb, packet_info *pinfo) |
3527 | 22.6k | { |
3528 | 22.6k | if (have_tap_listener(exported_pdu_tap)) { |
3529 | 0 | exp_pdu_data_t *exp_pdu_data = wmem_new0(pinfo->pool, exp_pdu_data_t); |
3530 | |
|
3531 | 0 | exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb); |
3532 | 0 | exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb); |
3533 | 0 | exp_pdu_data->pdu_tvb = tvb; |
3534 | 0 | tap_queue_packet(exported_pdu_tap, pinfo, exp_pdu_data); |
3535 | 0 | } |
3536 | 22.6k | } |
3537 | | |
3538 | | static struct ipv6_analysis * |
3539 | | init_ipv6_conversation_data(packet_info *pinfo) |
3540 | 9.65k | { |
3541 | 9.65k | struct ipv6_analysis *ipv6d; |
3542 | | |
3543 | | /* Initialize the ip protocol data structure to add to the ip conversation */ |
3544 | 9.65k | ipv6d=wmem_new0(wmem_file_scope(), struct ipv6_analysis); |
3545 | | |
3546 | 9.65k | ipv6d->initial_frame = pinfo->num; |
3547 | 9.65k | ipv6d->stream = 0; |
3548 | 9.65k | ipv6d->stream = ipv6_stream_count++; |
3549 | | |
3550 | 9.65k | return ipv6d; |
3551 | 9.65k | } |
3552 | | |
3553 | | struct ipv6_analysis * |
3554 | | get_ipv6_conversation_data(conversation_t *conv, packet_info *pinfo) |
3555 | 22.6k | { |
3556 | 22.6k | struct ipv6_analysis *ipv6d; |
3557 | | |
3558 | | /* Did the caller supply the conversation pointer? */ |
3559 | 22.6k | if( conv==NULL ) { |
3560 | 0 | return NULL; |
3561 | 0 | } |
3562 | | |
3563 | | /* Get the data for this conversation */ |
3564 | 22.6k | ipv6d=(struct ipv6_analysis *)conversation_get_proto_data(conv, proto_ipv6); |
3565 | | |
3566 | 22.6k | if (!ipv6d) { |
3567 | 9.65k | ipv6d = init_ipv6_conversation_data(pinfo); |
3568 | 9.65k | conversation_add_proto_data(conv, proto_ipv6, ipv6d); |
3569 | 9.65k | } |
3570 | | |
3571 | 22.6k | if (!ipv6d) { |
3572 | 0 | return NULL; |
3573 | 0 | } |
3574 | | |
3575 | 22.6k | return ipv6d; |
3576 | 22.6k | } |
3577 | | |
3578 | | static int |
3579 | | dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
3580 | 23.2k | { |
3581 | 23.2k | proto_tree *ipv6_tree, *pt; |
3582 | 23.2k | proto_item *ipv6_item, *ti, *pi; |
3583 | 23.2k | proto_item *ti_ipv6_plen = NULL, *ti_ipv6_version; |
3584 | 23.2k | uint8_t ip6_tcls, ip6_nxt, ip6_hlim; |
3585 | 23.2k | uint32_t ip6_flow; |
3586 | 23.2k | const ws_in6_addr *ip6_src, *ip6_dst; |
3587 | 23.2k | uint32_t ip6_plen = 0, jumbo_plen = 0; |
3588 | 23.2k | uint32_t plen; |
3589 | 23.2k | int offset; |
3590 | 23.2k | unsigned reported_plen; |
3591 | 23.2k | tvbuff_t *next_tvb; |
3592 | 23.2k | bool save_fragmented; |
3593 | 23.2k | int version; |
3594 | 23.2k | ws_ip6 *iph; |
3595 | 23.2k | struct ipv6_analysis *ipv6d=NULL; |
3596 | | |
3597 | 23.2k | offset = 0; |
3598 | | |
3599 | 23.2k | iph = wmem_new0(pinfo->pool, ws_ip6); |
3600 | | |
3601 | 23.2k | col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPv6"); |
3602 | 23.2k | col_clear(pinfo->cinfo, COL_INFO); |
3603 | | |
3604 | 23.2k | ipv6_item = proto_tree_add_item(tree, proto_ipv6, tvb, offset, IPv6_HDR_SIZE, ENC_NA); |
3605 | 23.2k | ipv6_tree = proto_item_add_subtree(ipv6_item, ett_ipv6_proto); |
3606 | | |
3607 | | |
3608 | | /* Validate IP version (6) */ |
3609 | 23.2k | version = tvb_get_bits8(tvb, (offset + IP6H_CTL_VFC) * 8, 4); |
3610 | 23.2k | ti_ipv6_version = proto_tree_add_bits_item(ipv6_tree, hf_ipv6_version, tvb, |
3611 | 23.2k | (offset + IP6H_CTL_VFC) * 8, 4, ENC_BIG_ENDIAN); |
3612 | 23.2k | pi = proto_tree_add_item(ipv6_tree, hf_ip_version, tvb, |
3613 | 23.2k | offset + IP6H_CTL_VFC, 1, ENC_BIG_ENDIAN); |
3614 | 23.2k | proto_item_append_text(pi, " [This field makes the filter match on \"ip.version == 6\" possible]"); |
3615 | 23.2k | proto_item_set_hidden(pi); |
3616 | 23.2k | if (version != 6) { |
3617 | 258 | col_add_fstr(pinfo->cinfo, COL_INFO, |
3618 | 258 | "Bogus IPv6 version (%u, must be 6)", version); |
3619 | 258 | expert_add_info_format(pinfo, ti_ipv6_version, &ei_ipv6_bogus_ipv6_version, "Bogus IPv6 version"); |
3620 | 258 | return offset + IP6H_CTL_VFC; |
3621 | 258 | } |
3622 | | |
3623 | | /* Validate header size (40 bytes) */ |
3624 | 23.0k | if (tvb_reported_length(tvb) < IPv6_HDR_SIZE) { |
3625 | 332 | col_add_fstr(pinfo->cinfo, COL_INFO, |
3626 | 332 | "Invalid IPv6 header (%u bytes, need exactly 40)", |
3627 | 332 | tvb_reported_length(tvb)); |
3628 | 332 | expert_add_info_format(pinfo, ipv6_item, &ei_ipv6_invalid_header, |
3629 | 332 | "IPv6 header must be exactly 40 bytes"); |
3630 | 332 | } |
3631 | | |
3632 | | /* !!! warning: (4-bit) version, (6-bit) DSCP, (2-bit) ECN and (20-bit) Flow */ |
3633 | 23.0k | ti = proto_tree_add_item(ipv6_tree, hf_ipv6_tclass, tvb, |
3634 | 23.0k | offset + IP6H_CTL_VFC, 4, ENC_BIG_ENDIAN); |
3635 | 23.0k | ip6_tcls = tvb_get_bits8(tvb, (offset + IP6H_CTL_VFC) * 8 + 4, 8); |
3636 | 23.0k | proto_item_append_text(ti, " (DSCP: %s, ECN: %s)", |
3637 | 23.0k | val_to_str_ext_const(IPDSFIELD_DSCP(ip6_tcls), &dscp_short_vals_ext, "Unknown"), |
3638 | 23.0k | val_to_str_ext_const(IPDSFIELD_ECN(ip6_tcls), &ecn_short_vals_ext, "Unknown")); |
3639 | | |
3640 | 23.0k | pt = proto_item_add_subtree(ti, ett_ipv6_traffic_class); |
3641 | 23.0k | proto_tree_add_item(pt, hf_ipv6_tclass_dscp, tvb, |
3642 | 23.0k | offset + IP6H_CTL_VFC, 4, ENC_BIG_ENDIAN); |
3643 | 23.0k | proto_tree_add_item(pt, hf_ipv6_tclass_ecn, tvb, |
3644 | 23.0k | offset + IP6H_CTL_VFC, 4, ENC_BIG_ENDIAN); |
3645 | | |
3646 | | /* Set DSCP column */ |
3647 | 23.0k | col_add_str(pinfo->cinfo, COL_DSCP_VALUE, |
3648 | 23.0k | val_to_str_ext(IPDSFIELD_DSCP(ip6_tcls), &dscp_short_vals_ext, "%u")); |
3649 | | |
3650 | 23.0k | proto_tree_add_item_ret_uint(ipv6_tree, hf_ipv6_flow, tvb, |
3651 | 23.0k | offset + IP6H_CTL_FLOW + 1, 3, ENC_BIG_ENDIAN, &ip6_flow); |
3652 | | |
3653 | 23.0k | ip6_plen = tvb_get_uint16(tvb, offset + IP6H_CTL_PLEN, ENC_BIG_ENDIAN); |
3654 | | |
3655 | 23.0k | ip6_nxt = tvb_get_uint8(tvb, offset + IP6H_CTL_NXT); |
3656 | | |
3657 | 23.0k | if (ipv6_tso_supported && ip6_plen == 0 && |
3658 | 23.0k | ip6_nxt != IP_PROTO_HOPOPTS && ip6_nxt != IP_PROTO_NONE) { |
3659 | 0 | ip6_plen = tvb_reported_length(tvb) - IPv6_HDR_SIZE; |
3660 | 0 | pi = proto_tree_add_uint_format_value(ipv6_tree, hf_ipv6_plen, tvb, |
3661 | 0 | offset + IP6H_CTL_PLEN, 2, ip6_plen, |
3662 | 0 | "%u bytes (reported as 0, presumed to be because " |
3663 | 0 | "of \"TCP segmentation offload\" (TSO))", |
3664 | 0 | ip6_plen); |
3665 | 0 | proto_item_set_generated(pi); |
3666 | 23.0k | } else { |
3667 | 23.0k | ti_ipv6_plen = proto_tree_add_item(ipv6_tree, hf_ipv6_plen, tvb, |
3668 | 23.0k | offset + IP6H_CTL_PLEN, 2, ENC_BIG_ENDIAN); |
3669 | 23.0k | if (ip6_plen == 0 && ip6_nxt != IP_PROTO_HOPOPTS && ip6_nxt != IP_PROTO_NONE) { |
3670 | 80 | expert_add_info(pinfo, ti_ipv6_plen, &ei_ipv6_plen_zero); |
3671 | 80 | } |
3672 | 23.0k | } |
3673 | | |
3674 | 23.0k | proto_tree_add_item(ipv6_tree, hf_ipv6_nxt, tvb, offset + IP6H_CTL_NXT, 1, ENC_NA); |
3675 | | |
3676 | 23.0k | proto_tree_add_item(ipv6_tree, hf_ipv6_hlim, tvb, |
3677 | 23.0k | offset + IP6H_CTL_HLIM, 1, ENC_BIG_ENDIAN); |
3678 | 23.0k | ip6_hlim = tvb_get_uint8(tvb, offset + IP6H_CTL_HLIM); |
3679 | | |
3680 | | /* Source address */ |
3681 | 23.0k | add_ipv6_address(pinfo, ipv6_tree, tvb, offset + IP6H_SRC, &ipv6_src_info); |
3682 | 23.0k | ip6_src = tvb_get_ptr_ipv6(tvb, offset + IP6H_SRC); |
3683 | 23.0k | alloc_address_wmem_ipv6(pinfo->pool, &pinfo->net_src, ip6_src); |
3684 | 23.0k | copy_address_shallow(&pinfo->src, &pinfo->net_src); |
3685 | | |
3686 | | /* Destination address */ |
3687 | 23.0k | add_ipv6_address(pinfo, ipv6_tree, tvb, offset + IP6H_DST, &ipv6_dst_info); |
3688 | 23.0k | ip6_dst = tvb_get_ptr_ipv6(tvb, offset + IP6H_DST); |
3689 | 23.0k | alloc_address_wmem_ipv6(pinfo->pool, &pinfo->net_dst, ip6_dst); |
3690 | 23.0k | copy_address_shallow(&pinfo->dst, &pinfo->net_dst); |
3691 | | |
3692 | 23.0k | if (tree) { |
3693 | 22.6k | if (ipv6_summary_in_tree) { |
3694 | 22.6k | proto_item_append_text(ipv6_item, ", Src: %s, Dst: %s", |
3695 | 22.6k | address_with_resolution_to_str(pinfo->pool, &pinfo->src), |
3696 | 22.6k | address_with_resolution_to_str(pinfo->pool, &pinfo->dst)); |
3697 | 22.6k | } |
3698 | | |
3699 | | /* Add the different items for the address */ |
3700 | 22.6k | add_ipv6_address_6to4(ipv6_tree, tvb, offset + IP6H_SRC, |
3701 | 22.6k | hf_ipv6_src_6to4_gateway_ipv4, hf_ipv6_src_6to4_sla_id); |
3702 | 22.6k | add_ipv6_address_6to4(ipv6_tree, tvb, offset + IP6H_DST, |
3703 | 22.6k | hf_ipv6_dst_6to4_gateway_ipv4, hf_ipv6_dst_6to4_sla_id); |
3704 | | |
3705 | 22.6k | add_ipv6_address_teredo(ipv6_tree, tvb, offset + IP6H_SRC, |
3706 | 22.6k | hf_ipv6_src_teredo_server_ipv4, hf_ipv6_src_teredo_port, hf_ipv6_src_teredo_client_ipv4); |
3707 | 22.6k | add_ipv6_address_teredo(ipv6_tree, tvb, offset + IP6H_DST, |
3708 | 22.6k | hf_ipv6_dst_teredo_server_ipv4, hf_ipv6_dst_teredo_port, hf_ipv6_dst_teredo_client_ipv4); |
3709 | | |
3710 | 22.6k | add_ipv6_address_slaac(pinfo, ipv6_tree, tvb, offset + IP6H_SRC, hf_ipv6_src_slaac_mac); |
3711 | 22.6k | add_ipv6_address_slaac(pinfo, ipv6_tree, tvb, offset + IP6H_DST, hf_ipv6_dst_slaac_mac); |
3712 | | |
3713 | 22.6k | add_ipv6_address_isatap(ipv6_tree, tvb, offset + IP6H_SRC, hf_ipv6_src_isatap_ipv4); |
3714 | 22.6k | add_ipv6_address_isatap(ipv6_tree, tvb, offset + IP6H_DST, hf_ipv6_dst_isatap_ipv4); |
3715 | | |
3716 | 22.6k | add_ipv6_address_embed_ipv4(pinfo, ipv6_tree, tvb, offset + IP6H_SRC, hf_ipv6_src_embed_ipv4); |
3717 | 22.6k | add_ipv6_address_embed_ipv4(pinfo, ipv6_tree, tvb, offset + IP6H_DST, hf_ipv6_dst_embed_ipv4); |
3718 | | |
3719 | 22.6k | if (gbl_resolv_flags.maxmind_geoip) { |
3720 | 22.6k | add_geoip_info(ipv6_tree, pinfo, tvb, offset, ip6_src, ip6_dst); |
3721 | 22.6k | } |
3722 | 22.6k | } |
3723 | | |
3724 | | /* Increment offset to point to next header (may be an extension header) */ |
3725 | 23.0k | offset += IPv6_HDR_SIZE; |
3726 | | |
3727 | | /* Check for Jumbo option */ |
3728 | 23.0k | plen = ip6_plen; |
3729 | 23.0k | if (plen == 0 && ip6_nxt == IP_PROTO_HOPOPTS) { |
3730 | 95 | jumbo_plen = ipv6_get_jumbo_plen(tvb, offset); |
3731 | 95 | if (jumbo_plen != 0) { |
3732 | 0 | proto_item_append_text(ti_ipv6_plen, " (Jumbogram)"); |
3733 | 0 | plen = jumbo_plen; |
3734 | 95 | } else { |
3735 | | /* IPv6 length zero is invalid if there is a hop-by-hop header without jumbo option */ |
3736 | 95 | col_set_str(pinfo->cinfo, COL_INFO, "Invalid IPv6 payload length"); |
3737 | 95 | expert_add_info(pinfo, ti_ipv6_plen, &ei_ipv6_opt_jumbo_missing); |
3738 | 95 | } |
3739 | 95 | } |
3740 | | |
3741 | 23.0k | reported_plen = tvb_reported_length(tvb) - IPv6_HDR_SIZE; |
3742 | 23.0k | if (!pinfo->flags.in_error_pkt && plen > reported_plen) { |
3743 | 15.3k | expert_add_info_format(pinfo, ti_ipv6_plen, &ei_ipv6_plen_exceeds_framing, |
3744 | 15.3k | "IPv6 payload length exceeds framing length (%d bytes)", reported_plen); |
3745 | 15.3k | } |
3746 | | |
3747 | | |
3748 | 23.0k | if (ipv6_track_conv_id) { |
3749 | | /* conversation management */ |
3750 | 22.6k | conversation_t *conv; |
3751 | | |
3752 | | /* find (and extend) an existing conversation, or create a new one */ |
3753 | 22.6k | conv = find_conversation_strat(pinfo, CONVERSATION_IPV6, NO_PORT_X, false); |
3754 | 22.6k | if(!conv) { |
3755 | 9.65k | conv=conversation_new_strat(pinfo, CONVERSATION_IPV6, NO_PORTS); |
3756 | 9.65k | } |
3757 | 12.9k | else { |
3758 | | /* |
3759 | | * while not strictly necessary because there is only 1 |
3760 | | * conversation between 2 IPs, we still move the last frame |
3761 | | * indicator as being a usual practice. |
3762 | | */ |
3763 | 12.9k | if (!(pinfo->fd->visited)) { |
3764 | 12.9k | if (pinfo->num > conv->last_frame) { |
3765 | 12.2k | conv->last_frame = pinfo->num; |
3766 | 12.2k | } |
3767 | 12.9k | } |
3768 | 12.9k | } |
3769 | | |
3770 | 22.6k | ipv6d = get_ipv6_conversation_data(conv, pinfo); |
3771 | 22.6k | if(ipv6d) { |
3772 | 22.6k | iph->ip6_stream = ipv6d->stream; |
3773 | | |
3774 | 22.6k | ipv6_item = proto_tree_add_uint(ipv6_tree, hf_ipv6_stream, tvb, 0, 0, ipv6d->stream); |
3775 | 22.6k | proto_item_set_generated(ipv6_item); |
3776 | 22.6k | } |
3777 | 22.6k | } |
3778 | | |
3779 | | /* Fill in IP header fields for subdissectors */ |
3780 | 23.0k | iph->ip6_ver = 6; |
3781 | 23.0k | iph->ip6_tc = ip6_tcls; |
3782 | 23.0k | iph->ip6_flw = ip6_flow; |
3783 | 23.0k | iph->ip6_len = plen; |
3784 | 23.0k | iph->ip6_nxt = ip6_nxt; |
3785 | 23.0k | iph->ip6_hop = ip6_hlim; |
3786 | 23.0k | alloc_address_wmem_ipv6(pinfo->pool, &iph->ip6_src, ip6_src); |
3787 | 23.0k | alloc_address_wmem_ipv6(pinfo->pool, &iph->ip6_dst, ip6_dst); |
3788 | | |
3789 | | /* Shared state between IPv6 header and extensions. */ |
3790 | 23.0k | ipv6_pinfo_t *ipv6_pinfo = wmem_new0(pinfo->pool, ipv6_pinfo_t); |
3791 | 23.0k | ipv6_pinfo->ip6_plen = ip6_plen; |
3792 | 23.0k | ipv6_pinfo->jumbo_plen = jumbo_plen; |
3793 | 23.0k | ipv6_pinfo->frag_plen = ip6_plen; /* updated by extension header dissectors, if any */ |
3794 | 23.0k | if (!ipv6_exthdr_under_root) { |
3795 | 22.6k | ipv6_pinfo->ipv6_tree = ipv6_tree; |
3796 | 22.6k | ipv6_pinfo->ipv6_item_len = IPv6_HDR_SIZE; |
3797 | 22.6k | } |
3798 | 23.0k | p_add_proto_data(pinfo->pool, pinfo, proto_ipv6, IPV6_PROTO_PINFO, ipv6_pinfo); |
3799 | | |
3800 | | /* Adjust the length of this tvbuff to include only the IPv6 datagram. */ |
3801 | 23.0k | set_actual_length(tvb, IPv6_HDR_SIZE + plen); |
3802 | | /* Only export after adjusting the length */ |
3803 | 23.0k | export_pdu(tvb, pinfo); |
3804 | 23.0k | save_fragmented = pinfo->fragmented; |
3805 | | |
3806 | 23.0k | p_add_ipv6_nxt(pinfo, ip6_nxt); |
3807 | | |
3808 | 23.0k | next_tvb = tvb_new_subset_remaining(tvb, offset); |
3809 | 23.0k | TRY { |
3810 | 22.6k | ipv6_dissect_next(ip6_nxt, next_tvb, pinfo, tree, iph); |
3811 | 22.6k | } |
3812 | 23.0k | FINALLY { |
3813 | | /* If we need to extend the length due to an ext header and haven't |
3814 | | * yet, do so now. This might be due to an exception or unreassembled |
3815 | | * fragments. |
3816 | | * XXX: What about the tap? We want to tap if we haven't yet, but |
3817 | | * if we always tapped here we would send to the tap in reverse order |
3818 | | * for IP-in-IP. |
3819 | | */ |
3820 | 22.6k | if (ipv6_pinfo != NULL && ipv6_pinfo->ipv6_tree != NULL) { |
3821 | | /* Set IPv6 Header length */ |
3822 | 627 | proto_item_set_len(proto_tree_get_parent(ipv6_pinfo->ipv6_tree), ipv6_pinfo->ipv6_item_len); |
3823 | 627 | ipv6_pinfo->ipv6_tree = NULL; |
3824 | 627 | } |
3825 | 22.6k | } |
3826 | 23.0k | ENDTRY; |
3827 | | |
3828 | 23.0k | pinfo->fragmented = save_fragmented; |
3829 | 23.0k | return tvb_captured_length(tvb); |
3830 | 23.2k | } |
3831 | | |
3832 | | void |
3833 | | ipv6_dissect_next(unsigned nxt, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, ws_ip6 *iph) |
3834 | 25.5k | { |
3835 | 25.5k | dissector_handle_t nxt_handle; |
3836 | 25.5k | ipv6_pinfo_t *ipv6_pinfo = p_get_ipv6_pinfo(pinfo); |
3837 | | |
3838 | | /* https://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml#extension-header */ |
3839 | | |
3840 | 25.5k | switch (nxt) { |
3841 | 2.80k | case IP_PROTO_HOPOPTS: |
3842 | 2.98k | case IP_PROTO_ROUTING: |
3843 | 3.08k | case IP_PROTO_FRAGMENT: |
3844 | | //case IP_PROTO_ESP: Even though ESP is technically an extension header, |
3845 | | // we treat it as a payload container. |
3846 | 3.13k | case IP_PROTO_AH: |
3847 | 3.14k | case IP_PROTO_DSTOPTS: |
3848 | 3.25k | case IP_PROTO_MIPV6: |
3849 | | //case IP_PROTO_HIP: Even though HIP is technically an extension header, the only defined |
3850 | | // next header is IP_NONE. Also the HIP dissector is not ready for this. |
3851 | 3.32k | case IP_PROTO_SHIM6: |
3852 | 3.32k | nxt_handle = dissector_get_uint_handle(ip_dissector_table, nxt); |
3853 | 3.32k | break; |
3854 | 22.2k | default: |
3855 | 22.2k | nxt_handle = NULL; |
3856 | 22.2k | break; |
3857 | 25.5k | } |
3858 | 25.5k | if (nxt_handle != NULL) { |
3859 | 3.32k | call_dissector_with_data(nxt_handle, tvb, pinfo, tree, iph); |
3860 | 3.32k | return; |
3861 | 3.32k | } |
3862 | | |
3863 | | /* |
3864 | | * Done with extension header chain |
3865 | | */ |
3866 | | |
3867 | 22.2k | if (ipv6_pinfo != NULL && ipv6_pinfo->ipv6_tree != NULL) { |
3868 | | /* Set IPv6 Header length */ |
3869 | 22.0k | proto_item_set_len(proto_tree_get_parent(ipv6_pinfo->ipv6_tree), ipv6_pinfo->ipv6_item_len); |
3870 | 22.0k | ipv6_pinfo->ipv6_tree = NULL; |
3871 | 22.0k | } |
3872 | | |
3873 | 22.2k | if (iph != NULL && iph->ip6_ver == 6) { |
3874 | 22.0k | iph->ip6_nxt = nxt; /* upper-layer protocol more useful */ |
3875 | 22.0k | tap_queue_packet(ipv6_tap, pinfo, iph); |
3876 | 22.0k | } |
3877 | | |
3878 | 22.2k | if (nxt == IP_PROTO_NONE) { |
3879 | 20 | col_set_str(pinfo->cinfo, COL_INFO, "IPv6 no next header"); |
3880 | 20 | call_data_dissector(tvb, pinfo, tree); |
3881 | 20 | return; |
3882 | 20 | } |
3883 | | |
3884 | 22.2k | if (ip_try_dissect(try_heuristic_first, nxt, tvb, pinfo, tree, iph)) { |
3885 | 16.4k | return; |
3886 | 16.4k | } |
3887 | | |
3888 | | /* Unknown protocol. */ |
3889 | 5.72k | col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown IP Protocol: %s (%u)", ipprotostr(nxt), nxt); |
3890 | 5.72k | call_data_dissector(tvb, pinfo, tree); |
3891 | 5.72k | } |
3892 | | |
3893 | | static void |
3894 | | ipv6_init(void) |
3895 | 14 | { |
3896 | 14 | ipv6_stream_count = 0; |
3897 | 14 | } |
3898 | | |
3899 | | void |
3900 | | proto_register_ipv6(void) |
3901 | 14 | { |
3902 | 14 | static hf_register_info hf_ipv6[] = { |
3903 | 14 | { &hf_ipv6_version, |
3904 | 14 | { "Version", "ipv6.version", |
3905 | 14 | FT_UINT8, BASE_DEC, NULL, 0x00, |
3906 | 14 | NULL, HFILL } |
3907 | 14 | }, |
3908 | 14 | { &hf_ip_version, |
3909 | 14 | { "Version", "ip.version", |
3910 | 14 | FT_UINT8, BASE_DEC, NULL, 0xF0, |
3911 | 14 | NULL, HFILL } |
3912 | 14 | }, |
3913 | 14 | { &hf_ipv6_tclass, |
3914 | 14 | { "Traffic Class", "ipv6.tclass", |
3915 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0FF00000, |
3916 | 14 | NULL, HFILL } |
3917 | 14 | }, |
3918 | 14 | { &hf_ipv6_tclass_dscp, |
3919 | 14 | { "Differentiated Services Codepoint", "ipv6.tclass.dscp", |
3920 | 14 | FT_UINT32, BASE_DEC | BASE_EXT_STRING, &dscp_vals_ext, 0x0FC00000, |
3921 | 14 | NULL, HFILL } |
3922 | 14 | }, |
3923 | 14 | { &hf_ipv6_tclass_ecn, |
3924 | 14 | { "Explicit Congestion Notification", "ipv6.tclass.ecn", |
3925 | 14 | FT_UINT32, BASE_DEC | BASE_EXT_STRING, &ecn_vals_ext, 0x00300000, |
3926 | 14 | NULL, HFILL } |
3927 | 14 | }, |
3928 | 14 | { &hf_ipv6_flow, |
3929 | 14 | { "Flow Label", "ipv6.flow", |
3930 | 14 | FT_UINT24, BASE_HEX, NULL, 0x0FFFFF, |
3931 | 14 | NULL, HFILL } |
3932 | 14 | }, |
3933 | 14 | { &hf_ipv6_plen, |
3934 | 14 | { "Payload Length", "ipv6.plen", |
3935 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
3936 | 14 | NULL, HFILL } |
3937 | 14 | }, |
3938 | 14 | { &hf_ipv6_nxt, |
3939 | 14 | { "Next Header", "ipv6.nxt", |
3940 | 14 | FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0x0, |
3941 | 14 | NULL, HFILL } |
3942 | 14 | }, |
3943 | 14 | { &hf_ipv6_hlim, |
3944 | 14 | { "Hop Limit", "ipv6.hlim", |
3945 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
3946 | 14 | NULL, HFILL } |
3947 | 14 | }, |
3948 | 14 | { &hf_ipv6_src, |
3949 | 14 | { "Source Address", "ipv6.src", |
3950 | 14 | FT_IPv6, BASE_NONE, NULL, 0x0, |
3951 | 14 | "Source IPv6 Address", HFILL } |
3952 | 14 | }, |
3953 | 14 | { &hf_ipv6_src_addr_space, |
3954 | 14 | { "Address Space", "ipv6.src_addr_space", |
3955 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3956 | 14 | "Source IPv6 Address Space", HFILL } |
3957 | 14 | }, |
3958 | 14 | { &hf_ipv6_src_multicast_flags, |
3959 | 14 | { "Multicast Flags", "ipv6.src_multicast_flags", |
3960 | 14 | FT_UINT16, BASE_HEX, NULL, 0x00F0, |
3961 | 14 | "Source Address Multicast Flags", HFILL } |
3962 | 14 | }, |
3963 | 14 | { &hf_ipv6_src_multicast_flags_transient, |
3964 | 14 | { "Transient", "ipv6.src_multicast_flags.transient", |
3965 | 14 | FT_BOOLEAN, 16, NULL, 0x0010, |
3966 | 14 | "Source Address Transient Multicast Flag", HFILL } |
3967 | 14 | }, |
3968 | 14 | { &hf_ipv6_src_multicast_flags_network_prefix, |
3969 | 14 | { "Network Prefix", "ipv6.src_multicast_flags.network_prefix", |
3970 | 14 | FT_BOOLEAN, 16, NULL, 0x0020, |
3971 | 14 | "Source Address Network Prefix Multicast Flag", HFILL } |
3972 | 14 | }, |
3973 | 14 | { &hf_ipv6_src_multicast_flags_embed_rp, |
3974 | 14 | { "Rendezvous Point (RP)", "ipv6.src_multicast_flags.embed_rp", |
3975 | 14 | FT_BOOLEAN, 16, NULL, 0x0040, |
3976 | 14 | "Source Address Rendezvous Point (RP) Multicast Flag", HFILL } |
3977 | 14 | }, |
3978 | 14 | { &hf_ipv6_src_multicast_flags_reserved, |
3979 | 14 | { "Reserved", "ipv6.src_multicast_flags.reserved", |
3980 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0080, |
3981 | 14 | "Source Address Reserved Multicast Flag", HFILL } |
3982 | 14 | }, |
3983 | 14 | { &hf_ipv6_src_multicast_scope, |
3984 | 14 | { "Multicast Scope", "ipv6.src_multicast_scope", |
3985 | 14 | FT_UINT16, BASE_HEX, VALS(ipv6_multicast_scope_vals), 0x000F, |
3986 | 14 | "Source Address Multicast Scope", HFILL } |
3987 | 14 | }, |
3988 | 14 | { &hf_ipv6_src_special_purpose, |
3989 | 14 | { "Special-Purpose Allocation", "ipv6.src_special_purpose", |
3990 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
3991 | 14 | "Source Address Special-Purpose Allocation", HFILL } |
3992 | 14 | }, |
3993 | 14 | { &hf_ipv6_src_special_purpose_source, |
3994 | 14 | { "Source", "ipv6.src_special_purpose_source", |
3995 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
3996 | 14 | "Whether an address from the allocated special-purpose address " |
3997 | 14 | "block is valid when used as the source address of an IP datagram", HFILL } |
3998 | 14 | }, |
3999 | 14 | { &hf_ipv6_src_special_purpose_destination, |
4000 | 14 | { "Destination", "ipv6.src_special_purpose_destination", |
4001 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4002 | 14 | "Whether an address from the allocated special-purpose address " |
4003 | 14 | "block is valid when used as the destination address of an IP datagram", HFILL } |
4004 | 14 | }, |
4005 | 14 | { &hf_ipv6_src_special_purpose_forwardable, |
4006 | 14 | { "Forwardable", "ipv6.src_special_purpose_forwardable", |
4007 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4008 | 14 | "Whether a router may forward an IP datagram whose destination " |
4009 | 14 | "address is drawn from the allocated special-purpose address block", HFILL } |
4010 | 14 | }, |
4011 | 14 | { &hf_ipv6_src_special_purpose_global, |
4012 | 14 | { "Globally Reachable", "ipv6.src_special_purpose_global", |
4013 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4014 | 14 | "Whether an IP datagram whose destination address is drawn " |
4015 | 14 | "from the allocated special-purpose address block is " |
4016 | 14 | "forwardable beyond a specified administrative domain", HFILL } |
4017 | 14 | }, |
4018 | 14 | { &hf_ipv6_src_special_purpose_reserved, |
4019 | 14 | { "Reserved-by-Protocol", "ipv6.src_special_purpose_reserved", |
4020 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4021 | 14 | "Whether the special-purpose address block is reserved by IP itself", HFILL } |
4022 | 14 | }, |
4023 | 14 | { &hf_ipv6_src_host, |
4024 | 14 | { "Source Host", "ipv6.src_host", |
4025 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4026 | 14 | "Source IPv6 Host", HFILL } |
4027 | 14 | }, |
4028 | 14 | { &hf_ipv6_src_slaac_mac, |
4029 | 14 | { "Source SLAAC MAC", "ipv6.src_slaac_mac", |
4030 | 14 | FT_ETHER, BASE_NONE, NULL, 0x0, |
4031 | 14 | "Source IPv6 Stateless Address Autoconfiguration (SLAAC) 48-bit MAC Identifier", HFILL } |
4032 | 14 | }, |
4033 | 14 | { &hf_ipv6_src_isatap_ipv4, |
4034 | 14 | { "Source ISATAP IPv4", "ipv6.src_isatap_ipv4", |
4035 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4036 | 14 | "Source IPv6 ISATAP Encapsulated IPv4 Address", HFILL } |
4037 | 14 | }, |
4038 | 14 | { &hf_ipv6_src_6to4_gateway_ipv4, |
4039 | 14 | { "Source 6to4 Gateway IPv4", "ipv6.src_6to4_gw_ipv4", |
4040 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4041 | 14 | "Source IPv6 6to4 Gateway IPv4 Address", HFILL } |
4042 | 14 | }, |
4043 | 14 | { &hf_ipv6_src_6to4_sla_id, |
4044 | 14 | { "Source 6to4 SLA ID", "ipv6.src_6to4_sla_id", |
4045 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4046 | 14 | "Source IPv6 6to4 SLA ID", HFILL } |
4047 | 14 | }, |
4048 | 14 | { &hf_ipv6_src_teredo_server_ipv4, |
4049 | 14 | { "Source Teredo Server IPv4", "ipv6.src_ts_ipv4", |
4050 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4051 | 14 | "Source IPv6 Teredo Server Encapsulated IPv4 Address", HFILL } |
4052 | 14 | }, |
4053 | 14 | { &hf_ipv6_src_teredo_port, |
4054 | 14 | { "Source Teredo Port", "ipv6.src_tc_port", |
4055 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4056 | 14 | "Source IPv6 Teredo Client Mapped Port", HFILL } |
4057 | 14 | }, |
4058 | 14 | { &hf_ipv6_src_teredo_client_ipv4, |
4059 | 14 | { "Source Teredo Client IPv4", "ipv6.src_tc_ipv4", |
4060 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4061 | 14 | "Source IPv6 Teredo Client Encapsulated IPv4 Address", HFILL } |
4062 | 14 | }, |
4063 | 14 | { &hf_ipv6_src_embed_ipv4, |
4064 | 14 | { "Source Embedded IPv4", "ipv6.src_embed_ipv4", |
4065 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4066 | 14 | "Source IPv4-Embedded IPv6 Address", HFILL } |
4067 | 14 | }, |
4068 | 14 | { &hf_ipv6_dst, |
4069 | 14 | { "Destination Address", "ipv6.dst", |
4070 | 14 | FT_IPv6, BASE_NONE, NULL, 0x0, |
4071 | 14 | "Destination IPv6 Address", HFILL } |
4072 | 14 | }, |
4073 | 14 | { &hf_ipv6_dst_addr_space, |
4074 | 14 | { "Address Space", "ipv6.dst_addr_space", |
4075 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4076 | 14 | "Destination IPv6 Address Space", HFILL } |
4077 | 14 | }, |
4078 | 14 | { &hf_ipv6_dst_multicast_flags, |
4079 | 14 | { "Multicast Flags", "ipv6.dst_multicast_flags", |
4080 | 14 | FT_UINT16, BASE_HEX, NULL, 0x00F0, |
4081 | 14 | "Destination Address Multicast Flags", HFILL } |
4082 | 14 | }, |
4083 | 14 | { &hf_ipv6_dst_multicast_flags_transient, |
4084 | 14 | { "Transient", "ipv6.dst_multicast_flags.transient", |
4085 | 14 | FT_BOOLEAN, 16, NULL, 0x0010, |
4086 | 14 | "Destination Address Transient Multicast Flag", HFILL } |
4087 | 14 | }, |
4088 | 14 | { &hf_ipv6_dst_multicast_flags_network_prefix, |
4089 | 14 | { "Network Prefix", "ipv6.dst_multicast_flags.network_prefix", |
4090 | 14 | FT_BOOLEAN, 16, NULL, 0x0020, |
4091 | 14 | "Destination Address Network Prefix Multicast Flag", HFILL } |
4092 | 14 | }, |
4093 | 14 | { &hf_ipv6_dst_multicast_flags_embed_rp, |
4094 | 14 | { "Rendezvous Point (RP)", "ipv6.dst_multicast_flags.embed_rp", |
4095 | 14 | FT_BOOLEAN, 16, NULL, 0x0040, |
4096 | 14 | "Destination Address Rendezvous Point (RP) Multicast Flag", HFILL } |
4097 | 14 | }, |
4098 | 14 | { &hf_ipv6_dst_multicast_flags_reserved, |
4099 | 14 | { "Reserved", "ipv6.dst_multicast_flags.reserved", |
4100 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0080, |
4101 | 14 | "Destination Address Reserved Multicast Flag", HFILL } |
4102 | 14 | }, |
4103 | 14 | { &hf_ipv6_dst_multicast_scope, |
4104 | 14 | { "Multicast Scope", "ipv6.dst_multicast_scope", |
4105 | 14 | FT_UINT16, BASE_HEX, VALS(ipv6_multicast_scope_vals), 0x000F, |
4106 | 14 | "Destination Address Multicast Scope", HFILL } |
4107 | 14 | }, |
4108 | 14 | { &hf_ipv6_dst_special_purpose, |
4109 | 14 | { "Special-Purpose Allocation", "ipv6.dst_special_purpose", |
4110 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4111 | 14 | "Destination Address Special-Purpose Allocation", HFILL } |
4112 | 14 | }, |
4113 | 14 | { &hf_ipv6_dst_special_purpose_source, |
4114 | 14 | { "Source", "ipv6.dst_special_purpose_source", |
4115 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4116 | 14 | "Whether an address from the allocated special-purpose address " |
4117 | 14 | "block is valid when used as the source address of an IP datagram", HFILL } |
4118 | 14 | }, |
4119 | 14 | { &hf_ipv6_dst_special_purpose_destination, |
4120 | 14 | { "Destination", "ipv6.dst_special_purpose_destination", |
4121 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4122 | 14 | "Whether an address from the allocated special-purpose address " |
4123 | 14 | "block is valid when used as the destination address of an IP datagram", HFILL } |
4124 | 14 | }, |
4125 | 14 | { &hf_ipv6_dst_special_purpose_forwardable, |
4126 | 14 | { "Forwardable", "ipv6.dst_special_purpose_forwardable", |
4127 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4128 | 14 | "Whether a router may forward an IP datagram whose destination " |
4129 | 14 | "address is drawn from the allocated special-purpose address block", HFILL } |
4130 | 14 | }, |
4131 | 14 | { &hf_ipv6_dst_special_purpose_global, |
4132 | 14 | { "Globally Reachable", "ipv6.dst_special_purpose_global", |
4133 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4134 | 14 | "Whether an IP datagram whose destination address is drawn " |
4135 | 14 | "from the allocated special-purpose address block is " |
4136 | 14 | "forwardable beyond a specified administrative domain", HFILL } |
4137 | 14 | }, |
4138 | 14 | { &hf_ipv6_dst_special_purpose_reserved, |
4139 | 14 | { "Reserved-by-Protocol", "ipv6.dst_special_purpose_reserved", |
4140 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4141 | 14 | "Whether the special-purpose address block is reserved by IP itself", HFILL } |
4142 | 14 | }, |
4143 | 14 | { &hf_ipv6_dst_host, |
4144 | 14 | { "Destination Host", "ipv6.dst_host", |
4145 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4146 | 14 | "Destination IPv6 Host", HFILL } |
4147 | 14 | }, |
4148 | 14 | { &hf_ipv6_dst_slaac_mac, |
4149 | 14 | { "Destination SLAAC MAC", "ipv6.dst_slaac_mac", |
4150 | 14 | FT_ETHER, BASE_NONE, NULL, 0x0, |
4151 | 14 | "Destination IPv6 Stateless Address Autoconfiguration (SLAAC) 48-bit MAC Identifier", HFILL } |
4152 | 14 | }, |
4153 | 14 | { &hf_ipv6_dst_isatap_ipv4, |
4154 | 14 | { "Destination ISATAP IPv4", "ipv6.dst_isatap_ipv4", |
4155 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4156 | 14 | "Destination IPv6 ISATAP Encapsulated IPv4 Address", HFILL } |
4157 | 14 | }, |
4158 | 14 | { &hf_ipv6_dst_6to4_gateway_ipv4, |
4159 | 14 | { "Destination 6to4 Gateway IPv4", "ipv6.dst_6to4_gw_ipv4", |
4160 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4161 | 14 | "Destination IPv6 6to4 Gateway IPv4 Address", HFILL } |
4162 | 14 | }, |
4163 | 14 | { &hf_ipv6_dst_6to4_sla_id, |
4164 | 14 | { "Destination 6to4 SLA ID", "ipv6.dst_6to4_sla_id", |
4165 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4166 | 14 | "Destination IPv6 6to4 SLA ID", HFILL } |
4167 | 14 | }, |
4168 | 14 | { &hf_ipv6_dst_teredo_server_ipv4, |
4169 | 14 | { "Destination Teredo Server IPv4", "ipv6.dst_ts_ipv4", |
4170 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4171 | 14 | "Destination IPv6 Teredo Server Encapsulated IPv4 Address", HFILL } |
4172 | 14 | }, |
4173 | 14 | { &hf_ipv6_dst_teredo_port, |
4174 | 14 | { "Destination Teredo Port", "ipv6.dst_tc_port", |
4175 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4176 | 14 | "Destination IPv6 Teredo Client Mapped Port", HFILL } |
4177 | 14 | }, |
4178 | 14 | { &hf_ipv6_dst_teredo_client_ipv4, |
4179 | 14 | { "Destination Teredo Client IPv4", "ipv6.dst_tc_ipv4", |
4180 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4181 | 14 | "Destination IPv6 Teredo Client Encapsulated IPv4 Address", HFILL } |
4182 | 14 | }, |
4183 | 14 | { &hf_ipv6_dst_embed_ipv4, |
4184 | 14 | { "Destination Embedded IPv4", "ipv6.dst_embed_ipv4", |
4185 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4186 | 14 | "Destination IPv4-Embedded IPv6 Address", HFILL } |
4187 | 14 | }, |
4188 | 14 | { &hf_ipv6_addr, |
4189 | 14 | { "Source or Destination Address", "ipv6.addr", |
4190 | 14 | FT_IPv6, BASE_NONE, NULL, 0x0, |
4191 | 14 | NULL, HFILL } |
4192 | 14 | }, |
4193 | 14 | { &hf_ipv6_addr_space, |
4194 | 14 | { "Address Space", "ipv6.addr_space", |
4195 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4196 | 14 | "Source or Destination Address Space", HFILL } |
4197 | 14 | }, |
4198 | 14 | { &hf_ipv6_multicast_flags, |
4199 | 14 | { "Multicast Flags", "ipv6.multicast_flags", |
4200 | 14 | FT_UINT16, BASE_HEX, NULL, 0x00F0, |
4201 | 14 | "Source or Destination Address Multicast Flags", HFILL } |
4202 | 14 | }, |
4203 | 14 | { &hf_ipv6_multicast_flags_transient, |
4204 | 14 | { "Transient", "ipv6.multicast_flags.transient", |
4205 | 14 | FT_BOOLEAN, 16, NULL, 0x0010, |
4206 | 14 | "Source or Destination Address Transient Multicast Flag", HFILL } |
4207 | 14 | }, |
4208 | 14 | { &hf_ipv6_multicast_flags_network_prefix, |
4209 | 14 | { "Network Prefix", "ipv6.multicast_flags.network_prefix", |
4210 | 14 | FT_BOOLEAN, 16, NULL, 0x0020, |
4211 | 14 | "Source or Destination Address Network Prefix Multicast Flag", HFILL } |
4212 | 14 | }, |
4213 | 14 | { &hf_ipv6_multicast_flags_embed_rp, |
4214 | 14 | { "Rendezvous Point (RP)", "ipv6.multicast_flags.embed_rp", |
4215 | 14 | FT_BOOLEAN, 16, NULL, 0x0040, |
4216 | 14 | "Source or Destination Address Rendezvous Point (RP) Multicast Flag", HFILL } |
4217 | 14 | }, |
4218 | 14 | { &hf_ipv6_multicast_flags_reserved, |
4219 | 14 | { "Reserved", "ipv6.multicast_flags.reserved", |
4220 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0080, |
4221 | 14 | "Source or Destination Address Reserved Multicast Flag", HFILL } |
4222 | 14 | }, |
4223 | 14 | { &hf_ipv6_multicast_scope, |
4224 | 14 | { "Multicast Scope", "ipv6.multicast_scope", |
4225 | 14 | FT_UINT16, BASE_HEX, VALS(ipv6_multicast_scope_vals), 0x000F, |
4226 | 14 | "Source or Destination Address Multicast Scope", HFILL } |
4227 | 14 | }, |
4228 | 14 | { &hf_ipv6_addr_special_purpose, |
4229 | 14 | { "Special-Purpose Allocation", "ipv6.addr_special_purpose", |
4230 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4231 | 14 | "Source or Destination Address Special-Purpose Allocation", HFILL } |
4232 | 14 | }, |
4233 | 14 | { &hf_ipv6_addr_special_purpose_source, |
4234 | 14 | { "Source", "ipv6.addr_special_purpose_source", |
4235 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4236 | 14 | "Whether an address from the allocated special-purpose address " |
4237 | 14 | "block is valid when used as the source address of an IP datagram", HFILL } |
4238 | 14 | }, |
4239 | 14 | { &hf_ipv6_addr_special_purpose_destination, |
4240 | 14 | { "Destination", "ipv6.addr_special_purpose_destination", |
4241 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4242 | 14 | "Whether an address from the allocated special-purpose address " |
4243 | 14 | "block is valid when used as the destination address of an IP datagram", HFILL } |
4244 | 14 | }, |
4245 | 14 | { &hf_ipv6_addr_special_purpose_forwardable, |
4246 | 14 | { "Forwardable", "ipv6.addr_special_purpose_forwardable", |
4247 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4248 | 14 | "Whether a router may forward an IP datagram whose destination " |
4249 | 14 | "address is drawn from the allocated special-purpose address block", HFILL } |
4250 | 14 | }, |
4251 | 14 | { &hf_ipv6_addr_special_purpose_global, |
4252 | 14 | { "Globally Reachable", "ipv6.addr_special_purpose_global", |
4253 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4254 | 14 | "Whether an IP datagram whose destination address is drawn " |
4255 | 14 | "from the allocated special-purpose address block is " |
4256 | 14 | "forwardable beyond a specified administrative domain", HFILL } |
4257 | 14 | }, |
4258 | 14 | { &hf_ipv6_addr_special_purpose_reserved, |
4259 | 14 | { "Reserved-by-Protocol", "ipv6.addr_special_purpose_reserved", |
4260 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4261 | 14 | "Whether the special-purpose address block is reserved by IP itself", HFILL } |
4262 | 14 | }, |
4263 | 14 | { &hf_ipv6_host, |
4264 | 14 | { "Source or Destination Host", "ipv6.host", |
4265 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4266 | 14 | NULL, HFILL } |
4267 | 14 | }, |
4268 | 14 | { &hf_ipv6_slaac_mac, |
4269 | 14 | { "SLAAC MAC", "ipv6.slaac_mac", |
4270 | 14 | FT_ETHER, BASE_NONE, NULL, 0x0, |
4271 | 14 | "IPv6 Stateless Address Autoconfiguration (SLAAC) 48-bit MAC Identifier", HFILL } |
4272 | 14 | }, |
4273 | 14 | { &hf_ipv6_isatap_ipv4, |
4274 | 14 | { "ISATAP IPv4", "ipv6.isatap_ipv4", |
4275 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4276 | 14 | "IPv6 ISATAP Encapsulated IPv4 Address", HFILL } |
4277 | 14 | }, |
4278 | 14 | { &hf_ipv6_6to4_gateway_ipv4, |
4279 | 14 | { "6to4 Gateway IPv4", "ipv6.6to4_gw_ipv4", |
4280 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4281 | 14 | "IPv6 6to4 Gateway IPv4 Address", HFILL } |
4282 | 14 | }, |
4283 | 14 | { &hf_ipv6_6to4_sla_id, |
4284 | 14 | { "6to4 SLA ID", "ipv6.6to4_sla_id", |
4285 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4286 | 14 | "IPv6 6to4 SLA ID", HFILL } |
4287 | 14 | }, |
4288 | 14 | { &hf_ipv6_teredo_server_ipv4, |
4289 | 14 | { "Teredo Server IPv4", "ipv6.ts_ipv4", |
4290 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4291 | 14 | "IPv6 Teredo Server Encapsulated IPv4 Address", HFILL } |
4292 | 14 | }, |
4293 | 14 | { &hf_ipv6_teredo_port, |
4294 | 14 | { "Teredo Port", "ipv6.tc_port", |
4295 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4296 | 14 | "IPv6 Teredo Client Mapped Port", HFILL } |
4297 | 14 | }, |
4298 | 14 | { &hf_ipv6_teredo_client_ipv4, |
4299 | 14 | { "Teredo Client IPv4", "ipv6.tc_ipv4", |
4300 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4301 | 14 | "IPv6 Teredo Client Encapsulated IPv4 Address", HFILL } |
4302 | 14 | }, |
4303 | 14 | { &hf_ipv6_embed_ipv4_prefix, |
4304 | 14 | { "Embedded IPv4 Prefix", "ipv6.embed_ipv4_prefix", |
4305 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4306 | 14 | "IPv4-Embedded IPv6 Address Prefix", HFILL } |
4307 | 14 | }, |
4308 | 14 | { &hf_ipv6_embed_ipv4, |
4309 | 14 | { "Embedded IPv4", "ipv6.embed_ipv4", |
4310 | 14 | FT_IPv4, BASE_NONE, NULL, 0x0, |
4311 | 14 | "IPv4-Embedded IPv6 Address", HFILL } |
4312 | 14 | }, |
4313 | 14 | { &hf_ipv6_embed_ipv4_u, |
4314 | 14 | { "Embedded IPv4 u field", "ipv6.embed_ipv4_u", |
4315 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4316 | 14 | "IPv4-Embedded IPv6 Address u field", HFILL } |
4317 | 14 | }, |
4318 | 14 | { &hf_ipv6_embed_ipv4_suffix, |
4319 | 14 | { "Embedded IPv4 Suffix", "ipv6.embed_ipv4_suffix", |
4320 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4321 | 14 | "IPv4-Embedded IPv6 Address Suffix", HFILL } |
4322 | 14 | }, |
4323 | | |
4324 | 14 | { &hf_ipv6_stream, |
4325 | 14 | { "Stream index", "ipv6.stream", |
4326 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4327 | 14 | NULL, HFILL } |
4328 | 14 | }, |
4329 | | |
4330 | 14 | { &hf_geoip_country, |
4331 | 14 | { "Source or Destination GeoIP Country", "ipv6.geoip.country", |
4332 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4333 | 14 | NULL, HFILL } |
4334 | 14 | }, |
4335 | 14 | { &hf_geoip_country_iso, |
4336 | 14 | { "Source or Destination GeoIP ISO Two Letter Country Code", "ipv6.geoip.country_iso", |
4337 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4338 | 14 | NULL, HFILL } |
4339 | 14 | }, |
4340 | 14 | { &hf_geoip_city, |
4341 | 14 | { "Source or Destination GeoIP City", "ipv6.geoip.city", |
4342 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4343 | 14 | NULL, HFILL } |
4344 | 14 | }, |
4345 | 14 | { &hf_geoip_as_number, |
4346 | 14 | { "Source or Destination GeoIP AS Number", "ipv6.geoip.asnum", |
4347 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4348 | 14 | NULL, HFILL } |
4349 | 14 | }, |
4350 | 14 | { &hf_geoip_as_org, |
4351 | 14 | { "Source or Destination GeoIP AS Organization", "ipv6.geoip.org", |
4352 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4353 | 14 | NULL, HFILL } |
4354 | 14 | }, |
4355 | 14 | { &hf_geoip_latitude, |
4356 | 14 | { "Source or Destination GeoIP Latitude", "ipv6.geoip.lat", |
4357 | 14 | FT_DOUBLE, BASE_NONE, NULL, 0x0, |
4358 | 14 | NULL, HFILL } |
4359 | 14 | }, |
4360 | 14 | { &hf_geoip_longitude, |
4361 | 14 | { "Source or Destination GeoIP Longitude", "ipv6.geoip.lon", |
4362 | 14 | FT_DOUBLE, BASE_NONE, NULL, 0x0, |
4363 | 14 | NULL, HFILL } |
4364 | 14 | }, |
4365 | 14 | { &hf_geoip_src_summary, |
4366 | 14 | { "Source GeoIP", "ipv6.geoip.src_summary", |
4367 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4368 | 14 | NULL, HFILL } |
4369 | 14 | }, |
4370 | 14 | { &hf_geoip_src_country, |
4371 | 14 | { "Source GeoIP Country", "ipv6.geoip.src_country", |
4372 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4373 | 14 | NULL, HFILL } |
4374 | 14 | }, |
4375 | 14 | { &hf_geoip_src_country_iso, |
4376 | 14 | { "Source GeoIP ISO Two Letter Country Code", "ipv6.geoip.src_country_iso", |
4377 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4378 | 14 | NULL, HFILL } |
4379 | 14 | }, |
4380 | 14 | { &hf_geoip_src_city, |
4381 | 14 | { "Source GeoIP City", "ipv6.geoip.src_city", |
4382 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4383 | 14 | NULL, HFILL } |
4384 | 14 | }, |
4385 | 14 | { &hf_geoip_src_as_number, |
4386 | 14 | { "Source GeoIP AS Number", "ipv6.geoip.src_asnum", |
4387 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4388 | 14 | NULL, HFILL } |
4389 | 14 | }, |
4390 | 14 | { &hf_geoip_src_as_org, |
4391 | 14 | { "Source GeoIP AS Organization", "ipv6.geoip.src_org", |
4392 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4393 | 14 | NULL, HFILL } |
4394 | 14 | }, |
4395 | 14 | { &hf_geoip_src_latitude, |
4396 | 14 | { "Source GeoIP Latitude", "ipv6.geoip.src_lat", |
4397 | 14 | FT_DOUBLE, BASE_NONE, NULL, 0x0, |
4398 | 14 | NULL, HFILL } |
4399 | 14 | }, |
4400 | 14 | { &hf_geoip_src_longitude, |
4401 | 14 | { "Source GeoIP Longitude", "ipv6.geoip.src_lon", |
4402 | 14 | FT_DOUBLE, BASE_NONE, NULL, 0x0, |
4403 | 14 | NULL, HFILL } |
4404 | 14 | }, |
4405 | 14 | { &hf_geoip_dst_summary, |
4406 | 14 | { "Destination GeoIP", "ipv6.geoip.dst_summary", |
4407 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4408 | 14 | NULL, HFILL } |
4409 | 14 | }, |
4410 | 14 | { &hf_geoip_dst_country, |
4411 | 14 | { "Destination GeoIP Country", "ipv6.geoip.dst_country", |
4412 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4413 | 14 | NULL, HFILL } |
4414 | 14 | }, |
4415 | 14 | { &hf_geoip_dst_country_iso, |
4416 | 14 | { "Destination GeoIP ISO Two Letter Country Code", "ipv6.geoip.dst_country_iso", |
4417 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4418 | 14 | NULL, HFILL } |
4419 | 14 | }, |
4420 | 14 | { &hf_geoip_dst_city, |
4421 | 14 | { "Destination GeoIP City", "ipv6.geoip.dst_city", |
4422 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4423 | 14 | NULL, HFILL } |
4424 | 14 | }, |
4425 | 14 | { &hf_geoip_dst_as_number, |
4426 | 14 | { "Destination GeoIP AS Number", "ipv6.geoip.dst_asnum", |
4427 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4428 | 14 | NULL, HFILL } |
4429 | 14 | }, |
4430 | 14 | { &hf_geoip_dst_as_org, |
4431 | 14 | { "Destination GeoIP AS Organization", "ipv6.geoip.dst_org", |
4432 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
4433 | 14 | NULL, HFILL } |
4434 | 14 | }, |
4435 | 14 | { &hf_geoip_dst_latitude, |
4436 | 14 | { "Destination GeoIP Latitude", "ipv6.geoip.dst_lat", |
4437 | 14 | FT_DOUBLE, BASE_NONE, NULL, 0x0, |
4438 | 14 | NULL, HFILL } |
4439 | 14 | }, |
4440 | 14 | { &hf_geoip_dst_longitude, |
4441 | 14 | { "Destination GeoIP Longitude", "ipv6.geoip.dst_lon", |
4442 | 14 | FT_DOUBLE, BASE_NONE, NULL, 0x0, |
4443 | 14 | NULL, HFILL } |
4444 | 14 | }, |
4445 | | |
4446 | 14 | { &hf_ipv6_opt, |
4447 | 14 | { "IPv6 Option", "ipv6.opt", |
4448 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
4449 | 14 | NULL, HFILL } |
4450 | 14 | }, |
4451 | 14 | { &hf_ipv6_opt_type, |
4452 | 14 | { "Type", "ipv6.opt.type", |
4453 | 14 | FT_UINT8, BASE_HEX | BASE_EXT_STRING, &ipv6_opt_type_vals_ext, 0x0, |
4454 | 14 | "Option type", HFILL } |
4455 | 14 | }, |
4456 | 14 | { &hf_ipv6_opt_type_action, |
4457 | 14 | { "Action", "ipv6.opt.type.action", |
4458 | 14 | FT_UINT8, BASE_DEC, VALS(ipv6_opt_type_action_vals), 0xC0, |
4459 | 14 | "Action for unrecognized option type", HFILL } |
4460 | 14 | }, |
4461 | 14 | { &hf_ipv6_opt_type_change, |
4462 | 14 | { "May Change", "ipv6.opt.type.change", |
4463 | 14 | FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, |
4464 | 14 | "Whether the option data may change en-route", HFILL } |
4465 | 14 | }, |
4466 | 14 | { &hf_ipv6_opt_type_rest, |
4467 | 14 | { "Low-Order Bits", "ipv6.opt.type.rest", |
4468 | 14 | FT_UINT8, BASE_HEX, NULL, 0x1F, |
4469 | 14 | "Remaining low-order bits", HFILL } |
4470 | 14 | }, |
4471 | 14 | { &hf_ipv6_opt_length, |
4472 | 14 | { "Length", "ipv6.opt.length", |
4473 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4474 | 14 | "Option length in octets", HFILL } |
4475 | 14 | }, |
4476 | 14 | { &hf_ipv6_opt_pad1, |
4477 | 14 | { "Pad1", "ipv6.opt.pad1", |
4478 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
4479 | 14 | "Pad1 Option", HFILL } |
4480 | 14 | }, |
4481 | 14 | { &hf_ipv6_opt_padn, |
4482 | 14 | { "PadN", "ipv6.opt.padn", |
4483 | 14 | FT_BYTES, BASE_NONE|BASE_ALLOW_ZERO, NULL, 0x0, |
4484 | 14 | "PadN Option", HFILL } |
4485 | 14 | }, |
4486 | 14 | { &hf_ipv6_opt_pmtu_min, |
4487 | 14 | { "Minimum Reported PMTU", "ipv6.opt.pmtu.min", |
4488 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4489 | 14 | "The minimum reported PMTU in octets", HFILL } |
4490 | 14 | }, |
4491 | 14 | { &hf_ipv6_opt_pmtu_rtn, |
4492 | 14 | { "Return Minimum PMTU", "ipv6.opt.pmtu.rtn", |
4493 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4494 | 14 | "The Return Min-PMTU in octets", HFILL } |
4495 | 14 | }, |
4496 | 14 | { &hf_ipv6_opt_pmtu_rtn_flag, |
4497 | 14 | { "Return Flag", "ipv6.opt.pmtu.r_flag", |
4498 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
4499 | 14 | "Destination should include the received reported PMTU", HFILL } |
4500 | 14 | }, |
4501 | 14 | { &hf_ipv6_opt_apn_id_type, |
4502 | 14 | { "ID Type", "ipv6.opt.apn.id.type", |
4503 | 14 | FT_UINT8, BASE_DEC, VALS(apn_id_type_strs), 0x0, |
4504 | 14 | "The type of the APN ID", HFILL } |
4505 | 14 | }, |
4506 | 14 | { &hf_ipv6_opt_apn_flags, |
4507 | 14 | { "Flags", "ipv6.opt.apn.flags", |
4508 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
4509 | 14 | "Flags for advanced processing", HFILL } |
4510 | 14 | }, |
4511 | 14 | { &hf_ipv6_opt_apn_param_type, |
4512 | 14 | { "Parameters Types", "ipv6.opt.apn.param.type", |
4513 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
4514 | 14 | "Bitmap to identify the existence of APN Parameters", HFILL } |
4515 | 14 | }, |
4516 | 14 | { &hf_ipv6_opt_apn_id_part1, |
4517 | 14 | { "ID Part1", "ipv6.opt.apn.id.part1", |
4518 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4519 | 14 | "The first 32-bit of the APN ID", HFILL } |
4520 | 14 | }, |
4521 | 14 | { &hf_ipv6_opt_apn_id_part2, |
4522 | 14 | { "ID Part2", "ipv6.opt.apn.id.part2", |
4523 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4524 | 14 | "The second 32-bit of the APN ID", HFILL } |
4525 | 14 | }, |
4526 | 14 | { &hf_ipv6_opt_apn_id_part3, |
4527 | 14 | { "ID Part3", "ipv6.opt.apn.id.part3", |
4528 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4529 | 14 | "The third 32-bit of the APN ID", HFILL } |
4530 | 14 | }, |
4531 | 14 | { &hf_ipv6_opt_apn_id_part4, |
4532 | 14 | { "ID Part4", "ipv6.opt.apn.id.part4", |
4533 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4534 | 14 | "The last 32-bit of the APN ID", HFILL } |
4535 | 14 | }, |
4536 | 14 | { &hf_ipv6_opt_rtalert, |
4537 | 14 | { "Router Alert", "ipv6.opt.router_alert", |
4538 | 14 | FT_UINT16, BASE_DEC, VALS(ipv6_opt_rtalert_vals), 0x0, |
4539 | 14 | "Router Alert Option", HFILL } |
4540 | 14 | }, |
4541 | 14 | { &hf_ipv6_opt_tel, |
4542 | 14 | { "Tunnel Encapsulation Limit", "ipv6.opt.tel", |
4543 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4544 | 14 | "How many further levels of encapsulation are permitted", HFILL } |
4545 | 14 | }, |
4546 | 14 | { &hf_ipv6_opt_jumbo, |
4547 | 14 | { "Payload Length", "ipv6.opt.jumbo", |
4548 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4549 | 14 | "IPv6 (Jumbo) Payload Length", HFILL } |
4550 | 14 | }, |
4551 | 14 | { &hf_ipv6_opt_calipso_doi, |
4552 | 14 | { "CALIPSO Domain of Interpretation", "ipv6.opt.calipso.doi", |
4553 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4554 | 14 | NULL, HFILL } |
4555 | 14 | }, |
4556 | 14 | { &hf_ipv6_opt_calipso_cmpt_length, |
4557 | 14 | { "Compartment Length", "ipv6.opt.calipso.cmpt.length", |
4558 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4559 | 14 | NULL, HFILL } |
4560 | 14 | }, |
4561 | 14 | { &hf_ipv6_opt_calipso_sens_level, |
4562 | 14 | { "Sensitivity Level", "ipv6.opt.calipso.sens_level", |
4563 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4564 | 14 | NULL, HFILL } |
4565 | 14 | }, |
4566 | 14 | { &hf_ipv6_opt_calipso_checksum, |
4567 | 14 | { "Checksum", "ipv6.opt.calipso.checksum", |
4568 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
4569 | 14 | NULL, HFILL } |
4570 | 14 | }, |
4571 | 14 | { &hf_ipv6_opt_calipso_cmpt_bitmap, |
4572 | 14 | { "Compartment Bitmap", "ipv6.opt.calipso.cmpt_bitmap", |
4573 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4574 | 14 | NULL, HFILL } |
4575 | 14 | }, |
4576 | 14 | { &hf_ipv6_opt_smf_dpd_hash_bit, |
4577 | 14 | { "H-bit", "ipv6.opt.smf_dpd.hash_bit", |
4578 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
4579 | 14 | "Hash indicator", HFILL } |
4580 | 14 | }, |
4581 | 14 | { &hf_ipv6_opt_smf_dpd_tid_type, |
4582 | 14 | { "TaggerID Type", "ipv6.opt.smf_dpd.tid_type", |
4583 | 14 | FT_UINT8, BASE_DEC, VALS(ipv6_opt_smf_dpd_tidty_vals), 0x70, |
4584 | 14 | NULL, HFILL } |
4585 | 14 | }, |
4586 | 14 | { &hf_ipv6_opt_smf_dpd_tid_len, |
4587 | 14 | { "TaggerID Length", "ipv6.opt.smf_dpd.tid_len", |
4588 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0F, |
4589 | 14 | NULL, HFILL } |
4590 | 14 | }, |
4591 | 14 | { &hf_ipv6_opt_smf_dpd_tagger_id, |
4592 | 14 | { "TaggerID", "ipv6.opt.smf_dpd.tagger_id", |
4593 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4594 | 14 | NULL, HFILL } |
4595 | 14 | }, |
4596 | 14 | { &hf_ipv6_opt_smf_dpd_ident, |
4597 | 14 | { "Identifier", "ipv6.opt.smf_dpd.ident", |
4598 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4599 | 14 | NULL, HFILL } |
4600 | 14 | }, |
4601 | 14 | { &hf_ipv6_opt_smf_dpd_hav, |
4602 | 14 | { "Hash Assist Value", "ipv6.opt.smf_dpd.hav", |
4603 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4604 | 14 | NULL, HFILL } |
4605 | 14 | }, |
4606 | 14 | { &hf_ipv6_opt_pdm_scale_dtlr, |
4607 | 14 | { "Scale DTLR", "ipv6.opt.pdm.scale_dtlr", |
4608 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4609 | 14 | "Scale for Delta Time Last Received", HFILL } |
4610 | 14 | }, |
4611 | 14 | { &hf_ipv6_opt_pdm_scale_dtls, |
4612 | 14 | { "Scale DTLS", "ipv6.opt.pdm.scale_dtls", |
4613 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4614 | 14 | "Scale for Delta Time Last Sent", HFILL } |
4615 | 14 | }, |
4616 | 14 | { &hf_ipv6_opt_pdm_psn_this_pkt, |
4617 | 14 | { "PSN This Packet", "ipv6.opt.pdm.psn_this_pkt", |
4618 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4619 | 14 | "Packet Sequence Number This Packet", HFILL } |
4620 | 14 | }, |
4621 | 14 | { &hf_ipv6_opt_pdm_psn_last_recv, |
4622 | 14 | { "PSN Last Received", "ipv6.opt.pdm.psn_last_recv", |
4623 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4624 | 14 | "Packet Sequence Number Last Received", HFILL } |
4625 | 14 | }, |
4626 | 14 | { &hf_ipv6_opt_pdm_delta_last_recv, |
4627 | 14 | { "Delta Time Last Received", "ipv6.opt.pdm.delta_last_recv", |
4628 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4629 | 14 | NULL, HFILL } |
4630 | 14 | }, |
4631 | 14 | { &hf_ipv6_opt_pdm_delta_last_sent, |
4632 | 14 | { "Delta Time Last Sent", "ipv6.opt.pdm.delta_last_sent", |
4633 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4634 | 14 | NULL, HFILL } |
4635 | 14 | }, |
4636 | 14 | { &hf_ipv6_opt_qs_func, |
4637 | 14 | { "Function", "ipv6.opt.qs_func", |
4638 | 14 | FT_UINT8, BASE_DEC, VALS(qs_func_vals), QS_FUNC_MASK, |
4639 | 14 | NULL, HFILL } |
4640 | 14 | }, |
4641 | 14 | { &hf_ipv6_opt_qs_rate, |
4642 | 14 | { "Rate", "ipv6.opt.qs_rate", |
4643 | 14 | FT_UINT8, BASE_DEC | BASE_EXT_STRING, &qs_rate_vals_ext, QS_RATE_MASK, |
4644 | 14 | NULL, HFILL } |
4645 | 14 | }, |
4646 | 14 | { &hf_ipv6_opt_qs_ttl, |
4647 | 14 | { "QS TTL", "ipv6.opt.qs_ttl", |
4648 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4649 | 14 | NULL, HFILL } |
4650 | 14 | }, |
4651 | 14 | { &hf_ipv6_opt_qs_ttl_diff, |
4652 | 14 | { "TTL Diff", "ipv6.opt.qs_ttl_diff", |
4653 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4654 | 14 | NULL, HFILL } |
4655 | 14 | }, |
4656 | 14 | { &hf_ipv6_opt_qs_unused, |
4657 | 14 | { "Not Used", "ipv6.opt.qs_unused", |
4658 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4659 | 14 | NULL, HFILL } |
4660 | 14 | }, |
4661 | 14 | { &hf_ipv6_opt_qs_nonce, |
4662 | 14 | { "QS Nonce", "ipv6.opt.qs_nonce", |
4663 | 14 | FT_UINT32, BASE_HEX, NULL, 0xFFFFFFFC, |
4664 | 14 | NULL, HFILL } |
4665 | 14 | }, |
4666 | 14 | { &hf_ipv6_opt_qs_reserved, |
4667 | 14 | { "Reserved", "ipv6.opt.qs_reserved", |
4668 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0003, |
4669 | 14 | NULL, HFILL } |
4670 | 14 | }, |
4671 | 14 | { &hf_ipv6_opt_ioam_rsv, |
4672 | 14 | { "Reserved", "ipv6.opt.ioam.rsv", |
4673 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4674 | 14 | "Reserved (must be zero)", HFILL } |
4675 | 14 | }, |
4676 | 14 | { &hf_ipv6_opt_ioam_opt_type, |
4677 | 14 | { "Option-Type", "ipv6.opt.ioam.opt_type", |
4678 | 14 | FT_UINT8, BASE_DEC, VALS(ipv6_ioam_opt_types), 0x0, |
4679 | 14 | NULL, HFILL } |
4680 | 14 | }, |
4681 | 14 | { &hf_ipv6_opt_ioam_trace_ns, |
4682 | 14 | { "Namespace ID", "ipv6.opt.ioam.trace.ns", |
4683 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4684 | 14 | NULL, HFILL } |
4685 | 14 | }, |
4686 | 14 | { &hf_ipv6_opt_ioam_trace_nodelen, |
4687 | 14 | { "Node Length", "ipv6.opt.ioam.trace.nodelen", |
4688 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4689 | 14 | NULL, HFILL } |
4690 | 14 | }, |
4691 | 14 | { &hf_ipv6_opt_ioam_trace_flags, |
4692 | 14 | { "Flags", "ipv6.opt.ioam.trace.flags", |
4693 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0780, |
4694 | 14 | NULL, HFILL } |
4695 | 14 | }, |
4696 | 14 | { &hf_ipv6_opt_ioam_trace_flag_o, |
4697 | 14 | { "Overflow", "ipv6.opt.ioam.trace.flag.o", |
4698 | 14 | FT_BOOLEAN, 16, NULL, 0x0400, |
4699 | 14 | "Not enough free space", HFILL } |
4700 | 14 | }, |
4701 | 14 | { &hf_ipv6_opt_ioam_trace_flag_l, |
4702 | 14 | { "Loopback", "ipv6.opt.ioam.trace.flag.l", |
4703 | 14 | FT_BOOLEAN, 16, NULL, 0x0200, |
4704 | 14 | "Send a copy of the packet back towards the source", HFILL } |
4705 | 14 | }, |
4706 | 14 | { &hf_ipv6_opt_ioam_trace_flag_a, |
4707 | 14 | { "Active", "ipv6.opt.ioam.trace.flag.a", |
4708 | 14 | FT_BOOLEAN, 16, NULL, 0x0100, |
4709 | 14 | "Active measurement packet", HFILL } |
4710 | 14 | }, |
4711 | 14 | { &hf_ipv6_opt_ioam_trace_flag_rsv, |
4712 | 14 | { "Reserved", "ipv6.opt.ioam.trace.flag.rsv", |
4713 | 14 | FT_BOOLEAN, 16, NULL, 0x0080, |
4714 | 14 | "Reserved (must be zero)", HFILL } |
4715 | 14 | }, |
4716 | 14 | { &hf_ipv6_opt_ioam_trace_remlen, |
4717 | 14 | { "Remaining Length", "ipv6.opt.ioam.trace.remlen", |
4718 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4719 | 14 | NULL, HFILL } |
4720 | 14 | }, |
4721 | 14 | { &hf_ipv6_opt_ioam_trace_type, |
4722 | 14 | { "Trace Type", "ipv6.opt.ioam.trace.type", |
4723 | 14 | FT_UINT24, BASE_HEX, NULL, 0x0, |
4724 | 14 | NULL, HFILL } |
4725 | 14 | }, |
4726 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit0, |
4727 | 14 | { "Hop_Lim and Node ID (short)", "ipv6.opt.ioam.trace.type.bit0", |
4728 | 14 | FT_BOOLEAN, 24, NULL, 0x800000, |
4729 | 14 | NULL, HFILL } |
4730 | 14 | }, |
4731 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit1, |
4732 | 14 | { "Ingress and Egress IDs (short)", "ipv6.opt.ioam.trace.type.bit1", |
4733 | 14 | FT_BOOLEAN, 24, NULL, 0x400000, |
4734 | 14 | NULL, HFILL } |
4735 | 14 | }, |
4736 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit2, |
4737 | 14 | { "Timestamp seconds", "ipv6.opt.ioam.trace.type.bit2", |
4738 | 14 | FT_BOOLEAN, 24, NULL, 0x200000, |
4739 | 14 | NULL, HFILL } |
4740 | 14 | }, |
4741 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit3, |
4742 | 14 | { "Timestamp fraction", "ipv6.opt.ioam.trace.type.bit3", |
4743 | 14 | FT_BOOLEAN, 24, NULL, 0x100000, |
4744 | 14 | NULL, HFILL } |
4745 | 14 | }, |
4746 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit4, |
4747 | 14 | { "Transit delay", "ipv6.opt.ioam.trace.type.bit4", |
4748 | 14 | FT_BOOLEAN, 24, NULL, 0x080000, |
4749 | 14 | NULL, HFILL } |
4750 | 14 | }, |
4751 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit5, |
4752 | 14 | { "IOAM-Namespace specific data (short)", "ipv6.opt.ioam.trace.type.bit5", |
4753 | 14 | FT_BOOLEAN, 24, NULL, 0x040000, |
4754 | 14 | NULL, HFILL } |
4755 | 14 | }, |
4756 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit6, |
4757 | 14 | { "Queue depth", "ipv6.opt.ioam.trace.type.bit6", |
4758 | 14 | FT_BOOLEAN, 24, NULL, 0x020000, |
4759 | 14 | NULL, HFILL } |
4760 | 14 | }, |
4761 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit7, |
4762 | 14 | { "Checksum complement", "ipv6.opt.ioam.trace.type.bit7", |
4763 | 14 | FT_BOOLEAN, 24, NULL, 0x010000, |
4764 | 14 | NULL, HFILL } |
4765 | 14 | }, |
4766 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit8, |
4767 | 14 | { "Hop_Lim and Node ID (wide)", "ipv6.opt.ioam.trace.type.bit8", |
4768 | 14 | FT_BOOLEAN, 24, NULL, 0x008000, |
4769 | 14 | NULL, HFILL } |
4770 | 14 | }, |
4771 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit9, |
4772 | 14 | { "Ingress and Egress IDs (wide)", "ipv6.opt.ioam.trace.type.bit9", |
4773 | 14 | FT_BOOLEAN, 24, NULL, 0x004000, |
4774 | 14 | NULL, HFILL } |
4775 | 14 | }, |
4776 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit10, |
4777 | 14 | { "IOAM-Namespace specific data (wide)", "ipv6.opt.ioam.trace.type.bit10", |
4778 | 14 | FT_BOOLEAN, 24, NULL, 0x002000, |
4779 | 14 | NULL, HFILL } |
4780 | 14 | }, |
4781 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit11, |
4782 | 14 | { "Buffer occupancy", "ipv6.opt.ioam.trace.type.bit11", |
4783 | 14 | FT_BOOLEAN, 24, NULL, 0x001000, |
4784 | 14 | NULL, HFILL } |
4785 | 14 | }, |
4786 | 14 | { &hf_ipv6_opt_ioam_trace_type_undef, |
4787 | 14 | { "Undefined", "ipv6.opt.ioam.trace.type.undef", |
4788 | 14 | FT_BOOLEAN, 24, NULL, 0x000ffc, |
4789 | 14 | NULL, HFILL } |
4790 | 14 | }, |
4791 | 14 | { &hf_ipv6_opt_ioam_trace_type_bit22, |
4792 | 14 | { "Opaque State Snapshot", "ipv6.opt.ioam.trace.type.bit22", |
4793 | 14 | FT_BOOLEAN, 24, NULL, 0x000002, |
4794 | 14 | NULL, HFILL } |
4795 | 14 | }, |
4796 | 14 | { &hf_ipv6_opt_ioam_trace_type_rsv, |
4797 | 14 | { "Reserved", "ipv6.opt.ioam.trace.type.rsv", |
4798 | 14 | FT_BOOLEAN, 24, NULL, 0x000001, |
4799 | 14 | NULL, HFILL } |
4800 | 14 | }, |
4801 | 14 | { &hf_ipv6_opt_ioam_trace_rsv, |
4802 | 14 | { "Reserved", "ipv6.opt.ioam.trace.rsv", |
4803 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4804 | 14 | "Reserved (must be zero)", HFILL } |
4805 | 14 | }, |
4806 | 14 | { &hf_ipv6_opt_ioam_trace_free_space, |
4807 | 14 | { "Free space", "ipv6.opt.ioam.trace.free_space", |
4808 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4809 | 14 | NULL, HFILL } |
4810 | 14 | }, |
4811 | 14 | { &hf_ipv6_opt_ioam_trace_node_hlim, |
4812 | 14 | { "Hop Limit", "ipv6.opt.ioam.trace.node.hlim", |
4813 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4814 | 14 | NULL, HFILL } |
4815 | 14 | }, |
4816 | 14 | { &hf_ipv6_opt_ioam_trace_node_id, |
4817 | 14 | { "ID", "ipv6.opt.ioam.trace.node.id", |
4818 | 14 | FT_UINT24, BASE_HEX, NULL, 0x0, |
4819 | 14 | NULL, HFILL } |
4820 | 14 | }, |
4821 | 14 | { &hf_ipv6_opt_ioam_trace_node_iif, |
4822 | 14 | { "Ingress ID", "ipv6.opt.ioam.trace.node.iif", |
4823 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
4824 | 14 | NULL, HFILL } |
4825 | 14 | }, |
4826 | 14 | { &hf_ipv6_opt_ioam_trace_node_eif, |
4827 | 14 | { "Egress ID", "ipv6.opt.ioam.trace.node.eif", |
4828 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
4829 | 14 | NULL, HFILL } |
4830 | 14 | }, |
4831 | 14 | { &hf_ipv6_opt_ioam_trace_node_tss, |
4832 | 14 | { "Timestamp Seconds", "ipv6.opt.ioam.trace.node.tss", |
4833 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4834 | 14 | NULL, HFILL } |
4835 | 14 | }, |
4836 | 14 | { &hf_ipv6_opt_ioam_trace_node_tsf, |
4837 | 14 | { "Timestamp Fraction", "ipv6.opt.ioam.trace.node.tsf", |
4838 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4839 | 14 | NULL, HFILL } |
4840 | 14 | }, |
4841 | 14 | { &hf_ipv6_opt_ioam_trace_node_trdelay, |
4842 | 14 | { "Transit Delay", "ipv6.opt.ioam.trace.node.trdelay", |
4843 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4844 | 14 | NULL, HFILL } |
4845 | 14 | }, |
4846 | 14 | { &hf_ipv6_opt_ioam_trace_node_nsdata, |
4847 | 14 | { "Namespace Data (short)", "ipv6.opt.ioam.trace.node.nsdata", |
4848 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4849 | 14 | NULL, HFILL } |
4850 | 14 | }, |
4851 | 14 | { &hf_ipv6_opt_ioam_trace_node_qdepth, |
4852 | 14 | { "Queue Depth", "ipv6.opt.ioam.trace.node.qdepth", |
4853 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4854 | 14 | NULL, HFILL } |
4855 | 14 | }, |
4856 | 14 | { &hf_ipv6_opt_ioam_trace_node_csum, |
4857 | 14 | { "Checksum Complement", "ipv6.opt.ioam.trace.node.csum", |
4858 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4859 | 14 | NULL, HFILL } |
4860 | 14 | }, |
4861 | 14 | { &hf_ipv6_opt_ioam_trace_node_id_wide, |
4862 | 14 | { "ID", "ipv6.opt.ioam.trace.node.id_wide", |
4863 | 14 | FT_UINT56, BASE_HEX, NULL, 0x0, |
4864 | 14 | NULL, HFILL } |
4865 | 14 | }, |
4866 | 14 | { &hf_ipv6_opt_ioam_trace_node_iif_wide, |
4867 | 14 | { "Ingress ID", "ipv6.opt.ioam.trace.node.iif_wide", |
4868 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4869 | 14 | NULL, HFILL } |
4870 | 14 | }, |
4871 | 14 | { &hf_ipv6_opt_ioam_trace_node_eif_wide, |
4872 | 14 | { "Egress ID", "ipv6.opt.ioam.trace.node.eif_wide", |
4873 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4874 | 14 | NULL, HFILL } |
4875 | 14 | }, |
4876 | 14 | { &hf_ipv6_opt_ioam_trace_node_nsdata_wide, |
4877 | 14 | { "Namespace Data (wide)", "ipv6.opt.ioam.trace.node.nsdata_wide", |
4878 | 14 | FT_UINT64, BASE_HEX, NULL, 0x0, |
4879 | 14 | NULL, HFILL } |
4880 | 14 | }, |
4881 | 14 | { &hf_ipv6_opt_ioam_trace_node_bufoccup, |
4882 | 14 | { "Buffer Occupancy", "ipv6.opt.ioam.trace.node.bufoccup", |
4883 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4884 | 14 | NULL, HFILL } |
4885 | 14 | }, |
4886 | 14 | { &hf_ipv6_opt_ioam_trace_node_undefined, |
4887 | 14 | { "Undefined bit", "ipv6.opt.ioam.trace.node.undefined", |
4888 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4889 | 14 | NULL, HFILL } |
4890 | 14 | }, |
4891 | 14 | { &hf_ipv6_opt_ioam_trace_node_oss_len, |
4892 | 14 | { "Length", "ipv6.opt.ioam.trace.node.oss.len", |
4893 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4894 | 14 | NULL, HFILL } |
4895 | 14 | }, |
4896 | 14 | { &hf_ipv6_opt_ioam_trace_node_oss_scid, |
4897 | 14 | { "Schema ID", "ipv6.opt.ioam.trace.node.oss.scid", |
4898 | 14 | FT_UINT24, BASE_HEX, NULL, 0x0, |
4899 | 14 | NULL, HFILL } |
4900 | 14 | }, |
4901 | 14 | { &hf_ipv6_opt_ioam_trace_node_oss_data, |
4902 | 14 | { "Data", "ipv6.opt.ioam.trace.node.oss.data", |
4903 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4904 | 14 | NULL, HFILL } |
4905 | 14 | }, |
4906 | 14 | { &hf_ipv6_opt_ioam_dex_ns, |
4907 | 14 | { "Namespace ID", "ipv6.opt.ioam.dex.ns", |
4908 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
4909 | 14 | NULL, HFILL } |
4910 | 14 | }, |
4911 | 14 | { &hf_ipv6_opt_ioam_dex_flags, |
4912 | 14 | { "Flags", "ipv6.opt.ioam.dex.flags", |
4913 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4914 | 14 | NULL, HFILL } |
4915 | 14 | }, |
4916 | 14 | { &hf_ipv6_opt_ioam_dex_extflags, |
4917 | 14 | { "Extension Flags", "ipv6.opt.ioam.dex.extflags", |
4918 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
4919 | 14 | NULL, HFILL } |
4920 | 14 | }, |
4921 | 14 | { &hf_ipv6_opt_ioam_dex_extflag_flag_seqnum, |
4922 | 14 | { "Sequence Number", "ipv6.opt.ioam.dex.extflag.flag.seqnum", |
4923 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
4924 | 14 | NULL, HFILL } |
4925 | 14 | }, |
4926 | 14 | { &hf_ipv6_opt_ioam_dex_extflag_flag_flowid, |
4927 | 14 | { "Flow ID", "ipv6.opt.ioam.dex.extflag.flag.flowid", |
4928 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
4929 | 14 | NULL, HFILL } |
4930 | 14 | }, |
4931 | 14 | { &hf_ipv6_opt_ioam_dex_extflag_flag_rsv, |
4932 | 14 | { "Reserved", "ipv6.opt.ioam.trace.type.rsv", |
4933 | 14 | FT_BOOLEAN, 8, NULL, 0x3F, |
4934 | 14 | NULL, HFILL } |
4935 | 14 | }, |
4936 | 14 | { &hf_ipv6_opt_ioam_dex_extflag_flowid, |
4937 | 14 | { "Flow ID", "ipv6.opt.ioam.dex.extflag.flowid", |
4938 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4939 | 14 | NULL, HFILL } |
4940 | 14 | }, |
4941 | 14 | { &hf_ipv6_opt_ioam_dex_extflag_seqnum, |
4942 | 14 | { "Sequence Number", "ipv6.opt.ioam.dex.extflag.seqnum", |
4943 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
4944 | 14 | NULL, HFILL } |
4945 | 14 | }, |
4946 | 14 | { &hf_ipv6_opt_ioam_dex_rsv, |
4947 | 14 | { "Reserved", "ipv6.opt.ioam.dex.rsv", |
4948 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
4949 | 14 | NULL, HFILL } |
4950 | 14 | }, |
4951 | 14 | { &hf_ipv6_opt_tpf_information, |
4952 | 14 | { "TPF Information", "ipv6.opt.tpf_information", |
4953 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
4954 | 14 | "Tunnel Payload Forwarding Information", HFILL } |
4955 | 14 | }, |
4956 | 14 | { &hf_ipv6_opt_mipv6_home_address, |
4957 | 14 | { "MIPv6 Home Address", "ipv6.opt.mipv6.home_address", |
4958 | 14 | FT_IPv6, BASE_NONE, NULL, 0x0, |
4959 | 14 | NULL, HFILL } |
4960 | 14 | }, |
4961 | 14 | { &hf_ipv6_opt_rpl_flag, |
4962 | 14 | { "Flag", "ipv6.opt.rpl.flag", |
4963 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
4964 | 14 | NULL, HFILL } |
4965 | 14 | }, |
4966 | 14 | { &hf_ipv6_opt_rpl_flag_o, |
4967 | 14 | { "Down", "ipv6.opt.rpl.flag.o", |
4968 | 14 | FT_BOOLEAN, 8, NULL, 0x80, |
4969 | 14 | "The packet is expected to progress Up or Down", HFILL } |
4970 | 14 | }, |
4971 | 14 | { &hf_ipv6_opt_rpl_flag_r, |
4972 | 14 | { "Rank Error", "ipv6.opt.rpl.flag.r", |
4973 | 14 | FT_BOOLEAN, 8, NULL, 0x40, |
4974 | 14 | "Whether a rank error was detected", HFILL } |
4975 | 14 | }, |
4976 | 14 | { &hf_ipv6_opt_rpl_flag_f, |
4977 | 14 | { "Forwarding Error", "ipv6.opt.rpl.flag.f", |
4978 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
4979 | 14 | "Set if the node cannot forward the packet further towards the destination", HFILL } |
4980 | 14 | }, |
4981 | 14 | { &hf_ipv6_opt_rpl_flag_rsv, |
4982 | 14 | { "Reserved", "ipv6.opt.rpl.flag.rsv", |
4983 | 14 | FT_UINT8, BASE_HEX, NULL, 0x1F, |
4984 | 14 | "Reserved (must be zero)", HFILL } |
4985 | 14 | }, |
4986 | 14 | { &hf_ipv6_opt_rpl_instance_id, |
4987 | 14 | { "RPLInstanceID", "ipv6.opt.rpl.instance_id", |
4988 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
4989 | 14 | "The DODAG instance along which the packet is sent", HFILL } |
4990 | 14 | }, |
4991 | 14 | { &hf_ipv6_opt_rpl_senderrank, |
4992 | 14 | { "Sender Rank", "ipv6.opt.rpl.sender_rank", |
4993 | 14 | FT_UINT16, BASE_HEX, NULL, 0x0, |
4994 | 14 | "Set to zero by the source and to DAGRank(rank) by a router that forwards inside the RPL network", HFILL } |
4995 | 14 | }, |
4996 | 14 | { &hf_ipv6_opt_ilnp_nonce, |
4997 | 14 | { "ILNP Nonce", "ipv6.opt.ilnp_nonce", |
4998 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
4999 | 14 | NULL, HFILL } |
5000 | 14 | }, |
5001 | 14 | { &hf_ipv6_opt_lio_len, |
5002 | 14 | { "LineIDLen", "ipv6.opt.lio.length", |
5003 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5004 | 14 | NULL, HFILL } |
5005 | 14 | }, |
5006 | 14 | { &hf_ipv6_opt_lio_id, |
5007 | 14 | { "Line ID", "ipv6.opt.lio.line_id", |
5008 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
5009 | 14 | NULL, HFILL } |
5010 | 14 | }, |
5011 | 14 | { &hf_ipv6_opt_mpl_flag, |
5012 | 14 | { "Flag", "ipv6.opt.mpl.flag", |
5013 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
5014 | 14 | NULL, HFILL } |
5015 | 14 | }, |
5016 | 14 | { &hf_ipv6_opt_mpl_flag_s, |
5017 | 14 | { "Seed ID Length", "ipv6.opt.mpl.flag.s", |
5018 | 14 | FT_UINT8, BASE_DEC, VALS(mpl_seed_id_len_vals), 0xC0, |
5019 | 14 | "Identifies the length of Seed ID", HFILL } |
5020 | 14 | }, |
5021 | 14 | { &hf_ipv6_opt_mpl_flag_m, |
5022 | 14 | { "Largest Sequence", "ipv6.opt.mpl.flag.m", |
5023 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
5024 | 14 | "Indicates Sequence is known to be the largest sequence number", HFILL } |
5025 | 14 | }, |
5026 | 14 | { &hf_ipv6_opt_mpl_flag_v, |
5027 | 14 | { "Version", "ipv6.opt.mpl.flag.v", |
5028 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
5029 | 14 | "0 indicates this option conforms to RFC<TBC>", HFILL } |
5030 | 14 | }, |
5031 | 14 | { &hf_ipv6_opt_mpl_flag_rsv, |
5032 | 14 | { "Reserved", "ipv6.opt.mpl.flag.rsv", |
5033 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0F, |
5034 | 14 | "Reserved (must be zero)", HFILL } |
5035 | 14 | }, |
5036 | 14 | { &hf_ipv6_opt_mpl_sequence, |
5037 | 14 | { "Sequence", "ipv6.opt.mpl.sequence", |
5038 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
5039 | 14 | "Identifies relative ordering of MPL Data Messages from the MPL Seed identified by Seed ID", HFILL } |
5040 | 14 | }, |
5041 | 14 | { &hf_ipv6_opt_mpl_seed_id, |
5042 | 14 | { "Seed ID", "ipv6.opt.mpl.seed_id", |
5043 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5044 | 14 | "Uniquely identifies the MPL Seed that initiated dissemination of the MPL Data Message", HFILL } |
5045 | 14 | }, |
5046 | 14 | { &hf_ipv6_opt_dff_flags, |
5047 | 14 | { "Flags", "ipv6.opt.dff.flags", |
5048 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
5049 | 14 | NULL, HFILL } |
5050 | 14 | }, |
5051 | 14 | { &hf_ipv6_opt_dff_flag_ver, |
5052 | 14 | { "Version (VER)", "ipv6.opt.dff.flag.ver", |
5053 | 14 | FT_UINT8, BASE_DEC, NULL, 0xC0, |
5054 | 14 | "The version of DFF that is used", HFILL } |
5055 | 14 | }, |
5056 | 14 | { &hf_ipv6_opt_dff_flag_dup, |
5057 | 14 | { "Duplicate (DUP)", "ipv6.opt.dff.flag.dup", |
5058 | 14 | FT_BOOLEAN, 8, NULL, 0x20, |
5059 | 14 | "Indicates the packet is being retransmitted", HFILL } |
5060 | 14 | }, |
5061 | 14 | { &hf_ipv6_opt_dff_flag_ret, |
5062 | 14 | { "Return (RET)", "ipv6.opt.dff.flag.ret", |
5063 | 14 | FT_BOOLEAN, 8, NULL, 0x10, |
5064 | 14 | "Must be set to 1 prior to sending the packet back to the Previous Hop", HFILL } |
5065 | 14 | }, |
5066 | 14 | { &hf_ipv6_opt_dff_flag_rsv, |
5067 | 14 | { "Reserved", "ipv6.opt.dff.flag.rsv", |
5068 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0F, |
5069 | 14 | "Reserved (must be zero)", HFILL } |
5070 | 14 | }, |
5071 | 14 | { &hf_ipv6_opt_dff_seqnum, |
5072 | 14 | { "Sequence Number", "ipv6.opt.dff.sequence_number", |
5073 | 14 | FT_UINT16, BASE_DEC_HEX, NULL, 0x0, |
5074 | 14 | NULL, HFILL } |
5075 | 14 | }, |
5076 | 14 | { &hf_ipv6_opt_experimental, |
5077 | 14 | { "Experimental Option", "ipv6.opt.experimental", |
5078 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5079 | 14 | NULL, HFILL } |
5080 | 14 | }, |
5081 | 14 | { &hf_ipv6_opt_unknown_data, |
5082 | 14 | { "Unknown Data", "ipv6.opt_unknown_data", |
5083 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5084 | 14 | "Not interpreted data", HFILL } |
5085 | 14 | }, |
5086 | 14 | { &hf_ipv6_opt_unknown, |
5087 | 14 | { "Unknown Option Payload", "ipv6.opt.unknown", |
5088 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5089 | 14 | NULL, HFILL } |
5090 | 14 | }, |
5091 | 14 | { &hf_ipv6_fragment, |
5092 | 14 | { "IPv6 Fragment", "ipv6.fragment", |
5093 | 14 | FT_FRAMENUM, BASE_NONE, NULL, 0x0, |
5094 | 14 | NULL, HFILL } |
5095 | 14 | }, |
5096 | 14 | { &hf_ipv6_fragment_overlap, |
5097 | 14 | { "Fragment overlap", "ipv6.fragment.overlap", |
5098 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5099 | 14 | "Fragment overlaps with other fragments", HFILL } |
5100 | 14 | }, |
5101 | 14 | { &hf_ipv6_fragment_overlap_conflict, |
5102 | 14 | { "Conflicting data in fragment overlap", "ipv6.fragment.overlap.conflict", |
5103 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5104 | 14 | "Overlapping fragments contained conflicting data", HFILL } |
5105 | 14 | }, |
5106 | 14 | { &hf_ipv6_fragment_multiple_tails, |
5107 | 14 | { "Multiple tail fragments found", "ipv6.fragment.multipletails", |
5108 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5109 | 14 | "Several tails were found when defragmenting the packet", HFILL } |
5110 | 14 | }, |
5111 | 14 | { &hf_ipv6_fragment_too_long_fragment, |
5112 | 14 | { "Fragment too long", "ipv6.fragment.toolongfragment", |
5113 | 14 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, |
5114 | 14 | "Fragment contained data past end of packet", HFILL } |
5115 | 14 | }, |
5116 | 14 | { &hf_ipv6_fragment_error, |
5117 | 14 | { "Defragmentation error", "ipv6.fragment.error", |
5118 | 14 | FT_FRAMENUM, BASE_NONE, NULL, 0x0, |
5119 | 14 | "Defragmentation error due to illegal fragments", HFILL } |
5120 | 14 | }, |
5121 | 14 | { &hf_ipv6_fragment_count, |
5122 | 14 | { "Fragment count", "ipv6.fragment.count", |
5123 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5124 | 14 | NULL, HFILL } |
5125 | 14 | }, |
5126 | 14 | { &hf_ipv6_fragments, |
5127 | 14 | { "IPv6 Fragments", "ipv6.fragments", |
5128 | 14 | FT_NONE, BASE_NONE, NULL, 0x0, |
5129 | 14 | NULL, HFILL } |
5130 | 14 | }, |
5131 | 14 | { &hf_ipv6_reassembled_in, |
5132 | 14 | { "Reassembled IPv6 in frame", "ipv6.reassembled.in", |
5133 | 14 | FT_FRAMENUM, BASE_NONE, NULL, 0x0, |
5134 | 14 | "This IPv6 packet is reassembled in this frame", HFILL } |
5135 | 14 | }, |
5136 | 14 | { &hf_ipv6_reassembled_length, |
5137 | 14 | { "Reassembled IPv6 length", "ipv6.reassembled.length", |
5138 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5139 | 14 | "The total length of the reassembled payload", HFILL } |
5140 | 14 | }, |
5141 | 14 | { &hf_ipv6_reassembled_data, |
5142 | 14 | { "Reassembled IPv6 data", "ipv6.reassembled.data", |
5143 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5144 | 14 | "The reassembled payload", HFILL } |
5145 | 14 | } |
5146 | 14 | }; |
5147 | | |
5148 | 14 | static hf_register_info hf_ipv6_hopopts[] = { |
5149 | 14 | { &hf_ipv6_hopopts_nxt, |
5150 | 14 | { "Next Header", "ipv6.hopopts.nxt", |
5151 | 14 | FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0x0, |
5152 | 14 | NULL, HFILL } |
5153 | 14 | }, |
5154 | 14 | { &hf_ipv6_hopopts_len, |
5155 | 14 | { "Length", "ipv6.hopopts.len", |
5156 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5157 | 14 | "Extension header length in 8-octet words (minus 1)", HFILL } |
5158 | 14 | }, |
5159 | 14 | { &hf_ipv6_hopopts_len_oct, |
5160 | 14 | { "Length", "ipv6.hopopts.len_oct", |
5161 | 14 | FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, |
5162 | 14 | "Extension header length in octets", HFILL } |
5163 | 14 | } |
5164 | 14 | }; |
5165 | | |
5166 | 14 | static hf_register_info hf_ipv6_dstopts[] = { |
5167 | 14 | { &hf_ipv6_dstopts_nxt, |
5168 | 14 | { "Next Header", "ipv6.dstopts.nxt", |
5169 | 14 | FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0x0, |
5170 | 14 | NULL, HFILL } |
5171 | 14 | }, |
5172 | 14 | { &hf_ipv6_dstopts_len, |
5173 | 14 | { "Length", "ipv6.dstopts.len", |
5174 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5175 | 14 | "Extension header length in 8-octet words (minus 1)", HFILL } |
5176 | 14 | }, |
5177 | 14 | { &hf_ipv6_dstopts_len_oct, |
5178 | 14 | { "Length", "ipv6.dstopts.len_oct", |
5179 | 14 | FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, |
5180 | 14 | "Extension header length in octets", HFILL } |
5181 | 14 | } |
5182 | 14 | }; |
5183 | | |
5184 | 14 | static hf_register_info hf_ipv6_routing[] = { |
5185 | | |
5186 | | /* IPv6 Routing Header */ |
5187 | 14 | { &hf_ipv6_routing_nxt, |
5188 | 14 | { "Next Header", "ipv6.routing.nxt", |
5189 | 14 | FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0x0, |
5190 | 14 | NULL, HFILL } |
5191 | 14 | }, |
5192 | 14 | { &hf_ipv6_routing_len, |
5193 | 14 | { "Length", "ipv6.routing.len", |
5194 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5195 | 14 | "Extension header length in 8-octet words (minus 1)", HFILL } |
5196 | 14 | }, |
5197 | 14 | { &hf_ipv6_routing_len_oct, |
5198 | 14 | { "Length", "ipv6.routing.len_oct", |
5199 | 14 | FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0x0, |
5200 | 14 | "Extension header length in octets", HFILL } |
5201 | 14 | }, |
5202 | 14 | { &hf_ipv6_routing_type, |
5203 | 14 | { "Type", "ipv6.routing.type", |
5204 | 14 | FT_UINT8, BASE_DEC, VALS(routing_header_type), 0x0, |
5205 | 14 | "Routing Header Type", HFILL } |
5206 | 14 | }, |
5207 | 14 | { &hf_ipv6_routing_segleft, |
5208 | 14 | { "Segments Left", "ipv6.routing.segleft", |
5209 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5210 | 14 | "Routing Header Segments Left", HFILL } |
5211 | 14 | }, |
5212 | 14 | { &hf_ipv6_routing_unknown_data, |
5213 | 14 | { "Type-Specific Data", "ipv6.routing.unknown_data", |
5214 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5215 | 14 | "Unknown routing header type-specific data", HFILL } |
5216 | 14 | }, |
5217 | | |
5218 | | /* Source Routing Header */ |
5219 | 14 | { &hf_ipv6_routing_src_reserved, |
5220 | 14 | { "Reserved", "ipv6.routing.src.reserved", |
5221 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5222 | 14 | "Must be zero", HFILL } |
5223 | 14 | }, |
5224 | 14 | { &hf_ipv6_routing_src_addr, |
5225 | 14 | { "Address", "ipv6.routing.src.addr", |
5226 | 14 | FT_IPv6, BASE_NONE, NULL, 0x0, |
5227 | 14 | "Source Routing Header Address", HFILL }}, |
5228 | | |
5229 | | /* Mobile IPv6 */ |
5230 | 14 | { &hf_ipv6_routing_mipv6_reserved, |
5231 | 14 | { "Reserved", "ipv6.routing.mipv6.reserved", |
5232 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5233 | 14 | "Must be zero", HFILL } |
5234 | 14 | }, |
5235 | 14 | { &hf_ipv6_routing_mipv6_home_address, |
5236 | 14 | { "Home Address", "ipv6.routing.mipv6.home_address", |
5237 | 14 | FT_IPv6, BASE_NONE, NULL, 0x0, |
5238 | 14 | NULL, HFILL } |
5239 | 14 | }, |
5240 | | |
5241 | | /* RPL Routing Header */ |
5242 | 14 | { &hf_ipv6_routing_rpl_cmprI, |
5243 | 14 | { "Compressed Internal Octets (CmprI)", "ipv6.routing.rpl.cmprI", |
5244 | 14 | FT_UINT32, BASE_DEC, NULL, IP6RRPL_BITMASK_CMPRI, |
5245 | 14 | "Elided octets from all but last segment", HFILL } |
5246 | 14 | }, |
5247 | 14 | { &hf_ipv6_routing_rpl_cmprE, |
5248 | 14 | { "Compressed Final Octets (CmprE)", "ipv6.routing.rpl.cmprE", |
5249 | 14 | FT_UINT32, BASE_DEC, NULL, IP6RRPL_BITMASK_CMPRE, |
5250 | 14 | "Elided octets from last segment address", HFILL } |
5251 | 14 | }, |
5252 | 14 | { &hf_ipv6_routing_rpl_pad, |
5253 | 14 | { "Padding Bytes", "ipv6.routing.rpl.pad", |
5254 | 14 | FT_UINT32, BASE_DEC, NULL, IP6RRPL_BITMASK_PAD, |
5255 | 14 | NULL, HFILL } |
5256 | 14 | }, |
5257 | 14 | { &hf_ipv6_routing_rpl_reserved, |
5258 | 14 | { "Reserved", "ipv6.routing.rpl.reserved", |
5259 | 14 | FT_UINT32, BASE_DEC, NULL, IP6RRPL_BITMASK_RESERVED, |
5260 | 14 | "Must be zero", HFILL } |
5261 | 14 | }, |
5262 | 14 | { &hf_ipv6_routing_rpl_addr_count, |
5263 | 14 | { "Total Address Count", "ipv6.routing.rpl.addr_count", |
5264 | 14 | FT_INT32, BASE_DEC, NULL, 0, |
5265 | 14 | NULL, HFILL } |
5266 | 14 | }, |
5267 | 14 | { &hf_ipv6_routing_rpl_addr, |
5268 | 14 | { "Address", "ipv6.routing.rpl.address", |
5269 | 14 | FT_BYTES, BASE_NONE, NULL, 0, |
5270 | 14 | NULL, HFILL } |
5271 | 14 | }, |
5272 | 14 | { &hf_ipv6_routing_rpl_fulladdr, |
5273 | 14 | { "Full Address", "ipv6.routing.rpl.full_address", |
5274 | 14 | FT_IPv6, BASE_NONE, NULL, 0, |
5275 | 14 | "Uncompressed IPv6 Address", HFILL } |
5276 | 14 | }, |
5277 | | |
5278 | | /* Segment Routing Header */ |
5279 | 14 | { &hf_ipv6_routing_srh_last_entry, |
5280 | 14 | { "Last Entry", "ipv6.routing.srh.last_entry", |
5281 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
5282 | 14 | "Index (zero based) of the last element of the Segment List", HFILL } |
5283 | 14 | }, |
5284 | 14 | { &hf_ipv6_routing_srh_flags, |
5285 | 14 | { "Flags", "ipv6.routing.srh.flags", |
5286 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
5287 | 14 | "Unused, 8 bits of flags", HFILL } |
5288 | 14 | }, |
5289 | 14 | { &hf_ipv6_routing_srh_tag, |
5290 | 14 | { "Tag", "ipv6.routing.srh.tag", |
5291 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
5292 | 14 | "Tag a packet as part of a class or group of packets", HFILL } |
5293 | 14 | }, |
5294 | 14 | { &hf_ipv6_routing_srh_addr, |
5295 | 14 | { "Address", "ipv6.routing.srh.addr", |
5296 | 14 | FT_IPv6, BASE_NONE, NULL, 0x0, |
5297 | 14 | "Segment address", HFILL } |
5298 | 14 | }, |
5299 | | |
5300 | | /* Compact Routing Header */ |
5301 | 14 | { &hf_ipv6_routing_crh16_current_sid, |
5302 | 14 | { "Current SID", "ipv6.routing.crh16.current_sid", |
5303 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5304 | 14 | "Value of the current Segment ID", HFILL } |
5305 | 14 | }, |
5306 | 14 | { &hf_ipv6_routing_crh32_current_sid, |
5307 | 14 | { "Current SID", "ipv6.routing.crh32.current_sid", |
5308 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5309 | 14 | "Value of the current Segment ID", HFILL } |
5310 | 14 | }, |
5311 | 14 | { &hf_ipv6_routing_crh16_segment_id, |
5312 | 14 | { "Segment ID", "ipv6.routing.crh16.sid", |
5313 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
5314 | 14 | "Segment address", HFILL } |
5315 | 14 | }, |
5316 | 14 | { &hf_ipv6_routing_crh32_segment_id, |
5317 | 14 | { "Segment ID", "ipv6.routing.crh32.sid", |
5318 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0, |
5319 | 14 | "Segment address", HFILL } |
5320 | 14 | } |
5321 | 14 | }; |
5322 | | |
5323 | 14 | static hf_register_info hf_ipv6_fraghdr[] = { |
5324 | 14 | { &hf_ipv6_fraghdr_nxt, |
5325 | 14 | { "Next header", "ipv6.fraghdr.nxt", |
5326 | 14 | FT_UINT8, BASE_DEC | BASE_EXT_STRING, &ipproto_val_ext, 0x0, |
5327 | 14 | NULL, HFILL } |
5328 | 14 | }, |
5329 | 14 | { &hf_ipv6_fraghdr_reserved_octet, |
5330 | 14 | { "Reserved octet", "ipv6.fraghdr.reserved_octet", |
5331 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
5332 | 14 | "Should always be 0", HFILL } |
5333 | 14 | }, |
5334 | 14 | { &hf_ipv6_fraghdr_offset, |
5335 | 14 | { "Offset", "ipv6.fraghdr.offset", |
5336 | 14 | FT_UINT16, BASE_DEC, NULL, IP6F_OFF_MASK, |
5337 | 14 | "Fragment Offset", HFILL } |
5338 | 14 | }, |
5339 | 14 | { &hf_ipv6_fraghdr_reserved_bits, |
5340 | 14 | { "Reserved bits", "ipv6.fraghdr.reserved_bits", |
5341 | 14 | FT_UINT16, BASE_DEC, NULL, IP6F_RESERVED_MASK, |
5342 | 14 | NULL, HFILL } |
5343 | 14 | }, |
5344 | 14 | { &hf_ipv6_fraghdr_more, |
5345 | 14 | { "More Fragments", "ipv6.fraghdr.more", |
5346 | 14 | FT_BOOLEAN, 16, TFS(&tfs_yes_no), IP6F_MORE_FRAG, |
5347 | 14 | NULL, HFILL } |
5348 | 14 | }, |
5349 | 14 | { &hf_ipv6_fraghdr_ident, |
5350 | 14 | { "Identification", "ipv6.fraghdr.ident", |
5351 | 14 | FT_UINT32, BASE_HEX, NULL, 0x0, |
5352 | 14 | "Fragment Identification", HFILL } |
5353 | 14 | } |
5354 | 14 | }; |
5355 | | |
5356 | 14 | static int *ett_ipv6[] = { |
5357 | 14 | &ett_ipv6_proto, |
5358 | 14 | &ett_ipv6_detail, |
5359 | 14 | &ett_ipv6_detail_special_purpose, |
5360 | 14 | &ett_ipv6_multicast_flags, |
5361 | 14 | &ett_ipv6_traffic_class, |
5362 | 14 | &ett_geoip_info, |
5363 | 14 | &ett_ipv6_opt, |
5364 | 14 | &ett_ipv6_opt_type, |
5365 | 14 | &ett_ipv6_opt_rpl, |
5366 | 14 | &ett_ipv6_opt_mpl, |
5367 | 14 | &ett_ipv6_opt_dff_flags, |
5368 | 14 | &ett_ipv6_opt_ioam_trace_flags, |
5369 | 14 | &ett_ipv6_opt_ioam_trace_types, |
5370 | 14 | &ett_ipv6_opt_ioam_dex_extflags, |
5371 | 14 | &ett_ipv6_fragment, |
5372 | 14 | &ett_ipv6_fragments |
5373 | 14 | }; |
5374 | | |
5375 | 14 | static int *ett_ipv6_hopopts[] = { |
5376 | 14 | &ett_ipv6_hopopts_proto |
5377 | 14 | }; |
5378 | | |
5379 | 14 | static int *ett_ipv6_routing[] = { |
5380 | 14 | &ett_ipv6_routing_proto, |
5381 | 14 | &ett_ipv6_routing_srh_vect |
5382 | 14 | }; |
5383 | | |
5384 | 14 | static int *ett_ipv6_fraghdr[] = { |
5385 | 14 | &ett_ipv6_fraghdr_proto |
5386 | 14 | }; |
5387 | | |
5388 | 14 | static int *ett_ipv6_dstopts[] = { |
5389 | 14 | &ett_ipv6_dstopts_proto |
5390 | 14 | }; |
5391 | | |
5392 | 14 | static ei_register_info ei_ipv6[] = { |
5393 | 14 | { &ei_ipv6_opt_jumbo_missing, |
5394 | 14 | { "ipv6.opt.jumbo.missing", PI_MALFORMED, PI_ERROR, |
5395 | 14 | "IPv6 payload length equals 0 and Hop-By-Hop present and Jumbo Payload option missing", EXPFILL } |
5396 | 14 | }, |
5397 | 14 | { &ei_ipv6_opt_jumbo_prohibited, |
5398 | 14 | { "ipv6.opt.jumbo.prohibited", PI_PROTOCOL, PI_WARN, |
5399 | 14 | "When IPv6 payload length does not equal 0 a Jumbo Payload option must not be present", EXPFILL } |
5400 | 14 | }, |
5401 | 14 | { &ei_ipv6_opt_jumbo_truncated, |
5402 | 14 | { "ipv6.opt.jumbo.truncated", PI_PROTOCOL, PI_WARN, |
5403 | 14 | "Jumbo Payload option present and jumbo length < 65536", EXPFILL } |
5404 | 14 | }, |
5405 | 14 | { &ei_ipv6_opt_jumbo_fragment, |
5406 | 14 | { "ipv6.opt.jumbo.fragment", PI_PROTOCOL, PI_WARN, |
5407 | 14 | "Jumbo Payload option cannot be used with a fragment header", EXPFILL } |
5408 | 14 | }, |
5409 | 14 | { &ei_ipv6_opt_invalid_len, |
5410 | 14 | { "ipv6.opt.invalid_len", PI_MALFORMED, PI_ERROR, |
5411 | 14 | "Invalid IPv6 option length", EXPFILL } |
5412 | 14 | }, |
5413 | 14 | { &ei_ipv6_opt_apn_invalid_id_type, |
5414 | 14 | { "ipv6.opt.apn.invalid.id_type", PI_MALFORMED, PI_ERROR, |
5415 | 14 | "Invalid APN ID Type", EXPFILL } |
5416 | 14 | }, |
5417 | 14 | { &ei_ipv6_opt_unknown_data, |
5418 | 14 | { "ipv6.opt.unknown_data.expert", PI_UNDECODED, PI_NOTE, |
5419 | 14 | "Unknown Data (not interpreted)", EXPFILL } |
5420 | 14 | }, |
5421 | 14 | { &ei_ipv6_plen_exceeds_framing, |
5422 | 14 | { "ipv6.plen_exceeds_framing", PI_PROTOCOL, PI_WARN, |
5423 | 14 | "IPv6 payload length does not match expected framing length", EXPFILL } |
5424 | 14 | }, |
5425 | 14 | { &ei_ipv6_plen_zero, |
5426 | 14 | { "ipv6.plen_zero", PI_PROTOCOL, PI_CHAT, |
5427 | 14 | "IPv6 payload length equals 0 (maybe because of \"TCP segmentation offload\" (TSO))", EXPFILL } |
5428 | 14 | }, |
5429 | 14 | { &ei_ipv6_bogus_ipv6_version, |
5430 | 14 | { "ipv6.bogus_ipv6_version", PI_MALFORMED, PI_ERROR, |
5431 | 14 | "Bogus IP version", EXPFILL } |
5432 | 14 | }, |
5433 | 14 | { &ei_ipv6_invalid_header, |
5434 | 14 | { "ipv6.invalid_header", PI_MALFORMED, PI_ERROR, |
5435 | 14 | "Invalid IPv6 header", EXPFILL } |
5436 | 14 | }, |
5437 | 14 | { &ei_ipv6_opt_header_mismatch, |
5438 | 14 | { "ipv6.opt.header_mismatch", PI_PROTOCOL, PI_WARN, |
5439 | 14 | "Wrong options extension header for type", EXPFILL } |
5440 | 14 | }, |
5441 | 14 | { &ei_ipv6_opt_deprecated, |
5442 | 14 | { "ipv6.opt.deprecated", PI_DEPRECATED, PI_NOTE, |
5443 | 14 | "Option type is deprecated", EXPFILL } |
5444 | 14 | }, |
5445 | 14 | { &ei_ipv6_opt_mpl_ipv6_src_seed_id, |
5446 | 14 | { "ipv6.opt.mpl.ipv6_src_seed_id", PI_PROTOCOL, PI_COMMENT, |
5447 | 14 | "Seed ID is the IPv6 Source Address", EXPFILL } |
5448 | 14 | }, |
5449 | 14 | { &ei_ipv6_opt_ioam_invalid_nodelen, |
5450 | 14 | { "ipv6.opt.ioam.trace.invalid_nodelen", PI_PROTOCOL, PI_ERROR, |
5451 | 14 | "Invalid \"NodeLen\" value: cannot be 0", EXPFILL } |
5452 | 14 | }, |
5453 | 14 | { &ei_ipv6_opt_ioam_invalid_remlen, |
5454 | 14 | { "ipv6.opt.ioam.trace.invalid_remlen", PI_PROTOCOL, PI_ERROR, |
5455 | 14 | "Invalid \"RemLen\" value", EXPFILL } |
5456 | 14 | }, |
5457 | 14 | { &ei_ipv6_opt_ioam_invalid_trace_type, |
5458 | 14 | { "ipv6.opt.ioam.trace.invalid_type", PI_PROTOCOL, PI_ERROR, |
5459 | 14 | "Mismatch between Trace Type and NodeLen", EXPFILL } |
5460 | 14 | }, |
5461 | 14 | { &ei_ipv6_embed_ipv4_u_value, |
5462 | 14 | { "ipv6.embed_ipv4.u.nonzero", PI_PROTOCOL, PI_WARN, |
5463 | 14 | "IPv4-Embedded IPv6 address bit 64 to 71 must be zero", EXPFILL } |
5464 | 14 | }, |
5465 | 14 | { &ei_ipv6_dst_addr_not_unspecified, |
5466 | 14 | { "ipv6.addr.not_unspecified", PI_PROTOCOL, PI_WARN, |
5467 | 14 | "Unspecified address cannot appear as a destination", EXPFILL } |
5468 | 14 | } |
5469 | 14 | }; |
5470 | | |
5471 | 14 | static ei_register_info ei_ipv6_hopopts[] = { |
5472 | 14 | { &ei_ipv6_hopopts_not_first, |
5473 | 14 | { "ipv6.hopopts.not_first", PI_PROTOCOL, PI_ERROR, |
5474 | 14 | "IPv6 Hop-by-Hop extension header must appear immediately after IPv6 header", EXPFILL } |
5475 | 14 | } |
5476 | 14 | }; |
5477 | | |
5478 | 14 | static ei_register_info ei_ipv6_routing[] = { |
5479 | 14 | { &ei_ipv6_src_addr_not_multicast, |
5480 | 14 | { "ipv6.src_addr.not_multicast", PI_PROTOCOL, PI_WARN, |
5481 | 14 | "Source address must not be a multicast address", EXPFILL } |
5482 | 14 | }, |
5483 | 14 | { &ei_ipv6_dst_addr_not_multicast, |
5484 | 14 | { "ipv6.dst_addr.not_multicast", PI_PROTOCOL, PI_WARN, |
5485 | 14 | "Destination address must not be a multicast address", EXPFILL } |
5486 | 14 | }, |
5487 | 14 | { &ei_ipv6_src_route_list_mult_inst_same_addr, |
5488 | 14 | { "ipv6.src_route_list.mult_inst_same_addr", PI_PROTOCOL, PI_WARN, |
5489 | 14 | "Multiple instances of the same address must not appear in the source route list", EXPFILL } |
5490 | 14 | }, |
5491 | 14 | { &ei_ipv6_src_route_list_src_addr, |
5492 | 14 | { "ipv6.src_route_list.src_addr", PI_PROTOCOL, PI_WARN, |
5493 | 14 | "Source address must not appear in the source route list", EXPFILL } |
5494 | 14 | }, |
5495 | 14 | { &ei_ipv6_src_route_list_dst_addr, |
5496 | 14 | { "ipv6.src_route_list.dst_addr", PI_PROTOCOL, PI_WARN, |
5497 | 14 | "Destination address must not appear in the source route list", EXPFILL } |
5498 | 14 | }, |
5499 | 14 | { &ei_ipv6_src_route_list_multicast_addr, |
5500 | 14 | { "ipv6.src_route_list.multicast_addr", PI_PROTOCOL, PI_WARN, |
5501 | 14 | "Multicast addresses must not appear in the source route list", EXPFILL } |
5502 | 14 | }, |
5503 | 14 | { &ei_ipv6_routing_rpl_cmpri_cmpre_pad, |
5504 | 14 | { "ipv6.routing.rpl.cmprI_cmprE_pad", PI_PROTOCOL, PI_WARN, |
5505 | 14 | "When cmprI equals 0 and cmprE equals 0, pad MUST equal 0 but instead was X", EXPFILL } |
5506 | 14 | }, |
5507 | 14 | { &ei_ipv6_routing_rpl_addr_count_ge0, |
5508 | 14 | { "ipv6.routing.rpl.addr_count_ge0", PI_MALFORMED, PI_ERROR, |
5509 | 14 | "Calculated total address count must be greater than or equal to 0, instead was X", EXPFILL } |
5510 | 14 | }, |
5511 | 14 | { &ei_ipv6_routing_rpl_reserved, |
5512 | 14 | { "ipv6.routing.rpl.reserved_not0", PI_PROTOCOL, PI_NOTE, |
5513 | 14 | "Reserved field must equal 0 but instead was X", EXPFILL } |
5514 | 14 | }, |
5515 | 14 | { &ei_ipv6_routing_invalid_length, |
5516 | 14 | { "ipv6.routing.invalid_length", PI_MALFORMED, PI_ERROR, |
5517 | 14 | "Invalid IPv6 Routing header length", EXPFILL } |
5518 | 14 | }, |
5519 | 14 | { &ei_ipv6_routing_invalid_segleft, |
5520 | 14 | { "ipv6.routing.invalid_segleft", PI_PROTOCOL, PI_WARN, |
5521 | 14 | "IPv6 Routing Header segments left field must not exceed address count", EXPFILL } |
5522 | 14 | }, |
5523 | 14 | { &ei_ipv6_routing_undecoded, |
5524 | 14 | { "ipv6.routing.undecoded", PI_UNDECODED, PI_NOTE, |
5525 | 14 | "Undecoded IPv6 routing header field", EXPFILL } |
5526 | 14 | }, |
5527 | 14 | { &ei_ipv6_routing_deprecated, |
5528 | 14 | { "ipv6.routing.deprecated", PI_DEPRECATED, PI_NOTE, |
5529 | 14 | "Routing header type is deprecated", EXPFILL } |
5530 | 14 | } |
5531 | 14 | }; |
5532 | | |
5533 | | /* Decode As handling */ |
5534 | 14 | static build_valid_func ipv6_da_build_value[1] = {ipv6_value}; |
5535 | 14 | static decode_as_value_t ipv6_da_values = {ipv6_prompt, 1, ipv6_da_build_value}; |
5536 | | |
5537 | 14 | static decode_as_t ipv6_da = {"ipv6", "ip.proto", 1, 0, &ipv6_da_values, NULL, NULL, |
5538 | 14 | decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; |
5539 | | |
5540 | 14 | static decode_as_t ipv6_hopopts_da = {"ipv6.hopopts", "ip.proto", 1, 0, &ipv6_da_values, NULL, NULL, |
5541 | 14 | decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; |
5542 | | |
5543 | 14 | static decode_as_t ipv6_routing_da = {"ipv6.routing", "ip.proto", 1, 0, &ipv6_da_values, NULL, NULL, |
5544 | 14 | decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; |
5545 | | |
5546 | 14 | static decode_as_t ipv6_fraghdr_da = {"ipv6.fraghdr", "ip.proto", 1, 0, &ipv6_da_values, NULL, NULL, |
5547 | 14 | decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; |
5548 | | |
5549 | 14 | static decode_as_t ipv6_dstopts_da = {"ipv6.dstopts", "ip.proto", 1, 0, &ipv6_da_values, NULL, NULL, |
5550 | 14 | decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; |
5551 | | |
5552 | 14 | module_t *ipv6_module; |
5553 | 14 | expert_module_t* expert_ipv6; |
5554 | 14 | expert_module_t* expert_ipv6_hopopts; |
5555 | 14 | expert_module_t* expert_ipv6_routing; |
5556 | | |
5557 | 14 | proto_ipv6 = proto_register_protocol("Internet Protocol Version 6", "IPv6", "ipv6"); |
5558 | 14 | proto_register_field_array(proto_ipv6, hf_ipv6, array_length(hf_ipv6)); |
5559 | 14 | proto_register_subtree_array(ett_ipv6, array_length(ett_ipv6)); |
5560 | 14 | expert_ipv6 = expert_register_protocol(proto_ipv6); |
5561 | 14 | expert_register_field_array(expert_ipv6, ei_ipv6, array_length(ei_ipv6)); |
5562 | | |
5563 | 14 | proto_ipv6_hopopts = proto_register_protocol("IPv6 Hop-by-Hop Option", "IPv6 Hop-by-Hop", "ipv6.hopopts"); |
5564 | 14 | proto_register_field_array(proto_ipv6_hopopts, hf_ipv6_hopopts, array_length(hf_ipv6_hopopts)); |
5565 | 14 | proto_register_subtree_array(ett_ipv6_hopopts, array_length(ett_ipv6_hopopts)); |
5566 | 14 | expert_ipv6_hopopts = expert_register_protocol(proto_ipv6_hopopts); |
5567 | 14 | expert_register_field_array(expert_ipv6_hopopts, ei_ipv6_hopopts, array_length(ei_ipv6_hopopts)); |
5568 | | |
5569 | 14 | proto_ipv6_routing = proto_register_protocol("Routing Header for IPv6", "IPv6 Routing", "ipv6.routing"); |
5570 | 14 | proto_register_field_array(proto_ipv6_routing, hf_ipv6_routing, array_length(hf_ipv6_routing)); |
5571 | 14 | proto_register_subtree_array(ett_ipv6_routing, array_length(ett_ipv6_routing)); |
5572 | 14 | expert_ipv6_routing = expert_register_protocol(proto_ipv6_routing); |
5573 | 14 | expert_register_field_array(expert_ipv6_routing, ei_ipv6_routing, array_length(ei_ipv6_routing)); |
5574 | | |
5575 | 14 | ipv6_routing_dissector_table = register_dissector_table("ipv6.routing.type", "IPv6 Routing Type", |
5576 | 14 | proto_ipv6_routing, FT_UINT8, BASE_DEC); |
5577 | | |
5578 | 14 | proto_ipv6_routing_rt0 = proto_register_protocol_in_name_only("IPv6 Routing Type - Source Route", "Source Route", "ipv6.routing.type.rt0", proto_ipv6, FT_BYTES); |
5579 | 14 | proto_ipv6_routing_mipv6 = proto_register_protocol_in_name_only("IPv6 Routing Type - Type 2", "Type 2", "ipv6.routing.type.mipv6", proto_ipv6, FT_BYTES); |
5580 | 14 | proto_ipv6_routing_rpl = proto_register_protocol_in_name_only("IPv6 Routing Type - RPL Source Route", "RPL Source Route", "ipv6.routing.type.mipv6", proto_ipv6, FT_BYTES); |
5581 | 14 | proto_ipv6_routing_srh = proto_register_protocol_in_name_only("IPv6 Routing Types - Segment Routing", "Segment Routing", "ipv6.routing.type.srh", proto_ipv6, FT_BYTES); |
5582 | 14 | proto_ipv6_routing_crh = proto_register_protocol_in_name_only("IPv6 Routing Types - Compact Routing", "Compact Routing", "ipv6.routing.type.crh", proto_ipv6, FT_BYTES); |
5583 | | |
5584 | 14 | proto_ipv6_fraghdr = proto_register_protocol("Fragment Header for IPv6", "IPv6 Fragment", "ipv6.fraghdr"); |
5585 | 14 | proto_register_field_array(proto_ipv6_fraghdr, hf_ipv6_fraghdr, array_length(hf_ipv6_fraghdr)); |
5586 | 14 | proto_register_subtree_array(ett_ipv6_fraghdr, array_length(ett_ipv6_fraghdr)); |
5587 | | |
5588 | 14 | proto_ipv6_dstopts = proto_register_protocol("Destination Options for IPv6", "IPv6 Destination", "ipv6.dstopts"); |
5589 | 14 | proto_register_field_array(proto_ipv6_dstopts, hf_ipv6_dstopts, array_length(hf_ipv6_dstopts)); |
5590 | 14 | proto_register_subtree_array(ett_ipv6_dstopts, array_length(ett_ipv6_dstopts)); |
5591 | | |
5592 | | /* Register configuration options */ |
5593 | 14 | ipv6_module = prefs_register_protocol(proto_ipv6, NULL); |
5594 | 14 | prefs_register_bool_preference(ipv6_module, "defragment", |
5595 | 14 | "Reassemble fragmented IPv6 datagrams", |
5596 | 14 | "Whether fragmented IPv6 datagrams should be reassembled", |
5597 | 14 | &ipv6_reassemble); |
5598 | 14 | prefs_register_bool_preference(ipv6_module, "summary_in_tree", |
5599 | 14 | "Show IPv6 summary in protocol tree", |
5600 | 14 | "Whether the IPv6 summary line should be shown in the protocol tree", |
5601 | 14 | &ipv6_summary_in_tree); |
5602 | 14 | prefs_register_bool_preference(ipv6_module, "address_detail" , |
5603 | 14 | "Show details about IPv6 addresses", |
5604 | 14 | "Whether to show extended information about IPv6 addresses", |
5605 | 14 | &ipv6_address_detail); |
5606 | | |
5607 | 14 | prefs_register_obsolete_preference(ipv6_module, "use_geoip"); |
5608 | | |
5609 | | /* RPL Strict Header Checking */ |
5610 | 14 | prefs_register_bool_preference(ipv6_module, "perform_strict_rpl_srh_rfc_checking", |
5611 | 14 | "Perform strict checking for RPL Source Routing Headers (RFC 6554)", |
5612 | 14 | "Check that all RPL Source Routed packets conform to RFC 6554 and do not visit a node more than once", |
5613 | 14 | &g_ipv6_rpl_srh_strict_rfc_checking); |
5614 | | |
5615 | 14 | prefs_register_bool_preference(ipv6_module, "try_heuristic_first", |
5616 | 14 | "Try heuristic sub-dissectors first", |
5617 | 14 | "Try to decode a packet using an heuristic sub-dissector before using a sub-dissector registered to a specific port", |
5618 | 14 | &try_heuristic_first); |
5619 | | |
5620 | 14 | prefs_register_bool_preference(ipv6_module, "exthdr_under_root_protocol_tree", |
5621 | 14 | "Display IPv6 extension headers under the root protocol tree", |
5622 | 14 | "Whether to display IPv6 extension headers as a separate protocol or a sub-protocol of the IPv6 packet", |
5623 | 14 | &ipv6_exthdr_under_root); |
5624 | | |
5625 | 14 | prefs_register_bool_preference(ipv6_module, "exthdr_hide_len_oct_field", |
5626 | 14 | "Use a single field for IPv6 extension header length", |
5627 | 14 | "If enabled the Length field in octets will be hidden", |
5628 | 14 | &ipv6_exthdr_hide_len_oct_field); |
5629 | | |
5630 | 14 | prefs_register_bool_preference(ipv6_module, "tso_support", |
5631 | 14 | "Support packet-capture from IPv6 TSO-enabled hardware", |
5632 | 14 | "Whether to correct for TSO-enabled (TCP segmentation offload) hardware " |
5633 | 14 | "captures, such as spoofing the IPv6 packet length", &ipv6_tso_supported); |
5634 | | |
5635 | 14 | prefs_register_static_text_preference(ipv6_module, "text_use_geoip" , |
5636 | 14 | "IP geolocation settings can be changed in the Name Resolution preferences", |
5637 | 14 | "IP geolocation settings can be changed in the Name Resolution preferences"); |
5638 | | |
5639 | 14 | prefs_register_bool_preference(ipv6_module, "conv_id", |
5640 | 14 | "Assign IPv6 conversation IDs", |
5641 | 14 | "Whether to assign unique numbers to each IPv6 conversation (increases resource consumption)", |
5642 | 14 | &ipv6_track_conv_id); |
5643 | | |
5644 | 14 | static uat_field_t nat64_uats_flds[] = { |
5645 | 14 | UAT_FLD_CSTRING_OTHER(nat64_prefix_uats, ipaddr, "NAT64 Prefix", nat64_prefix_uat_fld_ip_chk_cb, "IPv6 prefix address"), |
5646 | 14 | UAT_FLD_VS(nat64_prefix_uats, prefix_len, "Prefix length", nat64_prefix_length_vals, "IPv6 prefix address length"), |
5647 | 14 | UAT_FLD_VS(nat64_prefix_uats, prefix_wildcard_len, "Prefix wildcard length", nat64_prefix_wildcard_length_vals, "IPv6 prefix address wildcard length"), |
5648 | 14 | UAT_END_FIELDS |
5649 | 14 | }; |
5650 | | |
5651 | 14 | nat64_prefix_uat = uat_new("NAT64 Network-Specific Prefixes", |
5652 | 14 | sizeof(struct nat64_prefix_data), |
5653 | 14 | "NAT64_NSP_list", /* filename */ |
5654 | 14 | true, /* from_profile */ |
5655 | 14 | &nat64_prefix_uats, /* data_ptr */ |
5656 | 14 | &number_of_nat64_prefix, /* numitems_ptr */ |
5657 | 14 | UAT_AFFECTS_DISSECTION, |
5658 | 14 | NULL, |
5659 | 14 | nat64_prefix_copy_cb, |
5660 | 14 | NULL, |
5661 | 14 | nat64_prefix_free_cb, |
5662 | 14 | NULL, |
5663 | 14 | NULL, |
5664 | 14 | nat64_uats_flds); |
5665 | | |
5666 | 14 | prefs_register_uat_preference(ipv6_module, "nat64_prefixes", |
5667 | 14 | "NAT64 Prefixes", |
5668 | 14 | "A list of IPv6 prefixes used for NAT64s", |
5669 | 14 | nat64_prefix_uat); |
5670 | | |
5671 | 14 | register_init_routine(ipv6_init); |
5672 | | |
5673 | 14 | ipv6_handle = register_dissector("ipv6", dissect_ipv6, proto_ipv6); |
5674 | 14 | reassembly_table_register(&ipv6_reassembly_table, |
5675 | 14 | &addresses_reassembly_table_functions); |
5676 | 14 | ipv6_tap = register_tap("ipv6"); |
5677 | | |
5678 | 14 | register_decode_as(&ipv6_da); |
5679 | 14 | register_decode_as(&ipv6_hopopts_da); |
5680 | 14 | register_decode_as(&ipv6_routing_da); |
5681 | 14 | register_decode_as(&ipv6_fraghdr_da); |
5682 | 14 | register_decode_as(&ipv6_dstopts_da); |
5683 | | |
5684 | 14 | register_conversation_table(proto_ipv6, true, ipv6_conversation_packet, ipv6_endpoint_packet); |
5685 | 14 | register_conversation_filter("ipv6", "IPv6", ipv6_filter_valid, ipv6_build_filter, NULL); |
5686 | | |
5687 | 14 | register_capture_dissector("ipv6", capture_ipv6, proto_ipv6); |
5688 | 14 | } |
5689 | | |
5690 | | void |
5691 | | proto_reg_handoff_ipv6(void) |
5692 | 14 | { |
5693 | 14 | dissector_handle_t ipv6_hopopts_handle; |
5694 | 14 | dissector_handle_t ipv6_routing_handle; |
5695 | 14 | dissector_handle_t ipv6_fraghdr_handle; |
5696 | 14 | dissector_handle_t ipv6_dstopts_handle; |
5697 | 14 | capture_dissector_handle_t ipv6_cap_handle; |
5698 | 14 | capture_dissector_handle_t ipv6_ext_cap_handle; |
5699 | 14 | dissector_handle_t h; |
5700 | | |
5701 | 14 | dissector_add_uint("ethertype", ETHERTYPE_IPv6, ipv6_handle); |
5702 | 14 | dissector_add_uint("erf.types.type", ERF_TYPE_IPV6, ipv6_handle); |
5703 | 14 | dissector_add_uint("ppp.protocol", PPP_IPV6, ipv6_handle); |
5704 | 14 | dissector_add_uint("ppp.protocol", ETHERTYPE_IPv6, ipv6_handle); |
5705 | 14 | dissector_add_uint("gre.proto", ETHERTYPE_IPv6, ipv6_handle); |
5706 | 14 | dissector_add_uint("ip.proto", IP_PROTO_IPV6, ipv6_handle); |
5707 | 14 | dissector_add_uint("null.type", BSD_AF_INET6_BSD, ipv6_handle); |
5708 | 14 | dissector_add_uint("null.type", BSD_AF_INET6_FREEBSD, ipv6_handle); |
5709 | 14 | dissector_add_uint("null.type", BSD_AF_INET6_DARWIN, ipv6_handle); |
5710 | 14 | dissector_add_uint("chdlc.protocol", ETHERTYPE_IPv6, ipv6_handle); |
5711 | 14 | dissector_add_uint("fr.nlpid", NLPID_IP6, ipv6_handle); |
5712 | 14 | dissector_add_uint("osinl.excl", NLPID_IP6, ipv6_handle); |
5713 | 14 | dissector_add_uint("x.25.spi", NLPID_IP6, ipv6_handle); |
5714 | 14 | dissector_add_uint("arcnet.protocol_id", ARCNET_PROTO_IPv6, ipv6_handle); |
5715 | 14 | dissector_add_uint("juniper.proto", JUNIPER_PROTO_IP6, ipv6_handle); |
5716 | 14 | dissector_add_uint("juniper.proto", JUNIPER_PROTO_MPLS_IP6, ipv6_handle); |
5717 | 14 | dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_IPV6, ipv6_handle); |
5718 | 14 | dissector_add_uint("mcc.proto", PW_ACH_TYPE_IPV6, ipv6_handle); |
5719 | 14 | dissector_add_uint("sflow_245.header_protocol", SFLOW_245_HEADER_IPv6, ipv6_handle); |
5720 | 14 | dissector_add_uint("enc", BSD_AF_INET6_BSD, ipv6_handle); |
5721 | 14 | dissector_add_uint("vxlan.next_proto", VXLAN_IPV6, ipv6_handle); |
5722 | 14 | dissector_add_uint("nsh.next_proto", NSH_IPV6, ipv6_handle); |
5723 | | |
5724 | 14 | dissector_add_for_decode_as_with_preference("udp.port", ipv6_handle); |
5725 | | |
5726 | 14 | ipv6_hopopts_handle = create_dissector_handle(dissect_hopopts, proto_ipv6_hopopts); |
5727 | 14 | dissector_add_uint("ip.proto", IP_PROTO_HOPOPTS, ipv6_hopopts_handle); |
5728 | | |
5729 | 14 | ipv6_routing_handle = create_dissector_handle(dissect_routing6, proto_ipv6_routing); |
5730 | 14 | dissector_add_uint("ip.proto", IP_PROTO_ROUTING, ipv6_routing_handle); |
5731 | | |
5732 | 14 | ipv6_fraghdr_handle = create_dissector_handle(dissect_fraghdr, proto_ipv6_fraghdr); |
5733 | 14 | dissector_add_uint("ip.proto", IP_PROTO_FRAGMENT, ipv6_fraghdr_handle); |
5734 | | |
5735 | 14 | ipv6_dstopts_handle = create_dissector_handle(dissect_dstopts, proto_ipv6_dstopts); |
5736 | 14 | dissector_add_uint("ip.proto", IP_PROTO_DSTOPTS, ipv6_dstopts_handle); |
5737 | | |
5738 | 14 | ip_dissector_table = find_dissector_table("ip.proto"); |
5739 | | |
5740 | 14 | ipv6_cap_handle = find_capture_dissector("ipv6"); |
5741 | 14 | capture_dissector_add_uint("ethertype", ETHERTYPE_IPv6, ipv6_cap_handle); |
5742 | 14 | capture_dissector_add_uint("enc", BSD_AF_INET6_BSD, ipv6_cap_handle); |
5743 | 14 | capture_dissector_add_uint("null.bsd", BSD_AF_INET6_BSD, ipv6_cap_handle); |
5744 | 14 | capture_dissector_add_uint("null.bsd", BSD_AF_INET6_FREEBSD, ipv6_cap_handle); |
5745 | 14 | capture_dissector_add_uint("null.bsd", BSD_AF_INET6_DARWIN, ipv6_cap_handle); |
5746 | 14 | capture_dissector_add_uint("fr.nlpid", NLPID_IP6, ipv6_cap_handle); |
5747 | | |
5748 | 14 | ipv6_ext_cap_handle = create_capture_dissector_handle(capture_ipv6_exthdr, proto_ipv6_hopopts); |
5749 | 14 | capture_dissector_add_uint("ip.proto", IP_PROTO_HOPOPTS, ipv6_ext_cap_handle); |
5750 | 14 | ipv6_ext_cap_handle = create_capture_dissector_handle(capture_ipv6_exthdr, proto_ipv6_routing); |
5751 | 14 | capture_dissector_add_uint("ip.proto", IP_PROTO_ROUTING, ipv6_ext_cap_handle); |
5752 | 14 | ipv6_ext_cap_handle = create_capture_dissector_handle(capture_ipv6_exthdr, proto_ipv6_fraghdr); |
5753 | 14 | capture_dissector_add_uint("ip.proto", IP_PROTO_FRAGMENT, ipv6_ext_cap_handle); |
5754 | 14 | ipv6_ext_cap_handle = create_capture_dissector_handle(capture_ipv6_exthdr, proto_ipv6_dstopts); |
5755 | 14 | capture_dissector_add_uint("ip.proto", IP_PROTO_DSTOPTS, ipv6_ext_cap_handle); |
5756 | | |
5757 | 14 | h = create_dissector_handle(dissect_routing6_rt0, proto_ipv6_routing_rt0); |
5758 | 14 | dissector_add_uint("ipv6.routing.type", IPv6_RT_HEADER_SOURCE_ROUTING, h); |
5759 | 14 | h = create_dissector_handle(dissect_routing6_mipv6, proto_ipv6_routing_mipv6); |
5760 | 14 | dissector_add_uint("ipv6.routing.type", IPv6_RT_HEADER_MOBILE_IP, h); |
5761 | 14 | h = create_dissector_handle(dissect_routing6_rpl, proto_ipv6_routing_rpl); |
5762 | 14 | dissector_add_uint("ipv6.routing.type", IPv6_RT_HEADER_RPL, h); |
5763 | 14 | h = create_dissector_handle(dissect_routing6_srh, proto_ipv6_routing_srh); |
5764 | 14 | dissector_add_uint("ipv6.routing.type", IPv6_RT_HEADER_SEGMENT_ROUTING, h); |
5765 | 14 | h = create_dissector_handle(dissect_routing6_crh, proto_ipv6_routing_crh); |
5766 | 14 | dissector_add_uint("ipv6.routing.type", IPv6_RT_HEADER_COMPACT_16, h); |
5767 | 14 | dissector_add_uint("ipv6.routing.type", IPv6_RT_HEADER_COMPACT_32, h); |
5768 | | |
5769 | 14 | ilnp_handle = find_dissector_add_dependency("ilnp", proto_ipv6_dstopts); |
5770 | | |
5771 | 14 | exported_pdu_tap = find_tap_id("IP"); |
5772 | 14 | } |
5773 | | |
5774 | | /* |
5775 | | * Editor modelines |
5776 | | * |
5777 | | * Local Variables: |
5778 | | * c-basic-offset: 4 |
5779 | | * tab-width: 8 |
5780 | | * indent-tabs-mode: nil |
5781 | | * End: |
5782 | | * |
5783 | | * ex: set shiftwidth=4 tabstop=8 expandtab: |
5784 | | * :indentSize=4:tabSize=8:noTabs=true: |
5785 | | */ |