4 * Routines for OCFS2's networking protocol disassembly (o2net and o2dlm)
5 * The OCFS2 cluster file system is available in the mainline Linux kernel.
7 * Copyright (C) 2006, 2011 Oracle. All rights reserved.
10 * Kurt Hackel <kurt.hackel@oracle.com>
11 * Zach Brown <zach.brown@oracle.com>
12 * Sunil Mushran <sunil.mushran@oracle.com>
13 * Jeff Liu <jeff.liu@oracle.com>
15 * SPDX-License-Identifier: GPL-2.0-or-later
21 #include <epan/packet.h>
22 #include "packet-tcp.h"
24 void proto_register_ocfs2(void);
25 void proto_reg_handoff_ocfs2(void);
27 static gint ett_ocfs2 = -1;
28 static gint ett_dtm_lock_flags = -1;
29 static gint ett_mres_flags = -1;
30 static gint ett_migrate_lockres_locks = -1;
31 static gint ett_query_nodeinfo = -1;
33 static int proto_ocfs2 = -1;
34 static int hf_msg_magic = -1;
35 static int hf_msg_data_len = -1;
36 static int hf_msg_msg_type = -1;
37 static int hf_msg_sys_status = -1;
38 static int hf_msg_status = -1;
39 static int hf_msg_key = -1;
40 static int hf_msg_msg_num = -1;
41 static int hf_msg_pad = -1;
43 static int hf_dlm_node_idx = -1;
44 static int hf_dlm_lock_flags = -1;
45 static int hf_dlm_lock_flag_unused1 = -1;
46 static int hf_dlm_lock_flag_orphan = -1;
47 static int hf_dlm_lock_flag_parentable = -1;
48 static int hf_dlm_lock_flag_block = -1;
49 static int hf_dlm_lock_flag_local = -1;
50 static int hf_dlm_lock_flag_valblk = -1;
51 static int hf_dlm_lock_flag_noqueue = -1;
52 static int hf_dlm_lock_flag_convert = -1;
53 static int hf_dlm_lock_flag_nodlckwt = -1;
54 static int hf_dlm_lock_flag_unlock = -1;
55 static int hf_dlm_lock_flag_cancel = -1;
56 static int hf_dlm_lock_flag_deqall = -1;
57 static int hf_dlm_lock_flag_invvalblk = -1;
58 static int hf_dlm_lock_flag_syncsts = -1;
59 static int hf_dlm_lock_flag_timeout = -1;
60 static int hf_dlm_lock_flag_sngldlck = -1;
61 static int hf_dlm_lock_flag_findlocal = -1;
62 static int hf_dlm_lock_flag_proc_owned = -1;
63 static int hf_dlm_lock_flag_xid = -1;
64 static int hf_dlm_lock_flag_xid_conflict = -1;
65 static int hf_dlm_lock_flag_force = -1;
66 static int hf_dlm_lock_flag_revvalblk = -1;
67 static int hf_dlm_lock_flag_unused2 = -1;
68 static int hf_dlm_lock_flag_migration = -1;
69 static int hf_dlm_lock_flag_put_lvb = -1;
70 static int hf_dlm_lock_flag_get_lvb = -1;
71 static int hf_dlm_lock_flag_recovery = -1;
72 static int hf_dlm_am_flags = -1;
73 static int hf_dlm_fr_flags = -1;
74 static int hf_dlm_namelen = -1;
75 static int hf_dlm_name = -1;
76 static int hf_dlm_cookie = -1;
77 static int hf_dlm_requested_type = -1;
78 static int hf_dlm_lvb1 = -1;
79 static int hf_dlm_lvb2 = -1;
80 static int hf_dlm_lvb3 = -1;
81 static int hf_dlm_ast_type = -1;
82 static int hf_dlm_blocked_type = -1;
83 static int hf_dlm_dead_node = -1;
84 static int hf_dlm_domain_name_len = -1;
85 static int hf_dlm_domain_name = -1;
86 static int hf_dlm_proto_ver = -1;
87 static int hf_dlm_fs_proto_ver = -1;
88 static int hf_dlm_node_map = -1;
89 static int hf_dlm_master = -1;
90 static int hf_dlm_new_master = -1;
91 static int hf_dlm_mres_num_locks = -1;
92 static int hf_dlm_mres_flags = -1;
93 static int hf_dlm_mres_flag_recovery = -1;
94 static int hf_dlm_mres_flag_migration = -1;
95 static int hf_dlm_mres_flag_all_done = -1;
96 static int hf_dlm_mres_total_locks = -1;
97 static int hf_dlm_mres_mig_cookie = -1;
98 static int hf_dlm_mres_list = -1;
99 static int hf_dlm_mres_ml_flags = -1;
100 static int hf_dlm_mres_type = -1;
101 static int hf_dlm_mres_convert_type = -1;
102 static int hf_dlm_mres_highest_blocked = -1;
103 static int hf_dlm_mres_node = -1;
104 static int hf_dlm_qr_node = -1;
105 static int hf_dlm_qr_numregions = -1;
106 static int hf_dlm_qr_namelen = -1;
107 static int hf_dlm_qr_domain = -1;
108 static int hf_dlm_qr_region = -1;
109 static int hf_dlm_qn_nodenum = -1;
110 static int hf_dlm_qn_numnodes = -1;
111 static int hf_dlm_qn_namelen = -1;
112 static int hf_dlm_qn_domain = -1;
113 static int hf_dlm_qn_node = -1;
114 static int hf_dlm_qn_port = -1;
115 static int hf_dlm_qn_ip = -1;
116 static int hf_dlm_reco_lvb = -1;
117 static int hf_dlm_pad8 = -1;
118 static int hf_dlm_pad16 = -1;
119 static int hf_dlm_pad32 = -1;
120 static int hf_dlm_flags = -1;
121 static int hf_dlm_payload = -1;
123 #define O2NM_MAX_NAME_LEN 64
124 #define O2NM_NODE_MAP_IN_BYTES 32
126 #define OCFS2_DENTRY_LOCK_INO_START 18
129 * generic o2net constants
132 #define O2NET_MSG_MAGIC 0xfa55
133 #define O2NET_MSG_STATUS_MAGIC 0xfa56
134 #define O2NET_MSG_KEEP_REQ_MAGIC 0xfa57
135 #define O2NET_MSG_KEEP_RESP_MAGIC 0xfa58
136 static const value_string o2net_magic[] = {
137 { O2NET_MSG_MAGIC, "Request" },
138 { O2NET_MSG_STATUS_MAGIC, "Response" },
139 { O2NET_MSG_KEEP_REQ_MAGIC, "Keepalive Request" },
140 { O2NET_MSG_KEEP_RESP_MAGIC, "Keepalive Response" },
145 #define DLM_LVB_LEN 64
146 #define DLM_MOD_KEY (0x666c6172)
149 enum dlm_query_join_response {
153 JOIN_PROTOCOL_MISMATCH
169 static const value_string dlm_lock_modes[] = {
170 { LKM_IVMODE, "IV" },
171 { LKM_NLMODE, "NL" },
172 { LKM_CRMODE, "CR" },
173 { LKM_CWMODE, "CW" },
174 { LKM_PRMODE, "PR" },
175 { LKM_PWMODE, "PW" },
176 { LKM_EXMODE, "EX" },
180 /* DLM message types */
182 DLM_MASTER_REQUEST_MSG = 500,
183 DLM_UNUSED_MSG1 = 501,
184 DLM_ASSERT_MASTER_MSG = 502,
185 DLM_CREATE_LOCK_MSG = 503,
186 DLM_CONVERT_LOCK_MSG = 504,
187 DLM_PROXY_AST_MSG = 505,
188 DLM_UNLOCK_LOCK_MSG = 506,
189 DLM_DEREF_LOCKRES_MSG = 507,
190 DLM_MIGRATE_REQUEST_MSG = 508,
191 DLM_MIG_LOCKRES_MSG = 509,
192 DLM_QUERY_JOIN_MSG = 510,
193 DLM_ASSERT_JOINED_MSG = 511,
194 DLM_CANCEL_JOIN_MSG = 512,
195 DLM_EXIT_DOMAIN_MSG = 513,
196 DLM_MASTER_REQUERY_MSG = 514,
197 DLM_LOCK_REQUEST_MSG = 515,
198 DLM_RECO_DATA_DONE_MSG = 516,
199 DLM_BEGIN_RECO_MSG = 517,
200 DLM_FINALIZE_RECO_MSG = 518,
201 DLM_QUERY_REGION_MSG = 519,
202 DLM_QUERY_NODEINFO_MSG = 520
205 static const value_string dlm_magic[] = {
206 { DLM_MASTER_REQUEST_MSG, "Master Request" },
207 { DLM_UNUSED_MSG1, "Unused 1" },
208 { DLM_ASSERT_MASTER_MSG, "Assert Master" },
209 { DLM_CREATE_LOCK_MSG, "Create Lock" },
210 { DLM_CONVERT_LOCK_MSG, "Convert Lock" },
211 { DLM_PROXY_AST_MSG, "Proxy AST" },
212 { DLM_UNLOCK_LOCK_MSG, "Unlock Lock" },
213 { DLM_DEREF_LOCKRES_MSG, "Deref Lockres" },
214 { DLM_MIGRATE_REQUEST_MSG, "Migrate Request" },
215 { DLM_MIG_LOCKRES_MSG, "Migrate Lockres" },
216 { DLM_QUERY_JOIN_MSG, "Query Join" },
217 { DLM_ASSERT_JOINED_MSG, "Assert Join" },
218 { DLM_CANCEL_JOIN_MSG, "Cancel Join" },
219 { DLM_EXIT_DOMAIN_MSG, "Exit Domain" },
220 { DLM_MASTER_REQUERY_MSG, "Master Requery" },
221 { DLM_LOCK_REQUEST_MSG, "Lock Request" },
222 { DLM_RECO_DATA_DONE_MSG, "Recovery Data Done" },
223 { DLM_BEGIN_RECO_MSG, "Begin Recovery" },
224 { DLM_FINALIZE_RECO_MSG, "Finalize Recovery" },
225 { DLM_QUERY_REGION_MSG, "Query Region" },
226 { DLM_QUERY_NODEINFO_MSG, "Query Node Info" },
230 value_string_ext ext_dlm_magic = VALUE_STRING_EXT_INIT(dlm_magic);
234 DLM_GRANTED_LIST = 0,
240 static const value_string dlm_lockres_list[] = {
241 { DLM_GRANTED_LIST, "Granted" },
242 { DLM_CONVERTING_LIST, "Converting" },
243 { DLM_BLOCKED_LIST, "Blocked" },
257 DLM_DENIED_GRACE_PERIOD,
287 DLM_NO_DEVICE_PERMISSION,
288 DLM_NO_CONTROL_DEVICE,
294 static const value_string dlm_errnames[] = {
295 { DLM_NORMAL, "DLM_NORMAL" },
296 { DLM_GRANTED, "DLM_GRANTED" },
297 { DLM_DENIED, "DLM_DENIED" },
298 { DLM_DENIED_NOLOCKS, "DLM_DENIED_NOLOCKS" },
299 { DLM_WORKING, "DLM_WORKING" },
300 { DLM_BLOCKED, "DLM_BLOCKED" },
301 { DLM_BLOCKED_ORPHAN, "DLM_BLOCKED_ORPHAN" },
302 { DLM_DENIED_GRACE_PERIOD, "DLM_DENIED_GRACE_PERIOD" },
303 { DLM_SYSERR, "DLM_SYSERR" },
304 { DLM_NOSUPPORT, "DLM_NOSUPPORT" },
305 { DLM_CANCELGRANT, "DLM_CANCELGRANT" },
306 { DLM_IVLOCKID, "DLM_IVLOCKID" },
307 { DLM_SYNC, "DLM_SYNC" },
308 { DLM_BADTYPE, "DLM_BADTYPE" },
309 { DLM_BADRESOURCE, "DLM_BADRESOURCE" },
310 { DLM_MAXHANDLES, "DLM_MAXHANDLES" },
311 { DLM_NOCLINFO, "DLM_NOCLINFO" },
312 { DLM_NOLOCKMGR, "DLM_NOLOCKMGR" },
313 { DLM_NOPURGED, "DLM_NOPURGED" },
314 { DLM_BADARGS, "DLM_BADARGS" },
315 { DLM_VOID, "DLM_VOID" },
316 { DLM_NOTQUEUED, "DLM_NOTQUEUED" },
317 { DLM_IVBUFLEN, "DLM_IVBUFLEN" },
318 { DLM_CVTUNGRANT, "DLM_CVTUNGRANT" },
319 { DLM_BADPARAM, "DLM_BADPARAM" },
320 { DLM_VALNOTVALID, "DLM_VALNOTVALID" },
321 { DLM_REJECTED, "DLM_REJECTED" },
322 { DLM_ABORT, "DLM_ABORT" },
323 { DLM_CANCEL, "DLM_CANCEL" },
324 { DLM_IVRESHANDLE, "DLM_IVRESHANDLE" },
325 { DLM_DEADLOCK, "DLM_DEADLOCK" },
326 { DLM_DENIED_NOASTS, "DLM_DENIED_NOASTS" },
327 { DLM_FORWARD, "DLM_FORWARD" },
328 { DLM_TIMEOUT, "DLM_TIMEOUT" },
329 { DLM_IVGROUPID, "DLM_IVGROUPID" },
330 { DLM_VERS_CONFLICT, "DLM_VERS_CONFLICT" },
331 { DLM_BAD_DEVICE_PATH, "DLM_BAD_DEVICE_PATH" },
332 { DLM_NO_DEVICE_PERMISSION, "DLM_NO_DEVICE_PERMISSION" },
333 { DLM_NO_CONTROL_DEVICE , "DLM_NO_CONTROL_DEVICE " },
334 { DLM_RECOVERING, "DLM_RECOVERING" },
335 { DLM_MIGRATING, "DLM_MIGRATING" },
336 { DLM_MAXSTATS, "DLM_MAXSTATS" },
340 value_string_ext ext_dlm_errnames = VALUE_STRING_EXT_INIT(dlm_errnames);
342 static const value_string dlm_errmsgs[] = {
343 { DLM_NORMAL, "request in progress" },
344 { DLM_GRANTED, "request granted" },
345 { DLM_DENIED, "request denied" },
346 { DLM_DENIED_NOLOCKS, "request denied, out of system resources" },
347 { DLM_WORKING, "async request in progress" },
348 { DLM_BLOCKED, "lock request blocked" },
349 { DLM_BLOCKED_ORPHAN, "lock request blocked by a orphan lock" },
350 { DLM_DENIED_GRACE_PERIOD, "topological change in progress" },
351 { DLM_SYSERR, "system error" },
352 { DLM_NOSUPPORT, "unsupported" },
353 { DLM_CANCELGRANT, "can't cancel convert: already granted" },
354 { DLM_IVLOCKID, "bad lockid" },
355 { DLM_SYNC, "synchronous request granted" },
356 { DLM_BADTYPE, "bad resource type" },
357 { DLM_BADRESOURCE, "bad resource handle" },
358 { DLM_MAXHANDLES, "no more resource handles" },
359 { DLM_NOCLINFO, "can't contact cluster manager" },
360 { DLM_NOLOCKMGR, "can't contact lock manager" },
361 { DLM_NOPURGED, "can't contact purge daemon" },
362 { DLM_BADARGS, "bad api args" },
363 { DLM_VOID, "no status" },
364 { DLM_NOTQUEUED, "NOQUEUE was specified and request failed" },
365 { DLM_IVBUFLEN, "invalid resource name length" },
366 { DLM_CVTUNGRANT, "attempted to convert ungranted lock" },
367 { DLM_BADPARAM, "invalid lock mode specified" },
368 { DLM_VALNOTVALID, "value block has been invalidated" },
369 { DLM_REJECTED, "request rejected, unrecognized client" },
370 { DLM_ABORT, "blocked lock request cancelled" },
371 { DLM_CANCEL, "conversion request cancelled" },
372 { DLM_IVRESHANDLE, "invalid resource handle" },
373 { DLM_DEADLOCK, "deadlock recovery refused this request" },
374 { DLM_DENIED_NOASTS, "failed to allocate AST" },
375 { DLM_FORWARD, "request must wait for primary's response" },
376 { DLM_TIMEOUT, "timeout value for lock has expired" },
377 { DLM_IVGROUPID, "invalid group specification" },
378 { DLM_VERS_CONFLICT, "version conflicts prevent request handling" },
379 { DLM_BAD_DEVICE_PATH, "Locks device does not exist or path wrong" },
380 { DLM_NO_DEVICE_PERMISSION, "Client has insufficient perms for device" },
381 { DLM_NO_CONTROL_DEVICE, "Cannot set options on opened device " },
382 { DLM_RECOVERING, "lock resource being recovered" },
383 { DLM_MIGRATING, "lock resource being migrated" },
384 { DLM_MAXSTATS, "invalid error number" },
388 value_string_ext ext_dlm_errmsgs = VALUE_STRING_EXT_INIT(dlm_errmsgs);
392 #define DLM_ASSERT_MASTER_MLE_CLEANUP 0x00000001
393 #define DLM_ASSERT_MASTER_REQUERY 0x00000002
394 #define DLM_ASSERT_MASTER_FINISH_MIGRATION 0x00000004
395 static const value_string dlm_assert_master_flags[] = {
396 { DLM_ASSERT_MASTER_MLE_CLEANUP, "cleanup" },
397 { DLM_ASSERT_MASTER_REQUERY, "requery" },
398 { DLM_ASSERT_MASTER_FINISH_MIGRATION, "finish" },
402 #define DLM_FINALIZE_STAGE2 0x01
403 static const value_string dlm_finalize_reco_flags[] = {
404 { DLM_FINALIZE_STAGE2, "stage2" },
414 static const value_string dlm_proxy_ast_types[] = {
416 { DLM_BAST, "BAST" },
417 { DLM_ASTUNLOCK, "Unlock AST (unused)" },
421 /* DLM lock flag types */
423 DLM_LOCK_FLAGS_PUT_LVB = 0x20000000,
424 DLM_LOCK_FLAGS_GET_LVB = 0x40000000
428 static int dlm_cookie_handler(proto_tree *tree, tvbuff_t *tvb, guint offset, int hf_cookie)
435 item = proto_tree_add_item(tree, hf_cookie, tvb, offset, 8, ENC_BIG_ENDIAN);
436 cookie = tvb_get_ntoh64(tvb, offset);
439 node_idx = (guint8)((cookie >> 56) & G_GINT64_CONSTANT(0xff));
440 seq = cookie & G_GINT64_CONSTANT(0x00ffffffffffffff);
442 proto_item_append_text(item, " (%u:%" G_GINT64_MODIFIER "u)", node_idx, seq);
447 static int dlm_lkm_flags_handler(proto_tree *tree, tvbuff_t *tvb, guint offset,
448 guint32 *dlm_lock_flags_ptr)
450 static const int *flags[] = {
451 &hf_dlm_lock_flag_unused1,
452 &hf_dlm_lock_flag_orphan,
453 &hf_dlm_lock_flag_parentable,
454 &hf_dlm_lock_flag_block,
455 &hf_dlm_lock_flag_local,
456 &hf_dlm_lock_flag_valblk,
457 &hf_dlm_lock_flag_noqueue,
458 &hf_dlm_lock_flag_convert,
459 &hf_dlm_lock_flag_nodlckwt,
460 &hf_dlm_lock_flag_unlock,
461 &hf_dlm_lock_flag_cancel,
462 &hf_dlm_lock_flag_deqall,
463 &hf_dlm_lock_flag_invvalblk,
464 &hf_dlm_lock_flag_syncsts,
465 &hf_dlm_lock_flag_timeout,
466 &hf_dlm_lock_flag_sngldlck,
467 &hf_dlm_lock_flag_findlocal,
468 &hf_dlm_lock_flag_proc_owned,
469 &hf_dlm_lock_flag_xid,
470 &hf_dlm_lock_flag_xid_conflict,
471 &hf_dlm_lock_flag_force,
472 &hf_dlm_lock_flag_revvalblk,
473 &hf_dlm_lock_flag_unused2,
474 &hf_dlm_lock_flag_migration,
475 &hf_dlm_lock_flag_put_lvb,
476 &hf_dlm_lock_flag_get_lvb,
477 &hf_dlm_lock_flag_recovery,
481 if(dlm_lock_flags_ptr != NULL){
482 *dlm_lock_flags_ptr = tvb_get_ntohl(tvb, offset);
484 proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_dlm_lock_flags,
485 ett_dtm_lock_flags, flags, ENC_BIG_ENDIAN, BMT_NO_INT | BMT_NO_FALSE | BMT_NO_TFS);
489 static int dlm_name_handler(proto_tree *tree, tvbuff_t *tvb, guint offset, int namelen)
495 ti = proto_tree_add_item(tree, hf_dlm_name, tvb, offset, namelen, ENC_ASCII|ENC_NA);
496 lock_type = tvb_get_guint8(tvb, offset);
497 if (lock_type == 'N') {
498 blkno = tvb_get_ntoh64(tvb, offset + OCFS2_DENTRY_LOCK_INO_START);
499 proto_item_append_text(ti, "%08x", (unsigned int)blkno);
502 return offset + namelen;
506 * We would like to get one whole lockres into a single network
507 * message whenever possible. Generally speaking, there will be
508 * at most one dlm_lock on a lockres for each node in the cluster,
509 * plus (infrequently) any additional locks coming in from userdlm.
511 * struct _dlm_lockres_page
513 * dlm_migratable_lockres mres;
514 * dlm_migratable_lock ml[DLM_MAX_MIGRATABLE_LOCKS];
515 * guint8 pad[DLM_MIG_LOCKRES_RESERVED];
518 * from ../cluster/tcp.h
519 * NET_MAX_PAYLOAD_BYTES (4096 - sizeof(net_msg))
520 * (roughly 4080 bytes)
521 * and sizeof(dlm_migratable_lockres) = 112 bytes
522 * and sizeof(dlm_migratable_lock) = 16 bytes
524 * Choosing DLM_MAX_MIGRATABLE_LOCKS=240 and
525 * DLM_MIG_LOCKRES_RESERVED=128 means we have this:
527 * (DLM_MAX_MIGRATABLE_LOCKS * sizeof(dlm_migratable_lock)) +
528 * sizeof(dlm_migratable_lockres) + DLM_MIG_LOCKRES_RESERVED =
529 * NET_MAX_PAYLOAD_BYTES
530 * (240 * 16) + 112 + 128 = 4080
532 * So a lockres would need more than 240 locks before it would
533 * use more than one network packet to recover. Not too bad.
536 static void dissect_dlm_migrate_lockres(proto_tree *tree, tvbuff_t *tvb, int offset)
541 static const int * mres_flags[] = {
542 &hf_dlm_mres_flag_recovery,
543 &hf_dlm_mres_flag_migration,
544 &hf_dlm_mres_flag_all_done,
549 proto_tree_add_item(tree, hf_dlm_master, tvb, offset, 1, ENC_BIG_ENDIAN);
553 proto_tree_add_item(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN);
557 proto_tree_add_item_ret_uint(tree, hf_dlm_mres_num_locks, tvb, offset, 1, ENC_BIG_ENDIAN, &num_locks);
560 /* no locks were found on this lockres! done! */
565 proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_dlm_mres_flags,
566 ett_mres_flags, mres_flags, ENC_BIG_ENDIAN, BMT_NO_INT | BMT_NO_FALSE | BMT_NO_TFS);
570 proto_tree_add_item(tree, hf_dlm_mres_total_locks, tvb, offset, 4, ENC_BIG_ENDIAN);
574 offset = dlm_cookie_handler(tree, tvb, offset, hf_dlm_mres_mig_cookie);
577 proto_tree_add_item(tree, hf_dlm_name, tvb, offset, 32, ENC_ASCII|ENC_NA);
581 proto_tree_add_item(tree, hf_dlm_lvb1, tvb, offset, 24, ENC_NA);
584 proto_tree_add_item(tree, hf_dlm_lvb2, tvb, offset, 24, ENC_NA);
587 proto_tree_add_item(tree, hf_dlm_lvb3, tvb, offset, 16, ENC_NA);
590 /* dlm_migratable_lock */
591 for (i = 0; i < num_locks; i++) {
594 subtree = proto_tree_add_subtree_format(tree, tvb, offset, 16,
595 ett_migrate_lockres_locks, NULL, "Locks%d: ", i + 1);
598 offset = dlm_cookie_handler(subtree, tvb, offset, hf_dlm_mres_mig_cookie);
600 proto_tree_add_item(subtree, hf_dlm_pad8, tvb, offset, 1, ENC_BIG_ENDIAN);
604 proto_tree_add_item(subtree, hf_dlm_mres_list, tvb, offset, 1, ENC_BIG_ENDIAN);
608 proto_tree_add_item(subtree, hf_dlm_mres_ml_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
612 proto_tree_add_item(subtree, hf_dlm_mres_type, tvb, offset, 1, ENC_BIG_ENDIAN);
616 proto_tree_add_item(subtree, hf_dlm_mres_convert_type, tvb, offset, 1, ENC_BIG_ENDIAN);
619 /* highest_blocked */
620 proto_tree_add_item(subtree, hf_dlm_mres_highest_blocked, tvb, offset, 1, ENC_BIG_ENDIAN);
623 proto_tree_add_item(subtree, hf_dlm_mres_node, tvb, offset, 1, ENC_BIG_ENDIAN);
629 dlm_fmt_revision( gchar *result, guint32 revision )
631 g_snprintf( result, ITEM_LABEL_LENGTH, "%d.%02d", (guint8)(( revision & 0xFF00 ) >> 8), (guint8)(revision & 0xFF) );
634 #define DLM_QUERY_JOIN_REQUEST_OFF_DLMPROTO 4
635 #define DLM_QUERY_JOIN_REQUEST_OFF_FSPROTO 6
636 #define DLM_QUERY_JOIN_REQUEST_OFF_DOMAIN 8
637 #define DLM_QUERY_JOIN_REQUEST_OFF_NODEMAP 72
638 #define DLM_QUERY_JOIN_REQUEST_LEN_DLMPROTO 2
639 #define DLM_QUERY_JOIN_REQUEST_LEN_FSPROTO 2
640 #define DLM_QUERY_JOIN_REQUEST_LEN_DOMAIN 64
641 #define DLM_QUERY_JOIN_REQUEST_LEN_NODEMAP 32
643 #define DLM_QUERY_JOIN_REQUEST_OLD_LEN 100
644 static void dissect_dlm_query_join_request(proto_tree *tree, tvbuff_t *tvb, int offset)
646 guint8 cc, *node_bits_array;
650 gboolean oldver = FALSE;
652 node_bits_array = (guint8 *)wmem_alloc0(wmem_packet_scope(), (DLM_QUERY_JOIN_REQUEST_LEN_NODEMAP*8)+1);
654 len = tvb_reported_length_remaining(tvb, offset);
655 if (len == DLM_QUERY_JOIN_REQUEST_OLD_LEN)
659 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_BIG_ENDIAN);
662 proto_tree_add_item(tree, hf_dlm_pad16, tvb, offset, 2, ENC_BIG_ENDIAN);
666 proto_tree_add_item(tree, hf_dlm_domain_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
672 proto_tree_add_item(tree, hf_dlm_proto_ver, tvb, offset, 2, ENC_BIG_ENDIAN);
676 proto_tree_add_item(tree, hf_dlm_fs_proto_ver, tvb, offset, 2, ENC_BIG_ENDIAN);
681 proto_tree_add_item(tree, hf_dlm_domain_name, tvb, offset, 64, ENC_ASCII|ENC_NA);
685 node_map = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, offset, DLM_QUERY_JOIN_REQUEST_LEN_NODEMAP);
687 for (i = 0; i < DLM_QUERY_JOIN_REQUEST_LEN_NODEMAP; i++) {
689 for (j = 0; j < 8; j++)
690 node_bits_array[i * 8 + j] =
691 (((cc >> j) & 1) ? '1' : '0');
694 /* NULL terminate string */
695 node_bits_array[(DLM_QUERY_JOIN_REQUEST_LEN_NODEMAP*8)] = 0;
696 proto_tree_add_bytes_format_value(tree, hf_dlm_node_map, tvb, offset, DLM_QUERY_JOIN_REQUEST_LEN_NODEMAP, NULL, "%s", node_bits_array);
699 #define O2HB_MAX_REGION_NAME_LEN 32
701 static void dissect_dlm_query_region(proto_tree *tree, tvbuff_t *tvb,
704 guint32 i, num_regions;
708 proto_tree_add_item(tree, hf_dlm_qr_node, tvb, offset, 1, ENC_BIG_ENDIAN);
712 proto_tree_add_item_ret_uint(tree, hf_dlm_qr_numregions, tvb, offset, 1, ENC_BIG_ENDIAN, &num_regions);
716 proto_tree_add_item(tree, hf_dlm_qr_namelen, tvb, offset, 1, ENC_BIG_ENDIAN);
719 proto_tree_add_item(tree, hf_dlm_pad8, tvb, offset, 1, ENC_BIG_ENDIAN);
723 proto_tree_add_item(tree, hf_dlm_qr_domain, tvb, offset, 64, ENC_ASCII|ENC_NA);
727 for (i = 0; i < num_regions; i++, offset += O2HB_MAX_REGION_NAME_LEN) {
728 region = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, O2HB_MAX_REGION_NAME_LEN, ENC_ASCII);
729 proto_tree_add_string_format(tree, hf_dlm_qr_region, tvb, offset, 1,
730 region, "Region%d: %s", i + 1, region);
734 static void dissect_dlm_query_nodeinfo(proto_tree *tree, tvbuff_t *tvb, guint offset)
736 guint32 i, num_nodes;
739 proto_tree_add_item(tree, hf_dlm_qn_nodenum, tvb, offset, 1, ENC_BIG_ENDIAN);
743 proto_tree_add_item_ret_uint(tree, hf_dlm_qn_numnodes, tvb, offset, 1, ENC_BIG_ENDIAN, &num_nodes);
747 proto_tree_add_item(tree, hf_dlm_qn_namelen, tvb, offset, 1, ENC_BIG_ENDIAN);
751 proto_tree_add_item(tree, hf_dlm_qn_domain, tvb, offset, 64, ENC_ASCII|ENC_NA);
755 for (i = 0; i < num_nodes; i++) {
759 subtree = proto_tree_add_subtree_format(tree, tvb, offset, 8,
760 ett_query_nodeinfo, NULL, "Node%d: ", i+1);
762 proto_tree_add_item(subtree, hf_dlm_qn_node, tvb, offset, 1, ENC_BIG_ENDIAN);
765 proto_tree_add_item(subtree, hf_dlm_pad8, tvb, offset, 1, ENC_BIG_ENDIAN);
768 proto_tree_add_item(subtree, hf_dlm_qn_port, tvb, offset, 2, ENC_BIG_ENDIAN);
771 proto_tree_add_item(subtree, hf_dlm_qn_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
776 static int dissect_master_msg(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_flag)
780 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
783 proto_tree_add_item_ret_uint(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN, &namelen);
786 proto_tree_add_item(tree, hf_dlm_pad16, tvb, offset, 2, ENC_BIG_ENDIAN);
790 proto_tree_add_item(tree, hf_dlm_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
792 proto_tree_add_item(tree, hf_flag, tvb, offset, 4, ENC_BIG_ENDIAN);
795 return dlm_name_handler(tree, tvb, offset, namelen);
798 static int dissect_create_lock_msg(proto_tree *tree, tvbuff_t *tvb, int offset,
799 guint32 *dlm_lock_flags_ptr)
803 offset = dlm_cookie_handler(tree, tvb, offset, hf_dlm_cookie);
804 offset = dlm_lkm_flags_handler(tree, tvb, offset, dlm_lock_flags_ptr);
806 proto_tree_add_item(tree, hf_dlm_pad8, tvb, offset, 1, ENC_NA);
809 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
812 proto_tree_add_item(tree, hf_dlm_requested_type, tvb, offset, 1, ENC_BIG_ENDIAN);
815 proto_tree_add_item_ret_uint(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN, &namelen);
818 dlm_name_handler(tree, tvb, offset, namelen);
819 return offset + O2NM_MAX_NAME_LEN;
822 static int dissect_convert_lock_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
824 guint32 dlm_lock_flags;
825 offset = dissect_create_lock_msg(tree, tvb, offset, &dlm_lock_flags);
827 if(dlm_lock_flags & DLM_LOCK_FLAGS_PUT_LVB){
828 proto_tree_add_item(tree, hf_dlm_lvb1, tvb, offset, 24, ENC_NA);
831 proto_tree_add_item(tree, hf_dlm_lvb2, tvb, offset, 24, ENC_NA);
834 proto_tree_add_item(tree, hf_dlm_lvb3, tvb, offset, 16, ENC_NA);
841 static int dissect_unlock_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
844 guint32 dlm_lock_flags;
846 offset = dlm_cookie_handler(tree, tvb, offset, hf_dlm_cookie);
847 offset = dlm_lkm_flags_handler(tree, tvb, offset, &dlm_lock_flags);
849 proto_tree_add_item(tree, hf_dlm_pad16, tvb, offset, 2, ENC_BIG_ENDIAN);
852 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
855 proto_tree_add_item_ret_uint(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN, &namelen);
858 dlm_name_handler(tree, tvb, offset, namelen);
859 offset += O2NM_MAX_NAME_LEN;
861 if(dlm_lock_flags & DLM_LOCK_FLAGS_PUT_LVB){
862 proto_tree_add_item(tree, hf_dlm_lvb1, tvb, offset, 24, ENC_NA);
865 proto_tree_add_item(tree, hf_dlm_lvb2, tvb, offset, 24, ENC_NA);
868 proto_tree_add_item(tree, hf_dlm_lvb3, tvb, offset, 16, ENC_NA);
875 static int dissect_proxy_ast_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
878 guint32 dlm_lock_flags;
880 offset = dlm_cookie_handler(tree, tvb, offset, hf_dlm_cookie);
881 offset = dlm_lkm_flags_handler(tree, tvb, offset, &dlm_lock_flags);
883 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
886 proto_tree_add_item(tree, hf_dlm_ast_type, tvb, offset, 1, ENC_BIG_ENDIAN);
889 proto_tree_add_item(tree, hf_dlm_blocked_type, tvb, offset, 1, ENC_BIG_ENDIAN);
892 proto_tree_add_item_ret_uint(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN, &namelen);
895 dlm_name_handler(tree, tvb, offset, namelen);
896 offset += O2NM_MAX_NAME_LEN;
898 if(dlm_lock_flags & DLM_LOCK_FLAGS_GET_LVB){
899 proto_tree_add_item(tree, hf_dlm_lvb1, tvb, offset, 24, ENC_NA);
902 proto_tree_add_item(tree, hf_dlm_lvb2, tvb, offset, 24, ENC_NA);
905 proto_tree_add_item(tree, hf_dlm_lvb3, tvb, offset, 16, ENC_NA);
911 static int dissect_deref_lockres_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
915 proto_tree_add_item(tree, hf_dlm_pad32, tvb, offset, 4, ENC_BIG_ENDIAN);
918 proto_tree_add_item(tree, hf_dlm_pad16, tvb, offset, 2, ENC_BIG_ENDIAN);
921 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
924 proto_tree_add_item_ret_uint(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN, &namelen);
927 return dlm_name_handler(tree, tvb, offset, namelen);
930 static int dissect_migrate_request_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
934 proto_tree_add_item(tree, hf_dlm_master, tvb, offset, 1, ENC_NA);
937 proto_tree_add_item(tree, hf_dlm_new_master, tvb, offset, 1, ENC_NA);
940 proto_tree_add_item_ret_uint(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN, &namelen);
943 proto_tree_add_item(tree, hf_dlm_pad8, tvb, offset, 1, ENC_NA);
946 proto_tree_add_item(tree, hf_dlm_pad32, tvb, offset, 4, ENC_BIG_ENDIAN);
949 return dlm_name_handler(tree, tvb, offset, namelen);
952 static int dissect_dlm_joined_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
954 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
957 proto_tree_add_item(tree, hf_dlm_pad16, tvb, offset, 2, ENC_BIG_ENDIAN);
960 proto_tree_add_item(tree, hf_dlm_domain_name_len, tvb, offset, 1, ENC_BIG_ENDIAN);
963 proto_tree_add_item(tree, hf_dlm_domain_name, tvb, offset, 64, ENC_ASCII|ENC_NA);
969 static int dissect_master_requery_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
973 proto_tree_add_item(tree, hf_dlm_pad16, tvb, offset, 2, ENC_BIG_ENDIAN);
976 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
979 proto_tree_add_item_ret_uint(tree, hf_dlm_namelen, tvb, offset, 1, ENC_BIG_ENDIAN, &namelen);
982 proto_tree_add_item(tree, hf_dlm_pad32, tvb, offset, 4, ENC_BIG_ENDIAN);
985 return dlm_name_handler(tree, tvb, offset, namelen);
988 static int dissect_lock_request_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
990 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
993 proto_tree_add_item(tree, hf_dlm_dead_node, tvb, offset, 1, ENC_NA);
996 proto_tree_add_item(tree, hf_dlm_pad16, tvb, offset, 2, ENC_BIG_ENDIAN);
999 proto_tree_add_item(tree, hf_dlm_pad32, tvb, offset, 4, ENC_BIG_ENDIAN);
1005 static int dissect_reco_data_done_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
1007 offset = dissect_lock_request_msg(tree, tvb, offset);
1009 proto_tree_add_item(tree, hf_dlm_reco_lvb, tvb, offset, 64, ENC_NA);
1015 static int dissect_finalize_reco_msg(proto_tree *tree, tvbuff_t *tvb, int offset)
1017 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
1020 proto_tree_add_item(tree, hf_dlm_dead_node, tvb, offset, 1, ENC_NA);
1023 proto_tree_add_item(tree, hf_dlm_fr_flags, tvb, offset, 1, ENC_NA);
1026 proto_tree_add_item(tree, hf_dlm_pad8, tvb, offset, 1, ENC_NA);
1029 proto_tree_add_item(tree, hf_dlm_pad32, tvb, offset, 4, ENC_BIG_ENDIAN);
1035 static int dissect_ocfs2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1037 proto_tree *subtree;
1039 guint32 len, msg_type;
1044 magic = tvb_get_ntohs(tvb, offset);
1045 if (try_val_to_str(magic, o2net_magic) == NULL)
1048 col_set_str(pinfo->cinfo, COL_PROTOCOL, "OCFS2");
1049 col_clear(pinfo->cinfo, COL_INFO);
1051 ti = proto_tree_add_item(tree, proto_ocfs2, tvb, offset, -1, ENC_NA);
1052 subtree = proto_item_add_subtree(ti, ett_ocfs2);
1054 proto_tree_add_item(subtree, hf_msg_magic, tvb, offset, 2, ENC_BIG_ENDIAN);
1057 proto_tree_add_item_ret_uint(subtree, hf_msg_data_len, tvb, 2, 2, ENC_BIG_ENDIAN, &len);
1060 proto_tree_add_item_ret_uint(subtree, hf_msg_msg_type, tvb, 4, 2, ENC_BIG_ENDIAN, &msg_type);
1064 case O2NET_MSG_KEEP_REQ_MAGIC:
1065 col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", "Keepalive Request");
1067 case O2NET_MSG_KEEP_RESP_MAGIC:
1068 col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", "Keepalive Response");
1071 col_append_sep_str(pinfo->cinfo, COL_INFO, " | ",
1072 val_to_str_ext(msg_type, &ext_dlm_magic, "Unknown Type (0x%02x)") );
1076 col_set_fence(pinfo->cinfo, COL_INFO);
1078 proto_tree_add_item(subtree, hf_msg_pad, tvb, 4, 2, ENC_BIG_ENDIAN);
1081 proto_tree_add_item(subtree, hf_msg_sys_status, tvb, 8, 4, ENC_BIG_ENDIAN);
1084 proto_tree_add_item(subtree, hf_msg_status, tvb, 12, 4, ENC_BIG_ENDIAN);
1087 proto_tree_add_item(subtree, hf_msg_key, tvb, 16, 4, ENC_BIG_ENDIAN);
1090 proto_tree_add_item(subtree, hf_msg_msg_num, tvb, 20, 4, ENC_BIG_ENDIAN);
1093 if (magic == O2NET_MSG_MAGIC) {
1095 case DLM_MASTER_REQUEST_MSG:
1096 dissect_master_msg(subtree, tvb, offset, -1);
1098 case DLM_ASSERT_MASTER_MSG:
1099 dissect_master_msg(subtree, tvb, offset, hf_dlm_am_flags);
1101 case DLM_CREATE_LOCK_MSG:
1102 dissect_create_lock_msg(subtree, tvb, offset, NULL);
1104 case DLM_CONVERT_LOCK_MSG:
1105 dissect_convert_lock_msg(subtree, tvb, offset);
1107 case DLM_PROXY_AST_MSG:
1108 dissect_proxy_ast_msg(subtree, tvb, offset);
1110 case DLM_UNLOCK_LOCK_MSG:
1111 dissect_unlock_msg(subtree, tvb, offset);
1113 case DLM_DEREF_LOCKRES_MSG:
1114 dissect_deref_lockres_msg(subtree, tvb, offset);
1116 case DLM_MIGRATE_REQUEST_MSG:
1117 dissect_migrate_request_msg(subtree, tvb, offset);
1119 case DLM_MIG_LOCKRES_MSG:
1120 dissect_dlm_migrate_lockres(subtree, tvb, offset);
1122 case DLM_QUERY_JOIN_MSG:
1123 dissect_dlm_query_join_request(subtree, tvb, offset);
1125 case DLM_ASSERT_JOINED_MSG:
1126 case DLM_CANCEL_JOIN_MSG:
1127 dissect_dlm_joined_msg(subtree, tvb, offset);
1129 case DLM_EXIT_DOMAIN_MSG:
1130 proto_tree_add_item(tree, hf_dlm_node_idx, tvb, offset, 1, ENC_NA);
1132 case DLM_MASTER_REQUERY_MSG:
1133 dissect_master_requery_msg(subtree, tvb, offset);
1135 case DLM_LOCK_REQUEST_MSG:
1136 case DLM_BEGIN_RECO_MSG:
1137 dissect_lock_request_msg(subtree, tvb, offset);
1139 case DLM_RECO_DATA_DONE_MSG:
1140 dissect_reco_data_done_msg(subtree, tvb, offset);
1142 case DLM_FINALIZE_RECO_MSG:
1143 dissect_finalize_reco_msg(subtree, tvb, offset);
1145 case DLM_QUERY_REGION_MSG:
1146 dissect_dlm_query_region(subtree, tvb, offset);
1148 case DLM_QUERY_NODEINFO_MSG:
1149 dissect_dlm_query_nodeinfo(subtree, tvb, offset);
1152 proto_tree_add_item(tree, hf_dlm_payload, tvb, offset, len, ENC_NA);
1156 next_tvb = tvb_new_subset_length(tvb, offset, len);
1157 call_data_dissector(next_tvb, pinfo, tree);
1160 return tvb_reported_length(tvb);
1164 get_ocfs2_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
1168 /* Get the length of the data from header. */
1169 plen = tvb_get_ntohs(tvb, offset + 2);
1171 /* That length doesn't include the header itself, add that in. */
1175 static int dissect_ocfs2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1180 if (!tvb_bytes_exist(tvb, offset, 2))
1183 magic = tvb_get_ntohs(tvb, offset);
1184 if (try_val_to_str(magic, o2net_magic) == NULL)
1187 tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4, get_ocfs2_pdu_len, dissect_ocfs2_pdu, data);
1188 return tvb_captured_length(tvb);
1191 void proto_register_ocfs2(void)
1193 static hf_register_info hf[] = {
1196 { "Magic", "ocfs2.msg.magic", FT_UINT16, BASE_HEX,
1197 VALS(o2net_magic), 0x0,
1198 "Magic number identifier of O2NET-over-TCPmessage",
1203 { "Len", "ocfs2.msg.data_len", FT_UINT16, BASE_DEC,
1204 NULL, 0x0, "Data length", HFILL
1208 { "Type", "ocfs2.msg.msg_type", FT_UINT16, BASE_DEC|BASE_EXT_STRING,
1209 &ext_dlm_magic, 0x0, "Message type", HFILL
1213 { "Pad", "ocfs2.msg.pad", FT_UINT16, BASE_HEX,
1214 NULL, 0x0, NULL, HFILL
1217 { &hf_msg_sys_status,
1218 { "Sys Status", "ocfs2.msg.sys_status", FT_UINT32,
1219 BASE_DEC, NULL, 0x0,
1220 "System level status return code", HFILL
1224 { "Status", "ocfs2.msg.status", FT_UINT32, BASE_DEC,
1225 NULL, 0x0, "Return code", HFILL
1229 { "Key", "ocfs2.msg.key", FT_UINT32, BASE_HEX, NULL,
1234 { "Num", "ocfs2.msg.msg_num", FT_UINT32, BASE_DEC, NULL,
1235 0x0, "Message identification number", HFILL
1239 { "Node", "ocfs2.dlm.node_idx", FT_UINT8, BASE_DEC,
1240 NULL, 0x0, "Node index", HFILL
1243 { &hf_dlm_lock_flags,
1244 { "Flags", "ocfs2.dlm.lock.flags", FT_UINT32, BASE_HEX,
1245 NULL, 0x0, NULL, HFILL
1248 { &hf_dlm_lock_flag_unused1,
1249 { "unused", "ocfs2.dlm.lock.flags.unused", FT_UINT32, BASE_HEX,
1250 NULL, 0x0000000F, NULL, HFILL
1253 { &hf_dlm_lock_flag_orphan,
1254 { "orphan", "ocfs2.dlm.lock.flags.orphan", FT_BOOLEAN, 32,
1255 NULL, 0x00000010, NULL, HFILL
1258 { &hf_dlm_lock_flag_parentable,
1259 { "parentable", "ocfs2.dlm.lock.flags.parentable", FT_BOOLEAN, 32,
1260 NULL, 0x00000020, NULL, HFILL
1263 { &hf_dlm_lock_flag_block,
1264 { "block", "ocfs2.dlm.lock.flags.block", FT_BOOLEAN, 32,
1265 NULL, 0x00000040, NULL, HFILL
1268 { &hf_dlm_lock_flag_local,
1269 { "local", "ocfs2.dlm.lock.flags.local", FT_BOOLEAN, 32,
1270 NULL, 0x00000080, NULL, HFILL
1273 { &hf_dlm_lock_flag_valblk,
1274 { "valblk", "ocfs2.dlm.lock.flags.valblk", FT_BOOLEAN, 32,
1275 NULL, 0x00000100, NULL, HFILL
1278 { &hf_dlm_lock_flag_noqueue,
1279 { "noqueue", "ocfs2.dlm.lock.flags.noqueue", FT_BOOLEAN, 32,
1280 NULL, 0x00000200, NULL, HFILL
1283 { &hf_dlm_lock_flag_convert,
1284 { "convert", "ocfs2.dlm.lock.flags.convert", FT_BOOLEAN, 32,
1285 NULL, 0x00000400, NULL, HFILL
1288 { &hf_dlm_lock_flag_nodlckwt,
1289 { "nodlckwt", "ocfs2.dlm.lock.flags.nodlckwt", FT_BOOLEAN, 32,
1290 NULL, 0x00000800, NULL, HFILL
1293 { &hf_dlm_lock_flag_unlock,
1294 { "unlock", "ocfs2.dlm.lock.flags.unlock", FT_BOOLEAN, 32,
1295 NULL, 0x00001000, NULL, HFILL
1298 { &hf_dlm_lock_flag_cancel,
1299 { "cancel", "ocfs2.dlm.lock.flags.cancel", FT_BOOLEAN, 32,
1300 NULL, 0x00002000, NULL, HFILL
1303 { &hf_dlm_lock_flag_deqall,
1304 { "deqall", "ocfs2.dlm.lock.flags.deqall", FT_BOOLEAN, 32,
1305 NULL, 0x00004000, NULL, HFILL
1308 { &hf_dlm_lock_flag_invvalblk,
1309 { "invvalblk", "ocfs2.dlm.lock.flags.invvalblk", FT_BOOLEAN, 32,
1310 NULL, 0x00008000, NULL, HFILL
1313 { &hf_dlm_lock_flag_syncsts,
1314 { "syncsts", "ocfs2.dlm.lock.flags.syncsts", FT_BOOLEAN, 32,
1315 NULL, 0x00010000, NULL, HFILL
1318 { &hf_dlm_lock_flag_timeout,
1319 { "timeout", "ocfs2.dlm.lock.flags.timeout", FT_BOOLEAN, 32,
1320 NULL, 0x00020000, NULL, HFILL
1323 { &hf_dlm_lock_flag_sngldlck,
1324 { "sngldlck", "ocfs2.dlm.lock.flags.sngldlck", FT_BOOLEAN, 32,
1325 NULL, 0x00040000, NULL, HFILL
1328 { &hf_dlm_lock_flag_findlocal,
1329 { "findlocal", "ocfs2.dlm.lock.flags.findlocal", FT_BOOLEAN, 32,
1330 NULL, 0x00080000, NULL, HFILL
1333 { &hf_dlm_lock_flag_proc_owned,
1334 { "proc_owned", "ocfs2.dlm.lock.flags.proc_owned", FT_BOOLEAN, 32,
1335 NULL, 0x00100000, NULL, HFILL
1338 { &hf_dlm_lock_flag_xid,
1339 { "xid", "ocfs2.dlm.lock.flags.xid", FT_BOOLEAN, 32,
1340 NULL, 0x00200000, NULL, HFILL
1343 { &hf_dlm_lock_flag_xid_conflict,
1344 { "xid_conflict", "ocfs2.dlm.lock.flags.xid_conflict", FT_BOOLEAN, 32,
1345 NULL, 0x00400000, NULL, HFILL
1348 { &hf_dlm_lock_flag_force,
1349 { "force", "ocfs2.dlm.lock.flags.force", FT_BOOLEAN, 32,
1350 NULL, 0x00800000, NULL, HFILL
1353 { &hf_dlm_lock_flag_revvalblk,
1354 { "revvalblk", "ocfs2.dlm.lock.flags.revvalblk", FT_BOOLEAN, 32,
1355 NULL, 0x01000000, NULL, HFILL
1358 { &hf_dlm_lock_flag_unused2,
1359 { "unused", "ocfs2.dlm.lock.flags.unused", FT_UINT32, BASE_HEX,
1360 NULL, 0x0E000000, NULL, HFILL
1363 { &hf_dlm_lock_flag_migration,
1364 { "migration", "ocfs2.dlm.lock.flags.migration", FT_BOOLEAN, 32,
1365 NULL, 0x10000000, NULL, HFILL
1368 { &hf_dlm_lock_flag_put_lvb,
1369 { "put_lvb", "ocfs2.dlm.lock.flags.put_lvb", FT_BOOLEAN, 32,
1370 NULL, 0x20000000, NULL, HFILL
1373 { &hf_dlm_lock_flag_get_lvb,
1374 { "get_lvb", "ocfs2.dlm.lock.flags.get_lvb", FT_BOOLEAN, 32,
1375 NULL, 0x40000000, NULL, HFILL
1378 { &hf_dlm_lock_flag_recovery,
1379 { "recovery", "ocfs2.dlm.lock.flags.recovery", FT_BOOLEAN, 32,
1380 NULL, 0x80000000, NULL, HFILL
1384 { "Flags", "ocfs2.dlm.am_flags", FT_UINT32, BASE_HEX,
1385 VALS(dlm_assert_master_flags), 0x0,
1386 "Assert Master Flags", HFILL
1390 { "Flags", "ocfs2.dlm.fr_flags", FT_UINT32, BASE_HEX,
1391 VALS(dlm_finalize_reco_flags), 0x0,
1392 "Finalize Recovery Flags", HFILL
1396 { "Namelen", "ocfs2.dlm.namelen", FT_UINT8, BASE_DEC,
1397 NULL, 0x0, NULL, HFILL
1401 { "Name", "ocfs2.dlm.name", FT_STRING, BASE_NONE, NULL,
1406 { "Cookie", "ocfs2.dlm.cookie", FT_UINT64, BASE_HEX,
1408 "Unique ID for a single lock on a resource", HFILL
1411 { &hf_dlm_requested_type,
1412 { "Requested", "ocfs2.dlm.requested_type", FT_UINT8,
1413 BASE_DEC, VALS(dlm_lock_modes), 0x0,
1414 "Requested lock level", HFILL
1417 { &hf_dlm_blocked_type,
1418 { "Blocked", "ocfs2.dlm.blocked_type", FT_UINT8,
1419 BASE_DEC, VALS(dlm_lock_modes), 0x0,
1420 "Blocked lock type", HFILL
1424 { "AST Type", "ocfs2.dlm.ast_type", FT_UINT8, BASE_DEC,
1425 VALS(dlm_proxy_ast_types), 0x0, NULL, HFILL
1428 { &hf_dlm_dead_node,
1429 { "Dead Node", "ocfs2.dlm.dead_node", FT_UINT8,
1430 BASE_DEC, NULL, 0x0, "Dead node index", HFILL
1434 { "LVB1", "ocfs2.dlm.lvb", FT_BYTES, BASE_NONE, NULL,
1435 0x0, "Lock value block", HFILL
1439 { "LVB2", "ocfs2.dlm.lvb", FT_BYTES, BASE_NONE, NULL,
1440 0x0, "Lock value block", HFILL
1444 { "LVB3", "ocfs2.dlm.lvb", FT_BYTES, BASE_NONE, NULL,
1445 0x0, "Lock value block", HFILL
1448 { &hf_dlm_domain_name_len,
1449 { "Domain Namelen", "ocfs2.dlm.domain_namelen",
1450 FT_UINT8, BASE_DEC, NULL, 0x0, NULL,
1454 { &hf_dlm_proto_ver,
1455 { "DLM Protocol", "ocfs2.dlm.proto_ver",
1456 FT_UINT16, BASE_CUSTOM, CF_FUNC(dlm_fmt_revision), 0x0, NULL,
1460 { &hf_dlm_fs_proto_ver,
1461 { "FS Protocol", "ocfs2.dlm.fs_proto_ver",
1462 FT_UINT16, BASE_CUSTOM, CF_FUNC(dlm_fmt_revision), 0x0, NULL,
1467 { "Node Map", "ocfs2.dlm.node_map", FT_BYTES,
1468 BASE_NONE, NULL, 0x0, NULL, HFILL
1471 { &hf_dlm_domain_name,
1472 { "Domain Name", "ocfs2.dlm.domain_name", FT_STRING,
1473 BASE_NONE, NULL, 0x0, NULL, HFILL
1477 { "Master", "ocfs2.dlm.master", FT_UINT8, BASE_DEC,
1478 NULL, 0x0, NULL, HFILL
1481 { &hf_dlm_new_master,
1482 { "New Master", "ocfs2.dlm.new_master", FT_UINT8,
1483 BASE_DEC, NULL, 0x0, NULL, HFILL
1486 { &hf_dlm_mres_num_locks,
1487 { "Num Locks", "ocfs2.dlm.num_locks", FT_UINT8,
1488 BASE_DEC, NULL, 0x0, "Migres Num Locks", HFILL
1491 { &hf_dlm_mres_flags,
1492 { "Flags", "ocfs2.dlm.mres_flags", FT_UINT8, BASE_HEX,
1493 NULL, 0x01, "Migres Flags", HFILL
1496 { &hf_dlm_mres_flag_recovery,
1497 { "recovery", "ocfs2.dlm.mres_flags.recovery", FT_BOOLEAN, 8,
1498 NULL, 0x02, NULL, HFILL
1501 { &hf_dlm_mres_flag_migration,
1502 { "migration", "ocfs2.dlm.mres_flags.migration", FT_BOOLEAN, 8,
1503 NULL, 0x04, NULL, HFILL
1506 { &hf_dlm_mres_flag_all_done,
1507 { "all_done", "ocfs2.dlm.mres_flags.all_done", FT_BOOLEAN, 8,
1508 NULL, 0x0, NULL, HFILL
1511 { &hf_dlm_mres_total_locks,
1512 { "Total Locks", "ocfs2.dlm.total_locks", FT_UINT32,
1513 BASE_DEC, NULL, 0x0, "Migres Total Locks", HFILL
1516 { &hf_dlm_mres_mig_cookie,
1517 { "Cookie", "ocfs2.dlm.migratable_lock.mig_cookie",
1518 FT_UINT64, BASE_DEC, NULL, 0x0, "Migres Cookie", HFILL
1521 { &hf_dlm_mres_list,
1522 { "List", "ocfs2.dlm.migratable_lock.list", FT_UINT8,
1523 BASE_DEC, VALS(dlm_lockres_list), 0x0, NULL, HFILL
1526 { &hf_dlm_mres_ml_flags,
1527 { "List", "ocfs2.dlm.migratable_lock.flags", FT_UINT8,
1528 BASE_HEX, NULL, 0x0, NULL, HFILL
1531 { &hf_dlm_mres_type,
1532 { "Type", "ocfs2.dlm.migratable_lock.type", FT_UINT8,
1533 BASE_DEC, VALS(dlm_lock_modes), 0x0, NULL, HFILL
1536 { &hf_dlm_mres_convert_type,
1537 { "Convert type", "ocfs2.dlm.migratable_lock.convert_type", FT_UINT8,
1538 BASE_DEC, NULL, 0x0, NULL, HFILL
1541 { &hf_dlm_mres_highest_blocked,
1542 { "Highest blocked", "ocfs2.dlm.migratable_lock.highest_blocked", FT_UINT8,
1543 BASE_DEC, NULL, 0x0, NULL, HFILL
1546 { &hf_dlm_mres_node,
1547 { "Node", "ocfs2.dlm.migratable_lock.node", FT_UINT8,
1548 BASE_DEC, NULL, 0x0, NULL, HFILL
1552 { "Node", "ocfs2.dlm.query_region.qr_node", FT_UINT8,
1553 BASE_DEC, NULL, 0x0, "Query Region Node", HFILL
1556 { &hf_dlm_qr_numregions,
1557 { "Num Regions", "ocfs2.dlm.query_region.qr_numregions",
1558 FT_UINT8, BASE_DEC, NULL, 0x0,
1559 "The number of regions to compare with", HFILL
1562 { &hf_dlm_qr_namelen,
1563 { "Domain Namelen", "ocfs2.dlm.query_region.qr_namelen",
1564 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1567 { &hf_dlm_qr_domain,
1568 { "Domain Name", "ocfs2.dlm.query_region.qr_domain",
1569 FT_STRING, BASE_NONE, NULL, 0x0, NULL,
1573 { &hf_dlm_qr_region,
1574 { "Region", "ocfs2.dlm.query_region.region",
1575 FT_STRING, BASE_NONE, NULL, 0x0, NULL,
1579 { &hf_dlm_qn_nodenum,
1580 { "Node", "ocfs2.dlm_query_nodeinfo.qn_nodenum",
1581 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL
1584 { &hf_dlm_qn_numnodes,
1585 { "Num Nodes", "ocfs2.dlm_query_nodeinfo.qn_numnodes",
1586 FT_UINT8, BASE_DEC, NULL, 0x0,
1587 "The number of nodes to query", HFILL
1590 { &hf_dlm_qn_namelen,
1592 "ocfs2.dlm_query_nodeinfo.qn_namelen", FT_UINT8,
1593 BASE_DEC, NULL, 0x0, NULL, HFILL
1596 { &hf_dlm_qn_domain,
1597 { "Domain Name", "ocfs2.dlm_query_nodeinfo.qn_domain",
1598 FT_UINT8, BASE_DEC, NULL, 0x0, NULL,
1603 { "Node", "ocfs2.dlm_query_nodeinfo.node",
1604 FT_UINT8, BASE_DEC, NULL, 0x0, NULL,
1609 { "Port", "ocfs2.dlm_query_nodeinfo.port",
1610 FT_UINT16, BASE_DEC, NULL, 0x0, NULL,
1615 { "IP Address", "ocfs2.dlm_query_nodeinfo.ip",
1616 FT_IPv4, BASE_NONE, NULL, 0x0, NULL,
1621 { "Recovery LVB", "ocfs2.reco_lvb",
1622 FT_BYTES, BASE_NONE, NULL, 0x0, NULL,
1627 { "Pad", "ocfs2.dlm.pad",
1628 FT_UINT8, BASE_DEC, NULL, 0x0, NULL,
1633 { "Pad", "ocfs2.dlm.pad",
1634 FT_UINT16, BASE_HEX, NULL, 0x0, NULL,
1639 { "Pad", "ocfs2.dlm.pad",
1640 FT_UINT32, BASE_HEX, NULL, 0x0, NULL,
1645 { "Flags", "ocfs2.dlm.flags",
1646 FT_UINT32, BASE_HEX, NULL, 0x0, NULL,
1651 { "Payload", "ocfs2.dlm.payload",
1652 FT_BYTES, BASE_NONE, NULL, 0x0, NULL,
1658 static gint *ett[] = {
1660 &ett_dtm_lock_flags,
1662 &ett_migrate_lockres_locks,
1663 &ett_query_nodeinfo,
1666 proto_ocfs2 = proto_register_protocol("OCFS2 Networking", "OCFS2", "ocfs2");
1667 proto_register_field_array(proto_ocfs2, hf, array_length(hf));
1668 proto_register_subtree_array(ett, array_length(ett));
1671 void proto_reg_handoff_ocfs2(void)
1673 dissector_handle_t ocfs2_handle;
1675 ocfs2_handle = create_dissector_handle(dissect_ocfs2, proto_ocfs2);
1677 dissector_add_for_decode_as_with_preference("tcp.port", ocfs2_handle);
1682 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1687 * indent-tabs-mode: t
1690 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1691 * :indentSize=8:tabSize=8:noTabs=false: