/src/wireshark/epan/dissectors/packet-tipc.c
Line | Count | Source |
1 | | /* packet-tipc.c |
2 | | * Routines for Transparent Inter Process Communication packet dissection |
3 | | * |
4 | | * Copyright 2005-2006, Anders Broman <anders.broman@ericsson.com> |
5 | | * |
6 | | * TIPCv2 protocol updates |
7 | | * Copyright 2006-2008, Martin Peylo <wireshark@izac.de> |
8 | | * |
9 | | * Wireshark - Network traffic analyzer |
10 | | * By Gerald Combs <gerald@wireshark.org> |
11 | | * Copyright 1998 Gerald Combs |
12 | | * |
13 | | * SPDX-License-Identifier: GPL-2.0-or-later |
14 | | * Protocol ref: |
15 | | * https://tipc.sourceforge.net/ |
16 | | * https://tipc.sourceforge.net/protocol.html |
17 | | */ |
18 | | |
19 | | |
20 | | #include "config.h" |
21 | | |
22 | | #include <epan/packet.h> |
23 | | #include <epan/prefs.h> |
24 | | #include <epan/proto_data.h> |
25 | | #include <epan/expert.h> |
26 | | #include <epan/etypes.h> |
27 | | #include <epan/address_types.h> |
28 | | #include <epan/exceptions.h> |
29 | | #include <epan/reassemble.h> |
30 | | |
31 | | #include <wsutil/ws_roundup.h> |
32 | | #include <wsutil/ws_padding_to.h> |
33 | | |
34 | | #include "packet-tcp.h" |
35 | | |
36 | | void proto_register_tipc(void); |
37 | | |
38 | | static int proto_tipc; |
39 | | |
40 | | static int hf_tipc_msg_fragments; |
41 | | static int hf_tipc_msg_fragment; |
42 | | static int hf_tipc_msg_fragment_overlap; |
43 | | static int hf_tipc_msg_fragment_overlap_conflicts; |
44 | | static int hf_tipc_msg_fragment_multiple_tails; |
45 | | static int hf_tipc_msg_fragment_too_long_fragment; |
46 | | static int hf_tipc_msg_fragment_error; |
47 | | static int hf_tipc_msg_fragment_count; |
48 | | static int hf_tipc_msg_reassembled_in; |
49 | | static int hf_tipc_msg_reassembled_length; |
50 | | |
51 | | static int hf_tipc_ver; |
52 | | static int hf_tipc_usr; |
53 | | static int hf_tipcv2_usr; |
54 | | static int hf_tipc_hdr_size; |
55 | | static int hf_tipc_nonsequenced; |
56 | | static int hf_tipc_destdrop; |
57 | | static int hf_tipc_unused; |
58 | | static int hf_tipc_msg_size; |
59 | | static int hf_tipc_ack_link_lev_seq; |
60 | | static int hf_tipc_link_lev_seq; |
61 | | static int hf_tipc_prev_proc; |
62 | | static int hf_tipc_org_port; |
63 | | static int hf_tipc_dst_port; |
64 | | static int hf_tipc_data_msg_type; |
65 | | static int hf_tipc_err_code; |
66 | | static int hf_tipc_reroute_cnt; |
67 | | static int hf_tipc_act_id; |
68 | | static int hf_tipc_org_proc; |
69 | | static int hf_tipc_dst_proc; |
70 | | static int hf_tipc_unused2; |
71 | | static int hf_tipc_importance; |
72 | | static int hf_tipc_link_selector; |
73 | | static int hf_tipc_msg_cnt; |
74 | | static int hf_tipc_probe; |
75 | | static int hf_tipc_bearer_id; |
76 | | static int hf_tipc_link_selector2; |
77 | | static int hf_tipc_remote_addr; |
78 | | static int hf_tipc_rm_msg_type; |
79 | | static int hf_tipc_nd_msg_type; |
80 | | static int hf_tipc_cm_msg_type; |
81 | | static int hf_tipc_lp_msg_type; |
82 | | static int hf_tipc_cng_prot_msg_type; |
83 | | static int hf_tipc_sm_msg_type; |
84 | | static int hf_tipc_unknown_msg_type; |
85 | | static int hf_tipc_seq_gap; |
86 | | static int hf_tipc_nxt_snt_pkg; |
87 | | static int hf_tipc_unused_word; |
88 | | static int hf_tipc_bearer_name; |
89 | | static int hf_tipc_data; |
90 | | static int hf_tipc_msg_no_bundle; |
91 | | static int hf_tipc_changeover_protocol; |
92 | | static int hf_tipc_named_msg_hdr; |
93 | | static int hf_tipc_port_name_type; |
94 | | static int hf_tipc_port_name_instance; |
95 | | static int hf_tipc_data_fragment; |
96 | | static int hf_tipc_message_bundle; |
97 | | |
98 | | |
99 | | static int hf_tipc_name_dist_type; |
100 | | static int hf_tipc_name_dist_lower; |
101 | | static int hf_tipc_name_dist_upper; |
102 | | static int hf_tipc_name_dist_port; |
103 | | static int hf_tipc_name_dist_key; |
104 | | |
105 | | static int hf_tipcv2_srcdrop; |
106 | | static int hf_tipcv2_data_msg_type; |
107 | | static int hf_tipcv2_bcast_mtype; |
108 | | static int hf_tipcv2_bundler_mtype; |
109 | | static int hf_tipcv2_link_mtype; |
110 | | static int hf_tipcv2_connmgr_mtype; |
111 | | static int hf_tipcv2_route_mtype_1_6; |
112 | | static int hf_tipcv2_route_mtype_1_7; |
113 | | static int hf_tipcv2_changeover_mtype; |
114 | | static int hf_tipcv2_naming_mtype; |
115 | | static int hf_tipcv2_fragmenter_mtype; |
116 | | static int hf_tipcv2_neighbour_mtype; |
117 | | static int hf_tipcv2_errorcode; |
118 | | static int hf_tipcv2_rer_cnt; |
119 | | static int hf_tipcv2_lookup_scope; |
120 | | static int hf_tipcv2_opt_p; |
121 | | static int hf_tipcv2_broadcast_ack_no; |
122 | | static int hf_tipcv2_link_level_ack_no; |
123 | | static int hf_tipcv2_link_level_seq_no; |
124 | | /* static int hf_tipcv2_bcast_seq_no; */ |
125 | | static int hf_tipcv2_prev_node; |
126 | | static int hf_tipcv2_orig_node; |
127 | | static int hf_tipcv2_dest_node; |
128 | | static int hf_tipcv2_port_name_type; |
129 | | static int hf_tipcv2_port_name_instance; |
130 | | static int hf_tipcv2_multicast_lower; |
131 | | static int hf_tipcv2_multicast_upper; |
132 | | |
133 | | static int hf_tipcv2_sequence_gap; |
134 | | static int hf_tipcv2_next_sent_broadcast; |
135 | | static int hf_tipcv2_fragment_number; |
136 | | static int hf_tipcv2_fragment_msg_number; |
137 | | static int hf_tipcv2_next_sent_packet; |
138 | | static int hf_tipcv2_session_no; |
139 | | static int hf_tipcv2_link_prio; |
140 | | static int hf_tipcv2_network_plane; |
141 | | static int hf_tipcv2_probe; |
142 | | static int hf_tipcv2_link_tolerance; |
143 | | static int hf_tipcv2_bearer_instance; |
144 | | static int hf_tipcv2_padding; |
145 | | static int hf_tipcv2_bearer_level_orig_addr; |
146 | | static int hf_tipcv2_cluster_address; |
147 | | static int hf_tipcv2_bitmap; |
148 | | static int hf_tipcv2_node_address; |
149 | | static int hf_tipcv2_destination_domain; |
150 | | static int hf_tipcv2_network_id; |
151 | | |
152 | | static int hf_tipcv2_bcast_tag; |
153 | | static int hf_tipcv2_msg_count; |
154 | | static int hf_tipcv2_max_packet; |
155 | | static int hf_tipcv2_transport_seq_no; |
156 | | static int hf_tipcv2_redundant_link; |
157 | | static int hf_tipcv2_bearer_id; |
158 | | static int hf_tipcv2_conn_mgr_msg_ack; |
159 | | static int hf_tipcv2_minor_pv; |
160 | | static int hf_tipcv2_node_sig; |
161 | | static int hf_tipcv2_filler_mtu_discovery; |
162 | | static int hf_tipcv2_vendor_specific_data; |
163 | | static int hf_tipcv2_options; |
164 | | |
165 | | /* added for TIPC v1.7 */ |
166 | | static int hf_tipcv2_timestamp; |
167 | | static int hf_tipcv2_item_size; |
168 | | static int hf_tipcv2_network_region; |
169 | | static int hf_tipcv2_local_router; |
170 | | static int hf_tipcv2_remote_router; |
171 | | static int hf_tipcv2_dist_dist; |
172 | | static int hf_tipcv2_dist_scope; |
173 | | static int hf_tipcv2_name_dist_port_id_node; |
174 | | static int hf_tipcv2_media_id; |
175 | | |
176 | | /* added in minor PV 1 */ |
177 | | static int hf_tipcv2_syn; |
178 | | |
179 | | |
180 | | static int ett_tipc_msg_fragment; |
181 | | static int ett_tipc_msg_fragments; |
182 | | |
183 | | |
184 | | /* Initialize the subtree pointer */ |
185 | | static int ett_tipc; |
186 | | static int ett_tipc_data; |
187 | | |
188 | | static expert_field ei_tipc_field_not_specified; |
189 | | static expert_field ei_tipc_invalid_msg_size; |
190 | | static expert_field ei_tipc_invalid_bundle_size; |
191 | | static expert_field ei_tipc_max_recursion_depth_reached; |
192 | | |
193 | | static int tipc_address_type = -1; |
194 | | |
195 | | /* protocol preferences */ |
196 | | static bool tipc_defragment = true; |
197 | | static bool dissect_tipc_data = true; |
198 | | static bool try_heuristic_first; |
199 | 103 | #define V2_AS_ALL 0x1 |
200 | 277 | #define V2_AS_1_6 0x2 |
201 | 17 | #define V2_AS_1_7 0x4 |
202 | | static int handle_v2_as = V2_AS_ALL; |
203 | | static bool tipc_tcp_desegment = true; |
204 | | |
205 | | static dissector_handle_t tipc_handle; |
206 | | static dissector_handle_t tipc_tcp_handle; |
207 | | |
208 | | /* IANA have assigned port 6118 port for TIPC UDP transport. */ |
209 | 15 | #define DEFAULT_TIPC_PORT_RANGE "6118" |
210 | | |
211 | | /* this is used to find encapsulated protocols */ |
212 | | static dissector_table_t tipc_user_dissector; |
213 | | static dissector_table_t tipc_type_dissector; |
214 | | |
215 | | static heur_dissector_list_t tipc_heur_subdissector_list; |
216 | | |
217 | | static proto_tree *top_tree; |
218 | | |
219 | | static const fragment_items tipc_msg_frag_items = { |
220 | | /* Fragment subtrees */ |
221 | | &ett_tipc_msg_fragment, |
222 | | &ett_tipc_msg_fragments, |
223 | | /* Fragment fields */ |
224 | | &hf_tipc_msg_fragments, |
225 | | &hf_tipc_msg_fragment, |
226 | | &hf_tipc_msg_fragment_overlap, |
227 | | &hf_tipc_msg_fragment_overlap_conflicts, |
228 | | &hf_tipc_msg_fragment_multiple_tails, |
229 | | &hf_tipc_msg_fragment_too_long_fragment, |
230 | | &hf_tipc_msg_fragment_error, |
231 | | &hf_tipc_msg_fragment_count, |
232 | | /* Reassembled in field */ |
233 | | &hf_tipc_msg_reassembled_in, |
234 | | /* Reassembled length field */ |
235 | | &hf_tipc_msg_reassembled_length, |
236 | | /* Reassembled data field */ |
237 | | NULL, |
238 | | /* Tag */ |
239 | | "TIPC Message fragments" |
240 | | }; |
241 | | |
242 | | |
243 | 1.29k | #define MAX_TIPC_ADDRESS_STR_LEN 15 |
244 | 85 | #define TIPCv1 1 |
245 | 434 | #define TIPCv2 2 |
246 | | /* Users */ |
247 | 27 | #define TIPC_DATA_PRIO_0 0 |
248 | 31 | #define TIPC_DATA_PRIO_1 1 |
249 | 35 | #define TIPC_DATA_PRIO_2 2 |
250 | 37 | #define TIPC_DATA_NON_REJECTABLE 3 |
251 | | |
252 | 106 | #define TIPC_ROUTING_MANAGER 8 |
253 | 459 | #define TIPC_NAME_DISTRIBUTOR 9 |
254 | 3 | #define TIPC_CONNECTION_MANAGER 10 |
255 | 496 | #define TIPC_LINK_PROTOCOL 11 |
256 | 406 | #define TIPC_CHANGEOVER_PROTOCOL 13 |
257 | 528 | #define TIPC_SEGMENTATION_MANAGER 14 |
258 | 341 | #define TIPC_MSG_BUNDLER 15 |
259 | | |
260 | 6 | #define TIPC_LINK_PROTOCO_STATE_MSG 0 |
261 | | |
262 | | static const value_string tipc_user_values[] = { |
263 | | { TIPC_DATA_PRIO_0, "DATA_PRIO_0"}, |
264 | | { TIPC_DATA_PRIO_1, "DATA_PRIO_1"}, |
265 | | { TIPC_DATA_PRIO_2, "DATA_PRIO_2"}, |
266 | | { TIPC_DATA_NON_REJECTABLE, "DATA_NON_REJECTABLE"}, |
267 | | { TIPC_ROUTING_MANAGER, "ROUTING_MANAGER"}, |
268 | | { TIPC_NAME_DISTRIBUTOR, "NAME_DISTRIBUTOR"}, |
269 | | { TIPC_CONNECTION_MANAGER, "CONNECTION_MANAGER"}, |
270 | | { TIPC_LINK_PROTOCOL, "LINK_PROTOCOL"}, |
271 | | { TIPC_CHANGEOVER_PROTOCOL, "CHANGEOVER_PROTOCOL"}, |
272 | | { TIPC_SEGMENTATION_MANAGER, "SEGMENTATION_MANAGER"}, |
273 | | { TIPC_MSG_BUNDLER, "MSG_BUNDLER"}, |
274 | | { 0, NULL} |
275 | | }; |
276 | | |
277 | 4 | #define TIPCv2_DATA_LOW 0 |
278 | 16 | #define TIPCv2_DATA_NORMAL 1 |
279 | 22 | #define TIPCv2_DATA_HIGH 2 |
280 | 28 | #define TIPCv2_DATA_NON_REJECTABLE 3 |
281 | | |
282 | 5 | #define TIPCv2_BCAST_PROTOCOL 5 |
283 | 133 | #define TIPCv2_MSG_BUNDLER 6 |
284 | 321 | #define TIPCv2_LINK_PROTOCOL 7 |
285 | 8 | #define TIPCv2_CONN_MANAGER 8 |
286 | 13 | #define TIPCv2_ROUTE_DISTRIBUTOR 9 |
287 | 11 | #define TIPCv2_CHANGEOVER_PROTOCOL 10 |
288 | 32 | #define TIPCv2_NAME_DISTRIBUTOR 11 |
289 | 3 | #define TIPCv2_MSG_FRAGMENTER 12 |
290 | 121 | #define TIPCv2_NEIGHBOUR_DISCOVERY 13 |
291 | | |
292 | | #define TIPCv2_USER_FIRST_FRAGMENT 0 |
293 | | #define TIPCv2_USER_FRAGMENT 1 |
294 | 1 | #define TIPCv2_USER_LAST_FRAGMENT 2 |
295 | | |
296 | | static const value_string tipcv2_user_values[] = { |
297 | | { TIPCv2_DATA_LOW, "Low Priority Payload Data"}, |
298 | | { TIPCv2_DATA_NORMAL, "Normal Priority Payload Data"}, |
299 | | { TIPCv2_DATA_HIGH, "High Priority Payload Data"}, |
300 | | { TIPCv2_DATA_NON_REJECTABLE, "Non-Rejectable Payload Data"}, |
301 | | { TIPCv2_BCAST_PROTOCOL, "Broadcast Maintenance Protocol"}, |
302 | | { TIPCv2_MSG_BUNDLER, "Message Bundler Protocol"}, |
303 | | { TIPCv2_LINK_PROTOCOL, "Link State Maintenance Protocol"}, |
304 | | { TIPCv2_CONN_MANAGER, "Connection Manager"}, |
305 | | { TIPCv2_ROUTE_DISTRIBUTOR, "Routing Table Update Protocol"}, |
306 | | { TIPCv2_CHANGEOVER_PROTOCOL, "Link Changeover Protocol"}, |
307 | | { TIPCv2_NAME_DISTRIBUTOR, "Name Table Update Protocol"}, |
308 | | { TIPCv2_MSG_FRAGMENTER, "Message Fragmentation Protocol"}, |
309 | | { TIPCv2_NEIGHBOUR_DISCOVERY, "Neighbour Discovery Protocol"}, |
310 | | { 0, NULL} |
311 | | }; |
312 | | |
313 | | static const value_string tipcv2_user_short_str_vals[] = { |
314 | | { TIPCv2_DATA_LOW, "Payld:Low"}, |
315 | | { TIPCv2_DATA_NORMAL, "Payld:Normal"}, |
316 | | { TIPCv2_DATA_HIGH, "Payld:High"}, |
317 | | { TIPCv2_DATA_NON_REJECTABLE, "Payld:NoRej"}, |
318 | | { TIPCv2_BCAST_PROTOCOL, "Broadcast"}, |
319 | | { TIPCv2_MSG_BUNDLER, "Bundler"}, |
320 | | { TIPCv2_LINK_PROTOCOL, "Link State"}, |
321 | | { TIPCv2_CONN_MANAGER, "Conn Mgr"}, |
322 | | { TIPCv2_ROUTE_DISTRIBUTOR, "Route Dist"}, |
323 | | { TIPCv2_CHANGEOVER_PROTOCOL, "Changeover"}, |
324 | | { TIPCv2_NAME_DISTRIBUTOR, "Name Dist"}, |
325 | | { TIPCv2_MSG_FRAGMENTER, "Fragmenter"}, |
326 | | { TIPCv2_NEIGHBOUR_DISCOVERY, "Ngbr Disc"}, |
327 | | { 0, NULL} |
328 | | }; |
329 | | |
330 | 6 | #define TIPC_CONNECTED_MSG 0 |
331 | 2 | #define TIPC_NAMED_MSG 2 |
332 | 1 | #define TIPC_DIRECT_MSG 3 |
333 | | #define TIPC_OVERLOAD_W_MSG 4 |
334 | | |
335 | | static const value_string tipc_data_msg_type_values[] = { |
336 | | { 0, "CONN_MSG"}, |
337 | | { 2, "NAMED_MSG"}, |
338 | | { 3, "DIRECT_MSG"}, |
339 | | { 4, "OVERLOAD_W_MSG"}, |
340 | | { 0, NULL} |
341 | | }; |
342 | | |
343 | | static const value_string tipcv2_data_msg_type_defines[] = { |
344 | | { 0, "ConnMsg"}, |
345 | | { 1, "McastMsg"}, |
346 | | { 2, "NamedMsg"}, |
347 | | { 3, "DirectMsg"}, |
348 | | { 0, NULL} |
349 | | }; |
350 | | |
351 | | static const value_string tipcv2_data_msg_type_values[] _U_ = { |
352 | | { 0, "Sent on connection (CONN_MSG)"}, |
353 | | { 1, "Logical multicast (MCAST_MSG)"}, |
354 | | { 2, "Port name destination address (NAMED_MSG)"}, |
355 | | { 3, "Port identity destination address (DIRECT_MSG)"}, |
356 | | { 0, NULL} |
357 | | }; |
358 | | |
359 | | static const value_string tipc_error_code_values[] = { |
360 | | { 0, "MSG_OK"}, |
361 | | { 1, "NO_PORT_NAME"}, |
362 | | { 2, "NO_REMOTE_PORT"}, |
363 | | { 3, "NO_REMOTE_PROCESSOR"}, |
364 | | { 4, "DEST_OVERLOADED"}, |
365 | | { 5, "CONN_SHUTDOWN"}, |
366 | | { 6, "NO_CONNECTION"}, |
367 | | { 7, "COMMUNICATION_ERROR"}, |
368 | | { 0, NULL} |
369 | | }; |
370 | | |
371 | | static const value_string tipcv2_error_code_strings[] = { |
372 | | { 0, "No error (TIPC_OK)"}, |
373 | | { 1, "Destination port name unknown (TIPC_ERR_NO_NAME)"}, |
374 | | { 2, "Destination port does not exist (TIPC_ERR_NO_PORT)"}, |
375 | | { 3, "Destination node unavailable (TIPC_ERR_NO_NODE)"}, |
376 | | { 4, "Destination node overloaded (TIPC_ERR_OVERLOAD)"}, |
377 | | { 5, "Connection Shutdown (No error) (TIPC_CONN_SHUTDOWN)"}, |
378 | | { 6, "Communication Error (TIPC_CONN_ERROR)"}, |
379 | | { 0, NULL} |
380 | | }; |
381 | | |
382 | | static const value_string tipcv2_error_code_short_strings[] = { |
383 | | { 0, "OK"}, |
384 | | { 1, "ErrNoName"}, |
385 | | { 2, "ErrNoPort"}, |
386 | | { 3, "ErrNoNode"}, |
387 | | { 4, "ErrOverload"}, |
388 | | { 5, "ConnShutdown"}, |
389 | | { 6, "ConnError"}, |
390 | | { 0, NULL} |
391 | | }; |
392 | | |
393 | | static const value_string tipcv2_lookup_or_dist_scope_strings[] = { |
394 | | { 0, "Zone Scope"}, |
395 | | { 1, "Cluster Scope"}, |
396 | | { 2, "Node Scope"}, |
397 | | { 0, NULL} |
398 | | }; |
399 | | |
400 | | static const value_string tipc_routing_mgr_msg_type_values[] = { |
401 | | { 0, "EXT_ROUTING_TABLE"}, |
402 | | { 1, "LOCAL_ROUTING_TABLE"}, |
403 | | { 2, "DP_ROUTING_TABLE"}, |
404 | | { 3, "ROUTE_ADDITION"}, |
405 | | { 4, "ROUTE_REMOVAL"}, |
406 | | { 0, NULL} |
407 | | }; |
408 | | |
409 | | static const value_string tipc_name_dist_msg_type_values[] = { |
410 | | { 0, "PUBLICATION"}, |
411 | | { 1, "WITHDRAWAL"}, |
412 | | { 0, NULL} |
413 | | }; |
414 | | |
415 | | /* CONNECTION_MANAGER */ |
416 | | static const value_string tipc_cm_msg_type_values[] = { |
417 | | { 0, "CONNECTION_PROBE"}, |
418 | | { 1, "CONNECTION_PROBE_REPLY"}, |
419 | | { 0, NULL} |
420 | | }; |
421 | | |
422 | | static const value_string tipc_link_prot_msg_type_values[] = { |
423 | | { 10, "RESET_MSG"}, |
424 | | { 11, "ACTIVATE_MSG"}, |
425 | | { 12, "STATE_MSG"}, |
426 | | { 0, NULL} |
427 | | }; |
428 | | |
429 | | /* CHANGEOVER_PROTOCOL */ |
430 | | static const value_string tipc_cng_prot_msg_type_values[] = { |
431 | | { 0, "DUPLICATE_MSG"}, |
432 | | { 1, "ORIGINAL_MSG"}, |
433 | | { 2, "INFO_MSG"}, |
434 | | { 0, NULL} |
435 | | }; |
436 | | |
437 | | /* SEGMENTATION_MANAGER */ |
438 | 6 | #define TIPC_FIRST_SEGMENT 1 |
439 | | #define TIPC_SEGMENT 2 |
440 | | static const value_string tipc_sm_msg_type_values[] = { |
441 | | { 1, "FIRST_SEGMENT"}, |
442 | | { 2, "SEGMENT"}, |
443 | | { 0, NULL} |
444 | | }; |
445 | | |
446 | | /* TIPCv2_BCAST_PROTOCOL - Broadcast Maintenance Protocol */ |
447 | | static const value_string tipcv2_bcast_mtype_strings[] = { |
448 | | { 0, "Bcast"}, |
449 | | { 0, NULL} |
450 | | }; |
451 | | |
452 | | /* TIPCv2_MSG_BUNDLER - Message Bundler Protocol */ |
453 | | static const value_string tipcv2_bundler_mtype_strings[] = { |
454 | | { 1, "Bundler"}, |
455 | | { 0, NULL} |
456 | | }; |
457 | | |
458 | | /* TIPCv2_LINK_PROTOCOL - Link State Maintenance Protocol */ |
459 | 4 | #define TIPCv2_STATE_MSG 0 |
460 | 8 | #define TIPCv2_RESET_MSG 1 |
461 | | #define TIPCv2_ACTIV_MSG 2 |
462 | | |
463 | | static const value_string tipcv2_link_mtype_strings[] = { |
464 | | { TIPCv2_STATE_MSG, "State"}, |
465 | | { TIPCv2_RESET_MSG, "Reset"}, |
466 | | { TIPCv2_ACTIV_MSG, "Activate"}, |
467 | | { 0, NULL} |
468 | | }; |
469 | | |
470 | | /* TIPCv2_CONN_MANAGER - Connection Manager */ |
471 | | #define TIPCv2_CONMGR_CONN_PROBE 0 |
472 | | #define TIPCv2_CONMGR_CONN_PROBE_REPLY 1 |
473 | 8 | #define TIPCv2_CONMGR_MSG_ACK 2 |
474 | | static const value_string tipcv2_connmgr_mtype_strings[] = { |
475 | | { TIPCv2_CONMGR_CONN_PROBE , "Probe"}, |
476 | | { TIPCv2_CONMGR_CONN_PROBE_REPLY , "ProbeReply"}, |
477 | | { TIPCv2_CONMGR_MSG_ACK , "Ack"}, |
478 | | { 0, NULL} |
479 | | }; |
480 | | |
481 | | /* TIPCv2_ROUTE_DISTRIBUTOR - Routing Table Update Protocol */ |
482 | | /* for TIPC 1.6 */ |
483 | 0 | #define TIPCv2_EXT_ROUTING_TABLE 0 |
484 | 0 | #define TIPCv2_LOCAL_ROUTING_TABLE 1 |
485 | 1 | #define TIPCv2_SEC_ROUTING_TABLE 2 |
486 | 2 | #define TIPCv2_ROUTE_ADDITION 3 |
487 | 3 | #define TIPCv2_ROUTE_REMOVAL 4 |
488 | | /* for TIPC 1.7 */ |
489 | | #define TIPCv2_DIST_PUBLISH 0 |
490 | | #define TIPCv2_DIST_WITHDRAW 1 |
491 | | #define TIPCv2_DIST_PURGE 2 |
492 | | |
493 | | static const value_string tipcv2_route_mtype_strings_1_6[] = { |
494 | | { 0, "ExtRoutingTab"}, |
495 | | { 1, "LocalRoutingTab"}, |
496 | | { 2, "SecRoutingTab"}, |
497 | | { 3, "RouteAddition"}, |
498 | | { 4, "RouteRemoval"}, |
499 | | { 0, NULL} |
500 | | }; |
501 | | |
502 | | static const value_string tipcv2_route_mtype_strings_1_7[] = { |
503 | | { 0, "Dist Publish"}, |
504 | | { 1, "Dist Withdraw"}, |
505 | | { 2, "Dist Purge"}, |
506 | | { 0, NULL} |
507 | | }; |
508 | | |
509 | | static const value_string tipcv2_dist_dist_strings[] = { |
510 | | { 0, "Nowhere"}, |
511 | | { 1, "To Cluster"}, |
512 | | { 2, "To Zone"}, |
513 | | { 3, "To Cluster and Zone"}, |
514 | | { 4, "To Network"}, |
515 | | { 5, "To Cluster and Network"}, |
516 | | { 6, "To Zone and Network"}, |
517 | | { 7, "To Cluster, Zone and Network"}, |
518 | | { 0, NULL} |
519 | | }; |
520 | | |
521 | | /* TIPCv2_CHANGEOVER_PROTOCOL - Link Changeover Protocol */ |
522 | | static const value_string tipcv2_changeover_mtype_strings[] = { |
523 | | { 0, "Duplicate"}, |
524 | | { 1, "Original"}, |
525 | | { 0, NULL} |
526 | | }; |
527 | | |
528 | | /* TIPCv2_NAME_DISTRIBUTOR - Name Table Update Protocol */ |
529 | | static const value_string tipcv2_naming_mtype_strings[] = { |
530 | | { 0, "Publication"}, |
531 | | { 1, "Withdrawal"}, |
532 | | { 0, NULL} |
533 | | }; |
534 | | |
535 | | /* TIPCv2_MSG_FRAGMENTER - Message Fragmentation Protocol" */ |
536 | | static const value_string tipcv2_fragmenter_mtype_strings[] = { |
537 | | { 0, "First"}, |
538 | | { 1, "Fragment"}, |
539 | | { 2, "Last"}, |
540 | | { 0, NULL} |
541 | | }; |
542 | | |
543 | | /* TIPCv2_NEIGHBOUR_DISCOVERY |
544 | | * 4.3.9 Neighbour Detection Protocol |
545 | | */ |
546 | | |
547 | | static const value_string tipcv2_neighbour_mtype_strings[] = { |
548 | | { 0, "Request"}, |
549 | | { 1, "Response"}, |
550 | | { 0, NULL} |
551 | | }; |
552 | | |
553 | | static const value_string tipcv2_networkplane_strings[] = { |
554 | | { 0, "A"}, |
555 | | { 1, "B"}, |
556 | | { 2, "C"}, |
557 | | { 3, "D"}, |
558 | | { 4, "E"}, |
559 | | { 5, "F"}, |
560 | | { 0, NULL} |
561 | | }; |
562 | | |
563 | | /* functions forward declarations */ |
564 | | static int dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_); |
565 | | void proto_reg_handoff_tipc(void); |
566 | | |
567 | | static reassembly_table tipc_msg_reassembly_table; |
568 | | |
569 | | static char* |
570 | | tipc_addr_value_to_buf(unsigned tipc_address, char *buf, int buf_len) |
571 | 646 | { |
572 | 646 | uint8_t zone; |
573 | 646 | uint16_t subnetwork; |
574 | 646 | uint16_t processor; |
575 | | |
576 | 646 | processor = tipc_address & 0x0fff; |
577 | | |
578 | 646 | tipc_address = tipc_address >> 12; |
579 | 646 | subnetwork = tipc_address & 0x0fff; |
580 | | |
581 | 646 | tipc_address = tipc_address >> 12; |
582 | 646 | zone = tipc_address & 0xff; |
583 | | |
584 | 646 | snprintf(buf, buf_len, "%u.%u.%u", zone, subnetwork, processor); |
585 | 646 | return buf; |
586 | 646 | } |
587 | | |
588 | | static char * |
589 | | tipc_addr_to_str(wmem_allocator_t* allocator, unsigned tipc_address) |
590 | 646 | { |
591 | 646 | char *buf; |
592 | | |
593 | 646 | buf = (char *)wmem_alloc(allocator, MAX_TIPC_ADDRESS_STR_LEN); |
594 | 646 | return tipc_addr_value_to_buf(tipc_address, buf, MAX_TIPC_ADDRESS_STR_LEN); |
595 | 646 | } |
596 | | |
597 | | static int |
598 | | tipc_addr_to_str_buf(const address* addr, char *buf, int buf_len) |
599 | 0 | { |
600 | 0 | const uint8_t *data = (const uint8_t *)addr->data; |
601 | 0 | uint32_t tipc_address; |
602 | |
|
603 | 0 | tipc_address = data[0]; |
604 | 0 | tipc_address = (tipc_address << 8) ^ data[1]; |
605 | 0 | tipc_address = (tipc_address << 8) ^ data[2]; |
606 | 0 | tipc_address = (tipc_address << 8) ^ data[3]; |
607 | |
|
608 | 0 | tipc_addr_value_to_buf(tipc_address, buf, buf_len); |
609 | 0 | return (int)(strlen(buf)+1); |
610 | 0 | } |
611 | | |
612 | | static int |
613 | | tipc_addr_str_len(const address* addr _U_) |
614 | 0 | { |
615 | 0 | return MAX_TIPC_ADDRESS_STR_LEN; |
616 | 0 | } |
617 | | |
618 | | |
619 | | /* |
620 | | All name distributor messages have a data part containing one or more table elements with |
621 | | the following five-word structure: |
622 | | struct DistributionItem { |
623 | | unsigned int type; / Published port name type / |
624 | | unsigned int lower; / Lower bound of published sequence / |
625 | | unsigned int upper; / Upper bound of published sequence / |
626 | | unsigned int port; / Random number part of port identity / |
627 | | unsigned int key; / Use for verification at withdrawal / |
628 | | }; |
629 | | */ |
630 | | static void |
631 | | dissect_tipc_name_dist_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, uint8_t item_size) |
632 | 25 | { |
633 | 25 | unsigned offset = 0; |
634 | 25 | uint32_t dword; |
635 | 25 | char *addr_str_ptr; |
636 | | |
637 | 25 | if ((handle_v2_as & V2_AS_1_6) || ((handle_v2_as & (V2_AS_ALL) && item_size == 0))) { |
638 | | /* TIPC 1.6 */ |
639 | 103 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
640 | 90 | proto_tree_add_item(tree, hf_tipc_name_dist_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
641 | 90 | offset = offset+4; |
642 | 90 | proto_tree_add_item(tree, hf_tipc_name_dist_lower, tvb, offset, 4, ENC_BIG_ENDIAN); |
643 | 90 | offset = offset+4; |
644 | 90 | proto_tree_add_item(tree, hf_tipc_name_dist_upper, tvb, offset, 4, ENC_BIG_ENDIAN); |
645 | 90 | offset = offset+4; |
646 | 90 | proto_tree_add_item(tree, hf_tipc_name_dist_port, tvb, offset, 4, ENC_BIG_ENDIAN); |
647 | 90 | offset = offset+4; |
648 | 90 | proto_tree_add_item(tree, hf_tipc_name_dist_key, tvb, offset, 4, ENC_BIG_ENDIAN); |
649 | 90 | offset = offset+4; |
650 | 90 | } |
651 | 13 | } else { |
652 | | /* TIPC 1.7 */ |
653 | 49 | while (tvb_reported_length_remaining(tvb, offset) > 0) { |
654 | 37 | proto_tree_add_item(tree, hf_tipc_name_dist_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
655 | 37 | offset = offset+4; |
656 | 37 | proto_tree_add_item(tree, hf_tipc_name_dist_lower, tvb, offset, 4, ENC_BIG_ENDIAN); |
657 | 37 | offset = offset+4; |
658 | 37 | proto_tree_add_item(tree, hf_tipc_name_dist_upper, tvb, offset, 4, ENC_BIG_ENDIAN); |
659 | 37 | offset = offset+4; |
660 | 37 | proto_tree_add_item(tree, hf_tipc_name_dist_port, tvb, offset, 4, ENC_BIG_ENDIAN); |
661 | 37 | offset = offset+4; |
662 | 37 | proto_tree_add_item(tree, hf_tipc_name_dist_key, tvb, offset, 4, ENC_BIG_ENDIAN); |
663 | 37 | offset = offset+4; |
664 | 37 | dword = tvb_get_ntohl(tvb, offset); |
665 | 37 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
666 | 37 | proto_tree_add_string(tree, hf_tipcv2_name_dist_port_id_node, tvb, offset, 4, addr_str_ptr); |
667 | 37 | offset = offset+4; |
668 | 37 | proto_tree_add_item(tree, hf_tipcv2_dist_dist, tvb, offset, 4, ENC_BIG_ENDIAN); |
669 | 37 | proto_tree_add_item(tree, hf_tipcv2_dist_scope, tvb, offset, 4, ENC_BIG_ENDIAN); |
670 | 37 | offset = offset + 4; |
671 | 37 | if (item_size == 7) continue; |
672 | | /* if item_size is >7, the following fields are ignored |
673 | | * so far */ |
674 | 37 | proto_tree_add_expert(tree, pinfo, &ei_tipc_field_not_specified, tvb, offset, ((item_size-7)*4)); |
675 | 37 | offset += (item_size-7)*4; |
676 | 37 | } |
677 | 12 | } |
678 | 25 | } |
679 | | |
680 | | /* Set message type in COL INFO and return type of message (data or Internal message type */ |
681 | | static void |
682 | | tipc_v2_set_info_col(tvbuff_t *tvb, packet_info *pinfo, uint8_t user, uint8_t msg_type, uint8_t hdr_size) |
683 | 134 | { |
684 | 134 | uint32_t portNameInst, dword; |
685 | 134 | uint32_t portNameType, portNameInstLow, portNameInstHigh; |
686 | 134 | uint8_t error; |
687 | | /*uint8_t item_size = 0;*/ |
688 | | |
689 | 134 | switch (user) { |
690 | 3 | case TIPCv2_DATA_LOW: |
691 | 9 | case TIPCv2_DATA_NORMAL: |
692 | 12 | case TIPCv2_DATA_HIGH: |
693 | 15 | case TIPCv2_DATA_NON_REJECTABLE: |
694 | 15 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_data_msg_type_defines, "unknown")); |
695 | | |
696 | | /* Display Error != 0 in Info Column */ |
697 | 15 | dword = tvb_get_ntohl(tvb, 4); |
698 | 15 | error = (dword>>25) & 0xf; |
699 | 15 | if (error > 0) |
700 | 9 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(error, tipcv2_error_code_short_strings, "unknown")); |
701 | 15 | if (hdr_size > 8) { |
702 | | /* Port Name Type: 32 bits */ |
703 | 9 | portNameType = tvb_get_ntohl(tvb, 32); |
704 | 9 | col_append_fstr(pinfo->cinfo, COL_INFO, " type:%d", portNameType); |
705 | 9 | if (hdr_size > 9) { |
706 | | /* W9 name instance/multicast lower bound */ |
707 | 6 | portNameInst = tvb_get_ntohl(tvb, 36); |
708 | 6 | col_append_fstr(pinfo->cinfo, COL_INFO, " inst:%d", portNameInst); |
709 | | /* Port Name Sequence Lower: 32 bits */ |
710 | 6 | if (hdr_size > 10) { |
711 | 3 | portNameInst = tvb_get_ntohl(tvb, 40); |
712 | 3 | col_append_fstr(pinfo->cinfo, COL_INFO, "-%d", portNameInst); |
713 | 3 | } |
714 | 6 | } |
715 | 9 | } |
716 | 15 | break; |
717 | 3 | case TIPCv2_BCAST_PROTOCOL: |
718 | 3 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_bcast_mtype_strings, "unknown")); |
719 | 3 | break; |
720 | 67 | case TIPCv2_MSG_BUNDLER: |
721 | | /* No message types */ |
722 | 67 | break; |
723 | 9 | case TIPCv2_LINK_PROTOCOL: |
724 | 9 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_link_mtype_strings, "unknown")); |
725 | 9 | break; |
726 | 4 | case TIPCv2_CONN_MANAGER: |
727 | 4 | dword = tvb_get_ntohl(tvb, 4); |
728 | | /* Display Error != 0 in Info Column */ |
729 | 4 | error = (dword>>25) & 0xf; |
730 | 4 | if (error > 0) |
731 | 4 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(error, tipcv2_error_code_short_strings, "unknown")); |
732 | 4 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_connmgr_mtype_strings, "unknown")); |
733 | 4 | break; |
734 | 7 | case TIPCv2_ROUTE_DISTRIBUTOR: |
735 | | /* determine if it is TIPC v1.6 or v1.7 */ |
736 | | /*dword = tvb_get_ntohl(tvb, 36); */ |
737 | | /*item_size = (dword >> 24) & 0xff;*/ |
738 | 7 | if ((handle_v2_as & V2_AS_1_6) || ((handle_v2_as & V2_AS_ALL) == 0)) { |
739 | 0 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_route_mtype_strings_1_6, "unknown")); |
740 | 7 | } else { |
741 | 7 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_route_mtype_strings_1_7, "unknown")); |
742 | 7 | } |
743 | 7 | break; |
744 | 6 | case TIPCv2_CHANGEOVER_PROTOCOL: |
745 | 6 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_changeover_mtype_strings, "unknown")); |
746 | 6 | break; |
747 | 16 | case TIPCv2_NAME_DISTRIBUTOR: |
748 | 16 | portNameType = tvb_get_ntohl(tvb, 40); |
749 | 16 | portNameInstLow = tvb_get_ntohl(tvb, 44); |
750 | 16 | portNameInstHigh = tvb_get_ntohl(tvb, 48); |
751 | | |
752 | 16 | if (portNameInstLow == portNameInstHigh) { |
753 | 8 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s type:%d inst:%d", |
754 | 8 | val_to_str_const(msg_type, tipcv2_naming_mtype_strings, "unknown"), portNameType, portNameInstLow); |
755 | 8 | } else { |
756 | | /* sequence */ |
757 | 8 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s type:%d seq:%d-%d", |
758 | 8 | val_to_str_const(msg_type, tipcv2_naming_mtype_strings, "unknown"), portNameType, portNameInstLow, portNameInstHigh); |
759 | 8 | } |
760 | 16 | break; |
761 | 2 | case TIPCv2_MSG_FRAGMENTER: |
762 | 2 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_fragmenter_mtype_strings, "unknown")); |
763 | 2 | break; |
764 | 1 | case TIPCv2_NEIGHBOUR_DISCOVERY: |
765 | 1 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s", val_to_str_const(msg_type, tipcv2_neighbour_mtype_strings, "unknown")); |
766 | 1 | break; |
767 | 4 | default: |
768 | 4 | break; |
769 | 134 | } |
770 | 134 | } |
771 | | |
772 | | /* Set message type in COL INFO and return type of message (data or Internal message type */ |
773 | | static bool |
774 | | tipc_v1_set_col_msgtype(packet_info *pinfo, uint8_t user, uint8_t msg_type) |
775 | 82 | { |
776 | 82 | bool datatype_hdr = false; |
777 | | |
778 | 82 | switch (user) { |
779 | 27 | case TIPC_DATA_PRIO_0: |
780 | 31 | case TIPC_DATA_PRIO_1: |
781 | 35 | case TIPC_DATA_PRIO_2: |
782 | 37 | case TIPC_DATA_NON_REJECTABLE: |
783 | | /* |
784 | | * src and dest address will be found at different location depending on User as hdr_size |
785 | | */ |
786 | 37 | datatype_hdr = true; |
787 | 37 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", val_to_str_const(msg_type, tipc_data_msg_type_values, "unknown"), msg_type); |
788 | 37 | break; |
789 | 2 | case TIPC_NAME_DISTRIBUTOR: |
790 | 2 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", val_to_str_const(msg_type, tipc_name_dist_msg_type_values, "unknown"), msg_type); |
791 | 2 | break; |
792 | 2 | case TIPC_CONNECTION_MANAGER: |
793 | 2 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", val_to_str_const(msg_type, tipc_cm_msg_type_values, "unknown"), msg_type); |
794 | 2 | break; |
795 | 4 | case TIPC_ROUTING_MANAGER: |
796 | 4 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", val_to_str_const(msg_type, tipc_routing_mgr_msg_type_values, "unknown"), msg_type); |
797 | 4 | break; |
798 | 4 | case TIPC_LINK_PROTOCOL: |
799 | 4 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", val_to_str_const(msg_type, tipc_link_prot_msg_type_values, "unknown"), msg_type); |
800 | 4 | break; |
801 | 20 | case TIPC_CHANGEOVER_PROTOCOL: |
802 | 20 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", val_to_str_const(msg_type, tipc_cng_prot_msg_type_values, "unknown"), msg_type); |
803 | 20 | break; |
804 | 3 | case TIPC_SEGMENTATION_MANAGER: |
805 | 3 | col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", val_to_str_const(msg_type, tipc_sm_msg_type_values, "unknown"), msg_type); |
806 | 3 | break; |
807 | 7 | case TIPC_MSG_BUNDLER: |
808 | 7 | break; |
809 | 3 | default: |
810 | 3 | break; |
811 | 82 | } |
812 | 82 | return datatype_hdr; |
813 | 82 | } |
814 | | |
815 | | /* |
816 | | Version 2(draft-maloy-tipc-01.txt): |
817 | | 4.2.1 Internal Message Header Format |
818 | | |
819 | | 0 1 2 3 |
820 | | 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 |
821 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
822 | | w0:|vers |msg usr|hdr sz |n|resrv| packet size | |
823 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
824 | | w1:|m typ| sequence gap | broadcast ack no | |
825 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
826 | | w2:| link level ack no | broadcast/link level seq no | |
827 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
828 | | w3:| previous node | |
829 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
830 | | w4:| next sent broadcast/fragm no | next sent pkt/ fragm msg no | |
831 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
832 | | w5:| session no | res |r|berid|link prio|netpl|p| |
833 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
834 | | w6:| originating node | |
835 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
836 | | w7:| destination node | |
837 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
838 | | w8:| transport sequence number | |
839 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
840 | | w9:| msg count | link tolerance | |
841 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
842 | | \ \ |
843 | | / User Specific Data / |
844 | | \ \ |
845 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
846 | | */ |
847 | | |
848 | | static int |
849 | | // NOLINTNEXTLINE(misc-no-recursion) |
850 | | dissect_tipc_v2_internal_msg(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_info *pinfo, int offset, uint8_t user, uint32_t msg_size, uint8_t orig_hdr_size) |
851 | 113 | { |
852 | 113 | uint32_t dword; |
853 | 113 | char *addr_str_ptr; |
854 | 113 | tvbuff_t *data_tvb; |
855 | 113 | uint8_t message_type; |
856 | 113 | uint8_t item_size = 0; |
857 | 113 | uint16_t message_count; |
858 | 113 | unsigned msg_no = 0; |
859 | 113 | uint32_t msg_in_bundle_size; |
860 | 113 | uint8_t msg_in_bundle_user; |
861 | 113 | unsigned b_inst_strlen; |
862 | 113 | unsigned padlen; |
863 | | |
864 | | /* for fragmented messages */ |
865 | 113 | int len; |
866 | 113 | bool save_fragmented; |
867 | 113 | uint32_t frag_no, frag_msg_no; |
868 | 113 | tvbuff_t* new_tvb = NULL; |
869 | 113 | fragment_head *frag_msg = NULL; |
870 | 113 | proto_item *ti; |
871 | | |
872 | 113 | message_type = (tvb_get_uint8(tipc_tvb, offset) >>5) & 0x7; |
873 | | |
874 | 113 | switch (user) { |
875 | 2 | case TIPCv2_BCAST_PROTOCOL: |
876 | | /* W1 */ |
877 | 2 | proto_tree_add_item(tipc_tree, hf_tipcv2_bcast_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
878 | | /* NO sequence gap */ |
879 | 2 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
880 | 2 | offset = offset + 4; |
881 | | /* W2 */ |
882 | 2 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
883 | 2 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
884 | 2 | offset = offset + 4; |
885 | | /* W3 */ |
886 | 2 | dword = tvb_get_ntohl(tipc_tvb, offset); |
887 | 2 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
888 | 2 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
889 | 2 | offset = offset + 4; |
890 | 2 | if (handle_v2_as & (V2_AS_1_6)) { |
891 | | /* W4 Unused */ |
892 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
893 | 0 | offset = offset + 4; |
894 | | /* W5 Unused */ |
895 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 5 unused for this user"); |
896 | 0 | offset = offset + 4; |
897 | | /* W6 Unused */ |
898 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 6 unused for this user"); |
899 | 0 | offset = offset + 4; |
900 | | /* W7 Unused */ |
901 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 7 unused for this user"); |
902 | 0 | offset = offset + 4; |
903 | | /* W8 Unused */ |
904 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
905 | 0 | offset = offset + 4; |
906 | 2 | } else { |
907 | | /* W4 Unused */ |
908 | 2 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
909 | 2 | offset = offset + 4; |
910 | | /* W5 */ |
911 | 2 | proto_tree_add_item(tipc_tree, hf_tipcv2_network_id, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
912 | 2 | offset = offset + 4; |
913 | | /* W6 */ |
914 | 2 | dword = tvb_get_ntohl(tipc_tvb, offset); |
915 | 2 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
916 | 2 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
917 | 2 | offset = offset + 4; |
918 | | /* W7 */ |
919 | 2 | dword = tvb_get_ntohl(tipc_tvb, offset); |
920 | 2 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
921 | 2 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
922 | 2 | offset = offset + 4; |
923 | | /* W8 Unused */ |
924 | 2 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
925 | 2 | offset = offset + 4; |
926 | 2 | } |
927 | | /* W9 */ |
928 | 2 | proto_tree_add_item(tipc_tree, hf_tipcv2_bcast_tag, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
929 | | /* NO link tolerance */ |
930 | 2 | offset = offset + 4; |
931 | 2 | break; |
932 | 66 | case TIPCv2_MSG_BUNDLER: |
933 | 66 | if (handle_v2_as & (V2_AS_1_6)) { |
934 | | /* W1 Unused */ |
935 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 1 unused for this user"); |
936 | 0 | offset = offset + 4; |
937 | | /* W2 Unused */ |
938 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 2 unused for this user"); |
939 | 0 | offset = offset + 4; |
940 | 66 | } else { |
941 | | /* W1 */ |
942 | 66 | proto_tree_add_item(tipc_tree, hf_tipcv2_bundler_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
943 | 66 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
944 | 66 | offset = offset + 4; |
945 | | /* W2 */ |
946 | 66 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
947 | 66 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
948 | 66 | offset = offset + 4; |
949 | 66 | } |
950 | | /* W3 */ |
951 | 66 | dword = tvb_get_ntohl(tipc_tvb, offset); |
952 | 66 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
953 | 66 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
954 | 66 | offset = offset + 4; |
955 | 66 | if (handle_v2_as & (V2_AS_1_6)) { |
956 | | /* W4 Unused */ |
957 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
958 | 0 | offset = offset + 4; |
959 | | /* W5 Unused */ |
960 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 5 unused for this user"); |
961 | 0 | offset = offset + 4; |
962 | | /* W6 Unused */ |
963 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 6 unused for this user"); |
964 | 0 | offset = offset + 4; |
965 | | /* W7 Unused */ |
966 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 7 unused for this user"); |
967 | 0 | offset = offset + 4; |
968 | | /* W8 Unused */ |
969 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
970 | 0 | offset = offset + 4; |
971 | 66 | } else { |
972 | | /* W4 Unused */ |
973 | 66 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
974 | 66 | offset = offset + 4; |
975 | | /* W5 Unused */ |
976 | 66 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 5 unused for this user"); |
977 | 66 | offset = offset + 4; |
978 | | /* W6 */ |
979 | 66 | dword = tvb_get_ntohl(tipc_tvb, offset); |
980 | 66 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
981 | 66 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
982 | 66 | offset = offset + 4; |
983 | | /* W7 */ |
984 | 66 | dword = tvb_get_ntohl(tipc_tvb, offset); |
985 | 66 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
986 | 66 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
987 | 66 | offset = offset + 4; |
988 | | /* W8 Unused */ |
989 | 66 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
990 | 66 | offset = offset + 4; |
991 | 66 | } |
992 | | /* W9 */ |
993 | | /* Message Count: 16 bits. */ |
994 | 66 | proto_tree_add_item(tipc_tree, hf_tipcv2_msg_count, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
995 | 66 | message_count = tvb_get_ntohs(tipc_tvb, offset); |
996 | | /* According to the spec this should not be set here, |
997 | | * while there is data != 0 in this field when capturing |
998 | | * |
999 | | proto_tree_add_item(tipc_tree, hf_tipcv2_link_tolerance, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1000 | | */ |
1001 | 66 | offset = offset + 4; |
1002 | | /* This should give equal results like |
1003 | | * while (message_count-- > 0) */ |
1004 | 163 | while ((uint32_t)offset < msg_size) { |
1005 | 97 | msg_no++; |
1006 | | |
1007 | 97 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1008 | 97 | msg_in_bundle_size = dword & 0x1ffff; |
1009 | 97 | msg_in_bundle_user = (dword >> 25) & 0xf; |
1010 | | |
1011 | 97 | ti = proto_tree_add_uint_format(top_tree, hf_tipc_msg_no_bundle, tipc_tvb, offset, 1, msg_no, "Message %u of %u in Bundle (%s)", |
1012 | 97 | msg_no, message_count, val_to_str_const(msg_in_bundle_user, tipcv2_user_short_str_vals, "unknown")); |
1013 | 97 | proto_item_set_len(ti, msg_in_bundle_size); |
1014 | 97 | data_tvb = tvb_new_subset_length(tipc_tvb, offset, msg_in_bundle_size); |
1015 | | |
1016 | | /* the info column shall not be deleted by the |
1017 | | * encapsulated messages */ |
1018 | 97 | col_append_str(pinfo->cinfo, COL_INFO, " | "); |
1019 | 97 | col_set_fence(pinfo->cinfo, COL_INFO); |
1020 | | |
1021 | 97 | dissect_tipc(data_tvb, pinfo, top_tree, NULL); |
1022 | | |
1023 | | /* round up message size to align the messages to 4 Bytes */ |
1024 | 97 | offset += WS_ROUNDUP_4(msg_in_bundle_size); |
1025 | 97 | } |
1026 | 66 | break; |
1027 | 8 | case TIPCv2_LINK_PROTOCOL: |
1028 | | /* W1 */ |
1029 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1030 | | /* Sequence Gap: 13 bits. */ |
1031 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_sequence_gap, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1032 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1033 | 8 | offset = offset + 4; |
1034 | | /* W2 */ |
1035 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1036 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1037 | 8 | offset = offset + 4; |
1038 | | /* W3 */ |
1039 | 8 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1040 | 8 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1041 | 8 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1042 | 8 | offset = offset + 4; |
1043 | | /* W4 */ |
1044 | | /* Next Sent Broadcast: 16 bits */ |
1045 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_next_sent_broadcast, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1046 | | /* Next Sent Packet: 16 bits. */ |
1047 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_next_sent_packet, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1048 | 8 | offset = offset + 4; |
1049 | | /* W5 */ |
1050 | | /* Session Number: 16 bits. */ |
1051 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_session_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1052 | | /* Reserved: 3 bits Must be set to zero. */ |
1053 | | /* the following two fields appear in this user according to */ |
1054 | | /* Jon Maloy on the tipc-discussion mailing list */ |
1055 | | /* Redundant Link: 1 bit */ |
1056 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_redundant_link, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1057 | | /* Bearer Identity: 3 bits */ |
1058 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_id, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1059 | | /* Link Priority: 5 bits. */ |
1060 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_prio, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1061 | | /* Network Plane: 3 bits. */ |
1062 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_network_plane, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1063 | | /* Probe: 1 bit. */ |
1064 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_probe, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1065 | 8 | offset = offset + 4; |
1066 | 8 | if (handle_v2_as & (V2_AS_1_6)) { |
1067 | | /* W6 Unused */ |
1068 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 6 unused for this user"); |
1069 | 0 | offset = offset + 4; |
1070 | | /* W7 Unused */ |
1071 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 7 unused for this user"); |
1072 | 0 | offset = offset + 4; |
1073 | | /* W8 Unused */ |
1074 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1075 | 0 | offset = offset + 4; |
1076 | 8 | } else { |
1077 | | /* W6 */ |
1078 | 8 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1079 | 8 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1080 | 8 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
1081 | 8 | offset = offset + 4; |
1082 | | /* W7 */ |
1083 | 8 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1084 | 8 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1085 | 8 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
1086 | 8 | offset = offset + 4; |
1087 | | /* W8 */ |
1088 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_timestamp, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1089 | 8 | offset = offset + 4; |
1090 | 8 | } |
1091 | | /* W9 */ |
1092 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_max_packet, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1093 | | /* Link Tolerance: 16 bits */ |
1094 | 8 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_tolerance, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1095 | 8 | offset = offset + 4; |
1096 | | |
1097 | 8 | if ((message_type == TIPCv2_RESET_MSG) |
1098 | 6 | || ((message_type == TIPCv2_STATE_MSG) && ((msg_size-(orig_hdr_size*4)) != 0))){ /* is allowed */ |
1099 | 6 | proto_tree_add_item_ret_length(tipc_tree, hf_tipcv2_bearer_instance, tipc_tvb, offset, -1, ENC_ASCII, &b_inst_strlen); |
1100 | 6 | offset += b_inst_strlen; |
1101 | | /* the bearer instance string is padded with \0 to the next word boundary */ |
1102 | 6 | if ((padlen = WS_PADDING_TO_4(b_inst_strlen)) != 0) { |
1103 | 3 | proto_tree_add_bytes_format_value(tipc_tree, hf_tipcv2_padding, tipc_tvb, offset, padlen, NULL, "%d byte%c", padlen, (padlen!=1?'s':0)); |
1104 | 3 | offset += padlen; |
1105 | 3 | } |
1106 | | /* |
1107 | | * If there's any data left, show it as |
1108 | | * padding for MTU discovery. |
1109 | | */ |
1110 | 6 | if ((uint32_t)offset < msg_size) { |
1111 | 5 | uint32_t filler_len; |
1112 | | |
1113 | 5 | filler_len = msg_size - (uint32_t)offset; |
1114 | 5 | proto_tree_add_bytes_format_value(tipc_tree, hf_tipcv2_filler_mtu_discovery, tipc_tvb, offset, filler_len, NULL, |
1115 | 5 | "%d byte%c", filler_len, (filler_len!=1?'s':0)); |
1116 | 5 | } |
1117 | 6 | } |
1118 | 8 | break; |
1119 | 4 | case TIPCv2_CONN_MANAGER: |
1120 | | /* CONN_MANAGER uses the 36-byte header format of CONN_MSG payload messages */ |
1121 | | /* W1 */ |
1122 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_connmgr_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1123 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_errorcode, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1124 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_rer_cnt, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1125 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_lookup_scope, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1126 | | |
1127 | | /* Options Position: 3 bits */ |
1128 | | /* this is not used by this user according to Jon Maloy in tipc-discussion mailing list |
1129 | | opt_p = tvb_get_uint8(tipc_tvb, offset+1) & 0x7; |
1130 | | proto_tree_add_item(tipc_tree, hf_tipcv2_opt_p , tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1131 | | if (opt_p != 0) { |
1132 | | hdr_size = hdr_size - (opt_p << 2); |
1133 | | } |
1134 | | */ |
1135 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no , tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1136 | 4 | offset = offset + 4; |
1137 | | |
1138 | | /* W2 */ |
1139 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no , tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1140 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no , tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1141 | 4 | offset = offset + 4; |
1142 | | |
1143 | | /* W3 */ |
1144 | 4 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1145 | 4 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1146 | 4 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1147 | 4 | offset = offset + 4; |
1148 | | |
1149 | | /* W4 */ |
1150 | 4 | proto_tree_add_item(tipc_tree, hf_tipc_org_port , tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1151 | 4 | offset = offset + 4; |
1152 | | |
1153 | | /* W5 */ |
1154 | 4 | proto_tree_add_item(tipc_tree, hf_tipc_dst_port , tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1155 | 4 | offset = offset + 4; |
1156 | | |
1157 | | /* W6 */ |
1158 | 4 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1159 | 4 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1160 | 4 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
1161 | 4 | offset = offset + 4; |
1162 | | |
1163 | | /* W7 */ |
1164 | 4 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1165 | 4 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1166 | 4 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
1167 | 4 | offset = offset + 4; |
1168 | | |
1169 | | /* W8 Unused */ |
1170 | | /* might be set prior to 1.7.3 but according to Allan Stephens this was never verified by the receiver |
1171 | | proto_tree_add_item(tipc_tree, hf_tipcv2_transport_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1172 | | */ |
1173 | 4 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1174 | 4 | offset = offset + 4; |
1175 | | |
1176 | | |
1177 | | /* this is not used here according to Jon Maloy in tipc-discussion mailing list |
1178 | | * Options |
1179 | | |
1180 | | if (opt_p != 0) { |
1181 | | proto_tree_add_subtree(tipc_tree, tipc_tvb, offset, (opt_p >> 2), "Options"); |
1182 | | offset = offset + (opt_p << 2); |
1183 | | } |
1184 | | */ |
1185 | | |
1186 | 4 | if (message_type == TIPCv2_CONMGR_MSG_ACK || (handle_v2_as & (V2_AS_ALL + V2_AS_1_7))) |
1187 | 4 | { |
1188 | | /* W9 */ |
1189 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_conn_mgr_msg_ack, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1190 | 4 | offset += 4; |
1191 | 4 | } |
1192 | 4 | break; |
1193 | 6 | case TIPCv2_ROUTE_DISTRIBUTOR: |
1194 | | /* W1 */ |
1195 | | /* determine if it is TIPC v1.6 or v1.7 */ |
1196 | 6 | dword = tvb_get_ntohl(tipc_tvb, offset+28); |
1197 | 6 | item_size = (dword >> 24) & 0xff; |
1198 | 6 | if ((handle_v2_as & V2_AS_1_6) || ((handle_v2_as & V2_AS_ALL) == 0)) { |
1199 | 0 | proto_tree_add_item(tipc_tree, hf_tipcv2_route_mtype_1_6, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1200 | 6 | } else { |
1201 | 6 | proto_tree_add_item(tipc_tree, hf_tipcv2_route_mtype_1_7, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1202 | 6 | } |
1203 | 6 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1204 | 6 | offset = offset + 4; |
1205 | | /* W2 */ |
1206 | 6 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1207 | 6 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1208 | 6 | offset = offset + 4; |
1209 | | /* W3 */ |
1210 | 6 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1211 | 6 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1212 | 6 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1213 | 6 | offset = offset + 4; |
1214 | | /* W4 */ |
1215 | | |
1216 | 6 | if (handle_v2_as & V2_AS_1_6) { |
1217 | | /* W4 Unused */ |
1218 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
1219 | 0 | offset = offset + 4; |
1220 | | /* W5 Unused */ |
1221 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 5 unused for this user"); |
1222 | 0 | offset = offset + 4; |
1223 | | /* W6 Unused */ |
1224 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 6 unused for this user"); |
1225 | 0 | offset = offset + 4; |
1226 | | /* W7 Unused */ |
1227 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 7 unused for this user"); |
1228 | 0 | offset = offset + 4; |
1229 | | /* W8 Unused */ |
1230 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1231 | 0 | offset = offset + 4; |
1232 | | /* W9 Unused */ |
1233 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 9 unused for this user"); |
1234 | 0 | offset = offset + 4; |
1235 | 6 | } else { |
1236 | | /* W4 Unused */ |
1237 | 6 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
1238 | 6 | offset = offset + 4; |
1239 | | /* W5 */ |
1240 | 6 | proto_tree_add_item(tipc_tree, hf_tipc_dst_port, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1241 | 6 | offset = offset + 4; |
1242 | | /* W6 */ |
1243 | 6 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1244 | 6 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1245 | 6 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
1246 | 6 | offset = offset + 4; |
1247 | | /* W7 */ |
1248 | 6 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1249 | 6 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1250 | 6 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
1251 | 6 | offset = offset + 4; |
1252 | | /* W8 Unused */ |
1253 | 6 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1254 | 6 | offset = offset + 4; |
1255 | | /* W9 */ |
1256 | 6 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1257 | 6 | item_size = (dword >> 24) & 0xff; |
1258 | 6 | proto_tree_add_item(tipc_tree, hf_tipcv2_item_size, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1259 | 6 | offset = offset + 4; |
1260 | 6 | } |
1261 | | |
1262 | | /* item_size == 0 indicates that it's TIPC v1.6 style */ |
1263 | 6 | if ((handle_v2_as & V2_AS_1_6) || ((handle_v2_as & V2_AS_ALL) && (item_size == 0))) { |
1264 | | /* W10 */ |
1265 | 5 | switch (message_type) { |
1266 | 0 | case TIPCv2_EXT_ROUTING_TABLE: /* 0 */ |
1267 | 0 | case TIPCv2_LOCAL_ROUTING_TABLE: /* 1 */ |
1268 | 1 | case TIPCv2_SEC_ROUTING_TABLE: /* 2 */ |
1269 | | /* Cluster Address */ |
1270 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1271 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1272 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_cluster_address, tipc_tvb, offset, 4, addr_str_ptr); |
1273 | 1 | offset = offset + 4; |
1274 | | /* bitmap */ |
1275 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_bitmap, tipc_tvb, offset, -1, ENC_NA); |
1276 | 1 | break; |
1277 | 2 | case TIPCv2_ROUTE_ADDITION: /* 3 */ |
1278 | 3 | case TIPCv2_ROUTE_REMOVAL: /* 4 */ |
1279 | | /* Node Address */ |
1280 | 3 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1281 | 3 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1282 | 3 | proto_tree_add_string(tipc_tree, hf_tipcv2_node_address, tipc_tvb, offset, 4, addr_str_ptr); |
1283 | 3 | offset = offset + 4; |
1284 | 4 | default: |
1285 | 4 | break; |
1286 | 5 | } |
1287 | 5 | } else { |
1288 | | /* what if item_size is set to a value fitting to TIPC v1.6 ? */ |
1289 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1290 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1291 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_network_region, tipc_tvb, offset, 4, addr_str_ptr); |
1292 | 1 | offset += 4; |
1293 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1294 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1295 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_local_router, tipc_tvb, offset, 4, addr_str_ptr); |
1296 | 1 | offset += 4; |
1297 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1298 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1299 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_remote_router, tipc_tvb, offset, 4, addr_str_ptr); |
1300 | 1 | offset += 4; |
1301 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_dist_dist, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1302 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_dist_scope, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1303 | 1 | offset = offset + 4; |
1304 | 1 | } |
1305 | 6 | break; |
1306 | | |
1307 | 6 | case TIPCv2_CHANGEOVER_PROTOCOL: |
1308 | | /* W1 */ |
1309 | 5 | proto_tree_add_item(tipc_tree, hf_tipcv2_changeover_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1310 | 5 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1311 | 5 | offset = offset + 4; |
1312 | | /* W2 */ |
1313 | 5 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1314 | 5 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1315 | 5 | offset = offset + 4; |
1316 | | /* W3 */ |
1317 | 5 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1318 | 5 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1319 | 5 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1320 | 5 | offset = offset + 4; |
1321 | | /* W4 Unused */ |
1322 | 5 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
1323 | 5 | offset = offset + 4; |
1324 | | /* W5 */ |
1325 | | /* the following two fields appear in this user according to */ |
1326 | | /* Jon Maloy on the tipc-discussion mailing list */ |
1327 | | /* Redundant Link: 1 bit */ |
1328 | 5 | if (handle_v2_as & (V2_AS_1_6)) { |
1329 | 0 | proto_tree_add_item(tipc_tree, hf_tipcv2_redundant_link, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1330 | 0 | } |
1331 | | /* Bearer Identity: 3 bits */ |
1332 | 5 | proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_id, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1333 | 5 | offset = offset + 4; |
1334 | | /* W6-W8 */ |
1335 | 5 | if (handle_v2_as & (V2_AS_1_6)) { |
1336 | | /* W6 Unused */ |
1337 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 6 unused for this user"); |
1338 | 0 | offset = offset + 4; |
1339 | | /* W7 Unused */ |
1340 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 7 unused for this user"); |
1341 | 0 | offset = offset + 4; |
1342 | | /* W8 Unused */ |
1343 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1344 | 0 | offset = offset + 4; |
1345 | 5 | } else { |
1346 | | /* W6 */ |
1347 | 5 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1348 | 5 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1349 | 5 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
1350 | 5 | offset = offset + 4; |
1351 | | /* W7 */ |
1352 | 5 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1353 | 5 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1354 | 5 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
1355 | 5 | offset = offset + 4; |
1356 | | /* W8 Unused */ |
1357 | 5 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1358 | 5 | offset = offset + 4; |
1359 | 5 | } |
1360 | | /* W9 */ |
1361 | 5 | switch (message_type) |
1362 | 5 | { |
1363 | 2 | case 0: |
1364 | | /* DUPLICATE_MSG */ |
1365 | | /* W9 Unused */ |
1366 | 2 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 9 unused for this user"); |
1367 | 2 | break; |
1368 | 1 | case 1: |
1369 | | /* ORIGINAL_MSG */ |
1370 | | /* Message Count: 16 bits. */ |
1371 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_msg_count, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1372 | 1 | break; |
1373 | 1 | default: |
1374 | 1 | break; |
1375 | 5 | } |
1376 | 4 | offset = offset + 4; |
1377 | 4 | break; |
1378 | 16 | case TIPCv2_NAME_DISTRIBUTOR: |
1379 | | /* W1 */ |
1380 | 16 | proto_tree_add_item(tipc_tree, hf_tipcv2_naming_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1381 | 16 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1382 | 16 | offset = offset + 4; |
1383 | | /* W2 */ |
1384 | 16 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1385 | 16 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1386 | 16 | offset = offset + 4; |
1387 | | /* W3 */ |
1388 | 16 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1389 | 16 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1390 | 16 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1391 | 16 | offset = offset + 4; |
1392 | | /* W4 Unused */ |
1393 | 16 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 4 unused for this user"); |
1394 | 16 | offset = offset + 4; |
1395 | | /* W5 Unused */ |
1396 | 16 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 5 unused for this user"); |
1397 | 16 | offset = offset + 4; |
1398 | | /* W6 */ |
1399 | | /* Originating Node: 32 bits. */ |
1400 | 16 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1401 | 16 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1402 | 16 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
1403 | 16 | offset = offset + 4; |
1404 | | /* W7 */ |
1405 | | /* Destination Node: 32 bits. */ |
1406 | 16 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1407 | 16 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1408 | 16 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
1409 | 16 | offset = offset + 4; |
1410 | 16 | if (handle_v2_as & (V2_AS_1_6 + V2_AS_ALL)) { |
1411 | | /* W8 */ |
1412 | | /* Transport Level Sequence Number: 32 bits */ |
1413 | 16 | proto_tree_add_item(tipc_tree, hf_tipcv2_transport_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1414 | 16 | offset = offset + 4; |
1415 | 16 | } else { |
1416 | | /* W8 Unused */ |
1417 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1418 | 0 | offset = offset + 4; |
1419 | 0 | } |
1420 | | /* W9 */ |
1421 | 16 | if (handle_v2_as & V2_AS_1_6) { |
1422 | | /* W9 Unused */ |
1423 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 9 unused for this user"); |
1424 | 0 | offset = offset + 4; |
1425 | 16 | } else { |
1426 | 16 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1427 | 16 | item_size = (dword >> 24) & 0xff; |
1428 | 16 | proto_tree_add_item(tipc_tree, hf_tipcv2_item_size, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1429 | 16 | offset = offset + 4; |
1430 | 16 | } |
1431 | | /* W10 */ |
1432 | | /* dissect the (one or more) Publications */ |
1433 | 16 | data_tvb = tvb_new_subset_remaining(tipc_tvb, offset); |
1434 | 16 | dissect_tipc_name_dist_data(data_tvb, pinfo, tipc_tree, item_size); |
1435 | 16 | break; |
1436 | 1 | case TIPCv2_MSG_FRAGMENTER: |
1437 | | /* W1 */ |
1438 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_fragmenter_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1439 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1440 | 1 | offset = offset + 4; |
1441 | | /* W2 */ |
1442 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1443 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1444 | 1 | offset = offset + 4; |
1445 | | /* W3 */ |
1446 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1447 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1448 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1449 | 1 | offset = offset + 4; |
1450 | | /* W4 */ |
1451 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1452 | | /* Fragment Number: 16 Bits. */ |
1453 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_fragment_number, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1454 | 1 | frag_no = (dword >> 16) & 0x0000ffff; |
1455 | | /* Fragment msg Number: 16 bits */ |
1456 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_fragment_msg_number, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1457 | 1 | frag_msg_no = dword & 0x0000ffff; |
1458 | 1 | offset = offset + 4; |
1459 | 1 | if (handle_v2_as & (V2_AS_1_6)) { |
1460 | | /* W5 Unused */ |
1461 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 5 unused for this user"); |
1462 | 0 | offset = offset + 4; |
1463 | | /* W6 Unused */ |
1464 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 6 unused for this user"); |
1465 | 0 | offset = offset + 4; |
1466 | | /* W7 Unused */ |
1467 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 7 unused for this user"); |
1468 | 0 | offset = offset + 4; |
1469 | | /* W8 Unused */ |
1470 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1471 | 0 | offset = offset + 4; |
1472 | | /* W9 Unused */ |
1473 | 0 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 9 unused for this user"); |
1474 | 0 | offset = offset + 4; |
1475 | 1 | } else { |
1476 | | /* W5 Unused */ |
1477 | 1 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 5 unused for this user"); |
1478 | 1 | offset = offset + 4; |
1479 | | /* W6 */ |
1480 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1481 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1482 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
1483 | 1 | offset = offset + 4; |
1484 | | /* W7 */ |
1485 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1486 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1487 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
1488 | 1 | offset = offset + 4; |
1489 | | /* W8 Unused */ |
1490 | 1 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 8 unused for this user"); |
1491 | 1 | offset = offset + 4; |
1492 | | /* W9 Unused */ |
1493 | 1 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tipc_tvb, offset, 4, "word 9 unused for this user"); |
1494 | 1 | offset = offset + 4; |
1495 | 1 | } |
1496 | | |
1497 | 1 | len = (msg_size - (orig_hdr_size<<2)); |
1498 | | |
1499 | 1 | if (tipc_defragment) { |
1500 | | /* reassemble fragmented packages */ |
1501 | 1 | save_fragmented = pinfo->fragmented; |
1502 | 1 | pinfo->fragmented = true; |
1503 | | |
1504 | 1 | frag_msg = fragment_add_seq_check(&tipc_msg_reassembly_table, |
1505 | 1 | tipc_tvb, offset, |
1506 | 1 | pinfo, |
1507 | 1 | frag_msg_no, /* ID for fragments belonging together */ |
1508 | 1 | NULL, |
1509 | | /* TODO: make sure that fragments are on the same LINK */ |
1510 | | /* TIPC starts with "1" but we * need "0" */ |
1511 | 1 | (frag_no-1), /* number of the fragment */ |
1512 | 1 | len, /* fragment length - to the end of the data */ |
1513 | 1 | (message_type != TIPCv2_USER_LAST_FRAGMENT)); /* More fragments? */ |
1514 | | |
1515 | 1 | new_tvb = process_reassembled_data(tipc_tvb, offset, pinfo, |
1516 | 1 | "Reassembled TIPC", frag_msg, &tipc_msg_frag_items, |
1517 | 1 | NULL, tipc_tree); |
1518 | | |
1519 | 1 | if (frag_msg) { /* Reassembled */ |
1520 | 0 | col_append_str(pinfo->cinfo, COL_INFO, |
1521 | 0 | " (Message Reassembled)"); |
1522 | 1 | } else { /* Not last packet of reassembled Short Message */ |
1523 | 1 | col_append_fstr(pinfo->cinfo, COL_INFO, |
1524 | 1 | " (Message fragment %u)", frag_no); |
1525 | 1 | } |
1526 | 1 | if (new_tvb) { /* take it all */ |
1527 | | |
1528 | | /* the info column shall not be deleted by the |
1529 | | * encapsulated messages */ |
1530 | 0 | col_append_str(pinfo->cinfo, COL_INFO, " | "); |
1531 | 0 | col_set_fence(pinfo->cinfo, COL_INFO); |
1532 | 0 | dissect_tipc(new_tvb, pinfo, top_tree, NULL); |
1533 | 1 | } else { /* make a new subset */ |
1534 | 1 | data_tvb = tvb_new_subset_length(tipc_tvb, offset, len); |
1535 | 1 | call_data_dissector(data_tvb, pinfo, top_tree); |
1536 | 1 | } |
1537 | | |
1538 | 1 | pinfo->fragmented = save_fragmented; |
1539 | 1 | } else { |
1540 | | /* don't reassemble is set in the "preferences" */ |
1541 | 0 | data_tvb = tvb_new_subset_length(tipc_tvb, offset, len); |
1542 | 0 | call_data_dissector(data_tvb, pinfo, top_tree); |
1543 | 0 | } |
1544 | | |
1545 | 1 | break; |
1546 | 1 | case TIPCv2_NEIGHBOUR_DISCOVERY: |
1547 | | /* |
1548 | | The protocol for neighbour detection |
1549 | | uses a special message format, with the following generic structure: |
1550 | | |
1551 | | 0 1 2 3 |
1552 | | 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 |
1553 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1554 | | w0:|vers |msg usr|hdr sz |n|resrv| packet size | |
1555 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1556 | | w1:|m typ|00000| minor_pv | node signature | |
1557 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1558 | | w2:| destination domain | |
1559 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1560 | | w3:| previous node | |
1561 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1562 | | w4:| network identity | |
1563 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1564 | | w5:| | |
1565 | | +-+-+-+-+-+-+- +-+-+-+-+-+-+-+ |
1566 | | w6:| | |
1567 | | +-+-+-+-+-+-+- bearer level originating address +-+-+-+-+-+-+-+ |
1568 | | w7:| | |
1569 | | +-+-+-+-+-+-+- +-+-+-+-+-+-+-+ |
1570 | | w8:| | |
1571 | | +-+-+-+-+-+-+- +-+-+-+-+-+-+-+ |
1572 | | w9:| | |
1573 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1574 | | \ \ |
1575 | | / vendor specific data (optional) / |
1576 | | \ \ |
1577 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1578 | | */ |
1579 | | /* W1 */ |
1580 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_neighbour_mtype, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1581 | | /* Reserved 5 bits */ |
1582 | | /* Minor pv 8 bits */ |
1583 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_minor_pv, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1584 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_node_sig, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1585 | 1 | offset = offset + 4; |
1586 | | /* W2 */ |
1587 | | /* Destination Domain */ |
1588 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1589 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1590 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_destination_domain, tipc_tvb, offset, 4, addr_str_ptr); |
1591 | 1 | offset = offset + 4; |
1592 | | /* W3 */ |
1593 | 1 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1594 | 1 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1595 | 1 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1596 | 1 | offset = offset + 4; |
1597 | | /* W4 */ |
1598 | | /* Network Identity: */ |
1599 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_network_id, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1600 | 1 | offset = offset + 4; |
1601 | 1 | if (handle_v2_as & (V2_AS_1_6)) { |
1602 | | /* W5 - W9 Bearer Level Originating Address: */ |
1603 | 0 | proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_level_orig_addr, tipc_tvb, offset, 20, ENC_NA); |
1604 | 0 | offset = offset + 20; |
1605 | 1 | } else { |
1606 | | /* W5 */ |
1607 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_media_id, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1608 | 1 | offset = offset + 4; |
1609 | | /* W6 - W9 Bearer Level Originating Address: */ |
1610 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_bearer_level_orig_addr, tipc_tvb, offset, 16, ENC_NA); |
1611 | 1 | offset = offset + 16; |
1612 | 1 | } |
1613 | 1 | if (msg_size-(orig_hdr_size*4) != 0) { |
1614 | 1 | proto_tree_add_item(tipc_tree, hf_tipcv2_vendor_specific_data, tipc_tvb, offset, -1, ENC_NA); |
1615 | 1 | } |
1616 | 1 | break; |
1617 | 4 | default: |
1618 | 4 | break; |
1619 | 113 | } |
1620 | | |
1621 | 44 | return offset; |
1622 | | |
1623 | 113 | } |
1624 | | |
1625 | | /* Version 2 Header |
1626 | | http://tipc.sourceforge.net/doc/draft-spec-tipc-02.html#sec:TIPC_Pkt_Format |
1627 | | 3.1.1. Payload Message Header Format |
1628 | | |
1629 | | 0 1 2 3 |
1630 | | 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 |
1631 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1632 | | w0:|vers | user |hdr sz |n|d|s|r| message size | |
1633 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1634 | | w1:|mstyp| error |rer cnt|lsc|opt p| broadcast ack no | |
1635 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1636 | | w2:| link level ack no | broadcast/link level seq no | |
1637 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1638 | | w3:| previous node | |
1639 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1640 | | w4:| originating port | |
1641 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1642 | | w5:| destination port | |
1643 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1644 | | w6:| originating node | |
1645 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1646 | | w7:| destination node | |
1647 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1648 | | w8:| name type / transport sequence number | |
1649 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1650 | | w9:| name instance/multicast lower bound | |
1651 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1652 | | wA:| multicast upper bound | |
1653 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1654 | | / / |
1655 | | \ options \ |
1656 | | / / |
1657 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
1658 | | */ |
1659 | | |
1660 | | /* this function tries to call subdissectors for encapsulated data |
1661 | | * @name_type pointer to the used port name type, NULL if not available |
1662 | | * @user uint8_t holding the used TIPC user, is allways available |
1663 | | */ |
1664 | | static void |
1665 | | call_tipc_v2_data_subdissectors(tvbuff_t *data_tvb, packet_info *pinfo, uint32_t *name_type_p, uint8_t user) |
1666 | 33 | { |
1667 | 33 | if (dissect_tipc_data) { |
1668 | 33 | heur_dtbl_entry_t *hdtbl_entry; |
1669 | | /* dissection of TIPC data is set in preferences */ |
1670 | | |
1671 | | /* check for heuristic dissectors if specified in the |
1672 | | * preferences to try them first */ |
1673 | 33 | if (try_heuristic_first) { |
1674 | 0 | if (dissector_try_heuristic(tipc_heur_subdissector_list, data_tvb, pinfo, top_tree, &hdtbl_entry, NULL)) |
1675 | 0 | return; |
1676 | 0 | } |
1677 | | /* This triggers if a dissectors if |
1678 | | * tipc.user is just set to a TIPC user holding data */ |
1679 | 33 | if (dissector_try_uint(tipc_user_dissector, user, data_tvb, pinfo, top_tree)) |
1680 | 0 | return; |
1681 | | /* The Name Type is not always explicitly set in a TIPC Data |
1682 | | * Message. |
1683 | | * |
1684 | | * On the tipc-discussion mailing list, Allan Stephens described |
1685 | | * where the Port Name is not set with the following words: |
1686 | | * |
1687 | | * <cite> |
1688 | | * The "named" and "mcast" message types have info in the TIPC header to |
1689 | | * specify the message's destination (a port name and port name sequence, |
1690 | | * respectively); these message types typically occur when an application |
1691 | | * sends connectionless traffic. The "conn" type is used to carry |
1692 | | * connection-oriented traffic over an already established connection; |
1693 | | * since the sending socket/port already knows the port ID of the other end |
1694 | | * of the connection, there is no need for any port name information to be |
1695 | | * present in the TIPC header. |
1696 | | * |
1697 | | * The "direct" type is used to carry connectionless traffic to a |
1698 | | * destination that was specified using a port ID, rather than a port name; |
1699 | | * again, no port name info is present in the TIPC header because it is not |
1700 | | * required. Situations where this sort of message might be generated |
1701 | | * include: a) an application obtains a port ID as part of a subscription |
1702 | | * event generated by TIPC's topology server and then sends a message to |
1703 | | * that port ID (using sendto() or sendmsg()), and b) a server obtains a |
1704 | | * client's port ID when it receives a message from the client (using |
1705 | | * recvfrom() or recvmsg()) and then sends a reply back to that client port |
1706 | | * ID (using sendto() or sendmsg()). |
1707 | | * </cite> |
1708 | | * |
1709 | | * TODO: it should be determined by |
1710 | | * some kind of static function which port name type a message |
1711 | | * is going to, if it is not specified explicitly in a message */ |
1712 | 33 | if (name_type_p) |
1713 | 31 | if (dissector_try_uint(tipc_type_dissector, *name_type_p, data_tvb, pinfo, top_tree)) |
1714 | 0 | return; |
1715 | | /* check for heuristic dissectors if specified in the |
1716 | | * preferences not to try them first */ |
1717 | 33 | if (!try_heuristic_first) { |
1718 | 33 | if (dissector_try_heuristic(tipc_heur_subdissector_list, data_tvb, pinfo, top_tree, &hdtbl_entry, NULL)) |
1719 | 0 | return; |
1720 | 33 | } |
1721 | 33 | } |
1722 | | |
1723 | | /* dissection of TIPC data is not set in preferences or no subdissector found */ |
1724 | | |
1725 | 33 | call_data_dissector(data_tvb, pinfo, top_tree); |
1726 | 33 | } |
1727 | | |
1728 | | |
1729 | | static void |
1730 | | // NOLINTNEXTLINE(misc-no-recursion) |
1731 | | dissect_tipc_v2(tvbuff_t *tipc_tvb, proto_tree *tipc_tree, packet_info *pinfo, int offset, uint8_t user, uint32_t msg_size, uint8_t hdr_size, bool datatype_hdr) |
1732 | 126 | { |
1733 | 126 | uint32_t dword; |
1734 | 126 | char *addr_str_ptr; |
1735 | 126 | uint8_t opt_p = 0; |
1736 | 126 | proto_item *item; |
1737 | | /* The unit used is 32 bit words */ |
1738 | 126 | uint8_t orig_hdr_size; |
1739 | | |
1740 | 126 | uint32_t name_type = 0; |
1741 | 126 | uint32_t *name_type_p = NULL; |
1742 | 126 | tvbuff_t *data_tvb; |
1743 | 126 | int len; |
1744 | | |
1745 | 126 | orig_hdr_size = hdr_size; |
1746 | | |
1747 | | /* Word 0 */ |
1748 | | /* Version: 3 bits */ |
1749 | 126 | proto_tree_add_item(tipc_tree, hf_tipc_ver, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1750 | | /* User: 4 bits */ |
1751 | 126 | proto_tree_add_item(tipc_tree, hf_tipcv2_usr, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1752 | | /* Header Size: 4 bits */ |
1753 | 126 | item = proto_tree_add_item(tipc_tree, hf_tipc_hdr_size, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1754 | 126 | proto_item_append_text(item, " = %u bytes", (hdr_size * 4)); |
1755 | | /* Non-sequenced: 1 bit */ |
1756 | 126 | proto_tree_add_item(tipc_tree, hf_tipc_nonsequenced, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1757 | 126 | if (datatype_hdr) { |
1758 | | /* Destination Droppable: 1 bit */ |
1759 | 13 | proto_tree_add_item(tipc_tree, hf_tipc_destdrop, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1760 | | /* Source Droppable: 1 bit */ |
1761 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_srcdrop, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1762 | | /* SYN: 1 bit */ |
1763 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_syn, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1764 | 13 | } |
1765 | | /* Reserved: 1 bits */ |
1766 | | |
1767 | | /* Message Size: 17 bits */ |
1768 | 126 | item = proto_tree_add_item(tipc_tree, hf_tipc_msg_size, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1769 | 126 | if (msg_size < (unsigned)(orig_hdr_size << 2)) { |
1770 | 0 | expert_add_info_format(pinfo, item, &ei_tipc_invalid_msg_size, "Invalid message size (%u bytes) < header size (%d bytes)", msg_size, orig_hdr_size << 2); |
1771 | 0 | THROW(ReportedBoundsError); |
1772 | 0 | } |
1773 | 126 | offset = offset + 4; |
1774 | | |
1775 | 126 | if (!datatype_hdr) { |
1776 | 113 | dissect_tipc_v2_internal_msg(tipc_tvb, tipc_tree, pinfo, offset, user, msg_size, orig_hdr_size); |
1777 | 113 | return; |
1778 | 113 | } |
1779 | | |
1780 | | /* Word 1 */ |
1781 | | /* Message Type: 3 bits */ |
1782 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_data_msg_type, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1783 | | /* Error Code: 4 bits */ |
1784 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_errorcode, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1785 | | |
1786 | | /* Reroute Counter: 4 bits */ |
1787 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_rer_cnt, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1788 | | /* Lookup Scope: 2 bits */ |
1789 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_lookup_scope, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1790 | | |
1791 | | /* Options Position: 3 bits */ |
1792 | 13 | if (handle_v2_as & (V2_AS_ALL + V2_AS_1_6)) { |
1793 | 13 | opt_p = tvb_get_uint8(tipc_tvb, offset+1) & 0x7; |
1794 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_opt_p, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1795 | 13 | if (opt_p != 0) { |
1796 | 9 | hdr_size = hdr_size - (opt_p << 2); |
1797 | 9 | } |
1798 | 13 | } |
1799 | | /* Broadcast Acknowledge Number: 16 bits */ |
1800 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_broadcast_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1801 | 13 | offset = offset + 4; |
1802 | | |
1803 | | /* W2 */ |
1804 | | /* Link Level Acknowledge Number: 16 bits */ |
1805 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_ack_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1806 | | /* broadcast/link level seq no */ |
1807 | 13 | proto_tree_add_item(tipc_tree, hf_tipcv2_link_level_seq_no, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1808 | 13 | offset = offset + 4; |
1809 | | /* W3 previous node */ |
1810 | 13 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1811 | 13 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1812 | 13 | proto_tree_add_string(tipc_tree, hf_tipcv2_prev_node, tipc_tvb, offset, 4, addr_str_ptr); |
1813 | 13 | offset = offset + 4; |
1814 | | |
1815 | | /* W4 Originating Port: 32 bits */ |
1816 | 13 | proto_tree_add_item(tipc_tree, hf_tipc_org_port, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1817 | 13 | offset = offset + 4; |
1818 | | |
1819 | | /* W5 Destination Port: 32 bits */ |
1820 | 13 | proto_tree_add_item(tipc_tree, hf_tipc_dst_port, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1821 | 13 | offset = offset + 4; |
1822 | 13 | if (hdr_size > 6) { |
1823 | | |
1824 | | /* W6 Originating Node: 32 bits */ |
1825 | 9 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1826 | 9 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1827 | 9 | proto_tree_add_string(tipc_tree, hf_tipcv2_orig_node, tipc_tvb, offset, 4, addr_str_ptr); |
1828 | 9 | offset = offset + 4; |
1829 | | /* W7 Destination Node: 32 bits */ |
1830 | 9 | dword = tvb_get_ntohl(tipc_tvb, offset); |
1831 | 9 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
1832 | 9 | proto_tree_add_string(tipc_tree, hf_tipcv2_dest_node, tipc_tvb, offset, 4, addr_str_ptr); |
1833 | 9 | offset = offset + 4; |
1834 | 9 | if (hdr_size > 8) { |
1835 | | /* W8 name type / transport sequence number */ |
1836 | | /* Transport Level Sequence Number: 32 bits */ |
1837 | | /* Port Name Type: 32 bits */ |
1838 | 8 | proto_tree_add_item_ret_uint(tipc_tree, hf_tipcv2_port_name_type, tipc_tvb, offset, 4, ENC_BIG_ENDIAN, &name_type); |
1839 | 8 | name_type_p = &name_type; |
1840 | 8 | offset = offset + 4; |
1841 | | |
1842 | 8 | if (hdr_size > 9) { |
1843 | | /* W9 name instance/multicast lower bound */ |
1844 | 7 | if (hdr_size < 11) |
1845 | | /* no multicast */ |
1846 | | /* Port Name Instance: 32 bits */ |
1847 | 2 | proto_tree_add_item(tipc_tree, hf_tipcv2_port_name_instance, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1848 | 5 | else |
1849 | | /* multicast */ |
1850 | | /* Port Name Sequence Lower: 32 bits */ |
1851 | 5 | proto_tree_add_item(tipc_tree, hf_tipcv2_multicast_lower, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1852 | 7 | offset = offset + 4; |
1853 | 7 | if (hdr_size > 10) { |
1854 | | |
1855 | | /* W10 multicast upper bound */ |
1856 | | /* Port Name Sequence Upper: 32 bits */ |
1857 | 4 | proto_tree_add_item(tipc_tree, hf_tipcv2_multicast_upper, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
1858 | 4 | offset = offset + 4; |
1859 | 4 | } |
1860 | 7 | } |
1861 | 8 | } |
1862 | 9 | } |
1863 | | /* Options */ |
1864 | 13 | if (handle_v2_as & (V2_AS_ALL + V2_AS_1_6)) { |
1865 | 9 | if (opt_p != 0) { |
1866 | 5 | proto_tree_add_bytes_format(tipc_tree, hf_tipcv2_options, tipc_tvb, offset, (opt_p >> 2), NULL, "Options"); |
1867 | 5 | offset = offset + (opt_p << 2); |
1868 | 5 | } |
1869 | 9 | } |
1870 | | /* TIPCv2 data */ |
1871 | 13 | len = (msg_size - (orig_hdr_size<<2)); |
1872 | 13 | data_tvb = tvb_new_subset_length(tipc_tvb, offset, len); |
1873 | | |
1874 | 13 | call_tipc_v2_data_subdissectors(data_tvb, pinfo, name_type_p, user); |
1875 | 13 | } |
1876 | | |
1877 | | /* From message.h (http://cvs.sourceforge.net/viewcvs.py/tipc/source/stable_ericsson/TIPC_SCC/src/Message.h?rev=1.2&view=markup) |
1878 | | //////////////////////////////////////////////////////////////////// |
1879 | | TIPC internal header format, version 1: |
1880 | | |
1881 | | : : |
1882 | | | Word 0-2: common to all users | |
1883 | | | | |
1884 | | +-------+-------+-------+-------+-------+-------+-------+-------+ |
1885 | | |netw-|imp|link | | |p|bea- |link | |
1886 | | w3:|ork |ort|sel- | message count | |r|rer |sel- | |
1887 | | |id |anc|ector| | |b|id |ector| |
1888 | | +-------+-------+-------+-------+-------+-------+-------+-------+ |
1889 | | | | |
1890 | | w4:| remote address | |
1891 | | | | |
1892 | | +-------+-------+-------+-------+-------+-------+-------+-------+ |
1893 | | | msg | | | |
1894 | | w5:| type | gap | next sent | |
1895 | | | | | | |
1896 | | +-------+-------+-------+-------+-------+-------+-------+-------+ |
1897 | | | | link | | |
1898 | | w6:| reserve | prio- | link tolerance | |
1899 | | | | ity | | |
1900 | | +-------+-------+-------+-------+-------+-------+-------+-------+ |
1901 | | | | |
1902 | | w7:| | |
1903 | | | | |
1904 | | +-------+-------+ +-------+-------+ |
1905 | | | | |
1906 | | w8:| | |
1907 | | | | |
1908 | | +-------+-------+ bearer name +-------+-------+ |
1909 | | | | |
1910 | | w9:| | |
1911 | | | | |
1912 | | +-------+-------+ +-------+-------+ |
1913 | | | | |
1914 | | wa:| | |
1915 | | | | |
1916 | | +-------+-------+-------+-------+-------+-------+-------+-------+ |
1917 | | |
1918 | | NB: Connection Manager and Name Distributor use data message format. |
1919 | | */ |
1920 | | |
1921 | | static void |
1922 | | // NOLINTNEXTLINE(misc-no-recursion) |
1923 | | dissect_tipc_int_prot_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tipc_tree, int offset, uint8_t user, uint32_t msg_size) |
1924 | 94 | { |
1925 | 94 | uint8_t msg_type; |
1926 | 94 | tvbuff_t *data_tvb; |
1927 | 94 | uint32_t msg_in_bundle_size; |
1928 | 94 | uint32_t dword; |
1929 | 94 | unsigned msg_no = 0; |
1930 | 94 | uint8_t link_sel; |
1931 | 94 | uint16_t link_lev_seq_no; |
1932 | 94 | uint32_t reassembled_msg_length = 0; |
1933 | 94 | uint32_t no_of_segments = 0; |
1934 | | |
1935 | 94 | bool save_fragmented; |
1936 | 94 | tvbuff_t* new_tvb = NULL; |
1937 | 94 | tvbuff_t* next_tvb = NULL; |
1938 | 94 | fragment_head *frag_msg = NULL; |
1939 | 94 | proto_item *item; |
1940 | | |
1941 | 94 | link_lev_seq_no = tvb_get_ntohl(tvb, 4) & 0xffff; |
1942 | | /* Internal Protocol Header */ |
1943 | | /* Unused */ |
1944 | | |
1945 | 94 | msg_type = tvb_get_uint8(tvb, 20)>>4; |
1946 | | /* W3 */ |
1947 | 94 | dword = tvb_get_ntohl(tvb, offset); |
1948 | 94 | link_sel = dword & 0x7; |
1949 | 94 | proto_tree_add_item(tipc_tree, hf_tipc_unused2, tvb, offset, 4, ENC_BIG_ENDIAN); |
1950 | | /* Importance */ |
1951 | 94 | if (user == TIPC_SEGMENTATION_MANAGER) |
1952 | 7 | proto_tree_add_item(tipc_tree, hf_tipc_importance, tvb, offset, 4, ENC_BIG_ENDIAN); |
1953 | | /* Link selector */ |
1954 | 94 | if (user == TIPC_SEGMENTATION_MANAGER || user == TIPC_NAME_DISTRIBUTOR || user == TIPC_CHANGEOVER_PROTOCOL) |
1955 | 31 | proto_tree_add_item(tipc_tree, hf_tipc_link_selector, tvb, offset, 4, ENC_BIG_ENDIAN); |
1956 | | /* Message count */ |
1957 | 94 | if (user == TIPC_MSG_BUNDLER || user == TIPC_CHANGEOVER_PROTOCOL) { |
1958 | 76 | proto_tree_add_item(tipc_tree, hf_tipc_msg_cnt, tvb, offset, 4, ENC_BIG_ENDIAN); |
1959 | 76 | } |
1960 | | /* Unused */ |
1961 | | /* Probe */ |
1962 | 94 | if (user == TIPC_LINK_PROTOCOL) |
1963 | 7 | proto_tree_add_item(tipc_tree, hf_tipc_probe, tvb, offset, 4, ENC_BIG_ENDIAN); |
1964 | | /* Bearer identity */ |
1965 | 94 | if (user == TIPC_LINK_PROTOCOL || user == TIPC_CHANGEOVER_PROTOCOL) |
1966 | 31 | proto_tree_add_item(tipc_tree, hf_tipc_bearer_id, tvb, offset, 4, ENC_BIG_ENDIAN); |
1967 | | /* Link selector */ |
1968 | 94 | if (user == TIPC_SEGMENTATION_MANAGER || user == TIPC_NAME_DISTRIBUTOR || user == TIPC_CHANGEOVER_PROTOCOL) |
1969 | 31 | proto_tree_add_item(tipc_tree, hf_tipc_link_selector2, tvb, offset, 4, ENC_BIG_ENDIAN); |
1970 | | |
1971 | 94 | offset = offset + 4; |
1972 | | |
1973 | | /* W4 */ |
1974 | | /* Remote address */ |
1975 | 94 | if (user == TIPC_ROUTING_MANAGER) |
1976 | 4 | proto_tree_add_item(tipc_tree, hf_tipc_remote_addr, tvb, offset, 4, ENC_BIG_ENDIAN); |
1977 | 94 | offset = offset + 4; |
1978 | | |
1979 | | /* W5 */ |
1980 | | /* Message type */ |
1981 | 94 | switch (user) { |
1982 | 4 | case TIPC_ROUTING_MANAGER: |
1983 | 4 | proto_tree_add_item(tipc_tree, hf_tipc_rm_msg_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
1984 | 4 | break; |
1985 | 0 | case TIPC_NAME_DISTRIBUTOR: |
1986 | 0 | proto_tree_add_item(tipc_tree, hf_tipc_nd_msg_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
1987 | 0 | break; |
1988 | 0 | case TIPC_CONNECTION_MANAGER: |
1989 | 0 | break; |
1990 | 7 | case TIPC_LINK_PROTOCOL: |
1991 | 7 | proto_tree_add_item(tipc_tree, hf_tipc_lp_msg_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
1992 | 7 | break; |
1993 | 24 | case TIPC_CHANGEOVER_PROTOCOL: |
1994 | 24 | proto_tree_add_item(tipc_tree, hf_tipc_cng_prot_msg_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
1995 | 24 | break; |
1996 | 7 | case TIPC_SEGMENTATION_MANAGER: |
1997 | 7 | proto_tree_add_item(tipc_tree, hf_tipc_sm_msg_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
1998 | 7 | break; |
1999 | 52 | default: |
2000 | 52 | proto_tree_add_item(tipc_tree, hf_tipc_unknown_msg_type, tvb, offset, 4, ENC_BIG_ENDIAN); |
2001 | 52 | break; |
2002 | 94 | } |
2003 | | /* Sequence gap */ |
2004 | 93 | if (user == TIPC_LINK_PROTOCOL && msg_type == TIPC_LINK_PROTOCO_STATE_MSG) |
2005 | 2 | proto_tree_add_item(tipc_tree, hf_tipc_seq_gap, tvb, offset, 4, ENC_BIG_ENDIAN); |
2006 | | /* Next sent packet */ |
2007 | 93 | proto_tree_add_item(tipc_tree, hf_tipc_nxt_snt_pkg, tvb, offset, 4, ENC_BIG_ENDIAN); |
2008 | | |
2009 | 93 | offset = offset + 4; |
2010 | | /* W6 Unused */ |
2011 | 93 | proto_tree_add_none_format(tipc_tree, hf_tipc_unused_word, tvb, offset, 4, "word 6 unused for this user"); |
2012 | 93 | offset = offset + 4; |
2013 | | /* W7 */ |
2014 | 93 | if (msg_size == 28) /* No data */ |
2015 | 0 | return; |
2016 | | |
2017 | 93 | switch (user) { |
2018 | 6 | case TIPC_LINK_PROTOCOL: |
2019 | 6 | proto_tree_add_item(tipc_tree, hf_tipc_bearer_name, tvb, offset, -1, ENC_ASCII); |
2020 | 6 | break; |
2021 | 24 | case TIPC_CHANGEOVER_PROTOCOL: |
2022 | 24 | switch (msg_type) { |
2023 | 12 | case 0: /* DUPLICATE_MSG */ |
2024 | 21 | case 1: /* ORIGINAL_MSG */ |
2025 | 21 | item = proto_tree_add_uint_format(tipc_tree, hf_tipc_changeover_protocol, tvb, offset, 1, |
2026 | 21 | msg_type, "TIPC_CHANGEOVER_PROTOCOL %s (%u)", |
2027 | 21 | val_to_str_const(msg_type, tipc_cng_prot_msg_type_values, "unknown"), msg_type); |
2028 | 21 | proto_item_set_len(item, tvb_reported_length_remaining(tvb, offset)); |
2029 | 21 | data_tvb = tvb_new_subset_remaining(tvb, offset); |
2030 | 21 | col_set_fence(pinfo->cinfo, COL_INFO); |
2031 | 21 | dissect_tipc(data_tvb, pinfo, tipc_tree, NULL); |
2032 | 21 | break; |
2033 | 3 | default: |
2034 | | /* INFO_MSG: Even when there are no packets in the send queue of a removed link, the other |
2035 | | * endpoint must be informed about this fact, so it can be unblocked when it has terminated its |
2036 | | * part of the changeover procedure. This message type may be regarded as an empty |
2037 | | * ORIGINAL_MSG, where message count is zero, and no packet is wrapped inside. |
2038 | | */ |
2039 | 3 | item = proto_tree_add_uint_format(tipc_tree, hf_tipc_changeover_protocol, tvb, offset, 1, msg_type, |
2040 | 3 | "TIPC_CHANGEOVER_PROTOCOL Protocol/dissection Error"); |
2041 | 3 | proto_item_set_len(item, tvb_reported_length_remaining(tvb, offset)); |
2042 | 3 | break; |
2043 | 24 | } |
2044 | 13 | break; |
2045 | 13 | case TIPC_SEGMENTATION_MANAGER: |
2046 | 6 | save_fragmented = pinfo->fragmented; |
2047 | 6 | if (tipc_defragment) { |
2048 | 6 | pinfo->fragmented = true; |
2049 | | |
2050 | 6 | frag_msg = fragment_add_seq_next(&tipc_msg_reassembly_table, |
2051 | 6 | tvb, offset, |
2052 | 6 | pinfo, |
2053 | 6 | link_sel, /* ID for fragments belonging together - NEEDS IMPROVING? */ |
2054 | 6 | NULL, |
2055 | 6 | tvb_captured_length_remaining(tvb, offset), /* fragment length - to the end */ |
2056 | 6 | true); /* More fragments? */ |
2057 | 6 | if (msg_type == TIPC_FIRST_SEGMENT) { |
2058 | 4 | reassembled_msg_length = tvb_get_ntohl(tvb, offset) & 0x1ffff; |
2059 | | /* The number of segments needed for he complete message (Including header) will be |
2060 | | * The size of the data section of the first message, divided by the complete message size |
2061 | | * + one segment for the remainder (if any). |
2062 | | */ |
2063 | 4 | no_of_segments = reassembled_msg_length/(msg_size - 28); |
2064 | 4 | if (reassembled_msg_length > (no_of_segments * (msg_size - 28))) |
2065 | 3 | no_of_segments++; |
2066 | 4 | fragment_set_tot_len(&tipc_msg_reassembly_table, |
2067 | 4 | pinfo, link_sel, NULL, |
2068 | 4 | no_of_segments-1); |
2069 | 4 | item = proto_tree_add_bytes_format(tipc_tree, hf_tipc_data_fragment, tvb, offset, -1, NULL, "Segmented message size %u bytes -> No segments = %i", |
2070 | 4 | reassembled_msg_length, no_of_segments); |
2071 | 4 | proto_item_set_generated(item); |
2072 | 4 | } |
2073 | | |
2074 | 6 | new_tvb = process_reassembled_data(tvb, offset, pinfo, |
2075 | 6 | "Reassembled TIPC", frag_msg, &tipc_msg_frag_items, |
2076 | 6 | NULL, tipc_tree); |
2077 | | |
2078 | 6 | if (frag_msg) { /* Reassembled */ |
2079 | 1 | col_append_str(pinfo->cinfo, COL_INFO, |
2080 | 1 | " (Message Reassembled)"); |
2081 | 5 | } else { /* Not last packet of reassembled Short Message */ |
2082 | 5 | col_append_fstr(pinfo->cinfo, COL_INFO, |
2083 | 5 | " (Message fragment %u)", link_lev_seq_no); |
2084 | 5 | } |
2085 | 6 | } |
2086 | | |
2087 | 6 | if (new_tvb) { /* take it all */ |
2088 | 1 | next_tvb = new_tvb; |
2089 | 5 | } else { /* make a new subset */ |
2090 | 5 | next_tvb = tvb_new_subset_remaining(tvb, offset); |
2091 | 5 | } |
2092 | 6 | pinfo->fragmented = save_fragmented; |
2093 | 6 | if (new_tvb) { |
2094 | 1 | col_set_fence(pinfo->cinfo, COL_INFO); |
2095 | 1 | dissect_tipc(next_tvb, pinfo, tipc_tree, NULL); |
2096 | 1 | return; |
2097 | 1 | } |
2098 | | |
2099 | 5 | proto_tree_add_bytes_format(tipc_tree, hf_tipc_data_fragment, next_tvb, 0, -1, NULL, "%u bytes Data Fragment", (msg_size - 28)); |
2100 | 5 | break; |
2101 | 52 | case TIPC_MSG_BUNDLER: |
2102 | 52 | proto_tree_add_item(tipc_tree, hf_tipc_message_bundle, tvb, offset, -1, ENC_NA); |
2103 | 97 | while ((uint32_t)offset < msg_size) { |
2104 | 75 | msg_no++; |
2105 | 75 | msg_in_bundle_size = tvb_get_ntohl(tvb, offset) & 0x1FFFF; |
2106 | 75 | item = proto_tree_add_uint_format(tipc_tree, hf_tipc_msg_no_bundle, tvb, offset, 1, msg_no, "%u Message in Bundle", msg_no); |
2107 | 75 | int remaining = tvb_reported_length_remaining(tvb, offset); |
2108 | 75 | if (remaining > 0 && msg_in_bundle_size <= (unsigned)remaining) { |
2109 | 45 | proto_item_set_len(item, msg_in_bundle_size); |
2110 | 45 | data_tvb = tvb_new_subset_length(tvb, offset, msg_in_bundle_size); |
2111 | 45 | col_set_fence(pinfo->cinfo, COL_INFO); |
2112 | 45 | dissect_tipc(data_tvb, pinfo, tipc_tree, NULL); |
2113 | 45 | offset += msg_in_bundle_size; |
2114 | 45 | } else { |
2115 | 30 | proto_tree_add_expert(tipc_tree, pinfo, &ei_tipc_invalid_bundle_size, tvb, offset, 4); |
2116 | 30 | break; |
2117 | 30 | } |
2118 | 75 | } |
2119 | 52 | break; |
2120 | 4 | default: |
2121 | 4 | proto_tree_add_item(tipc_tree, hf_tipc_data, tvb, offset, -1, ENC_NA); |
2122 | 4 | break; |
2123 | 93 | } |
2124 | 93 | } |
2125 | | |
2126 | | |
2127 | | /* determines the length of a TIPC package */ |
2128 | | static unsigned |
2129 | | get_tipc_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) |
2130 | 0 | { |
2131 | 0 | return tvb_get_ntohl(tvb, offset) & 0x0001FFFF; |
2132 | 0 | } |
2133 | | |
2134 | | |
2135 | | /* triggers the dissection of TIPC-over-TCP */ |
2136 | | static int |
2137 | | dissect_tipc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data) |
2138 | 0 | { |
2139 | 0 | tcp_dissect_pdus(tvb, pinfo, parent_tree, tipc_tcp_desegment, 4, get_tipc_pdu_len, |
2140 | 0 | dissect_tipc, data); |
2141 | 0 | return tvb_captured_length(tvb); |
2142 | 0 | } |
2143 | | |
2144 | 304 | #define TIPC_MAX_RECURSION_DEPTH 10 // Arbitrary |
2145 | | static int |
2146 | | // NOLINTNEXTLINE(misc-no-recursion) |
2147 | | dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
2148 | 304 | { |
2149 | 304 | proto_item *ti, *item; |
2150 | 304 | proto_tree *tipc_tree, *tipc_data_tree; |
2151 | 304 | unsigned offset = 0; |
2152 | 304 | uint32_t srcport, destport = 0, dword; |
2153 | 304 | uint8_t version; |
2154 | 304 | uint32_t msg_size; |
2155 | 304 | uint8_t hdr_size; |
2156 | 304 | uint8_t user; |
2157 | 304 | char *addr_str_ptr; |
2158 | 304 | tvbuff_t *data_tvb, *tipc_tvb; |
2159 | 304 | bool datatype_hdr = false; |
2160 | 304 | uint8_t msg_type = 0; |
2161 | | |
2162 | | /* Make entry in Protocol column on summary display */ |
2163 | 304 | col_set_str(pinfo->cinfo, COL_PROTOCOL, "TIPC"); |
2164 | | |
2165 | 304 | col_clear(pinfo->cinfo, COL_INFO); |
2166 | | |
2167 | 304 | top_tree = tree; |
2168 | 304 | dword = tvb_get_ntohl(tvb, offset); |
2169 | 304 | version = (dword >>29) & 0xf; |
2170 | 304 | hdr_size = (dword >>21) & 0xf; |
2171 | 304 | user = (dword>>25) & 0xf; |
2172 | 304 | msg_size = dword & 0x1ffff; |
2173 | | |
2174 | 304 | unsigned recursion_depth = p_get_proto_depth(pinfo, proto_tipc); |
2175 | 304 | if (++recursion_depth >= TIPC_MAX_RECURSION_DEPTH) { |
2176 | 0 | proto_tree_add_expert(tree, pinfo, &ei_tipc_max_recursion_depth_reached, tvb, 0, 0); |
2177 | 0 | return tvb_captured_length(tvb); |
2178 | 0 | } |
2179 | 304 | p_set_proto_depth(pinfo, proto_tipc, recursion_depth); |
2180 | | |
2181 | 304 | tipc_tvb = tvb_new_subset_length(tvb, offset, msg_size); |
2182 | | /* user == 7 only works for v2, this will decode the legacy TIPC configuration protocol */ |
2183 | 304 | if (user == TIPCv2_LINK_PROTOCOL) version = TIPCv2; |
2184 | | /* Set User values in COL INFO different in V1 and V2 */ |
2185 | 304 | switch (version) { |
2186 | 46 | case 0: |
2187 | 85 | case TIPCv1: |
2188 | 85 | msg_type = tvb_get_uint8(tipc_tvb, offset + 20)>>4; |
2189 | 85 | col_append_fstr(pinfo->cinfo, COL_INFO, " %s(%u) ", val_to_str_const(user, tipc_user_values, "unknown"), user); |
2190 | | /* Set msg type in info col and find out if it's a data hdr or not */ |
2191 | 85 | datatype_hdr = tipc_v1_set_col_msgtype(pinfo, user, msg_type); |
2192 | 85 | if (datatype_hdr) { |
2193 | | /* Data type header */ |
2194 | 37 | if (hdr_size > 5 && user <4) { |
2195 | | /* W6 Originating Processor */ |
2196 | 27 | set_address_tvb(&pinfo->src, tipc_address_type, 4, tipc_tvb, offset + 24); |
2197 | | |
2198 | | /* W7 Destination Processor */ |
2199 | 27 | set_address_tvb(&pinfo->dst, tipc_address_type, 4, tipc_tvb, offset + 28); |
2200 | 27 | } else { |
2201 | | /* Short data hdr */ |
2202 | | /* W2 Previous Processor */ |
2203 | 10 | set_address_tvb(&pinfo->src, tipc_address_type, 4, tipc_tvb, offset + 8); |
2204 | 10 | } |
2205 | 48 | } else { |
2206 | | /* W2 Previous Processor */ |
2207 | 48 | set_address_tvb(&pinfo->src, tipc_address_type, 4, tipc_tvb, offset + 8); |
2208 | 48 | } |
2209 | 85 | break; |
2210 | 135 | case TIPCv2: |
2211 | 135 | msg_type = tvb_get_uint8(tipc_tvb, offset + 4)>>5; |
2212 | 135 | col_append_fstr(pinfo->cinfo, COL_INFO, "%-12s", val_to_str_const(user, tipcv2_user_short_str_vals, "unknown")); |
2213 | | /* Set msg type in info col */ |
2214 | 135 | tipc_v2_set_info_col(tvb, pinfo, user, msg_type, hdr_size); |
2215 | | |
2216 | | /* find out if it's a data hdr or not */ |
2217 | 135 | switch (user) { |
2218 | 1 | case TIPCv2_DATA_LOW: |
2219 | 7 | case TIPCv2_DATA_NORMAL: |
2220 | 10 | case TIPCv2_DATA_HIGH: |
2221 | 13 | case TIPCv2_DATA_NON_REJECTABLE: |
2222 | 13 | datatype_hdr = true; |
2223 | 13 | break; |
2224 | 119 | default: |
2225 | 119 | datatype_hdr = false; |
2226 | 119 | break; |
2227 | 135 | } |
2228 | | |
2229 | 132 | if (datatype_hdr) { |
2230 | 13 | if (hdr_size > 6) { |
2231 | | /* W6 Originating Processor */ |
2232 | 8 | set_address_tvb(&pinfo->src, tipc_address_type, 4, tipc_tvb, offset + 24); |
2233 | | |
2234 | | /* W7 Destination Processor */ |
2235 | 8 | set_address_tvb(&pinfo->dst, tipc_address_type, 4, tipc_tvb, offset + 28); |
2236 | 8 | } else { |
2237 | | /* W3 Previous Processor */ |
2238 | 5 | set_address_tvb(&pinfo->src, tipc_address_type, 4, tipc_tvb, offset + 12); |
2239 | 5 | } |
2240 | | |
2241 | 119 | } else { |
2242 | 119 | if (user != TIPCv2_NEIGHBOUR_DISCOVERY) { |
2243 | | /* W6 Originating Processor */ |
2244 | 118 | set_address_tvb(&pinfo->src, tipc_address_type, 4, tipc_tvb, offset + 24); |
2245 | | |
2246 | | /* W7 Destination Processor */ |
2247 | 118 | set_address_tvb(&pinfo->dst, tipc_address_type, 4, tipc_tvb, offset + 28); |
2248 | 118 | } else { |
2249 | | /* W2 Destination Domain */ |
2250 | 1 | set_address_tvb(&pinfo->dst, tipc_address_type, 4, tipc_tvb, offset + 8); |
2251 | | |
2252 | | /* W3 Previous Node */ |
2253 | 1 | set_address_tvb(&pinfo->src, tipc_address_type, 4, tipc_tvb, offset + 12); |
2254 | 1 | } |
2255 | 119 | } |
2256 | 132 | break; |
2257 | 84 | default: |
2258 | 84 | break; |
2259 | 304 | } |
2260 | | |
2261 | 290 | ti = proto_tree_add_item(tree, proto_tipc, tipc_tvb, offset, -1, ENC_NA); |
2262 | 290 | tipc_tree = proto_item_add_subtree(ti, ett_tipc); |
2263 | 290 | if (version == TIPCv2) { |
2264 | 126 | dissect_tipc_v2(tipc_tvb, tipc_tree, pinfo, offset, user, msg_size, hdr_size, datatype_hdr); |
2265 | 126 | p_set_proto_depth(pinfo, proto_tipc, recursion_depth - 1); |
2266 | 126 | return tvb_captured_length(tvb); |
2267 | 126 | } |
2268 | | |
2269 | | /* Word 0-2 common for all messages */ |
2270 | | /* Word 0 */ |
2271 | 164 | proto_tree_add_item(tipc_tree, hf_tipc_ver, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2272 | 164 | proto_tree_add_item(tipc_tree, hf_tipc_usr, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2273 | 164 | item = proto_tree_add_item(tipc_tree, hf_tipc_hdr_size, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2274 | 164 | proto_item_append_text(item, " = %u bytes", (hdr_size * 4)); |
2275 | 164 | proto_tree_add_item(tipc_tree, hf_tipc_nonsequenced, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2276 | 164 | proto_tree_add_item(tipc_tree, hf_tipc_unused, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2277 | 164 | if (datatype_hdr) { |
2278 | 35 | proto_tree_add_item(tipc_tree, hf_tipc_destdrop, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2279 | 35 | proto_tree_add_item(tipc_tree, hf_tipcv2_srcdrop, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2280 | 35 | } |
2281 | | |
2282 | 164 | item = proto_tree_add_item(tipc_tree, hf_tipc_msg_size, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2283 | 164 | if (msg_size < (unsigned)(hdr_size << 2)) { |
2284 | 3 | expert_add_info_format(pinfo, item, &ei_tipc_invalid_msg_size, "Invalid message size (%u bytes) < Header size (%d bytes)", msg_size, hdr_size << 2); |
2285 | 3 | THROW(ReportedBoundsError); |
2286 | 3 | } |
2287 | 164 | offset = offset + 4; |
2288 | | |
2289 | | /* Word 1 */ |
2290 | 164 | proto_tree_add_item(tipc_tree, hf_tipc_ack_link_lev_seq, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2291 | 164 | proto_tree_add_item(tipc_tree, hf_tipc_link_lev_seq, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2292 | 164 | offset = offset + 4; |
2293 | | |
2294 | | /* Word 2 */ |
2295 | 164 | dword = tvb_get_ntohl(tipc_tvb, offset); |
2296 | 164 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
2297 | 164 | proto_tree_add_string(tipc_tree, hf_tipc_prev_proc, tipc_tvb, offset, 4, addr_str_ptr); |
2298 | | |
2299 | 164 | offset = offset + 4; |
2300 | 164 | switch (user) { |
2301 | 4 | case TIPC_ROUTING_MANAGER: |
2302 | 11 | case TIPC_LINK_PROTOCOL: |
2303 | 35 | case TIPC_CHANGEOVER_PROTOCOL: |
2304 | 42 | case TIPC_SEGMENTATION_MANAGER: |
2305 | 94 | case TIPC_MSG_BUNDLER: |
2306 | 94 | dissect_tipc_int_prot_msg(tipc_tvb, pinfo, tipc_tree, offset, user, msg_size); |
2307 | 94 | p_set_proto_depth(pinfo, proto_tipc, recursion_depth - 1); |
2308 | 94 | return tvb_captured_length(tvb); |
2309 | 66 | default: |
2310 | 66 | break; |
2311 | 164 | } |
2312 | | |
2313 | 66 | proto_tree_add_item_ret_uint(tipc_tree, hf_tipc_org_port, tipc_tvb, offset, 4, ENC_BIG_ENDIAN, &srcport); |
2314 | 66 | offset = offset + 4; |
2315 | 66 | if (user != TIPC_NAME_DISTRIBUTOR) { |
2316 | 53 | proto_tree_add_item_ret_uint(tipc_tree, hf_tipc_dst_port, tipc_tvb, offset, 4, ENC_BIG_ENDIAN, &destport); |
2317 | 53 | } |
2318 | | |
2319 | 66 | conversation_set_conv_addr_port_endpoints(pinfo, &pinfo->src, &pinfo->dst, CONVERSATION_TIPC, srcport, destport); |
2320 | | |
2321 | 66 | offset = offset + 4; |
2322 | | /* 20 - 24 Bytes |
2323 | | 20 bytes: Used in subnetwork local, connection oriented messages, where error code, reroute |
2324 | | counter and activity identity are zero. A recipient finding that the header size field is 20 does |
2325 | | by default know both user (DATA), message type (CONNECTED_MSG), error code |
2326 | | (MSG_OK), reroute counter (0), and activity identity (undefined). Since no more testing for |
2327 | | this is needed these fields can be left out in the header. Furthermore, since such messages |
2328 | | only will do zero or one inter-processor hop, we know that previous processor is the real |
2329 | | origin of the message. Hence the field originating processor can be omitted. For the same |
2330 | | reason, the recipient processor will know that it is identical to destination processor, so even |
2331 | | this field can be skipped. Finally, because the link layer guarantees delivery and sequence |
2332 | | order for this single hop, even the connection sequence number is redundant. So the message |
2333 | | can just be passed directly on to the destination port. Since this type of message statistically |
2334 | | should be by far the most frequent one this small optimization pays off. |
2335 | | */ |
2336 | 66 | if (hdr_size <= 6) { |
2337 | 19 | proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA); |
2338 | 47 | } else { |
2339 | 47 | switch (user) { |
2340 | 11 | case TIPC_NAME_DISTRIBUTOR: |
2341 | 11 | proto_tree_add_item(tipc_tree, hf_tipc_nd_msg_type, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2342 | 11 | break; |
2343 | 1 | case TIPC_CONNECTION_MANAGER: |
2344 | 1 | proto_tree_add_item(tipc_tree, hf_tipc_cm_msg_type, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2345 | 1 | break; |
2346 | 33 | default: |
2347 | 33 | proto_tree_add_item(tipc_tree, hf_tipc_data_msg_type, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2348 | 33 | break; |
2349 | 47 | } |
2350 | 45 | proto_tree_add_item(tipc_tree, hf_tipc_err_code, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2351 | 45 | proto_tree_add_item(tipc_tree, hf_tipc_reroute_cnt, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2352 | 45 | proto_tree_add_item(tipc_tree, hf_tipc_act_id, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2353 | 45 | offset = offset + 4; |
2354 | | |
2355 | 45 | dword = tvb_get_ntohl(tipc_tvb, offset); |
2356 | 45 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
2357 | | |
2358 | 45 | proto_tree_add_string(tipc_tree, hf_tipc_org_proc, tipc_tvb, offset, 4, addr_str_ptr); |
2359 | 45 | offset = offset + 4; |
2360 | | |
2361 | 45 | dword = tvb_get_ntohl(tipc_tvb, offset); |
2362 | 45 | addr_str_ptr = tipc_addr_to_str(pinfo->pool, dword); |
2363 | | |
2364 | 45 | proto_tree_add_string(tipc_tree, hf_tipc_dst_proc, tipc_tvb, offset, 4, addr_str_ptr); |
2365 | 45 | offset = offset + 4; |
2366 | | /* 32 bytes |
2367 | | 32 bytes: The size of all data messages containing an explicit port identity as destination |
2368 | | address. |
2369 | | */ |
2370 | 45 | if (hdr_size > 8) { |
2371 | 18 | if (user == TIPC_NAME_DISTRIBUTOR) { |
2372 | | /* |
2373 | | Although an internal service, the name distributor uses the full 40-byte "external" data header |
2374 | | format when updating the naming table instances. This is because its messages may need |
2375 | | routing, - all system processor must contain the publications from all device processors and |
2376 | | vice versa, whether they are directly linked or not. The fields name type, name instance, and |
2377 | | destination port of that header have no meaning for such messages |
2378 | | */ |
2379 | 10 | offset = offset + 8; |
2380 | 10 | tipc_data_tree = proto_tree_add_subtree_format(tipc_tree, tvb, offset, -1, ett_tipc_data, NULL, |
2381 | 10 | "TIPC_NAME_DISTRIBUTOR %u bytes User Data", (msg_size - hdr_size*4)); |
2382 | 10 | data_tvb = tvb_new_subset_remaining(tipc_tvb, offset); |
2383 | 10 | dissect_tipc_name_dist_data(data_tvb, pinfo, tipc_data_tree, 0); |
2384 | 10 | p_set_proto_depth(pinfo, proto_tipc, recursion_depth - 1); |
2385 | 10 | return tvb_captured_length(tvb); |
2386 | 10 | } else { |
2387 | | /* Port name type / Connection level sequence number */ |
2388 | 8 | proto_tree_add_item(tipc_tree, hf_tipc_port_name_type, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2389 | 8 | offset = offset + 4; |
2390 | | /* Port name instance */ |
2391 | 8 | proto_tree_add_item(tipc_tree, hf_tipc_port_name_instance, tipc_tvb, offset, 4, ENC_BIG_ENDIAN); |
2392 | 8 | offset = offset + 4; |
2393 | 8 | } |
2394 | 18 | } |
2395 | | |
2396 | 35 | if (user < 4 && dissect_tipc_data) { /* DATA type user */ |
2397 | 29 | tvbuff_t *next_tvb; |
2398 | 29 | uint32_t msg_type32 = msg_type; |
2399 | 29 | uint32_t *name_type_p = &msg_type32; |
2400 | 29 | switch (msg_type) { |
2401 | 6 | case TIPC_CONNECTED_MSG: |
2402 | 6 | proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA); |
2403 | 6 | break; |
2404 | 2 | case TIPC_NAMED_MSG: |
2405 | 2 | proto_tree_add_item(tipc_tree, hf_tipc_named_msg_hdr, tipc_tvb, offset, 14, ENC_NA); |
2406 | 2 | proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset+14, -1, ENC_NA); |
2407 | 2 | break; |
2408 | 1 | case TIPC_DIRECT_MSG: |
2409 | 1 | proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA); |
2410 | 1 | break; |
2411 | 20 | default: |
2412 | 20 | proto_tree_add_item(tipc_tree, hf_tipc_data, tipc_tvb, offset, -1, ENC_NA); |
2413 | 20 | break; |
2414 | 29 | } |
2415 | | /* tipc data type user doesn't change format, reuse v2 function */ |
2416 | 27 | next_tvb = tvb_new_subset_remaining(tipc_tvb, offset); |
2417 | 27 | call_tipc_v2_data_subdissectors(next_tvb, pinfo, name_type_p, user); |
2418 | 27 | } |
2419 | 35 | } /*if (hdr_size <= 5) */ |
2420 | | |
2421 | 52 | p_set_proto_depth(pinfo, proto_tipc, recursion_depth - 1); |
2422 | 52 | return tvb_captured_length(tvb); |
2423 | 66 | } |
2424 | | |
2425 | | /* Register TIPC with Wireshark */ |
2426 | | void |
2427 | | proto_register_tipc(void) |
2428 | 15 | { |
2429 | 15 | static hf_register_info hf[] = { |
2430 | 15 | { &hf_tipc_msg_fragments, |
2431 | 15 | { "Message fragments", "tipc.msg.fragments", |
2432 | 15 | FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL } |
2433 | 15 | }, |
2434 | 15 | { &hf_tipc_msg_fragment, |
2435 | 15 | { "Message fragment", "tipc.msg.fragment", |
2436 | 15 | FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } |
2437 | 15 | }, |
2438 | 15 | { &hf_tipc_msg_fragment_overlap, |
2439 | 15 | { "Message fragment overlap", "tipc.msg.fragment.overlap", |
2440 | 15 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } |
2441 | 15 | }, |
2442 | 15 | { &hf_tipc_msg_fragment_overlap_conflicts, |
2443 | 15 | { "Message fragment overlapping with conflicting data", "tipc.msg.fragment.overlap.conflicts", |
2444 | 15 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } |
2445 | 15 | }, |
2446 | 15 | { &hf_tipc_msg_fragment_multiple_tails, |
2447 | 15 | { "Message has multiple tail fragments", "tipc.msg.fragment.multiple_tails", |
2448 | 15 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } |
2449 | 15 | }, |
2450 | 15 | { &hf_tipc_msg_fragment_too_long_fragment, |
2451 | 15 | { "Message fragment too long", "tipc.msg.fragment.too_long_fragment", |
2452 | 15 | FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } |
2453 | 15 | }, |
2454 | 15 | { &hf_tipc_msg_fragment_error, |
2455 | 15 | { "Message defragmentation error", "tipc.msg.fragment.error", |
2456 | 15 | FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } |
2457 | 15 | }, |
2458 | 15 | { &hf_tipc_msg_fragment_count, |
2459 | 15 | { "Message fragment count", "tipc.msg.fragment.count", |
2460 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } |
2461 | 15 | }, |
2462 | 15 | { &hf_tipc_msg_reassembled_in, |
2463 | 15 | { "Reassembled in", "tipc.msg.reassembled.in", |
2464 | 15 | FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL } |
2465 | 15 | }, |
2466 | 15 | { &hf_tipc_msg_reassembled_length, |
2467 | 15 | { "Reassembled TIPC length", "tipc.msg.reassembled.length", |
2468 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00, NULL, HFILL } |
2469 | 15 | }, |
2470 | 15 | { &hf_tipc_ver, |
2471 | 15 | { "Version", "tipc.ver", |
2472 | 15 | FT_UINT32, BASE_DEC, NULL, 0xe0000000, |
2473 | 15 | "TIPC protocol version", HFILL } |
2474 | 15 | }, |
2475 | 15 | { &hf_tipc_usr, |
2476 | 15 | { "User", "tipc.usr", |
2477 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_user_values), 0x1e000000, |
2478 | 15 | "TIPC User", HFILL } |
2479 | 15 | }, |
2480 | 15 | { &hf_tipcv2_usr, |
2481 | 15 | { "User", "tipc.usr", |
2482 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_user_values), 0x1e000000, |
2483 | 15 | "TIPC User", HFILL } |
2484 | 15 | }, |
2485 | 15 | { &hf_tipc_hdr_size, |
2486 | 15 | { "Header size", "tipc.hdr_size", |
2487 | 15 | FT_UINT32, BASE_DEC, NULL, 0x01e00000, |
2488 | 15 | "TIPC Header size", HFILL } |
2489 | 15 | }, |
2490 | 15 | { &hf_tipc_nonsequenced, |
2491 | 15 | { "Non-sequenced", "tipc.non_sequenced", |
2492 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00100000, |
2493 | 15 | "Non-sequenced Bit", HFILL } |
2494 | 15 | }, |
2495 | 15 | { &hf_tipc_destdrop, |
2496 | 15 | { "Destination Droppable", "tipc.destdrop", |
2497 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00080000, |
2498 | 15 | "Destination Droppable Bit", HFILL } |
2499 | 15 | }, |
2500 | 15 | { &hf_tipc_unused, |
2501 | 15 | { "Unused", "tipc.hdr_unused", |
2502 | 15 | FT_UINT32, BASE_DEC, NULL, 0x000e0000, |
2503 | 15 | "TIPC Unused", HFILL } |
2504 | 15 | }, |
2505 | 15 | { &hf_tipc_msg_size, |
2506 | 15 | { "Message size", "tipc.msg_size", |
2507 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0001ffff, |
2508 | 15 | "TIPC Message size", HFILL } |
2509 | 15 | }, |
2510 | 15 | { &hf_tipc_ack_link_lev_seq, |
2511 | 15 | { "Acknowledged link level sequence number", "tipc.ack_link_lev_seq", |
2512 | 15 | FT_UINT32, BASE_DEC, NULL, 0xffff0000, |
2513 | 15 | "TIPC Acknowledged link level sequence number", HFILL } |
2514 | 15 | }, |
2515 | 15 | { &hf_tipc_link_lev_seq, |
2516 | 15 | { "Link level sequence number", "tipc.link_lev_seq", |
2517 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000ffff, |
2518 | 15 | "TIPC Link level sequence number", HFILL } |
2519 | 15 | }, |
2520 | 15 | { &hf_tipc_prev_proc, |
2521 | 15 | { "Previous processor", "tipc.prev_proc", |
2522 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2523 | 15 | "TIPC Previous processor", HFILL } |
2524 | 15 | }, |
2525 | 15 | { &hf_tipc_org_port, |
2526 | 15 | { "Originating port", "tipc.org_port", |
2527 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2528 | 15 | "TIPC Originating port", HFILL } |
2529 | 15 | }, |
2530 | 15 | { &hf_tipc_dst_port, |
2531 | 15 | { "Destination port", "tipc.dst_port", |
2532 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2533 | 15 | "TIPC Destination port", HFILL } |
2534 | 15 | }, |
2535 | 15 | { &hf_tipc_data_msg_type, |
2536 | 15 | { "Message type", "tipc.msg_type", |
2537 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_data_msg_type_values), 0xf0000000, |
2538 | 15 | "TIPC Message type", HFILL } |
2539 | 15 | }, |
2540 | 15 | { &hf_tipc_err_code, |
2541 | 15 | { "Error code", "tipc.err_code", |
2542 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_error_code_values), 0x0f000000, |
2543 | 15 | "TIPC Error code", HFILL } |
2544 | 15 | }, |
2545 | 15 | { &hf_tipc_reroute_cnt, |
2546 | 15 | { "Reroute counter", "tipc.route_cnt", |
2547 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00f00000, |
2548 | 15 | "TIPC Reroute counter", HFILL } |
2549 | 15 | }, |
2550 | 15 | { &hf_tipc_act_id, |
2551 | 15 | { "Activity identity", "tipc.act_id", |
2552 | 15 | FT_UINT32, BASE_DEC, NULL, 0x000fffff, |
2553 | 15 | "TIPC Activity identity", HFILL } |
2554 | 15 | }, |
2555 | 15 | { &hf_tipc_org_proc, |
2556 | 15 | { "Originating processor", "tipc.org_proc", |
2557 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2558 | 15 | "TIPC Originating processor", HFILL } |
2559 | 15 | }, |
2560 | 15 | { &hf_tipc_dst_proc, |
2561 | 15 | { "Destination processor", "tipc.dst_proc", |
2562 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2563 | 15 | "TIPC Destination processor", HFILL } |
2564 | 15 | }, |
2565 | 15 | { &hf_tipc_unused2, |
2566 | 15 | { "Unused", "tipc.unused2", |
2567 | 15 | FT_UINT32, BASE_DEC, NULL, 0xe0000000, |
2568 | 15 | "TIPC Unused", HFILL } |
2569 | 15 | }, |
2570 | 15 | { &hf_tipc_importance, |
2571 | 15 | { "Importance", "tipc.importance", |
2572 | 15 | FT_UINT32, BASE_DEC, NULL, 0x18000000, |
2573 | 15 | "TIPC Importance", HFILL } |
2574 | 15 | }, |
2575 | 15 | { &hf_tipc_link_selector, |
2576 | 15 | { "Link selector", "tipc.link_selector", |
2577 | 15 | FT_UINT32, BASE_DEC, NULL, 0x07000000, |
2578 | 15 | "TIPC Link selector", HFILL } |
2579 | 15 | }, |
2580 | 15 | { &hf_tipc_msg_cnt, |
2581 | 15 | { "Message count", "tipc.imsg_cnt", |
2582 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00ffff00, |
2583 | 15 | "TIPC Message count", HFILL } |
2584 | 15 | }, |
2585 | 15 | { &hf_tipc_probe, |
2586 | 15 | { "Probe", "tipc.probe", |
2587 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00000040, |
2588 | 15 | "TIPC Probe", HFILL } |
2589 | 15 | }, |
2590 | 15 | { &hf_tipc_bearer_id, |
2591 | 15 | { "Bearer identity", "tipc.bearer_id", |
2592 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00000038, |
2593 | 15 | "TIPC Bearer identity", HFILL } |
2594 | 15 | }, |
2595 | 15 | { &hf_tipc_link_selector2, |
2596 | 15 | { "Link selector", "tipc.link_selector", |
2597 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00000007, |
2598 | 15 | "TIPC Link selector", HFILL } |
2599 | 15 | }, |
2600 | 15 | { &hf_tipc_remote_addr, |
2601 | 15 | { "Remote address", "tipc.remote_addr", |
2602 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2603 | 15 | "TIPC Remote address", HFILL } |
2604 | 15 | }, |
2605 | 15 | { &hf_tipc_rm_msg_type, |
2606 | 15 | { "Message type", "tipc.rm_msg_type", |
2607 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_routing_mgr_msg_type_values), 0xf0000000, |
2608 | 15 | "TIPC Message type", HFILL } |
2609 | 15 | }, |
2610 | 15 | { &hf_tipc_nd_msg_type, |
2611 | 15 | { "Message type", "tipc.nd_msg_type", |
2612 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_name_dist_msg_type_values), 0xf0000000, |
2613 | 15 | "TIPC Message type", HFILL } |
2614 | 15 | }, |
2615 | 15 | { &hf_tipc_cm_msg_type, |
2616 | 15 | { "Message type", "tipc.nd_msg_type", |
2617 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_cm_msg_type_values), 0xf0000000, |
2618 | 15 | "TIPC Message type", HFILL } |
2619 | 15 | }, |
2620 | 15 | { &hf_tipc_lp_msg_type, |
2621 | 15 | { "Message type", "tipc.lp_msg_type", |
2622 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_link_prot_msg_type_values), 0xf0000000, |
2623 | 15 | "TIPC Message type", HFILL } |
2624 | 15 | }, |
2625 | 15 | { &hf_tipc_cng_prot_msg_type, |
2626 | 15 | { "Message type", "tipc.cng_prot_msg_type", |
2627 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_cng_prot_msg_type_values), 0xf0000000, |
2628 | 15 | "TIPC Message type", HFILL } |
2629 | 15 | }, |
2630 | 15 | { &hf_tipc_sm_msg_type, |
2631 | 15 | { "Message type", "tipc.sm_msg_type", |
2632 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_sm_msg_type_values), 0xf0000000, |
2633 | 15 | "TIPC Message type", HFILL } |
2634 | 15 | }, |
2635 | 15 | { &hf_tipc_unknown_msg_type, |
2636 | 15 | { "Message type", "tipc.unknown_msg_type", |
2637 | 15 | FT_UINT32, BASE_DEC, NULL, 0xf0000000, |
2638 | 15 | "TIPC Message type", HFILL } |
2639 | 15 | }, |
2640 | 15 | { &hf_tipc_seq_gap, |
2641 | 15 | { "Sequence gap", "tipc.seq_gap", |
2642 | 15 | FT_UINT32, BASE_DEC, NULL, 0x1fff0000, |
2643 | 15 | "TIPC Sequence gap", HFILL } |
2644 | 15 | }, |
2645 | 15 | { &hf_tipc_nxt_snt_pkg, |
2646 | 15 | { "Next sent packet", "tipc.nxt_snt_pkg", |
2647 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000ffff, |
2648 | 15 | "TIPC Next sent packet", HFILL } |
2649 | 15 | }, |
2650 | 15 | { &hf_tipc_unused_word, |
2651 | 15 | { "Word Unused", "tipc.unused_word", |
2652 | 15 | FT_NONE, BASE_NONE, NULL, 0x0, |
2653 | 15 | NULL, HFILL } |
2654 | 15 | }, |
2655 | 15 | { &hf_tipc_bearer_name, |
2656 | 15 | { "Bearer name", "tipc.bearer_name", |
2657 | 15 | FT_STRINGZ, BASE_NONE, NULL, 0x0, |
2658 | 15 | "TIPC Bearer name", HFILL } |
2659 | 15 | }, |
2660 | 15 | { &hf_tipc_data, |
2661 | 15 | { "Data", "tipc.data", |
2662 | 15 | FT_BYTES, BASE_NONE, NULL, 0x0, |
2663 | 15 | NULL, HFILL } |
2664 | 15 | }, |
2665 | 15 | { &hf_tipc_msg_no_bundle, |
2666 | 15 | { "Message no. in bundle", "tipc.msg_no_bundle", |
2667 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2668 | 15 | NULL, HFILL } |
2669 | 15 | }, |
2670 | 15 | { &hf_tipc_changeover_protocol, |
2671 | 15 | { "TIPC_CHANGEOVER_PROTOCOL", "tipc.changeover_protocol", |
2672 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2673 | 15 | NULL, HFILL } |
2674 | 15 | }, |
2675 | 15 | { &hf_tipc_name_dist_type, |
2676 | 15 | { "Published port name type", "tipc.name_dist_type", |
2677 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2678 | 15 | "TIPC Published port name type", HFILL } |
2679 | 15 | }, |
2680 | 15 | { &hf_tipc_name_dist_lower, |
2681 | 15 | { "Lower bound of published sequence", "tipc.name_dist_lower", |
2682 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2683 | 15 | "TIPC Lower bound of published sequence", HFILL } |
2684 | 15 | }, |
2685 | 15 | { &hf_tipc_name_dist_upper, |
2686 | 15 | { "Upper bound of published sequence", "tipc.name_dist_upper", |
2687 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2688 | 15 | "TIPC Upper bound of published sequence", HFILL } |
2689 | 15 | }, |
2690 | 15 | { &hf_tipc_name_dist_port, |
2691 | 15 | { "Random number part of port identity", "tipc.dist_port", |
2692 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2693 | 15 | "TIPC Random number part of port identity", HFILL } |
2694 | 15 | }, |
2695 | 15 | { &hf_tipc_name_dist_key, |
2696 | 15 | { "Key (Use for verification at withdrawal)", "tipc.dist_key", |
2697 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2698 | 15 | "TIPC key", HFILL } |
2699 | 15 | }, |
2700 | 15 | { &hf_tipcv2_srcdrop, |
2701 | 15 | { "Source Droppable", "tipc.srcdrop", |
2702 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00040000, |
2703 | 15 | "Destination Droppable Bit", HFILL } |
2704 | 15 | }, |
2705 | 15 | { &hf_tipcv2_syn, |
2706 | 15 | { "Connection request (SYN)", "tipc.syn", |
2707 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00020000, |
2708 | 15 | "Destination Droppable Bit", HFILL } |
2709 | 15 | }, |
2710 | 15 | { &hf_tipcv2_data_msg_type, |
2711 | 15 | { "Message type", "tipc.data_type", |
2712 | 15 | FT_UINT32, BASE_DEC, VALS(tipc_data_msg_type_values), 0xe0000000, |
2713 | 15 | "TIPC Message type", HFILL } |
2714 | 15 | }, |
2715 | 15 | { &hf_tipcv2_bcast_mtype, |
2716 | 15 | { "Message type", "tipcv2.bcast_msg_type", |
2717 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_bcast_mtype_strings), 0xe0000000, |
2718 | 15 | "TIPC Message type", HFILL } |
2719 | 15 | }, |
2720 | 15 | { &hf_tipcv2_bundler_mtype, |
2721 | 15 | { "Message type", "tipcv2.bundler_msg_type", |
2722 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_bundler_mtype_strings), 0xe0000000, |
2723 | 15 | "TIPC Message type", HFILL } |
2724 | 15 | }, |
2725 | 15 | { &hf_tipcv2_link_mtype, |
2726 | 15 | { "Message type", "tipcv2.link_msg_type", |
2727 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_link_mtype_strings), 0xe0000000, |
2728 | 15 | "TIPC Message type", HFILL } |
2729 | 15 | }, |
2730 | 15 | { &hf_tipcv2_connmgr_mtype, |
2731 | 15 | { "Message type", "tipcv2.connmgr_msg_type", |
2732 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_connmgr_mtype_strings), 0xe0000000, |
2733 | 15 | "TIPC Message type", HFILL } |
2734 | 15 | }, |
2735 | 15 | { &hf_tipcv2_route_mtype_1_6, |
2736 | 15 | { "Message type", "tipcv2.route_msg_type", |
2737 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_route_mtype_strings_1_6), 0xe0000000, |
2738 | 15 | "TIPC Message type", HFILL } |
2739 | 15 | }, |
2740 | 15 | { &hf_tipcv2_route_mtype_1_7, |
2741 | 15 | { "Message type", "tipcv2.route_msg_type", |
2742 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_route_mtype_strings_1_7), 0xe0000000, |
2743 | 15 | "TIPC Message type", HFILL } |
2744 | 15 | }, |
2745 | 15 | { &hf_tipcv2_changeover_mtype, |
2746 | 15 | { "Message type", "tipcv2.changeover_msg_type", |
2747 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_changeover_mtype_strings), 0xe0000000, |
2748 | 15 | "TIPC Message type", HFILL } |
2749 | 15 | }, |
2750 | 15 | { &hf_tipcv2_naming_mtype, |
2751 | 15 | { "Message type", "tipcv2.naming_msg_type", |
2752 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_naming_mtype_strings), 0xe0000000, |
2753 | 15 | "TIPC Message type", HFILL } |
2754 | 15 | }, |
2755 | 15 | { &hf_tipcv2_fragmenter_mtype, |
2756 | 15 | { "Message type", "tipcv2.fragmenter_msg_type", |
2757 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_fragmenter_mtype_strings), 0xe0000000, |
2758 | 15 | "TIPC Message type", HFILL } |
2759 | 15 | }, |
2760 | 15 | { &hf_tipcv2_neighbour_mtype, |
2761 | 15 | { "Message type", "tipcv2.data_msg_type", |
2762 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_neighbour_mtype_strings), 0xe0000000, |
2763 | 15 | "TIPC Message type", HFILL } |
2764 | 15 | }, |
2765 | 15 | { &hf_tipcv2_errorcode, |
2766 | 15 | { "Error code", "tipcv2.errorcode", |
2767 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_error_code_strings), 0x1e000000, |
2768 | 15 | NULL, HFILL } |
2769 | 15 | }, |
2770 | 15 | { &hf_tipcv2_rer_cnt, |
2771 | 15 | { "Reroute Counter", "tipcv2.rer_cnt", |
2772 | 15 | FT_UINT32, BASE_DEC, NULL, 0x01e00000, |
2773 | 15 | NULL, HFILL } |
2774 | 15 | }, |
2775 | 15 | { &hf_tipcv2_lookup_scope, |
2776 | 15 | { "Lookup Scope", "tipcv2.lookup_scope", |
2777 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_lookup_or_dist_scope_strings), 0x00180000, |
2778 | 15 | NULL, HFILL } |
2779 | 15 | }, |
2780 | 15 | { &hf_tipcv2_opt_p, |
2781 | 15 | { "Options Position", "tipcv2.opt_p", |
2782 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00070000, |
2783 | 15 | NULL, HFILL } |
2784 | 15 | }, |
2785 | 15 | { &hf_tipcv2_broadcast_ack_no, |
2786 | 15 | { "Broadcast Acknowledge Number", "tipcv2.broadcast_ack_no", |
2787 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, |
2788 | 15 | NULL, HFILL } |
2789 | 15 | }, |
2790 | 15 | { &hf_tipcv2_link_level_ack_no, |
2791 | 15 | { "Link Level Acknowledge Number", "tipcv2.link_level_ack_no", |
2792 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, |
2793 | 15 | NULL, HFILL } |
2794 | 15 | }, |
2795 | 15 | { &hf_tipcv2_link_level_seq_no, |
2796 | 15 | { "Link Level Sequence Number", "tipcv2.link_level_seq_no", |
2797 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, |
2798 | 15 | NULL, HFILL } |
2799 | 15 | }, |
2800 | | #if 0 |
2801 | | { &hf_tipcv2_bcast_seq_no, |
2802 | | { "Broadcast Sequence Number", "tipcv2.bcast_seq_no", |
2803 | | FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, |
2804 | | NULL, HFILL } |
2805 | | }, |
2806 | | #endif |
2807 | 15 | { &hf_tipcv2_prev_node, |
2808 | 15 | { "Previous Node", "tipcv2.prev_node", |
2809 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2810 | 15 | "TIPC Previous Node", HFILL } |
2811 | 15 | }, |
2812 | 15 | { &hf_tipcv2_orig_node, |
2813 | 15 | { "Originating Node", "tipcv2.orig_node", |
2814 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2815 | 15 | "TIPC Originating Node", HFILL } |
2816 | 15 | }, |
2817 | 15 | { &hf_tipcv2_dest_node, |
2818 | 15 | { "Destination Node", "tipcv2.dest_node", |
2819 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2820 | 15 | "TIPC Destination Node", HFILL } |
2821 | 15 | }, |
2822 | 15 | { &hf_tipcv2_port_name_type, |
2823 | 15 | { "Port name type", "tipcv2.port_name_type", |
2824 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2825 | 15 | NULL, HFILL } |
2826 | 15 | }, |
2827 | 15 | { &hf_tipcv2_port_name_instance, |
2828 | 15 | { "Port name instance", "tipcv2.port_name_instance", |
2829 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2830 | 15 | NULL, HFILL } |
2831 | 15 | }, |
2832 | 15 | { &hf_tipcv2_multicast_lower, |
2833 | 15 | { "Multicast lower bound", "tipcv2.multicast_lower", |
2834 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2835 | 15 | "Multicast port name instance lower bound", HFILL } |
2836 | 15 | }, |
2837 | 15 | { &hf_tipcv2_multicast_upper, |
2838 | 15 | { "Multicast upper bound", "tipcv2.multicast_upper", |
2839 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2840 | 15 | "Multicast port name instance upper bound", HFILL } |
2841 | 15 | }, |
2842 | 15 | { &hf_tipcv2_sequence_gap, |
2843 | 15 | { "Sequence Gap", "tipcv2.seq_gap", |
2844 | 15 | FT_UINT32, BASE_DEC, NULL, 0x1FFF0000, |
2845 | 15 | NULL, HFILL } |
2846 | 15 | }, |
2847 | 15 | { &hf_tipcv2_next_sent_broadcast, |
2848 | 15 | { "Next Sent Broadcast", "tipcv2.next_sent_broadcast", |
2849 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, |
2850 | 15 | NULL, HFILL } |
2851 | 15 | }, |
2852 | 15 | { &hf_tipcv2_fragment_number, |
2853 | 15 | { "Fragment Number", "tipcv2.fragment_number", |
2854 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, |
2855 | 15 | NULL, HFILL } |
2856 | 15 | }, |
2857 | 15 | { &hf_tipcv2_fragment_msg_number, |
2858 | 15 | { "Fragment Message Number", "tipcv2.fragment_msg_number", |
2859 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, |
2860 | 15 | NULL, HFILL } |
2861 | 15 | }, |
2862 | 15 | { &hf_tipcv2_next_sent_packet, |
2863 | 15 | { "Next Sent Packet", "tipcv2.next_sent_packet", |
2864 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, |
2865 | 15 | NULL, HFILL } |
2866 | 15 | }, |
2867 | 15 | { &hf_tipcv2_session_no, |
2868 | 15 | { "Session Number", "tipcv2.session_no", |
2869 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, |
2870 | 15 | NULL, HFILL } |
2871 | 15 | }, |
2872 | 15 | { &hf_tipcv2_link_prio, |
2873 | 15 | { "Link Priority", "tipcv2.link_prio", |
2874 | 15 | FT_UINT32, BASE_DEC, NULL, 0x000001F0, |
2875 | 15 | NULL, HFILL } |
2876 | 15 | }, |
2877 | 15 | { &hf_tipcv2_network_plane, |
2878 | 15 | { "Network Plane", "tipcv2.network_plane", |
2879 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_networkplane_strings), 0x0000000E, |
2880 | 15 | NULL, HFILL } |
2881 | 15 | }, |
2882 | 15 | { &hf_tipcv2_probe, |
2883 | 15 | { "Probe", "tipcv2.probe", |
2884 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00000001, |
2885 | 15 | NULL, HFILL } |
2886 | 15 | }, |
2887 | 15 | { &hf_tipcv2_link_tolerance, |
2888 | 15 | { "Link Tolerance (ms)", "tipcv2.link_tolerance", |
2889 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, |
2890 | 15 | "Link Tolerance in ms", HFILL } |
2891 | 15 | }, |
2892 | 15 | { &hf_tipcv2_bearer_instance, |
2893 | 15 | { "Bearer Instance", "tipcv2.bearer_instance", |
2894 | 15 | FT_STRINGZ, BASE_NONE, NULL, 0, |
2895 | 15 | "Bearer instance used by the sender node for this link", HFILL } |
2896 | 15 | }, |
2897 | 15 | { &hf_tipcv2_padding, |
2898 | 15 | { "Padding", "tipcv2.padding", |
2899 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
2900 | 15 | NULL, HFILL } |
2901 | 15 | }, |
2902 | 15 | { &hf_tipcv2_bearer_level_orig_addr, |
2903 | 15 | { "Bearer Level Originating Address", "tipcv2.bearer_level_orig_addr", |
2904 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
2905 | 15 | NULL, HFILL } |
2906 | 15 | }, |
2907 | 15 | { &hf_tipcv2_cluster_address, |
2908 | 15 | { "Cluster Address", "tipcv2.cluster_address", |
2909 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2910 | 15 | "The remote cluster concerned by the table", HFILL } |
2911 | 15 | }, |
2912 | 15 | { &hf_tipcv2_bitmap, |
2913 | 15 | { "Bitmap", "tipcv2.bitmap", |
2914 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
2915 | 15 | "Bitmap, indicating to which nodes within that cluster the sending node has direct links", HFILL } |
2916 | 15 | }, |
2917 | 15 | { &hf_tipcv2_node_address, |
2918 | 15 | { "Node Address", "tipcv2.node_address", |
2919 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2920 | 15 | "Which node the route addition/loss concern", HFILL } |
2921 | 15 | }, |
2922 | 15 | { &hf_tipcv2_destination_domain, |
2923 | 15 | { "Destination Domain", "tipcv2.destination_domain", |
2924 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
2925 | 15 | "The domain to which the link request is directed", HFILL } |
2926 | 15 | }, |
2927 | 15 | { &hf_tipcv2_network_id, |
2928 | 15 | { "Network Identity", "tipcv2.network_id", |
2929 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2930 | 15 | "The sender node's network identity", HFILL } |
2931 | 15 | }, |
2932 | 15 | { &hf_tipcv2_bcast_tag, |
2933 | 15 | { "Broadcast Tag", "tipcv2.bcast_tag", |
2934 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, |
2935 | 15 | NULL, HFILL } |
2936 | 15 | }, |
2937 | 15 | { &hf_tipcv2_msg_count, |
2938 | 15 | { "Message Count", "tipcv2.msg_count", |
2939 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, |
2940 | 15 | NULL, HFILL } |
2941 | 15 | }, |
2942 | 15 | { &hf_tipcv2_max_packet, |
2943 | 15 | { "Max Packet", "tipcv2.max_packet", |
2944 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFFFF0000, |
2945 | 15 | NULL, HFILL } |
2946 | 15 | }, |
2947 | 15 | { &hf_tipcv2_transport_seq_no, |
2948 | 15 | { "Transport Sequence No", "tipcv2.tseq_no", |
2949 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
2950 | 15 | "Transport Level Sequence Number", HFILL } |
2951 | 15 | }, |
2952 | 15 | { &hf_tipcv2_redundant_link, |
2953 | 15 | { "Redundant Link", "tipcv2.redundant_link", |
2954 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00001000, |
2955 | 15 | NULL, HFILL } |
2956 | 15 | }, |
2957 | 15 | { &hf_tipcv2_bearer_id, |
2958 | 15 | { "Bearer identity", "tipcv2.bearer_id", |
2959 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00000e00, |
2960 | 15 | NULL, HFILL } |
2961 | 15 | }, |
2962 | 15 | { &hf_tipcv2_conn_mgr_msg_ack, /* special CONN_MANAGER payload */ |
2963 | 15 | { "Number of Messages Acknowledged", "tipcv2.conn_mgr_msg_ack", |
2964 | 15 | FT_UINT32, BASE_DEC, NULL, 0xffff0000, |
2965 | 15 | NULL, HFILL } |
2966 | 15 | }, |
2967 | 15 | { &hf_tipcv2_minor_pv, |
2968 | 15 | { "Minor protocol version", "tipcv2.minor_pv", |
2969 | 15 | FT_UINT32, BASE_DEC, NULL, 0x00ff0000, |
2970 | 15 | NULL, HFILL } |
2971 | 15 | }, |
2972 | 15 | { &hf_tipcv2_node_sig, |
2973 | 15 | { "Node signature", "tipcv2.node_sig", |
2974 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, |
2975 | 15 | NULL, HFILL } |
2976 | 15 | }, |
2977 | 15 | { &hf_tipcv2_filler_mtu_discovery, |
2978 | 15 | { "Filler for MTU discovery", "tipcv2.filler_mtu_discovery", |
2979 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
2980 | 15 | NULL, HFILL } |
2981 | 15 | }, |
2982 | 15 | { &hf_tipcv2_vendor_specific_data, |
2983 | 15 | { "Vendor specific data", "tipcv2.vendor_specific_data", |
2984 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
2985 | 15 | NULL, HFILL } |
2986 | 15 | }, |
2987 | 15 | { &hf_tipcv2_options, |
2988 | 15 | { "Options", "tipcv2.options", |
2989 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
2990 | 15 | NULL, HFILL } |
2991 | 15 | }, |
2992 | 15 | { &hf_tipc_named_msg_hdr, |
2993 | 15 | { "TIPC_NAMED_MSG Hdr", "tipc.named_msg_hdr", |
2994 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
2995 | 15 | NULL, HFILL } |
2996 | 15 | }, |
2997 | 15 | { &hf_tipc_port_name_type, |
2998 | 15 | { "Port name type / Connection level sequence number", "tipc.port_name_type", |
2999 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
3000 | 15 | NULL, HFILL } |
3001 | 15 | }, |
3002 | 15 | { &hf_tipc_port_name_instance, |
3003 | 15 | { "Port name instance", "tipc.port_name_instance", |
3004 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
3005 | 15 | NULL, HFILL } |
3006 | 15 | }, |
3007 | 15 | { &hf_tipc_data_fragment, |
3008 | 15 | { "Data fragment", "tipc.data_fragment", |
3009 | 15 | FT_BYTES, BASE_NONE, NULL, 0, |
3010 | 15 | NULL, HFILL } |
3011 | 15 | }, |
3012 | 15 | { &hf_tipc_message_bundle, |
3013 | 15 | { "Message Bundle", "tipc.message_bundle", |
3014 | 15 | FT_NONE, BASE_NONE, NULL, 0, |
3015 | 15 | NULL, HFILL } |
3016 | 15 | }, |
3017 | 15 | { &hf_tipcv2_timestamp, |
3018 | 15 | { "Timestamp", "tipcv2.timestamp", |
3019 | 15 | FT_UINT32, BASE_DEC, NULL, 0x0, |
3020 | 15 | "OS-dependent Timestamp", HFILL } |
3021 | 15 | }, |
3022 | 15 | { &hf_tipcv2_item_size, |
3023 | 15 | { "Item Size", "tipcv2.item_size", |
3024 | 15 | FT_UINT32, BASE_DEC, NULL, 0xFF000000, |
3025 | 15 | NULL, HFILL } |
3026 | 15 | }, |
3027 | 15 | { &hf_tipcv2_network_region, |
3028 | 15 | { "Network Region", "tipcv2.network_region", |
3029 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
3030 | 15 | NULL, HFILL } |
3031 | 15 | }, |
3032 | 15 | { &hf_tipcv2_local_router, |
3033 | 15 | { "Local Router", "tipcv2.local_router", |
3034 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
3035 | 15 | NULL, HFILL } |
3036 | 15 | }, |
3037 | 15 | { &hf_tipcv2_remote_router, |
3038 | 15 | { "Remote Router", "tipcv2.remote_router", |
3039 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
3040 | 15 | NULL, HFILL } |
3041 | 15 | }, |
3042 | 15 | { &hf_tipcv2_dist_dist, |
3043 | 15 | { "Route Distributor Dist", "tipcv2.dist_dist", |
3044 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_dist_dist_strings), 0x000000f0, |
3045 | 15 | NULL, HFILL } |
3046 | 15 | }, |
3047 | 15 | { &hf_tipcv2_dist_scope, |
3048 | 15 | { "Route Distributor Scope", "tipcv2.dist_scope", |
3049 | 15 | FT_UINT32, BASE_DEC, VALS(tipcv2_lookup_or_dist_scope_strings), 0x0000000f, |
3050 | 15 | NULL, HFILL } |
3051 | 15 | }, |
3052 | 15 | { &hf_tipcv2_name_dist_port_id_node, |
3053 | 15 | { "Port Id Node", "tipcv2.port_id_node", |
3054 | 15 | FT_STRING, BASE_NONE, NULL, 0x0, |
3055 | 15 | NULL, HFILL } |
3056 | 15 | }, |
3057 | 15 | { &hf_tipcv2_media_id, |
3058 | 15 | { "Media Id", "tipcv2.media_id", |
3059 | 15 | FT_UINT32, BASE_DEC, NULL, 0x000000ff, |
3060 | 15 | NULL, HFILL } |
3061 | 15 | } |
3062 | 15 | }; |
3063 | | |
3064 | | /* Setup protocol subtree array */ |
3065 | 15 | static int *ett[] = { |
3066 | 15 | &ett_tipc, |
3067 | 15 | &ett_tipc_data, |
3068 | 15 | &ett_tipc_msg_fragment, |
3069 | 15 | &ett_tipc_msg_fragments |
3070 | 15 | }; |
3071 | | |
3072 | 15 | static ei_register_info ei[] = { |
3073 | 15 | { &ei_tipc_field_not_specified, { "tipc.field_not_specified", PI_PROTOCOL, PI_WARN, "This field is not specified in TIPC v7", EXPFILL }}, |
3074 | 15 | { &ei_tipc_invalid_msg_size, { "tipc.invalid_message_size", PI_PROTOCOL, PI_WARN, "Invalid message size", EXPFILL }}, |
3075 | 15 | { &ei_tipc_invalid_bundle_size, { "tipc.invalid_bundle_size", PI_PROTOCOL, PI_WARN, "Invalid message bundle size", EXPFILL }}, |
3076 | 15 | { &ei_tipc_max_recursion_depth_reached, { "tipc.max_recursion_depth_reached", PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached. Dissection stopped.", EXPFILL }}, |
3077 | 15 | }; |
3078 | | |
3079 | 15 | module_t *tipc_module; |
3080 | 15 | expert_module_t* expert_tipc; |
3081 | | |
3082 | | /* options for the enum in the protocol preferences */ |
3083 | 15 | static const enum_val_t handle_v2_as_options[] = { |
3084 | 15 | { "all", "ALL", V2_AS_ALL }, |
3085 | 15 | { "1.5_1.6", "TIPC 1.5/1.6", V2_AS_1_6 }, |
3086 | 15 | { "1.7", "TIPC 1.7", V2_AS_1_7 }, |
3087 | 15 | { NULL, NULL, 0 } |
3088 | 15 | }; |
3089 | | |
3090 | | /* Register the protocol name and description */ |
3091 | 15 | proto_tipc = proto_register_protocol("Transparent Inter Process Communication(TIPC)", "TIPC", "tipc"); |
3092 | | |
3093 | | /* Required function calls to register the header fields and subtrees used */ |
3094 | 15 | proto_register_field_array(proto_tipc, hf, array_length(hf)); |
3095 | 15 | proto_register_subtree_array(ett, array_length(ett)); |
3096 | 15 | expert_tipc = expert_register_protocol(proto_tipc); |
3097 | 15 | expert_register_field_array(expert_tipc, ei, array_length(ei)); |
3098 | | |
3099 | | /* allow other protocols to be called according to specific values in order to |
3100 | | * dissect the protocols sent by TIPC */ |
3101 | | |
3102 | | /* this allows e.g. to dissect everything which is TIPC Data */ |
3103 | 15 | tipc_user_dissector = register_dissector_table("tipc.usr", |
3104 | 15 | "TIPC user", proto_tipc, FT_UINT8, BASE_DEC); |
3105 | | /* this allows to dissect everything which is TIPC Data and uses a specific |
3106 | | * port name type it actually does not really work because the type is not |
3107 | | * necessarily set in every data message */ |
3108 | 15 | tipc_type_dissector = register_dissector_table("tipcv2.port_name_type", |
3109 | 15 | "TIPC port name type", proto_tipc, FT_UINT32, BASE_DEC); |
3110 | | |
3111 | | /* make heuristic dissectors possible */ |
3112 | 15 | tipc_heur_subdissector_list = register_heur_dissector_list_with_description("tipc", "TIPC v2 data", proto_tipc); |
3113 | | |
3114 | | /* Register by name */ |
3115 | 15 | tipc_handle = register_dissector("tipc", dissect_tipc, proto_tipc); |
3116 | 15 | tipc_tcp_handle = register_dissector("tipc.tcp", dissect_tipc_tcp, proto_tipc); |
3117 | | |
3118 | 15 | reassembly_table_register(&tipc_msg_reassembly_table, |
3119 | 15 | &addresses_reassembly_table_functions); |
3120 | | |
3121 | | /* Register configuration options */ |
3122 | 15 | tipc_module = prefs_register_protocol(proto_tipc, NULL); |
3123 | | |
3124 | 15 | tipc_address_type = address_type_dissector_register("AT_TIPC", "TIPC Address Zone,Subnetwork,Processor", |
3125 | 15 | tipc_addr_to_str_buf, tipc_addr_str_len, NULL, NULL, NULL, NULL, NULL); |
3126 | | |
3127 | 15 | prefs_register_bool_preference(tipc_module, "defragment", |
3128 | 15 | "Reassemble TIPCv1 SEGMENTATION_MANAGER datagrams", |
3129 | 15 | "Whether TIPCv1 SEGMENTATION_MANAGER datagrams should be reassembled", |
3130 | 15 | &tipc_defragment); |
3131 | | |
3132 | 15 | prefs_register_bool_preference(tipc_module, "dissect_tipc_data", |
3133 | 15 | "Dissect TIPC data", |
3134 | 15 | "Whether to try to dissect TIPC data or not", |
3135 | 15 | &dissect_tipc_data); |
3136 | | |
3137 | 15 | prefs_register_bool_preference(tipc_module, "try_heuristic_first", |
3138 | 15 | "Try heuristic sub-dissectors first", |
3139 | 15 | "Try to decode a TIPCv2 packet using an heuristic sub-dissector before using a registered sub-dissector", |
3140 | 15 | &try_heuristic_first); |
3141 | | |
3142 | 15 | prefs_register_enum_preference(tipc_module, "handle_v2_as", |
3143 | 15 | "Handle version 2 as", |
3144 | 15 | "TIPC 1.7 removes/adds fields (not) available in TIPC 1.5/1.6 while keeping the version number 2 in the packages. \"ALL\" shows all fields that were ever used in both versions.", |
3145 | 15 | &handle_v2_as, |
3146 | 15 | handle_v2_as_options, |
3147 | 15 | true); |
3148 | | |
3149 | 15 | prefs_register_bool_preference(tipc_module, "desegment", |
3150 | 15 | "Reassemble TIPC-over-TCP messages spanning multiple TCP segments", |
3151 | 15 | "Whether the TIPC-over-TCP dissector should reassemble messages spanning multiple TCP segments. " |
3152 | 15 | "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", |
3153 | 15 | &tipc_tcp_desegment); |
3154 | 15 | } |
3155 | | |
3156 | | void |
3157 | | proto_reg_handoff_tipc(void) |
3158 | 15 | { |
3159 | 15 | dissector_add_uint("ethertype", ETHERTYPE_TIPC, tipc_handle); |
3160 | 15 | dissector_add_for_decode_as_with_preference("tcp.port", tipc_tcp_handle); |
3161 | 15 | dissector_add_uint_range_with_preference("udp.port", DEFAULT_TIPC_PORT_RANGE, tipc_handle); |
3162 | 15 | } |
3163 | | |
3164 | | /* |
3165 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
3166 | | * |
3167 | | * Local variables: |
3168 | | * c-basic-offset: 8 |
3169 | | * tab-width: 8 |
3170 | | * indent-tabs-mode: t |
3171 | | * End: |
3172 | | * |
3173 | | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
3174 | | * :indentSize=8:tabSize=8:noTabs=false: |
3175 | | */ |