1 /* packet-corosync-totemsrp.c
2 * Dissectors for totem single ring protocol implemented in corosync cluster engine
3 * Copyright 2007 2009 2010 2014 Masatake YAMATO <yamato@redhat.com>
4 * Copyright (c) 2010 2014 Red Hat, Inc.
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 /* Fields description are taken from
15 Y.AMIR, L.E.MOSER, P.M.MELLIAR-SMITH, D.A.AGARWAL, P.CIARFELLA.
16 "The Totem Single-Ring Ordering and Membership Protocol"*/
19 * NOTE: the source code at www.corosync.org looks as if it will not
20 * work with multiple OSes in a cluster if it uses IPv6, as it appears
21 * to use the OS's AF_ values in packets, and the value of AF_INET6
22 * is ***NOT*** the same in all OSes.
24 * (It'll work with IPv4, because AF_INET came out of 4.2BSD and
25 * most if not all OSes just picked up BSD's value of 2.)
27 * So we just check for all the AF_INET6 values we know about.
29 * We get the AF_ values from epan/aftypes.h, *not* from the OS
30 * we happen to be built for.
35 #include <epan/packet.h>
36 #include <epan/aftypes.h>
39 * Utilities for subdissectors of corosync_totemsrp.
41 struct corosync_totemsrp_info
{
46 /* Forward declaration we need below */
47 void proto_register_corosync_totemsrp(void);
48 void proto_reg_handoff_corosync_totemsrp(void);
50 /* Initialize the protocol and registered fields */
51 static int proto_corosync_totemsrp
;
53 static heur_dissector_list_t heur_subdissector_list
;
55 /* fields for struct message_header */
56 static int hf_corosync_totemsrp_message_header_type
;
57 static int hf_corosync_totemsrp_message_header_encapsulated
;
58 static int hf_corosync_totemsrp_message_header_endian_detector
;
59 static int hf_corosync_totemsrp_message_header_nodeid
;
61 /* fields for struct orf_token */
62 static int hf_corosync_totemsrp_orf_token
;
63 static int hf_corosync_totemsrp_orf_token_seq
;
64 static int hf_corosync_totemsrp_orf_token_token_seq
;
65 static int hf_corosync_totemsrp_orf_token_aru
;
66 static int hf_corosync_totemsrp_orf_token_aru_addr
;
67 static int hf_corosync_totemsrp_orf_token_backlog
;
68 static int hf_corosync_totemsrp_orf_token_fcc
;
69 static int hf_corosync_totemsrp_orf_token_retrnas_flg
;
70 static int hf_corosync_totemsrp_orf_token_rtr_list_entries
;
72 /* field for struct memb_ring_id */
73 static int hf_corosync_totemsrp_memb_ring_id
;
74 static int hf_corosync_totemsrp_memb_ring_id_seq
;
76 /* field for struct totem_ip_address */
77 static int hf_corosync_totemsrp_ip_address
;
78 static int hf_corosync_totemsrp_ip_address_nodeid
;
79 static int hf_corosync_totemsrp_ip_address_family
;
80 static int hf_corosync_totemsrp_ip_address_addr
;
81 static int hf_corosync_totemsrp_ip_address_addr4
;
82 static int hf_corosync_totemsrp_ip_address_addr4_padding
;
83 static int hf_corosync_totemsrp_ip_address_addr6
;
85 /* field of struct mcast */
86 static int hf_corosync_totemsrp_mcast
;
87 static int hf_corosync_totemsrp_mcast_seq
;
88 static int hf_corosync_totemsrp_mcast_this_seqno
;
89 static int hf_corosync_totemsrp_mcast_node_id
;
90 static int hf_corosync_totemsrp_mcast_system_from
;
91 static int hf_corosync_totemsrp_mcast_guarantee
;
93 /* field of struct memb_merge_detect */
94 static int hf_corosync_totemsrp_memb_merge_detect
;
96 /* field of struct struct srp_addr */
97 static int hf_corosync_totemsrp_srp_addr
;
99 /* field of struct rtr_item */
100 static int hf_corosync_totemsrp_rtr_item
;
101 static int hf_corosync_totemsrp_rtr_item_seq
;
103 /* field of struct memb_join */
104 static int hf_corosync_totemsrp_memb_join
;
105 static int hf_corosync_totemsrp_memb_join_proc_list_entries
;
106 static int hf_corosync_totemsrp_memb_join_failed_list_entries
;
107 static int hf_corosync_totemsrp_memb_join_ring_seq
;
109 /* field of struct memb_commit_token */
110 static int hf_corosync_totemsrp_memb_commit_token
;
111 static int hf_corosync_totemsrp_memb_commit_token_token_seq
;
112 static int hf_corosync_totemsrp_memb_commit_token_retrans_flg
;
113 static int hf_corosync_totemsrp_memb_commit_token_memb_index
;
114 static int hf_corosync_totemsrp_memb_commit_token_addr_entries
;
116 /* field of struct memb_commit_token_memb_entry */
117 static int hf_corosync_totemsrp_memb_commit_token_memb_entry
;
118 static int hf_corosync_totemsrp_memb_commit_token_memb_entry_aru
;
119 static int hf_corosync_totemsrp_memb_commit_token_memb_entry_high_delivered
;
120 static int hf_corosync_totemsrp_memb_commit_token_memb_entry_received_flg
;
122 /* field of struct token_hold_cancel */
123 static int hf_corosync_totemsrp_token_hold_cancel
;
125 /* Initialize the subtree pointers */
126 static int ett_corosync_totemsrp
;
127 static int ett_corosync_totemsrp_orf_token
;
128 static int ett_corosync_totemsrp_memb_ring_id
;
129 static int ett_corosync_totemsrp_ip_address
;
130 static int ett_corosync_totemsrp_mcast
;
131 static int ett_corosync_totemsrp_memb_merge_detect
;
132 static int ett_corosync_totemsrp_srp_addr
;
133 static int ett_corosync_totemsrp_rtr_item
;
134 static int ett_corosync_totemsrp_memb_join
;
135 static int ett_corosync_totemsrp_memb_commit_token
;
136 static int ett_corosync_totemsrp_memb_commit_token_memb_entry
;
137 static int ett_corosync_totemsrp_token_hold_cancel
;
138 static int ett_corosync_totemsrp_memb_join_proc_list
;
139 static int ett_corosync_totemsrp_memb_join_failed_list
;
145 #define COROSYNC_TOTEMSRP_MESSAGE_TYPE_ORF_TOKEN 0
146 #define COROSYNC_TOTEMSRP_MESSAGE_TYPE_MCAST 1
147 #define COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_MERGE_DETECT 2
148 #define COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_JOIN 3
149 #define COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_COMMIT_TOKEN 4
150 #define COROSYNC_TOTEMSRP_MESSAGE_TYPE_TOKEN_HOLD_CANCEL 5
152 static const value_string corosync_totemsrp_message_header_type
[] = {
153 { COROSYNC_TOTEMSRP_MESSAGE_TYPE_ORF_TOKEN
, "orf" },
154 { COROSYNC_TOTEMSRP_MESSAGE_TYPE_MCAST
, "mcast" },
155 { COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_MERGE_DETECT
, "merge rings" },
156 { COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_JOIN
, "join message" },
157 { COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_COMMIT_TOKEN
, "commit token" },
158 { COROSYNC_TOTEMSRP_MESSAGE_TYPE_TOKEN_HOLD_CANCEL
, "cancel" },
162 #define COROSYNC_TOTEMSRP_MESSAGE_ENCAPSULATED 1
163 #define COROSYNC_TOTEMSRP_MESSAGE_NOT_ENCAPSULATED 2
165 static const value_string corosync_totemsrp_message_header_encapsulated
[] = {
166 { 0, "not mcast message" },
167 { COROSYNC_TOTEMSRP_MESSAGE_ENCAPSULATED
, "encapsulated" },
168 { COROSYNC_TOTEMSRP_MESSAGE_NOT_ENCAPSULATED
, "not encapsulated" },
173 static const value_string corosync_totemsrp_ip_address_family
[] = {
174 { COMMON_AF_INET
, "AF_INET" },
175 { BSD_AF_INET6_BSD
, "AF_INET6 (most BSD)" },
176 { BSD_AF_INET6_FREEBSD
, "AF_INET6 (FreeBSD)" },
177 { BSD_AF_INET6_DARWIN
, "AF_INET6 (macOS and iOS)" },
178 { LINUX_AF_INET6
, "AF_INET6 (Linux)" },
179 { SOLARIS_AF_INET6
, "AF_INET6 (Solaris)" },
180 { WINSOCK_AF_INET6
, "AF_INET6 (Windows)" },
185 corosync_totemsrp_get_uint16(tvbuff_t
* tvb
, int offset
, const unsigned encoding
)
187 if (encoding
== ENC_LITTLE_ENDIAN
)
188 return tvb_get_letohs(tvb
, offset
);
190 return tvb_get_ntohs(tvb
, offset
);
195 corosync_totemsrp_get_uint32(tvbuff_t
* tvb
, int offset
, const unsigned encoding
)
197 if (encoding
== ENC_LITTLE_ENDIAN
)
198 return tvb_get_letohl(tvb
, offset
);
200 return tvb_get_ntohl(tvb
, offset
);
204 corosync_totemsrp_get_uint64(tvbuff_t
* tvb
, int offset
, const unsigned encoding
)
206 if (encoding
== ENC_LITTLE_ENDIAN
)
207 return tvb_get_letoh64(tvb
, offset
);
209 return tvb_get_ntoh64(tvb
, offset
);
213 #define COROSYNC_TOTEMSRP_SRP_ADDR_INTERFACE_MAX 2
215 static int dissect_corosync_totemsrp0(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
,
220 dissect_corosync_totemsrp_ip_address(tvbuff_t
*tvb
,
221 packet_info
*pinfo _U_
,
222 proto_tree
*parent_tree
,
223 unsigned length _U_
, int offset
,
224 const unsigned encoding
,
225 bool print_interface
,
231 int original_offset
= offset
;
236 nid
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
239 family
= corosync_totemsrp_get_uint16(tvb
, offset
+ 4, encoding
);
241 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_ip_address
, tvb
, offset
,
243 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_ip_address
);
245 proto_item_append_text(item
, " (");
247 proto_item_append_text(item
, "interface: %u; ", interface
);
249 proto_tree_add_item(tree
, hf_corosync_totemsrp_ip_address_nodeid
,
250 tvb
, offset
, 4, encoding
);
251 proto_item_append_text(item
, "node: %u)", nid
);
254 proto_tree_add_item(tree
, hf_corosync_totemsrp_ip_address_family
,
255 tvb
, offset
, 2, encoding
);
262 proto_tree_add_item(tree
, hf_corosync_totemsrp_ip_address_addr4
, tvb
, offset
, len
, ENC_BIG_ENDIAN
);
264 case BSD_AF_INET6_BSD
:
265 case BSD_AF_INET6_FREEBSD
:
266 case BSD_AF_INET6_DARWIN
:
268 case SOLARIS_AF_INET6
:
269 case WINSOCK_AF_INET6
:
270 len
= sizeof(ws_in6_addr
);
271 proto_tree_add_item(tree
, hf_corosync_totemsrp_ip_address_addr6
, tvb
, offset
, len
, ENC_NA
);
274 len
= sizeof(ws_in6_addr
);
275 proto_tree_add_item(tree
, hf_corosync_totemsrp_ip_address_addr
, tvb
, offset
, len
, ENC_NA
);
281 if (len
!= sizeof(ws_in6_addr
)) {
284 padding_len
= (int)(sizeof(ws_in6_addr
) - len
);
285 proto_tree_add_item (tree
, hf_corosync_totemsrp_ip_address_addr4_padding
,
286 tvb
, offset
, padding_len
, ENC_NA
);
287 offset
+= padding_len
;
290 proto_item_set_len(item
, offset
- original_offset
);
291 return offset
- original_offset
;
295 dissect_corosync_totemsrp_memb_ring_id(tvbuff_t
*tvb
,
296 packet_info
*pinfo
, proto_tree
*parent_tree
,
297 unsigned length
, int offset
,
298 const unsigned encoding
,
302 int original_offset
= offset
;
308 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_memb_ring_id
, tvb
, offset
,
310 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_memb_ring_id
);
312 offset
+= dissect_corosync_totemsrp_ip_address(tvb
, pinfo
, tree
,
318 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_ring_id_seq
,
319 tvb
, offset
, 8, encoding
);
320 rid
= corosync_totemsrp_get_uint64(tvb
, offset
, encoding
);
323 proto_item_append_text(item
, " (ring: %" PRIu64
")", rid
);
330 proto_item_set_len(item
, offset
- original_offset
);
331 return offset
- original_offset
;
335 dissect_corosync_totemsrp_rtr_list(tvbuff_t
*tvb
,
336 packet_info
*pinfo
, proto_tree
*parent_tree
,
337 unsigned length
, int offset
,
338 const unsigned encoding
)
340 int original_offset
= offset
;
348 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_rtr_item
, tvb
, offset
,
350 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_rtr_item
);
352 offset
+= dissect_corosync_totemsrp_memb_ring_id(tvb
, pinfo
, tree
,
358 proto_tree_add_item(tree
, hf_corosync_totemsrp_rtr_item_seq
,
359 tvb
, offset
, 4, encoding
);
361 seq
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
362 proto_item_append_text(item
, " (ring: %" PRIu64
" node: %u seq: %u)",
363 ring_id
, node_id
, seq
);
366 proto_item_set_len(item
, offset
- original_offset
);
367 return (offset
- original_offset
);
371 dissect_corosync_totemsrp_orf_token(tvbuff_t
*tvb
,
372 packet_info
*pinfo
, proto_tree
*parent_tree
,
373 unsigned length
, int offset
,
374 const unsigned encoding
)
376 int original_offset
= offset
;
377 uint32_t rtr_list_entries
= 0, seq
, aru
, i
;
383 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_orf_token
,
384 tvb
, offset
, -1, ENC_NA
);
385 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_orf_token
);
387 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_seq
,
388 tvb
, offset
, 4, encoding
);
391 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_token_seq
,
392 tvb
, offset
, 4, encoding
);
393 seq
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
396 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_aru
,
397 tvb
, offset
, 4, encoding
);
398 aru
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
401 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_aru_addr
,
402 tvb
, offset
, 4, encoding
);
405 offset
+= dissect_corosync_totemsrp_memb_ring_id(tvb
, pinfo
, tree
,
411 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_backlog
,
412 tvb
, offset
, 4, encoding
);
415 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_fcc
,
416 tvb
, offset
, 4, encoding
);
419 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_retrnas_flg
,
420 tvb
, offset
, 4, encoding
);
423 proto_tree_add_item(tree
, hf_corosync_totemsrp_orf_token_rtr_list_entries
,
424 tvb
, offset
, 4, encoding
);
425 rtr_list_entries
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
428 for (i
= 0; i
< rtr_list_entries
; i
++) {
429 offset
+= dissect_corosync_totemsrp_rtr_list(tvb
, pinfo
,
435 proto_item_append_text(item
, " (ring: %" PRIu64
" node: %u nrtr: %d seq: %d au: %u)",
436 ring_id
, node_id
, rtr_list_entries
, seq
, aru
);
438 proto_item_set_len(item
, offset
- original_offset
);
439 return offset
- original_offset
;
443 dissect_corosync_totemsrp_srp_addr(tvbuff_t
*tvb
,
444 packet_info
*pinfo
, proto_tree
*parent_tree
,
445 unsigned length
, int offset
,
447 const unsigned encoding
)
449 int original_offset
= offset
;
454 item
= proto_tree_add_item(parent_tree
, hf
? hf
: hf_corosync_totemsrp_srp_addr
, tvb
, offset
,
456 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_srp_addr
);
458 offset
+= dissect_corosync_totemsrp_ip_address(tvb
, pinfo
, tree
,
463 proto_item_append_text(item
, " (node: %u)", nodeid
);
465 offset
+= dissect_corosync_totemsrp_ip_address(tvb
, pinfo
, tree
,
471 proto_item_set_len(item
, offset
- original_offset
);
472 return (offset
- original_offset
);
476 // NOLINTNEXTLINE(misc-no-recursion)
477 dissect_corosync_totemsrp_mcast(tvbuff_t
*tvb
,
478 packet_info
*pinfo
, proto_tree
*tree
,
479 unsigned length
, int offset
,
480 uint8_t message_header__encapsulated
,
481 const unsigned encoding
, proto_tree
*parent_tree
,
482 struct corosync_totemsrp_info
*totemsrp_info
)
484 int original_offset
= offset
;
485 proto_tree
*mcast_tree
;
492 heur_dtbl_entry_t
*hdtbl_entry
= NULL
;
494 item
= proto_tree_add_item(tree
, hf_corosync_totemsrp_mcast
, tvb
, offset
,
496 mcast_tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_mcast
);
498 offset
+= dissect_corosync_totemsrp_srp_addr(tvb
, pinfo
, mcast_tree
,
500 hf_corosync_totemsrp_mcast_system_from
,
503 proto_tree_add_item(mcast_tree
, hf_corosync_totemsrp_mcast_seq
,
504 tvb
, offset
, 4, encoding
);
507 proto_tree_add_item(mcast_tree
, hf_corosync_totemsrp_mcast_this_seqno
,
508 tvb
, offset
, 4, encoding
);
511 offset
+= dissect_corosync_totemsrp_memb_ring_id(tvb
, pinfo
, mcast_tree
,
517 proto_item_append_text(item
, " (ring: %" PRIu64
" node: %u)",
520 proto_tree_add_item(tree
, hf_corosync_totemsrp_mcast_node_id
,
521 tvb
, offset
, 4, encoding
);
524 proto_tree_add_item(tree
, hf_corosync_totemsrp_mcast_guarantee
,
525 tvb
, offset
, 4, encoding
);
528 next_tvb
= tvb_new_subset_remaining(tvb
, offset
);
530 if (message_header__encapsulated
== COROSYNC_TOTEMSRP_MESSAGE_ENCAPSULATED
)
532 offset
+= dissect_corosync_totemsrp0(next_tvb
, pinfo
, tree
, true);
536 if (dissector_try_heuristic(heur_subdissector_list
,
545 proto_item_set_len(item
, offset
- original_offset
);
546 return (offset
- original_offset
);
551 dissect_corosync_totemsrp_memb_merge_detect(tvbuff_t
*tvb
,
552 packet_info
*pinfo
, proto_tree
*parent_tree
,
553 unsigned length
, int offset
,
554 const unsigned encoding
)
556 int original_offset
= offset
;
562 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_memb_merge_detect
, tvb
, offset
,
564 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_memb_merge_detect
);
566 offset
+= dissect_corosync_totemsrp_srp_addr(tvb
, pinfo
, tree
,
571 offset
+= dissect_corosync_totemsrp_memb_ring_id(tvb
, pinfo
, tree
,
577 proto_item_append_text(item
, " (ring: %" PRIu64
" node: %u)",
580 proto_item_set_len(item
, offset
- original_offset
);
581 return (offset
- original_offset
);
585 dissect_corosync_totemsrp_memb_join(tvbuff_t
*tvb
,
586 packet_info
*pinfo
, proto_tree
*parent_tree
,
587 unsigned length
, int offset
,
588 const unsigned encoding
)
590 int original_offset
= offset
;
594 uint32_t proc_list_entries
;
595 proto_tree
*proc_tree
;
597 uint32_t failed_list_entries
;
598 proto_tree
*failed_tree
;
599 proto_item
*failed_item
;
603 proto_item
*proc_item
;
605 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_memb_join
, tvb
, offset
,
607 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_memb_join
);
610 offset
+= dissect_corosync_totemsrp_srp_addr(tvb
, pinfo
, tree
,
615 proc_item
= proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_join_proc_list_entries
,
616 tvb
, offset
, 4, encoding
);
617 proc_list_entries
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
620 failed_item
= proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_join_failed_list_entries
,
621 tvb
, offset
, 4, encoding
);
622 failed_list_entries
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
625 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_join_ring_seq
,
626 tvb
, offset
, 8, encoding
);
629 proc_tree
= proto_item_add_subtree(proc_item
, ett_corosync_totemsrp_memb_join_proc_list
);
631 proto_item_append_text(item
, " (nprocs: %u nfailed: %u)",
632 proc_list_entries
, failed_list_entries
);
634 for (i
= 0; i
< proc_list_entries
; i
++) {
635 offset
+= dissect_corosync_totemsrp_srp_addr(tvb
, pinfo
, proc_tree
,
641 failed_tree
= proto_item_add_subtree(failed_item
,
642 ett_corosync_totemsrp_memb_join_failed_list
);
644 for (i
= 0; i
< failed_list_entries
; i
++) {
645 offset
+= dissect_corosync_totemsrp_srp_addr(tvb
, pinfo
, failed_tree
,
651 proto_item_set_len(item
, offset
- original_offset
);
652 return (offset
- original_offset
);
656 dissect_corosync_totemsrp_memb_commit_token_memb_entry(tvbuff_t
*tvb
,
658 proto_tree
*parent_tree
,
659 unsigned length
, int offset
,
660 const unsigned encoding
,
664 int original_offset
= offset
;
669 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_memb_commit_token_memb_entry
,
670 tvb
, offset
, -1, encoding
);
671 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_memb_commit_token_memb_entry
);
674 offset
+= dissect_corosync_totemsrp_memb_ring_id(tvb
, pinfo
, tree
,
680 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_commit_token_memb_entry_aru
,
681 tvb
, offset
, 4, encoding
);
684 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_commit_token_memb_entry_high_delivered
,
685 tvb
, offset
, 4, encoding
);
688 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_commit_token_memb_entry_received_flg
,
689 tvb
, offset
, 4, encoding
);
692 proto_item_set_len(item
, offset
- original_offset
);
693 return (offset
- original_offset
);
697 dissect_corosync_totemsrp_memb_commit_token(tvbuff_t
*tvb
,
698 packet_info
*pinfo
, proto_tree
*parent_tree
,
699 unsigned length
, int offset
,
700 const unsigned encoding
)
702 int original_offset
= offset
;
706 uint32_t i
, addr_entries
;
712 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_memb_commit_token
,
713 tvb
, offset
, -1, ENC_NA
);
714 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_memb_commit_token
);
716 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_commit_token_token_seq
,
717 tvb
, offset
, 4, encoding
);
718 seq
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
721 offset
+= dissect_corosync_totemsrp_memb_ring_id(tvb
, pinfo
, tree
,
727 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_commit_token_retrans_flg
,
728 tvb
, offset
, 4, encoding
);
731 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_commit_token_memb_index
,
732 tvb
, offset
, 4, encoding
);
735 proto_tree_add_item(tree
, hf_corosync_totemsrp_memb_commit_token_addr_entries
,
736 tvb
, offset
, 4, encoding
);
737 addr_entries
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
740 for (i
= 0; i
< addr_entries
; i
++) {
741 offset
+= dissect_corosync_totemsrp_srp_addr(tvb
, pinfo
, tree
,
747 for (i
= 0; i
< addr_entries
; i
++) {
748 offset
+= dissect_corosync_totemsrp_memb_commit_token_memb_entry(tvb
, pinfo
, tree
,
755 proto_item_append_text(item
, " (ring: %" PRIu64
" node: %u seq: %u entries: %u)",
756 ring_id
, node_id
, seq
, addr_entries
);
758 proto_item_set_len(item
, offset
- original_offset
);
759 return (offset
- original_offset
);
763 dissect_corosync_totemsrp_token_hold_cancel(tvbuff_t
*tvb
,
764 packet_info
*pinfo
, proto_tree
*parent_tree
,
765 unsigned length
, int offset
,
766 const unsigned encoding
)
768 int original_offset
= offset
;
774 item
= proto_tree_add_item(parent_tree
, hf_corosync_totemsrp_token_hold_cancel
, tvb
, offset
,
776 tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp_token_hold_cancel
);
778 offset
+= dissect_corosync_totemsrp_memb_ring_id(tvb
, pinfo
, tree
,
784 proto_item_append_text(item
, " (ring: %" PRIu64
" node: %u)",
787 proto_item_set_len(item
, offset
- original_offset
);
788 return (offset
- original_offset
);
792 dissect_corosync_totemsrp(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*parent_tree
, void* data _U_
)
794 return dissect_corosync_totemsrp0(tvb
, pinfo
, parent_tree
, false);
797 #define COROSYNC_TOTEMSRP_TEST_LITTLE_ENDIAN 0x22FF
798 #define COROSYNC_TOTEMSRP_TEST_BIG_ENDIAN 0xFF22
801 // NOLINTNEXTLINE(misc-no-recursion)
802 dissect_corosync_totemsrp0(tvbuff_t
*tvb
,
803 packet_info
*pinfo
, proto_tree
*tree
,
809 uint16_t endian_test
;
810 proto_tree
*corosync_tree
;
812 uint8_t message_header__type
;
813 uint8_t message_header__encapsulated
;
816 struct corosync_totemsrp_info info
;
818 /* Check that there's enough data */
819 length
= tvb_reported_length(tvb
);
820 if (length
< 1 + 1 + 2 + 4)
824 message_header__type
= tvb_get_uint8(tvb
, 0);
825 if (message_header__type
> 5)
828 message_header__encapsulated
= tvb_get_uint8(tvb
, 1);
830 /* message_header -- byte order checking */
831 endian_test
= tvb_get_ntohs(tvb
, 2);
832 if (endian_test
== COROSYNC_TOTEMSRP_TEST_LITTLE_ENDIAN
)
833 encoding
= ENC_LITTLE_ENDIAN
;
834 else if (endian_test
== COROSYNC_TOTEMSRP_TEST_BIG_ENDIAN
)
835 encoding
= ENC_BIG_ENDIAN
;
839 if (encapsulated
== false)
841 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "COROSYNC/TOTEMSRP");
842 col_set_str(pinfo
->cinfo
, COL_INFO
,
843 ((message_header__type
== COROSYNC_TOTEMSRP_MESSAGE_TYPE_MCAST
)
844 && (message_header__encapsulated
== COROSYNC_TOTEMSRP_MESSAGE_ENCAPSULATED
))?
846 val_to_str_const(message_header__type
,
847 corosync_totemsrp_message_header_type
,
851 item
= proto_tree_add_item(tree
, proto_corosync_totemsrp
, tvb
, offset
, -1, ENC_NA
);
852 corosync_tree
= proto_item_add_subtree(item
, ett_corosync_totemsrp
);
854 proto_tree_add_item(corosync_tree
, hf_corosync_totemsrp_message_header_type
,
855 tvb
, offset
, 1, ENC_NA
);
858 proto_tree_add_item(corosync_tree
, hf_corosync_totemsrp_message_header_encapsulated
,
859 tvb
, offset
, 1, ENC_NA
);
862 proto_tree_add_item(corosync_tree
, hf_corosync_totemsrp_message_header_endian_detector
,
863 tvb
, offset
, 2, encoding
);
866 proto_tree_add_item(corosync_tree
,
867 hf_corosync_totemsrp_message_header_nodeid
,
868 tvb
, offset
, 4, encoding
);
869 info
.encoding
= encoding
;
870 info
.nodeid
= corosync_totemsrp_get_uint32(tvb
, offset
, encoding
);
873 increment_dissection_depth(pinfo
);
874 switch (message_header__type
) {
875 case COROSYNC_TOTEMSRP_MESSAGE_TYPE_ORF_TOKEN
:
876 dissect_corosync_totemsrp_orf_token(tvb
, pinfo
, corosync_tree
, length
, offset
, encoding
);
878 case COROSYNC_TOTEMSRP_MESSAGE_TYPE_MCAST
:
879 dissect_corosync_totemsrp_mcast(tvb
, pinfo
, corosync_tree
, length
, offset
,
880 message_header__encapsulated
,
881 encoding
, tree
, &info
);
883 case COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_MERGE_DETECT
:
884 dissect_corosync_totemsrp_memb_merge_detect(tvb
, pinfo
, corosync_tree
, length
, offset
,
887 case COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_JOIN
:
888 dissect_corosync_totemsrp_memb_join(tvb
, pinfo
, corosync_tree
, length
, offset
,
891 case COROSYNC_TOTEMSRP_MESSAGE_TYPE_MEMB_COMMIT_TOKEN
:
892 dissect_corosync_totemsrp_memb_commit_token(tvb
, pinfo
, corosync_tree
, length
, offset
,
895 case COROSYNC_TOTEMSRP_MESSAGE_TYPE_TOKEN_HOLD_CANCEL
:
896 dissect_corosync_totemsrp_token_hold_cancel(tvb
, pinfo
, corosync_tree
, length
, offset
,
902 decrement_dissection_depth(pinfo
);
908 proto_register_corosync_totemsrp(void)
910 static hf_register_info hf
[] = {
912 { &hf_corosync_totemsrp_message_header_type
,
913 { "Type", "corosync_totemsrp.message_header.type",
914 FT_INT8
, BASE_DEC
, VALS(corosync_totemsrp_message_header_type
), 0x0,
916 { &hf_corosync_totemsrp_message_header_encapsulated
,
917 { "Encapsulated", "corosync_totemsrp.message_header.encapsulated",
918 FT_INT8
, BASE_DEC
, VALS(corosync_totemsrp_message_header_encapsulated
), 0x0,
920 { &hf_corosync_totemsrp_message_header_endian_detector
,
921 { "Endian detector", "corosync_totemsrp.message_header.endian_detector",
922 FT_UINT16
, BASE_HEX
, NULL
, 0x0,
924 { &hf_corosync_totemsrp_message_header_nodeid
,
925 { "Node ID", "corosync_totemsrp.message_header.nodeid",
926 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
930 { &hf_corosync_totemsrp_orf_token
,
931 { "Ordering, Reliability, Flow (ORF) control Token", "corosync_totemsrp.orf_token",
932 FT_NONE
, BASE_NONE
, NULL
, 0x0,
934 { &hf_corosync_totemsrp_orf_token_seq
,
935 { "Sequence number allowing recognition of redundant copies of the token", "corosync_totemsrp.orf_token.seq",
936 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
938 { &hf_corosync_totemsrp_orf_token_token_seq
,
939 { "The largest sequence number", "corosync_totemsrp.orf_token.seq",
940 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
941 "The largest sequence number of any message "
942 "that has been broadcast on the ring"
945 { &hf_corosync_totemsrp_orf_token_aru
,
946 { "Sequence number all received up to", "corosync_totemsrp.orf_token.aru",
947 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
949 { &hf_corosync_totemsrp_orf_token_aru_addr
,
950 { "ID of node setting ARU", "corosync_totemsrp.orf_token.aru_addr",
951 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
953 { &hf_corosync_totemsrp_orf_token_backlog
,
954 { "Backlog", "corosync_totemsrp.orf_token.backlog",
955 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
956 "The sum of the number of new message waiting to be transmitted by each processor on the ring "
957 "at the time at which that processor forwarded the token during the previous rotation"
960 { &hf_corosync_totemsrp_orf_token_fcc
,
962 "corosync_totemsrp.orf_token.fcc",
963 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
964 "A count of the number of messages broadcast by all processors "
965 "during the previous rotation of the token"
968 { &hf_corosync_totemsrp_orf_token_retrnas_flg
,
969 { "Retransmission flag", "corosync_totemsrp.orf_token.retrans_flg",
970 FT_INT32
, BASE_DEC
, NULL
, 0x0,
972 { &hf_corosync_totemsrp_orf_token_rtr_list_entries
,
973 { "The number of retransmission list entries", "corosync_totemsrp.orf_token.rtr_list_entries",
974 FT_INT32
, BASE_DEC
, NULL
, 0x0,
978 { &hf_corosync_totemsrp_memb_ring_id
,
979 { "Member ring id", "corosync_totemsrp.memb_ring_id",
980 FT_NONE
, BASE_NONE
, NULL
, 0x0,
982 { &hf_corosync_totemsrp_memb_ring_id_seq
,
983 { "Sequence in member ring id", "corosync_totemsrp.memb_ring_id.seq",
984 FT_UINT64
, BASE_DEC
, NULL
, 0x0,
987 /* totem_ip_address */
988 { &hf_corosync_totemsrp_ip_address
,
989 { "Node IP address", "corosync_totemsrp.ip_address",
990 FT_NONE
, BASE_NONE
, NULL
, 0x0,
992 { &hf_corosync_totemsrp_ip_address_nodeid
,
993 { "Node ID", "corosync_totemsrp.ip_address.nodeid",
994 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
996 { &hf_corosync_totemsrp_ip_address_family
,
997 { "Address family", "corosync_totemsrp.ip_address.family",
998 FT_UINT16
, BASE_DEC
, VALS(corosync_totemsrp_ip_address_family
), 0x0,
1000 { &hf_corosync_totemsrp_ip_address_addr
,
1001 { "Address", "corosync_totemsrp.ip_address.addr",
1002 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1004 { &hf_corosync_totemsrp_ip_address_addr4
,
1005 { "Address", "corosync_totemsrp.ip_address.addr4",
1006 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
1008 { &hf_corosync_totemsrp_ip_address_addr4_padding
,
1009 { "Address padding", "corosync_totemsrp.ip_address.addr4_padding",
1010 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1012 { &hf_corosync_totemsrp_ip_address_addr6
,
1013 { "Address", "corosync_totemsrp.ip_address.addr6",
1014 FT_IPv6
, BASE_NONE
, NULL
, 0x0,
1018 { &hf_corosync_totemsrp_mcast
,
1019 { "ring ordered multicast message", "corosync_totemsrp.mcast",
1020 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1022 { &hf_corosync_totemsrp_mcast_seq
,
1023 {"Multicast sequence number", "corosync_totemsrp.mcast.seq",
1024 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1026 { &hf_corosync_totemsrp_mcast_this_seqno
,
1027 {"This Sequence number", "corosync_totemsrp.mcast.this_seqno",
1028 FT_INT32
, BASE_DEC
, NULL
, 0x0,
1030 { &hf_corosync_totemsrp_mcast_node_id
,
1031 {"Node id(unused?)", "corosync_totemsrp.mcast.node_id",
1032 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1034 { &hf_corosync_totemsrp_mcast_system_from
,
1035 {"System from address", "corosync_totemsrp.mcast.system_from",
1036 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1039 { &hf_corosync_totemsrp_mcast_guarantee
,
1040 {"Guarantee", "corosync_totemsrp.mcast.guarantee",
1041 FT_INT32
, BASE_DEC
, NULL
, 0x0,
1044 /* memb_merge_detect */
1045 { &hf_corosync_totemsrp_memb_merge_detect
,
1046 { "Merge rings if there are available rings", "corosync_totemsrp.memb_merge_detect",
1047 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1051 { &hf_corosync_totemsrp_srp_addr
,
1052 {"Single Ring Protocol Address", "corosync_totemsrp.srp_addr",
1053 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1057 { &hf_corosync_totemsrp_rtr_item
,
1058 {"Retransmission Item", "corosync_totemsrp.rtr_item",
1059 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1061 { &hf_corosync_totemsrp_rtr_item_seq
,
1062 {"Sequence of Retransmission Item", "corosync_totemsrp.rtr_item.seq",
1063 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1067 { &hf_corosync_totemsrp_memb_join
,
1068 {"Membership join message", "corosync_totemsrp.memb_join",
1069 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1071 { &hf_corosync_totemsrp_memb_join_proc_list_entries
,
1072 {"The number of processor list entries", "corosync_totemsrp.memb_join.proc_list_entries",
1073 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1075 { &hf_corosync_totemsrp_memb_join_failed_list_entries
,
1076 {"The number of failed list entries", "corosync_totemsrp.memb_join.failed_list_entries",
1077 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1079 { &hf_corosync_totemsrp_memb_join_ring_seq
,
1080 {"Ring sequence number", "corosync_totemsrp.memb_join.ring_seq",
1081 FT_UINT64
, BASE_DEC
, NULL
, 0x0,
1084 /* memb_commit_token */
1085 { &hf_corosync_totemsrp_memb_commit_token
,
1086 {"Membership commit token", "corosync_totemsrp.memb_commit_token",
1087 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1089 { &hf_corosync_totemsrp_memb_commit_token_token_seq
,
1090 {"Token sequence", "corosync_totemsrp.memb_commit_token.token_seq",
1091 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1093 { &hf_corosync_totemsrp_memb_commit_token_retrans_flg
,
1094 {"Retransmission flag", "corosync_totemsrp.memb_commit_token.retrans_flg",
1095 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1097 { &hf_corosync_totemsrp_memb_commit_token_memb_index
,
1098 {"Member index", "corosync_totemsrp.memb_commit_token.memb_index",
1099 FT_INT32
, BASE_DEC
, NULL
, 0x0,
1101 { &hf_corosync_totemsrp_memb_commit_token_addr_entries
,
1102 {"The number of address entries", "corosync_totemsrp.memb_commit_token.addr_entries",
1103 FT_INT32
, BASE_DEC
, NULL
, 0x0,
1106 /* memb_commit_token_memb_entry */
1107 { &hf_corosync_totemsrp_memb_commit_token_memb_entry
,
1108 { "Membership entry", "corosync_totemsrp.memb_commit_token_memb_entry",
1109 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1111 { &hf_corosync_totemsrp_memb_commit_token_memb_entry_aru
,
1112 {"Sequence number all received up to", "corosync_totemsrp.memb_commit_token_memb_entry.aru",
1113 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1115 { &hf_corosync_totemsrp_memb_commit_token_memb_entry_high_delivered
,
1116 {"High delivered", "corosync_totemsrp.memb_commit_token_memb_entry.high_delivered",
1117 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1119 { &hf_corosync_totemsrp_memb_commit_token_memb_entry_received_flg
,
1120 {"Received flag", "corosync_totemsrp.memb_commit_token_memb_entry.received_flg",
1121 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1124 /* token_hold_cancel */
1125 { &hf_corosync_totemsrp_token_hold_cancel
,
1126 {"Hold cancel token", "corosync_totemsrp.token_hold_cancel",
1127 FT_NONE
, BASE_NONE
, NULL
, 0x0,
1131 static int *ett
[] = {
1132 &ett_corosync_totemsrp
,
1133 &ett_corosync_totemsrp_orf_token
,
1134 &ett_corosync_totemsrp_memb_ring_id
,
1135 &ett_corosync_totemsrp_ip_address
,
1136 &ett_corosync_totemsrp_mcast
,
1137 &ett_corosync_totemsrp_memb_merge_detect
,
1138 &ett_corosync_totemsrp_srp_addr
,
1139 &ett_corosync_totemsrp_rtr_item
,
1140 &ett_corosync_totemsrp_memb_join
,
1141 &ett_corosync_totemsrp_memb_commit_token
,
1142 &ett_corosync_totemsrp_memb_commit_token_memb_entry
,
1143 &ett_corosync_totemsrp_token_hold_cancel
,
1144 &ett_corosync_totemsrp_memb_join_proc_list
,
1145 &ett_corosync_totemsrp_memb_join_failed_list
1149 proto_corosync_totemsrp
= proto_register_protocol("Totem Single Ring Protocol implemented in Corosync Cluster Engine",
1150 "COROSYNC/TOTEMSRP", "corosync_totemsrp");
1151 proto_register_field_array(proto_corosync_totemsrp
, hf
, array_length(hf
));
1152 proto_register_subtree_array(ett
, array_length(ett
));
1154 heur_subdissector_list
= register_heur_dissector_list_with_description("corosync_totemsrp.mcast", "COROSYNC/TOTEMSRP multicast data", proto_corosync_totemsrp
);
1156 register_dissector( "corosync_totemsrp", dissect_corosync_totemsrp
, proto_corosync_totemsrp
);
1160 proto_reg_handoff_corosync_totemsrp(void)
1162 /* Nothing to be done.
1163 dissect_corosync_totemsrp is directly called from corosync_totemnet dissector. */
1168 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1173 * indent-tabs-mode: nil
1176 * vi: set shiftwidth=2 tabstop=8 expandtab:
1177 * :indentSize=2:tabSize=8:noTabs=true: