1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
|
/* packet-dlm3.c
* Routines for dlm3 dissection
* Copyright 2007, Masatake YAMATO <jet@gyve.org>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
/* This dissector supports version 3.0 of the dlm(Distributed Lock Manager)
protocol
Actual implementation for the protocol is in linux kernel.
See files under linux/fs/dlm/ */
/*
* #defines are mostly copied from
* *.[ch] files in linux/fs/dlm/ and linux/include/linux/dlm.h
*
* dlm_internal.h:
* -----------------------------------------------------------------------
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
** of the GNU General Public License v.2.
* -----------------------------------------------------------------------
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
#include "packet-tcp.h"
#define TCP_PORT_DLM3 21064 /* Not IANA registered */
#define SCTP_PORT_DLM3 TCP_PORT_DLM3
#define DLM3_MAJOR_VERSION 0x00030000
#define DLM3_MINOR_VERSION_MAX 0x00000002
#define DLM_VERSION_3_1 0x00030001
#define DLM_VERSION_3_2 0x00030002
#define DLM3_MSG 1
#define DLM3_RCOM 2
#define DLM3_OPTS 3
#define DLM3_ACK 4
#define DLM3_FIN 5
#define DLM3_MSG_REQUEST 1
#define DLM3_MSG_CONVERT 2
#define DLM3_MSG_UNLOCK 3
#define DLM3_MSG_CANCEL 4
#define DLM3_MSG_REQUEST_REPLY 5
#define DLM3_MSG_CONVERT_REPLY 6
#define DLM3_MSG_UNLOCK_REPLY 7
#define DLM3_MSG_CANCEL_REPLY 8
#define DLM3_MSG_GRANT 9
#define DLM3_MSG_BAST 10
#define DLM3_MSG_LOOKUP 11
#define DLM3_MSG_REMOVE 12
#define DLM3_MSG_LOOKUP_REPLY 13
#define DLM3_MSG_PURGE 14
#define DLM3_LKF_NOQUEUE 0x00000001
#define DLM3_LKF_CANCEL 0x00000002
#define DLM3_LKF_CONVERT 0x00000004
#define DLM3_LKF_VALBLK 0x00000008
#define DLM3_LKF_QUECVT 0x00000010
#define DLM3_LKF_IVVALBLK 0x00000020
#define DLM3_LKF_CONVDEADLK 0x00000040
#define DLM3_LKF_PERSISTENT 0x00000080
#define DLM3_LKF_NODLCKWT 0x00000100
#define DLM3_LKF_NODLCKBLK 0x00000200
#define DLM3_LKF_EXPEDITE 0x00000400
#define DLM3_LKF_NOQUEUEBAST 0x00000800
#define DLM3_LKF_HEADQUE 0x00001000
#define DLM3_LKF_NOORDER 0x00002000
#define DLM3_LKF_ORPHAN 0x00004000
#define DLM3_LKF_ALTPR 0x00008000
#define DLM3_LKF_ALTCW 0x00010000
#define DLM3_LKF_FORCEUNLOCK 0x00020000
#define DLM3_LKF_TIMEOUT 0x00040000
#define DLM3_SBF_DEMOTED 0x01
#define DLM3_SBF_VALNOTVALID 0x02
#define DLM3_SBF_ALTMODE 0x04
#define DLM3_IFL_USER 0x00000001
#define DLM3_IFL_ORPHAN 0x00000002
/* They may not be used in receiver side.
--------------------------------------
#define DLM3_IFL_MSTCPY 0x00010000
#define DLM3_IFL_RESEND 0x00020000
#define DLM3_IFL_DEAD 0x00040000
#define DLM3_IFL_OVERLAP_UNLOCK 0x00080000
#define DLM3_IFL_OVERLAP_CANCEL 0x00100000
#define DLM3_IFL_ENDOFLIFE 0x00200000
#define DLM3_IFL_WATCH_TIMEWARN 0x00400000
#define DLM3_IFL_TIMEOUT_CANCEL 0x00800000
#define DLM3_IFL_DEADLOCK_CANCEL 0x01000000 */
#define DLM3_LKSTS_WAITING 1
#define DLM3_LKSTS_GRANTED 2
#define DLM3_LKSTS_CONVERT 3
#define DLM3_LOCK_IV -1
#define DLM3_LOCK_NL 0
#define DLM3_LOCK_CR 1
#define DLM3_LOCK_CW 2
#define DLM3_LOCK_PR 3
#define DLM3_LOCK_PW 4
#define DLM3_LOCK_EX 5
#define DLM3_AST_COMP 1
#define DLM3_AST_BAST 2
/* see asm-generic/errno-base.h about LINUX_* */
#define LINUX_EAGAIN 11
#define LINUX_ENOMEM 12
#define LINUX_INVAL 22
#define DLM3_ERRNO_EDEADLK 35
#define DLM3_ERRNO_EBADR 53
#define DLM3_ERRNO_EBADSLT 57
#define DLM3_ERRNO_EPROTO 71
#define DLM3_ERRNO_EOPNOTSUPP 95
#define DLM3_ERRNO_ETIMEDOUT 110
#define DLM3_ERRNO_EINPROGRESS 115
#define DLM3_ECANCEL 0x10001
#define DLM3_EUNLOCK 0x10002
#define DLM3_RCOM_STATUS 1
#define DLM3_RCOM_NAMES 2
#define DLM3_RCOM_LOOKUP 3
#define DLM3_RCOM_LOCK 4
#define DLM3_RCOM_STATUS_REPLY 5
#define DLM3_RCOM_NAMES_REPLY 6
#define DLM3_RCOM_LOOKUP_REPLY 7
#define DLM3_RCOM_LOCK_REPLY 8
#define DLM_RSF_NEED_SLOTS 0x00000001
#define DLM3_RS_NODES 0x00000001
#define DLM3_RS_NODES_ALL 0x00000002
#define DLM3_RS_DIR 0x00000004
#define DLM3_RS_DIR_ALL 0x00000008
#define DLM3_RS_LOCKS 0x00000010
#define DLM3_RS_LOCKS_ALL 0x00000020
#define DLM3_RS_DONE 0x00000040
#define DLM3_RS_DONE_ALL 0x00000080
#define DLM3_RESNAME_MAXLEN 64
#define DLM_HEADER_LEN (4 + 4 + 4 + 2 + 1 + 1)
#define DLM_RCOM_LEN (DLM_HEADER_LEN + 4 + 4 + 8 + 8 + 8)
#define DLM_MSG_LEN (DLM_HEADER_LEN + ((4 * 12) + (4 * 6)))
#define DLM_OPTS_LEN (DLM_HEADER_LEN + 1 + 1 + 2 + 4)
/* Forward declaration we need below */
void proto_register_dlm3(void);
void proto_reg_handoff_dlm3(void);
static dissector_handle_t dlm3_tcp_handle;
static dissector_handle_t dlm3_sctp_handle;
/* Initialize the protocol and registered fields */
static int proto_dlm3 = -1;
/* fields for struct dlm_header(h) */
static int hf_dlm3_h_version = -1;
static int hf_dlm3_h_major_version = -1;
static int hf_dlm3_h_minor_version = -1;
static int hf_dlm3_h_lockspace = -1;
static int hf_dlm3_h_seq = -1;
static int hf_dlm3_h_nodeid = -1;
static int hf_dlm3_h_length = -1;
static int hf_dlm3_h_cmd = -1;
static int hf_dlm3_h_pad = -1;
/* fields for struct dlm_opts(o) */
static int hf_dlm3_o_nextcmd = -1;
static int hf_dlm3_o_pad = -1;
static int hf_dlm3_o_optlen = -1;
static int hf_dlm3_o_pad2 = -1;
static int hf_dlm3_o_opts = -1;
/* fields for struct dlm_opt_header(t) */
static int hf_dlm3_t_type = -1;
static int hf_dlm3_t_length = -1;
static int hf_dlm3_t_pad = -1;
static int hf_dlm3_t_value = -1;
/* fields for struct dlm_message(m) */
static int hf_dlm3_m_type = -1;
static int hf_dlm3_m_nodeid = -1;
static int hf_dlm3_m_pid = -1;
static int hf_dlm3_m_lkid = -1;
static int hf_dlm3_m_remid = -1;
static int hf_dlm3_m_parent_lkid = -1;
static int hf_dlm3_m_parent_remid = -1;
/* bit fields for dlm_message::exflags */
static int hf_dlm3_m_exflags = -1;
static int hf_dlm3_m_exflags_noqueue = -1;
static int hf_dlm3_m_exflags_cancel = -1;
static int hf_dlm3_m_exflags_convert = -1;
static int hf_dlm3_m_exflags_valblk = -1;
static int hf_dlm3_m_exflags_quecvt = -1;
static int hf_dlm3_m_exflags_ivvalblk = -1;
static int hf_dlm3_m_exflags_convdeadlk = -1;
static int hf_dlm3_m_exflags_persistent = -1;
static int hf_dlm3_m_exflags_nodlckwt = -1;
static int hf_dlm3_m_exflags_nodlckblk = -1;
static int hf_dlm3_m_exflags_expedite = -1;
static int hf_dlm3_m_exflags_noqueuebast = -1;
static int hf_dlm3_m_exflags_headque = -1;
static int hf_dlm3_m_exflags_noorder = -1;
static int hf_dlm3_m_exflags_orphan = -1;
static int hf_dlm3_m_exflags_altpr = -1;
static int hf_dlm3_m_exflags_altcw = -1;
static int hf_dlm3_m_exflags_forceunlock = -1;
static int hf_dlm3_m_exflags_timeout = -1;
/* bit fields for dlm_message::sbflags */
static int hf_dlm3_m_sbflags = -1;
static int hf_dlm3_m_sbflags_demoted = -1;
static int hf_dlm3_m_sbflags_valnotvalid = -1;
static int hf_dlm3_m_sbflags_altmode = -1;
/* bit fields for dlm_message::flags */
static int hf_dlm3_m_flags = -1;
static int hf_dlm3_m_flags_user = -1;
static int hf_dlm3_m_flags_orphan = -1;
static int hf_dlm3_m_lvbseq = -1;
static int hf_dlm3_m_hash = -1;
static int hf_dlm3_m_status = -1;
static int hf_dlm3_m_grmode = -1;
static int hf_dlm3_m_rqmode = -1;
static int hf_dlm3_m_bastmode = -1;
/* bit fields for dlm_message::asts */
static int hf_dlm3_m_asts = -1;
static int hf_dlm3_m_asts_comp = -1;
static int hf_dlm3_m_asts_bast = -1;
static int hf_dlm3_m_result = -1;
static int hf_dlm3_m_extra = -1;
/* fields for struct dlm_rcom(rc) */
static int hf_dlm3_rc_type = -1;
static int hf_dlm3_rc_result = -1;
static int hf_dlm3_rc_id = -1;
static int hf_dlm3_rc_seq = -1;
static int hf_dlm3_rc_seq_reply = -1;
static int hf_dlm3_rc_buf = -1;
/* fields for struct rcom_config(rf) */
static int hf_dlm3_rf_lvblen = -1;
static int hf_dlm3_rf_lsflags = -1;
static int hf_dlm3_rf_lsflags_noqueue = -1;
static int hf_dlm3_rf_lsflags_cancel = -1;
static int hf_dlm3_rf_lsflags_convert = -1;
static int hf_dlm3_rf_lsflags_valblk = -1;
static int hf_dlm3_rf_lsflags_quecvt = -1;
static int hf_dlm3_rf_lsflags_ivvalblk = -1;
static int hf_dlm3_rf_lsflags_convdeadlk = -1;
static int hf_dlm3_rf_lsflags_persistent = -1;
static int hf_dlm3_rf_lsflags_nodlckwt = -1;
static int hf_dlm3_rf_lsflags_nodlckblk = -1;
static int hf_dlm3_rf_lsflags_expedite = -1;
static int hf_dlm3_rf_lsflags_noqueuebast = -1;
static int hf_dlm3_rf_lsflags_headque = -1;
static int hf_dlm3_rf_lsflags_noorder = -1;
static int hf_dlm3_rf_lsflags_orphan = -1;
static int hf_dlm3_rf_lsflags_altpr = -1;
static int hf_dlm3_rf_lsflags_altcw = -1;
static int hf_dlm3_rf_lsflags_forceunlock = -1;
static int hf_dlm3_rf_lsflags_timeout = -1;
static int hf_dlm3_rf_unused = -1;
/* fields for struct rcom_status(rs) */
static int hf_dlm3_rs_flags = -1;
static int hf_dlm3_rs_flags_need_slots = -1;
static int hf_dlm3_rs_unused1 = -1;
static int hf_dlm3_rs_unused2 = -1;
/* fields for struct rcom_lock(rl) */
static int hf_dlm3_rl_ownpid = -1;
static int hf_dlm3_rl_lkid = -1;
static int hf_dlm3_rl_remid = -1;
static int hf_dlm3_rl_parent_lkid = -1;
static int hf_dlm3_rl_parent_remid = -1;
static int hf_dlm3_rl_exflags = -1;
static int hf_dlm3_rl_exflags_noqueue = -1;
static int hf_dlm3_rl_exflags_cancel = -1;
static int hf_dlm3_rl_exflags_convert = -1;
static int hf_dlm3_rl_exflags_valblk = -1;
static int hf_dlm3_rl_exflags_quecvt = -1;
static int hf_dlm3_rl_exflags_ivvalblk = -1;
static int hf_dlm3_rl_exflags_convdeadlk = -1;
static int hf_dlm3_rl_exflags_persistent = -1;
static int hf_dlm3_rl_exflags_nodlckwt = -1;
static int hf_dlm3_rl_exflags_nodlckblk = -1;
static int hf_dlm3_rl_exflags_expedite = -1;
static int hf_dlm3_rl_exflags_noqueuebast = -1;
static int hf_dlm3_rl_exflags_headque = -1;
static int hf_dlm3_rl_exflags_noorder = -1;
static int hf_dlm3_rl_exflags_orphan = -1;
static int hf_dlm3_rl_exflags_altpr = -1;
static int hf_dlm3_rl_exflags_altcw = -1;
static int hf_dlm3_rl_exflags_forceunlock = -1;
static int hf_dlm3_rl_exflags_timeout = -1;
static int hf_dlm3_rl_flags = -1;
static int hf_dlm3_rl_flags_user = -1;
static int hf_dlm3_rl_flags_orphan = -1;
static int hf_dlm3_rl_lvbseq = -1;
static int hf_dlm3_rl_result = -1;
static int hf_dlm3_rl_rqmode = -1;
static int hf_dlm3_rl_grmode = -1;
static int hf_dlm3_rl_status = -1;
static int hf_dlm3_rl_asts = -1;
static int hf_dlm3_rl_asts_comp = -1;
static int hf_dlm3_rl_asts_bast = -1;
static int hf_dlm3_rl_wait_type = -1;
static int hf_dlm3_rl_namelen = -1;
static int hf_dlm3_rl_name = -1;
static int hf_dlm3_rl_name_contents = -1;
static int hf_dlm3_rl_name_padding = -1;
static int hf_dlm3_rl_lvb = -1;
/* Initialize the subtree pointers */
static gint ett_dlm3 = -1;
static gint ett_dlm3_version = -1;
static gint ett_dlm3_opts = -1;
static gint ett_dlm3_options = -1;
static gint ett_dlm3_next_cmd = -1;
static gint ett_dlm3_msg = -1;
static gint ett_dlm3_m_exflags = -1;
static gint ett_dlm3_sbflags = -1;
static gint ett_dlm3_m_flags = -1;
static gint ett_dlm3_m_asts = -1;
static gint ett_dlm3_rcom = -1;
static gint ett_dlm3_rcom_status = -1;
static gint ett_dlm3_rcom_lock = -1;
static gint ett_dlm3_rcom_config = -1;
static gint ett_dlm3_rs_flags = -1;
static gint ett_dlm3_rf_lsflags = -1;
static gint ett_dlm3_rl_exflags = -1;
static gint ett_dlm3_rl_flags = -1;
static gint ett_dlm3_rl_asts = -1;
static gint ett_dlm3_rl_name = -1;
/*
* Value strings
*/
static const value_string dlm3_cmd[] = {
{ DLM3_MSG, "message" },
{ DLM3_RCOM, "recovery command" },
{ DLM3_OPTS, "options" },
{ DLM3_ACK, "acknowledge" },
{ DLM3_FIN, "fin" },
{ 0, NULL }
};
static const value_string dlm3_msg[] = {
{ DLM3_MSG_REQUEST, "request message" },
{ DLM3_MSG_CONVERT, "conversion message" },
{ DLM3_MSG_UNLOCK, "unlock message" },
{ DLM3_MSG_CANCEL, "cancel message" },
{ DLM3_MSG_REQUEST_REPLY, "request reply" },
{ DLM3_MSG_CONVERT_REPLY, "conversion reply" },
{ DLM3_MSG_UNLOCK_REPLY, "unlock reply" },
{ DLM3_MSG_CANCEL_REPLY, "cancel reply" },
{ DLM3_MSG_GRANT, "grant message" },
{ DLM3_MSG_BAST, "bast message" },
{ DLM3_MSG_LOOKUP, "lookup message" },
{ DLM3_MSG_REMOVE, "remove message" },
{ DLM3_MSG_LOOKUP_REPLY, "lookup reply" },
{ DLM3_MSG_PURGE, "purge orphans" },
{ 0, NULL }
};
static const value_string dlm3_status[] = {
{ DLM3_LKSTS_WAITING, "waiting" },
{ DLM3_LKSTS_GRANTED, "granted" },
{ DLM3_LKSTS_CONVERT, "convert" },
{ 0, NULL }
};
static const value_string dlm3_mode[] = {
{ DLM3_LOCK_IV, "invalid" },
{ DLM3_LOCK_NL, "null" },
{ DLM3_LOCK_CR, "concurrent read" },
{ DLM3_LOCK_CW, "concurrent write" },
{ DLM3_LOCK_PR, "protected read" },
{ DLM3_LOCK_PW, "protected write" },
{ DLM3_LOCK_EX, "exclusive" },
{ 0, NULL }
};
static const value_string dlm3_result[] = {
{ -LINUX_EAGAIN, "blocked" },
{ -LINUX_ENOMEM, "no memory" },
{ -LINUX_INVAL, "invalid parameters" },
{ -DLM3_ERRNO_EDEADLK, "Resource deadlock avoided" },
{ -DLM3_ERRNO_EBADR, "Invalid request descriptor" },
{ -DLM3_ERRNO_EBADSLT, "Invalid slot" },
{ -DLM3_ERRNO_EPROTO, "Protocol error" },
{ -DLM3_ERRNO_EOPNOTSUPP, "Operation not supported" },
{ -DLM3_ERRNO_ETIMEDOUT, "Connection timed out" },
{ -DLM3_ERRNO_EINPROGRESS, "Operation now in progress" },
{ -DLM3_ECANCEL, "cancel completed successfully" },
{ -DLM3_EUNLOCK, "unlock request was successful" },
{ 0, "successful" },
{ 0, NULL }
};
static const value_string dlm3_rcom[] = {
{ DLM3_RCOM_STATUS, "status command" },
{ DLM3_RCOM_NAMES, "names command" },
{ DLM3_RCOM_LOOKUP, "lookup command" },
{ DLM3_RCOM_LOCK, "lock command" },
{ DLM3_RCOM_STATUS_REPLY, "status reply" },
{ DLM3_RCOM_NAMES_REPLY, "names reply" },
{ DLM3_RCOM_LOOKUP_REPLY, "lookup reply" },
{ DLM3_RCOM_LOCK_REPLY, "lock reply" },
{ 0, NULL }
};
static const value_string dlm3_rs[] = {
{ DLM3_RS_NODES, "recovering nodes" },
{ DLM3_RS_NODES_ALL, "recovering all nodes" },
{ DLM3_RS_DIR, "recovering resource directory" },
{ DLM3_RS_DIR_ALL, "recovering all resource directories" },
{ DLM3_RS_LOCKS, "recovering lock" },
{ DLM3_RS_LOCKS_ALL, "recovering all locks" },
{ DLM3_RS_DONE, "recovering is done" },
{ DLM3_RS_DONE_ALL, "all recovering is done" },
{ 0, NULL }
};
/*
* Fields
*/
static int * const m_exflags_fields[] = {
&hf_dlm3_m_exflags_timeout,
&hf_dlm3_m_exflags_forceunlock,
&hf_dlm3_m_exflags_altcw,
&hf_dlm3_m_exflags_altpr,
&hf_dlm3_m_exflags_orphan,
&hf_dlm3_m_exflags_noorder,
&hf_dlm3_m_exflags_headque,
&hf_dlm3_m_exflags_noqueuebast,
&hf_dlm3_m_exflags_expedite,
&hf_dlm3_m_exflags_nodlckblk,
&hf_dlm3_m_exflags_nodlckwt,
&hf_dlm3_m_exflags_persistent,
&hf_dlm3_m_exflags_convdeadlk,
&hf_dlm3_m_exflags_ivvalblk,
&hf_dlm3_m_exflags_quecvt,
&hf_dlm3_m_exflags_valblk,
&hf_dlm3_m_exflags_convert,
&hf_dlm3_m_exflags_cancel,
&hf_dlm3_m_exflags_noqueue,
NULL
};
static int * const rs_flags_fields[] = {
&hf_dlm3_rs_flags_need_slots,
NULL
};
static int * const m_sbflags_fields[] = {
&hf_dlm3_m_sbflags_altmode,
&hf_dlm3_m_sbflags_valnotvalid,
&hf_dlm3_m_sbflags_demoted,
NULL
};
static int * const m_flags_fields[] = {
&hf_dlm3_m_flags_orphan,
&hf_dlm3_m_flags_user,
NULL
};
static int * const m_asts_fields[] = {
&hf_dlm3_m_asts_bast,
&hf_dlm3_m_asts_comp,
NULL
};
static int * const rf_lsflags_fields[] = {
&hf_dlm3_rf_lsflags_timeout,
&hf_dlm3_rf_lsflags_forceunlock,
&hf_dlm3_rf_lsflags_altcw,
&hf_dlm3_rf_lsflags_altpr,
&hf_dlm3_rf_lsflags_orphan,
&hf_dlm3_rf_lsflags_noorder,
&hf_dlm3_rf_lsflags_headque,
&hf_dlm3_rf_lsflags_noqueuebast,
&hf_dlm3_rf_lsflags_expedite,
&hf_dlm3_rf_lsflags_nodlckblk,
&hf_dlm3_rf_lsflags_nodlckwt,
&hf_dlm3_rf_lsflags_persistent,
&hf_dlm3_rf_lsflags_convdeadlk,
&hf_dlm3_rf_lsflags_ivvalblk,
&hf_dlm3_rf_lsflags_quecvt,
&hf_dlm3_rf_lsflags_valblk,
&hf_dlm3_rf_lsflags_convert,
&hf_dlm3_rf_lsflags_cancel,
&hf_dlm3_rf_lsflags_noqueue,
NULL
};
static int * const rl_exflags_fields[] = {
&hf_dlm3_rl_exflags_timeout,
&hf_dlm3_rl_exflags_forceunlock,
&hf_dlm3_rl_exflags_altcw,
&hf_dlm3_rl_exflags_altpr,
&hf_dlm3_rl_exflags_orphan,
&hf_dlm3_rl_exflags_noorder,
&hf_dlm3_rl_exflags_headque,
&hf_dlm3_rl_exflags_noqueuebast,
&hf_dlm3_rl_exflags_expedite,
&hf_dlm3_rl_exflags_nodlckblk,
&hf_dlm3_rl_exflags_nodlckwt,
&hf_dlm3_rl_exflags_persistent,
&hf_dlm3_rl_exflags_convdeadlk,
&hf_dlm3_rl_exflags_ivvalblk,
&hf_dlm3_rl_exflags_quecvt,
&hf_dlm3_rl_exflags_valblk,
&hf_dlm3_rl_exflags_convert,
&hf_dlm3_rl_exflags_cancel,
&hf_dlm3_rl_exflags_noqueue,
NULL
};
static int * const rl_flags_fields[] = {
&hf_dlm3_rl_flags_orphan,
&hf_dlm3_rl_flags_user,
NULL
};
static int * const rl_asts_fields[] = {
&hf_dlm3_rl_asts_bast,
&hf_dlm3_rl_asts_comp,
NULL
};
/* Code to actually dissect the packets */
static void
dissect_dlm3_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint length, int offset)
{
guint32 m_type;
m_type = tvb_get_letohl(tvb, offset);
proto_tree_add_uint(tree,
hf_dlm3_m_type, tvb, offset, 4, m_type);
col_append_fstr(pinfo->cinfo, COL_INFO,
": %s",
val_to_str_const(m_type,
dlm3_msg,
"Unknown"));
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_nodeid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_pid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_lkid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
/* TODO: See `create_lkb'
lkid has some structure. We dissect more. */
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_remid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_parent_lkid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_parent_remid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_exflags, ett_dlm3_m_exflags,
m_exflags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_sbflags, ett_dlm3_sbflags,
m_sbflags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_flags, ett_dlm3_m_flags,
m_flags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_lvbseq, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_hash, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_status, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_grmode, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_rqmode, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_bastmode, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_m_asts, ett_dlm3_m_asts,
m_asts_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_m_result, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
if ((length - offset) > 0) {
proto_tree_add_item(tree,
hf_dlm3_m_extra,
tvb,
offset,
-1,
ENC_NA);
}
}
static void
dissect_dlm3_rcom_status(tvbuff_t *tvb, proto_tree *tree,
guint length, int offset)
{
if ((length - offset) < ( 4 * 2 + 8 ))
return;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_rs_flags, ett_dlm3_rs_flags,
rs_flags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rs_unused1, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rs_unused2, tvb, offset, 8, ENC_LITTLE_ENDIAN);
}
static void
dissect_dlm3_rcom_lock(tvbuff_t *tvb, proto_tree *tree,
guint length, int offset)
{
proto_item *sub_item;
proto_tree *sub_tree;
int sub_offset;
guint16 namelen;
guint32 exflags;
if ((length - offset) < ( 4 * 8 + 4 + 1 * 4 + 2 * 2
+ DLM3_RESNAME_MAXLEN ))
return;
proto_tree_add_item(tree,
hf_dlm3_rl_ownpid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rl_lkid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rl_remid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rl_parent_lkid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rl_parent_remid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_rl_exflags, ett_dlm3_rl_exflags,
rl_exflags_fields, ENC_LITTLE_ENDIAN);
exflags = tvb_get_letohl(tvb, offset);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_rl_flags, ett_dlm3_rl_flags,
rl_flags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rl_lvbseq, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rl_result, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rl_rqmode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_item(tree,
hf_dlm3_rl_grmode, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_item(tree,
hf_dlm3_rl_status, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_rl_asts, ett_dlm3_rl_asts,
rl_asts_fields, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_item(tree,
hf_dlm3_rl_wait_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
namelen = tvb_get_letohs(tvb, offset);
proto_tree_add_uint(tree,
hf_dlm3_rl_namelen, tvb, offset, 2,
namelen);
offset += 2;
if (namelen <= DLM3_RESNAME_MAXLEN) {
sub_item = proto_tree_add_item(tree,
hf_dlm3_rl_name, tvb, offset,
DLM3_RESNAME_MAXLEN, ENC_NA);
sub_tree = proto_item_add_subtree(sub_item,
ett_dlm3_rl_name);
sub_offset = offset;
proto_tree_add_item(sub_tree,
hf_dlm3_rl_name_contents, tvb, sub_offset,
namelen, ENC_ASCII);
sub_offset += namelen;
proto_tree_add_item(sub_tree,
hf_dlm3_rl_name_padding, tvb, sub_offset,
DLM3_RESNAME_MAXLEN - namelen, ENC_NA);
} else {
/* XXX - report an error */
}
offset += DLM3_RESNAME_MAXLEN;
if (((length - offset) > 0) && (exflags & DLM3_LKF_VALBLK))
proto_tree_add_item(tree,
hf_dlm3_rl_lvb, tvb, offset,
-1,
ENC_NA);
}
static void
dissect_dlm3_rcom_config(tvbuff_t *tvb, proto_tree *tree,
guint length, int offset)
{
if ((length - offset) < ( 4 + 4 + 8 ))
return;
proto_tree_add_item(tree,
hf_dlm3_rf_lvblen, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_bitmask(tree, tvb, offset,
hf_dlm3_rf_lsflags, ett_dlm3_rf_lsflags,
rf_lsflags_fields, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rf_unused, tvb, offset, 8, ENC_LITTLE_ENDIAN);
/*offset += 8;*/
/* END */
}
static void
dissect_dlm3_rcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint length, int offset, guint32 h_version)
{
guint32 rc_type;
proto_item *sub_item;
proto_tree *sub_tree;
rc_type = tvb_get_letohl(tvb, offset);
proto_tree_add_uint(tree,
hf_dlm3_rc_type, tvb, offset, 4, rc_type);
col_append_fstr(pinfo->cinfo, COL_INFO,
": %s",
val_to_str_const(rc_type,
dlm3_rcom,
"Unknown"));
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rc_result, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_rc_id, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
proto_tree_add_item(tree,
hf_dlm3_rc_seq, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
proto_tree_add_item(tree,
hf_dlm3_rc_seq_reply, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
if ((length - offset) == 0) {
/* No rc_buf: Just return */
return;
}
/* Decode rc_buf */
sub_item = proto_tree_add_item(tree,
hf_dlm3_rc_buf,
tvb,
offset,
-1,
ENC_NA);
offset += 0;
if (rc_type == DLM3_RCOM_STATUS && (h_version & 0xffff) > 0) {
sub_tree = proto_item_add_subtree(sub_item,
ett_dlm3_rcom_status);
dissect_dlm3_rcom_status(tvb, sub_tree, length, offset);
} else if (rc_type == DLM3_RCOM_LOCK) {
sub_tree = proto_item_add_subtree(sub_item,
ett_dlm3_rcom_lock);
dissect_dlm3_rcom_lock(tvb, sub_tree, length, offset);
} else if (rc_type == DLM3_RCOM_STATUS_REPLY) {
sub_tree = proto_item_add_subtree(sub_item,
ett_dlm3_rcom_config);
dissect_dlm3_rcom_config(tvb, sub_tree, length, offset);
}
}
static int
dissect_dlm3_1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_,
guint8 h_cmd, guint32 h_version, guint length, int offset)
{
proto_item *sub_item;
proto_tree *sub_tree;
switch (h_cmd) {
case DLM3_MSG:
case DLM3_RCOM:
break;
default:
return 0;
}
sub_item = proto_tree_add_uint(tree,
hf_dlm3_h_version, tvb, offset, 4,
h_version);
sub_tree = proto_item_add_subtree(sub_item, ett_dlm3_version);
proto_tree_add_uint(sub_tree,
hf_dlm3_h_major_version, tvb, offset + 0, 2,
(h_version & 0xFFFF0000) >> 16);
proto_tree_add_uint(sub_tree,
hf_dlm3_h_minor_version, tvb, offset + 2, 2,
(h_version & 0x0000FFFF));
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_h_lockspace, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_h_nodeid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_h_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
sub_item = proto_tree_add_uint(tree,
hf_dlm3_h_cmd, tvb, offset, 1, h_cmd);
offset += 1;
proto_tree_add_item(tree,
hf_dlm3_h_pad, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
switch (h_cmd) {
case DLM3_MSG:
if (length < DLM_MSG_LEN)
return 0;
sub_tree = proto_item_add_subtree(sub_item, ett_dlm3_msg);
dissect_dlm3_msg(tvb, pinfo, sub_tree, length, offset);
break;
case DLM3_RCOM:
if (length < DLM_RCOM_LEN)
return 0;
sub_tree = proto_item_add_subtree(sub_item, ett_dlm3_rcom);
dissect_dlm3_rcom(tvb, pinfo, sub_tree, length, offset, h_version);
break;
default:
break;
}
return tvb_captured_length(tvb);
}
static int
dissect_dlm3_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_,
guint8 h_cmd, guint32 h_version, guint length)
{
proto_item *sub_item, *opts_item;
proto_tree *sub_tree, *opts_tree;
int offset, tlv_offset;
guint o_nextcmd;
guint16 o_optlen, tmp, t_len;
switch (h_cmd) {
case DLM3_MSG:
case DLM3_RCOM:
case DLM3_OPTS:
case DLM3_ACK:
case DLM3_FIN:
break;
default:
return 0;
}
offset = 0;
sub_item = proto_tree_add_uint(tree,
hf_dlm3_h_version, tvb, offset, 4,
h_version);
sub_tree = proto_item_add_subtree(sub_item, ett_dlm3_version);
proto_tree_add_uint(sub_tree,
hf_dlm3_h_major_version, tvb, offset + 0, 2,
(h_version & 0xFFFF0000) >> 16);
proto_tree_add_uint(sub_tree,
hf_dlm3_h_minor_version, tvb, offset + 2, 2,
(h_version & 0x0000FFFF));
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_h_seq, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_h_nodeid, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree,
hf_dlm3_h_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
sub_item = proto_tree_add_uint(tree,
hf_dlm3_h_cmd, tvb, offset, 1, h_cmd);
offset += 1;
proto_tree_add_item(tree,
hf_dlm3_h_pad, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
switch (h_cmd) {
case DLM3_OPTS:
if (length < DLM_OPTS_LEN)
return 0;
sub_tree = proto_item_add_subtree(sub_item, ett_dlm3_opts);
o_nextcmd = tvb_get_guint8(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO,
": %s", val_to_str_const(o_nextcmd,
dlm3_cmd,
"Unknown"));
sub_item = proto_tree_add_uint(sub_tree, hf_dlm3_o_nextcmd, tvb, offset, 1, o_nextcmd);
offset += 1;
proto_tree_add_item(sub_tree, hf_dlm3_o_pad, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
o_optlen = tvb_get_letohs(tvb, offset);
tmp = DLM_OPTS_LEN + o_optlen;
if (length < tmp)
return 0;
proto_tree_add_uint(sub_tree, hf_dlm3_o_optlen, tvb, offset, 2, o_optlen);
offset += 2;
proto_tree_add_item(sub_tree, hf_dlm3_o_pad2, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
tmp = o_optlen;
if (tmp) {
opts_item = proto_tree_add_item(sub_tree, hf_dlm3_o_opts, tvb, offset, tmp, ENC_NA);
opts_tree = proto_item_add_subtree(opts_item, ett_dlm3_options);
tlv_offset = 0;
while (tmp > 0) {
proto_tree_add_item(opts_tree, hf_dlm3_t_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
tlv_offset += 2;
t_len = tvb_get_letohs(tvb, offset);
if (t_len > o_optlen - tlv_offset)
return 0;
proto_tree_add_uint(opts_tree, hf_dlm3_t_length, tvb, offset, 2, t_len);
tlv_offset += 2;
proto_tree_add_item(opts_tree, hf_dlm3_t_pad, tvb, offset, 4, ENC_LITTLE_ENDIAN);
tlv_offset += 4;
proto_tree_add_item(opts_tree, hf_dlm3_t_value, tvb, offset, t_len, ENC_NA);
tlv_offset += t_len;
tmp -= t_len;
}
offset += tlv_offset;
}
switch (o_nextcmd) {
case DLM3_MSG:
tmp = DLM_OPTS_LEN + o_optlen + DLM_RCOM_LEN;
if (length < tmp)
return 0;
sub_tree = proto_item_add_subtree(sub_item, ett_dlm3_next_cmd);
dissect_dlm3_1(tvb, pinfo, sub_tree, data, o_nextcmd, h_version, length, offset);
break;
case DLM3_RCOM:
tmp = DLM_OPTS_LEN + o_optlen + DLM_RCOM_LEN;
if (length < tmp)
return 0;
sub_tree = proto_item_add_subtree(sub_item, ett_dlm3_next_cmd);
dissect_dlm3_1(tvb, pinfo, sub_tree, data, o_nextcmd, h_version, length, offset);
break;
default:
return 0;
}
break;
case DLM3_MSG:
if (length < DLM_MSG_LEN)
return 0;
dissect_dlm3_1(tvb, pinfo, sub_tree, data, h_cmd, h_version, length, offset);
break;
case DLM3_RCOM:
if (length < DLM_RCOM_LEN)
return 0;
dissect_dlm3_1(tvb, pinfo, sub_tree, data, h_cmd, h_version, length, offset);
break;
default:
break;
}
return tvb_captured_length(tvb);
}
static int
dissect_dlm3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
{
proto_item *item;
proto_tree *tree;
guint length;
guint32 h_version;
guint8 h_cmd;
int ret = 0;
/* Check that there's enough data */
length = tvb_captured_length(tvb);
if (length < DLM_HEADER_LEN)
return 0;
/* Check the protocol version */
h_version = tvb_get_letohl(tvb, 0);
if ((h_version & 0xffff0000) != DLM3_MAJOR_VERSION ||
(h_version & 0xffff) > DLM3_MINOR_VERSION_MAX)
return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DLM3");
col_set_str(pinfo->cinfo, COL_INFO, "DLM3");
h_cmd = tvb_get_guint8(tvb, DLM_HEADER_LEN - 1 - 1);
col_set_str(pinfo->cinfo, COL_INFO,
val_to_str_const(h_cmd,
dlm3_cmd,
"packet-dlm3.c internal bug"));
item = proto_tree_add_item(parent_tree, proto_dlm3, tvb, 0,
-1, ENC_NA);
tree = proto_item_add_subtree(item, ett_dlm3);
switch (h_version) {
case DLM_VERSION_3_1:
ret = dissect_dlm3_1(tvb, pinfo, tree, data, h_cmd, h_version, length, 0);
break;
case DLM_VERSION_3_2:
ret = dissect_dlm3_2(tvb, pinfo, tree, data, h_cmd, h_version, length);
break;
default:
break;
}
return ret;
}
/* This method dissects fully reassembled messages */
static int
dissect_dlm3_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_)
{
dissect_dlm3(tvb, pinfo, tree, data);
return tvb_captured_length(tvb);
}
/* determine PDU length of protocol foo */
static guint
get_dlm3_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
return tvb_get_letohs(tvb, offset + DLM_HEADER_LEN - 2 - 1 - 1);
}
static int
dissect_tcp_dlm3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, DLM_HEADER_LEN - 1 - 1,
get_dlm3_message_len, dissect_dlm3_message, data);
return tvb_captured_length(tvb);
}
/* Register the protocol with Wireshark */
void
proto_register_dlm3(void)
{
static hf_register_info hf[] = {
/* dlm_header */
{ &hf_dlm3_h_version,
{ "Version", "dlm3.h.version",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_major_version,
{ "Major Version", "dlm3.h.major_version",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_minor_version,
{ "Minor Version", "dlm3.h.minor_version",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_lockspace,
{ "Lockspace Global ID", "dlm3.h.lockspac",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_seq,
{ "Sequence Number", "dlm3.h.seq",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_nodeid,
{ "Sender Node ID", "dlm3.h.nodeid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_length,
{ "Length", "dlm3.h.length",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_cmd,
{ "Command", "dlm3.h.cmd",
FT_UINT8, BASE_DEC, VALS(dlm3_cmd), 0x0,
NULL, HFILL }},
{ &hf_dlm3_h_pad,
{ "Padding", "dlm3.h.pad",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
/* dlm_opts */
{ &hf_dlm3_o_nextcmd,
{ "Next Command", "dlm3.o.nextcmd",
FT_UINT8, BASE_DEC, VALS(dlm3_cmd), 0x0,
NULL, HFILL }},
{ &hf_dlm3_o_pad,
{ "Padding", "dlm3.o.pad",
FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_o_optlen,
{ "Options Length", "dlm3.o.optlen",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_o_pad2,
{ "Padding", "dlm3.o.pad2",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_o_opts,
{ "Options", "dlm3.o.opts",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
/* dlm_opt_header */
{ &hf_dlm3_t_type,
{ "Type", "dlm3.t.type",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_t_length,
{ "Length", "dlm3.t.length",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_t_pad,
{ "Padding", "dlm3.t.pad",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_t_value,
{ "Value", "dlm3.t.value",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
/* dlm_message */
{ &hf_dlm3_m_type,
{ "Message Type", "dlm3.m.type",
FT_UINT32, BASE_DEC, VALS(dlm3_msg), 0x0,
NULL, HFILL }},
{ &hf_dlm3_m_nodeid,
{ "Receiver Node ID", "dlm3.m.nodeid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_m_pid,
{ "Process ID of Lock Owner", "dlm3.m.pid",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_m_lkid,
{ "Lock ID on Sender", "dlm3.m.lkid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_remid,
{ "Lock ID on Receiver", "dlm3.m.remid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_parent_lkid,
{ "Parent Lock ID on Sender", "dlm3.m.parent_lkid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_parent_remid,
{ "Parent Lock ID on Receiver", "dlm3.m.parent_remid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
/* dlm_message::exflags */
{ &hf_dlm3_m_exflags,
{ "External Flags", "dlm3.m.exflags",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_noqueue,
{ "Don't queue", "dlm3.m.exflags.noqueue",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOQUEUE,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_cancel,
{ "Cancel", "dlm3.m.exflags.cancel",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CANCEL,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_convert,
{ "Convert", "dlm3.m.exflags.convert",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CONVERT,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_valblk,
{ "Return the contents of the lock value block", "dlm3.m.exflags.valblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_VALBLK,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_quecvt,
{ "Force a conversion request to be queued", "dlm3.m.exflags.quecvt",
FT_BOOLEAN, 32, NULL, DLM3_LKF_QUECVT,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_ivvalblk,
{ "Invalidate the lock value block", "dlm3.m.exflags.ivvalblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_IVVALBLK,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_convdeadlk,
{ "Forced down to NL to resolve a conversion deadlock", "dlm3.m.exflags.convdeadlk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CONVDEADLK,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_persistent,
{ "Persistent", "dlm3.m.exflags.persistent",
FT_BOOLEAN, 32, NULL, DLM3_LKF_PERSISTENT,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_nodlckwt,
{ "Don't cancel the lock if it gets into conversion deadlock", "dlm3.m.exflags.nodlckwt",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NODLCKWT,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_nodlckblk,
{ "Nodlckblk", "dlm3.m.exflags.nodlckblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NODLCKBLK,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_expedite,
{ "Grant a NL lock immediately", "dlm3.m.exflags.expedite",
FT_BOOLEAN, 32, NULL, DLM3_LKF_EXPEDITE,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_noqueuebast,
{ "Send blocking ASTs even for NOQUEUE operations", "dlm3.m.exflags.noqueuebast",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOQUEUEBAST,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_headque,
{ "Add a lock to the head of the queue", "dlm3.m.exflags.headque",
FT_BOOLEAN, 32, NULL, DLM3_LKF_HEADQUE,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_noorder,
{ "Disregard the standard grant order rules", "dlm3.m.exflags.noorder",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOORDER,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_orphan,
{ "Orphan", "dlm3.m.exflags.orphan",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ORPHAN,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_altpr,
{ "Try to grant the lock in `protected read' mode", "dlm3.m.exflags.altpr",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ALTPR,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_altcw,
{ "Try to grant the lock in `concurrent read' mode", "dlm3.m.exflags.altcw",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ALTCW,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_forceunlock,
{ "Force unlock", "dlm3.m.exflags.forceunlock",
FT_BOOLEAN, 32, NULL, DLM3_LKF_FORCEUNLOCK,
NULL, HFILL}},
{ &hf_dlm3_m_exflags_timeout,
{ "Timeout", "dlm3.m.exflags.timeout",
FT_BOOLEAN, 32, NULL, DLM3_LKF_TIMEOUT,
NULL, HFILL}},
/* dlm_message::sbflags */
{ &hf_dlm3_m_sbflags,
{ "Status Block Flags", "dlm3.m.sbflags",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_sbflags_demoted,
{ "Demoted for deadlock resolution", "dlm3.m.sbflags.demoted",
FT_BOOLEAN, 32, NULL, DLM3_SBF_DEMOTED,
NULL, HFILL}},
{ &hf_dlm3_m_sbflags_valnotvalid,
{ "Lock Value Block Is Invalid", "dlm3.m.sbflags.valnotvalid",
FT_BOOLEAN, 32, NULL, DLM3_SBF_VALNOTVALID,
NULL, HFILL}},
{ &hf_dlm3_m_sbflags_altmode,
{ "Try to Grant in Alternative Mode", "dlm3.m.sbflags.altmode",
FT_BOOLEAN, 32, NULL, DLM3_SBF_ALTMODE,
NULL, HFILL}},
/* dlm_message::flags */
{ &hf_dlm3_m_flags,
{ "Internal Flags", "dlm3.m.flags",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_flags_user,
{ "User space lock related", "dlm3.m.flags.user",
FT_BOOLEAN, 32, NULL, DLM3_IFL_USER,
NULL, HFILL}},
{ &hf_dlm3_m_flags_orphan,
{ "Orphaned lock", "dlm3.m.flags.orphan",
FT_BOOLEAN, 32, NULL, DLM3_IFL_ORPHAN,
NULL, HFILL}},
{ &hf_dlm3_m_lvbseq,
{ "Lock Value Block Sequence Number", "dlm3.m.lvbseq",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_hash,
{ "Hash value", "dlm3.m.hash",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_status,
{ "Status", "dlm3.m.status",
FT_INT32, BASE_DEC, VALS(dlm3_status), 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_grmode,
{ "Granted Mode", "dlm3.m.grmode",
FT_INT32, BASE_DEC, VALS(dlm3_mode), 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_rqmode,
{ "Request Mode", "dlm3.m.rqmode",
FT_INT32, BASE_DEC, VALS(dlm3_mode), 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_bastmode,
{ "Mode requested by another node", "dlm3.m.bastmode",
FT_INT32, BASE_DEC, VALS(dlm3_mode), 0x0,
NULL, HFILL}},
/* dlm_message::asts */
{ &hf_dlm3_m_asts,
{ "Asynchronous Traps", "dlm3.m.asts",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_asts_comp,
{ "Completion", "dlm3.m.asts.comp",
FT_BOOLEAN, 32, NULL, DLM3_AST_COMP,
NULL, HFILL }},
{ &hf_dlm3_m_asts_bast,
{ "Blocking", "dlm3.m.asts.bast",
FT_BOOLEAN, 32, NULL, DLM3_AST_BAST,
NULL, HFILL }},
{ &hf_dlm3_m_result,
{ "Message Result(errno)", "dlm3.m.result",
FT_INT32, BASE_DEC, VALS(dlm3_result), 0x0,
NULL, HFILL}},
{ &hf_dlm3_m_extra,
{ "Extra Message", "dlm3.m.extra",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL}},
/* dlm_rcom */
{ &hf_dlm3_rc_type,
{ "Recovery Command Type", "dlm3.rc.type",
FT_UINT32, BASE_DEC, VALS(dlm3_rcom), 0x0,
NULL, HFILL}},
{ &hf_dlm3_rc_result,
{ "Recovery Command Result", "dlm3.rc.result",
FT_INT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rc_id,
{ "Recovery Command ID", "dlm3.rc.id",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rc_seq,
{ "Recovery Command Sequence Number of Sender", "dlm3.rc.seq",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rc_seq_reply,
{ "Recovery Command Sequence Number of Receiver", "dlm3.rc.seq_reply",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rc_buf,
{ "Recovery Buffer", "dlm3.rc.buf",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL}},
/* rcom_config */
{ &hf_dlm3_rf_lvblen,
{ "Lock Value Block Length", "dlm3.rf.lvblen",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}},
/* rcom_config::rf_lsflags */
{ &hf_dlm3_rf_lsflags,
{ "External Flags", "dlm3.rf.lsflags",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_noqueue,
{ "Don't queue", "dlm3.rf.lsflags.noqueue",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOQUEUE,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_cancel,
{ "Cancel", "dlm3.rf.lsflags.cancel",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CANCEL,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_convert,
{ "Convert", "dlm3.rf.lsflags.convert",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CONVERT,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_valblk,
{ "Return the contents of the lock value block", "dlm3.rf.lsflags.valblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_VALBLK,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_quecvt,
{ "Force a conversion request to be queued", "dlm3.rf.lsflags.quecvt",
FT_BOOLEAN, 32, NULL, DLM3_LKF_QUECVT,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_ivvalblk,
{ "Invalidate the lock value block", "dlm3.rf.lsflags.ivvalblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_IVVALBLK,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_convdeadlk,
{ "Forced down to NL to resolve a conversion deadlock", "dlm3.rf.lsflags.convdeadlk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CONVDEADLK,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_persistent,
{ "Persistent", "dlm3.rf.lsflags.persistent",
FT_BOOLEAN, 32, NULL, DLM3_LKF_PERSISTENT,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_nodlckwt,
{ "Don't cancel the lock if it gets into conversion deadlock", "dlm3.rf.lsflags.nodlckwt",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NODLCKWT,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_nodlckblk,
{ "Nodlckblk", "dlm3.rf.lsflags.nodlckblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NODLCKBLK,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_expedite,
{ "Grant a NL lock immediately", "dlm3.rf.lsflags.expedite",
FT_BOOLEAN, 32, NULL, DLM3_LKF_EXPEDITE,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_noqueuebast,
{ "Send blocking ASTs even for NOQUEUE operations", "dlm3.rf.lsflags.noqueuebast",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOQUEUEBAST,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_headque,
{ "Add a lock to the head of the queue", "dlm3.rf.lsflags.headque",
FT_BOOLEAN, 32, NULL, DLM3_LKF_HEADQUE,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_noorder,
{ "Disregard the standard grant order rules", "dlm3.rf.lsflags.noorder",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOORDER,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_orphan,
{ "Orphan", "dlm3.rf.lsflags.orphan",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ORPHAN,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_altpr,
{ "Try to grant the lock in `protected read' mode", "dlm3.rf.lsflags.altpr",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ALTPR,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_altcw,
{ "Try to grant the lock in `concurrent read' mode", "dlm3.rf.lsflags.altcw",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ALTCW,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_forceunlock,
{ "Force unlock", "dlm3.rf.lsflags.forceunlock",
FT_BOOLEAN, 32, NULL, DLM3_LKF_FORCEUNLOCK,
NULL, HFILL}},
{ &hf_dlm3_rf_lsflags_timeout,
{ "Timeout", "dlm3.rf.lsflags.timeout",
FT_BOOLEAN, 32, NULL, DLM3_LKF_TIMEOUT,
NULL, HFILL}},
{ &hf_dlm3_rf_unused,
{ "Unused area", "dlm3.rf.lsflags.unused",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
/* rcom_status */
{ &hf_dlm3_rs_flags,
{ "Recovery Command Status Flags", "dlm3.rs.flags",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rs_flags_need_slots,
{ "Need slots", "dlm3.rs.flags.need_slots",
FT_UINT32, BASE_HEX, NULL, DLM_RSF_NEED_SLOTS,
NULL, HFILL}},
{ &hf_dlm3_rs_unused1,
{ "Unused area", "dlm3.rs.unused1",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rs_unused2,
{ "Unused area", "dlm3.rs.unused2",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
/* rcom_lock */
{ &hf_dlm3_rl_ownpid,
{ "Process ID of Lock Owner", "dlm3.rl.ownpid",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_lkid,
{ "Lock ID on Sender", "dlm3.rl.lkid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_remid,
{ "Lock ID on Receiver", "dlm3.rl.remid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_parent_lkid,
{ "Parent Lock ID on Sender", "dlm3.rl.parent_lkid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_parent_remid,
{ "Parent Lock ID on Receiver", "dlm3.rl.parent_remid",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags,
{ "External Flags", "dlm3.rl.exflags",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_noqueue,
{ "Don't queue", "dlm3.rl.exflags.noqueue",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOQUEUE,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_cancel,
{ "Cancel", "dlm3.rl.exflags.cancel",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CANCEL,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_convert,
{ "Convert", "dlm3.rl.exflags.convert",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CONVERT,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_valblk,
{ "Return the contents of the lock value block", "dlm3.rl.exflags.valblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_VALBLK,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_quecvt,
{ "Force a conversion request to be queued", "dlm3.rl.exflags.quecvt",
FT_BOOLEAN, 32, NULL, DLM3_LKF_QUECVT,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_ivvalblk,
{ "Invalidate the lock value block", "dlm3.rl.exflags.ivvalblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_IVVALBLK,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_convdeadlk,
{ "Forced down to NL to resolve a conversion deadlock", "dlm3.rl.exflags.convdeadlk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_CONVDEADLK,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_persistent,
{ "Persistent", "dlm3.rl.exflags.persistent",
FT_BOOLEAN, 32, NULL, DLM3_LKF_PERSISTENT,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_nodlckwt,
{ "Don't cancel the lock if it gets into conversion deadlock", "dlm3.rl.exflags.nodlckwt",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NODLCKWT,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_nodlckblk,
{ "Nodlckblk", "dlm3.rl.exflags.nodlckblk",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NODLCKBLK,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_expedite,
{ "Grant a NL lock immediately", "dlm3.rl.exflags.expedite",
FT_BOOLEAN, 32, NULL, DLM3_LKF_EXPEDITE,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_noqueuebast,
{ "Send blocking ASTs even for NOQUEUE operations", "dlm3.rl.exflags.noqueuebast",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOQUEUEBAST,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_headque,
{ "Add a lock to the head of the queue", "dlm3.rl.exflags.headque",
FT_BOOLEAN, 32, NULL, DLM3_LKF_HEADQUE,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_noorder,
{ "Disregard the standard grant order rules", "dlm3.rl.exflags.noorder",
FT_BOOLEAN, 32, NULL, DLM3_LKF_NOORDER,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_orphan,
{ "Orphan", "dlm3.rl.exflags.orphan",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ORPHAN,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_altpr,
{ "Try to grant the lock in `protected read' mode", "dlm3.rl.exflags.altpr",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ALTPR,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_altcw,
{ "Try to grant the lock in `concurrent read' mode", "dlm3.rl.exflags.altcw",
FT_BOOLEAN, 32, NULL, DLM3_LKF_ALTCW,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_forceunlock,
{ "Force unlock", "dlm3.rl.exflags.forceunlock",
FT_BOOLEAN, 32, NULL, DLM3_LKF_FORCEUNLOCK,
NULL, HFILL}},
{ &hf_dlm3_rl_exflags_timeout,
{ "Timeout", "dlm3.rl.exflags.timeout",
FT_BOOLEAN, 32, NULL, DLM3_LKF_TIMEOUT,
NULL, HFILL}},
{ &hf_dlm3_rl_flags,
{ "Internal Flags", "dlm3.rl.flags",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_flags_user,
{ "User space lock related", "dlm3.rl.flags.user",
FT_BOOLEAN, 32, NULL, DLM3_IFL_USER,
NULL, HFILL}},
{ &hf_dlm3_rl_flags_orphan,
{ "Orphaned lock", "dlm3.rl.flags.orphan",
FT_BOOLEAN, 32, NULL, DLM3_IFL_ORPHAN,
NULL, HFILL}},
{ &hf_dlm3_rl_lvbseq,
{ "Lock Value Block Sequence Number", "dlm3.rl.lvbseq",
FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_result,
{ "Result of Recovering master copy", "dlm3.rl.result",
FT_INT32, BASE_DEC, VALS(dlm3_result), 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_rqmode,
{ "Request Mode", "dlm3.rl.rqmode",
FT_INT8, BASE_DEC, VALS(dlm3_mode), 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_grmode,
{ "Granted Mode", "dlm3.rl.grmode",
FT_INT8, BASE_DEC, VALS(dlm3_mode), 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_status,
{ "Status", "dlm3.rl.status",
FT_INT8, BASE_DEC, VALS(dlm3_rs), 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_asts,
{ "Asynchronous Traps", "dlm3.rl.asts",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{ &hf_dlm3_rl_asts_comp,
{ "Completion", "dlm3.rl.asts.comp",
FT_BOOLEAN, 8, NULL, DLM3_AST_COMP,
NULL, HFILL }},
{ &hf_dlm3_rl_asts_bast,
{ "Blocking", "dlm3.rl.asts.bast",
FT_BOOLEAN, 8, NULL, DLM3_AST_BAST,
NULL, HFILL }},
{ &hf_dlm3_rl_wait_type,
{ "Message Type the waiter is waiting for", "dlm3.rl.wait_type",
FT_UINT16, BASE_DEC, VALS(dlm3_msg), 0x0,
NULL, HFILL }},
{ &hf_dlm3_rl_namelen,
{ "Length of `name' field", "dlm3.rl.namelen",
FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_rl_name,
{ "Name of Resource", "dlm3.rl.name",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_rl_name_contents,
{ "Contents actually occupying `name' field", "dlm3.rl.name_contents",
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_rl_name_padding,
{ "Padding", "dlm3.rl.name_padding",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_dlm3_rl_lvb,
{ "Lock Value Block", "dlm3.rl.lvb",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }}
};
static gint *ett[] = {
&ett_dlm3,
&ett_dlm3_version,
&ett_dlm3_opts,
&ett_dlm3_options,
&ett_dlm3_next_cmd,
&ett_dlm3_msg,
&ett_dlm3_m_exflags,
&ett_dlm3_sbflags,
&ett_dlm3_m_flags,
&ett_dlm3_m_asts,
&ett_dlm3_rcom,
&ett_dlm3_rcom_status,
&ett_dlm3_rcom_lock,
&ett_dlm3_rcom_config,
&ett_dlm3_rs_flags,
&ett_dlm3_rf_lsflags,
&ett_dlm3_rl_exflags,
&ett_dlm3_rl_flags,
&ett_dlm3_rl_asts,
&ett_dlm3_rl_name
};
proto_dlm3 = proto_register_protocol("Distributed Lock Manager",
"DLM3", "dlm3");
proto_register_field_array(proto_dlm3, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* dlm3_module = prefs_register_protocol(proto_dlm3, NULL); */
dlm3_sctp_handle = register_dissector("dlm3", dissect_dlm3, proto_dlm3);
dlm3_tcp_handle = register_dissector("dlm3.tcp", dissect_tcp_dlm3, proto_dlm3);
}
void
proto_reg_handoff_dlm3(void)
{
dissector_add_uint_with_preference("tcp.port", TCP_PORT_DLM3, dlm3_tcp_handle);
dissector_add_uint_with_preference("sctp.port", SCTP_PORT_DLM3, dlm3_sctp_handle);
}
/* packet-dlm3.c ends here. */
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local Variables:
* c-basic-offset: 2
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=2 tabstop=8 expandtab:
* :indentSize=2:tabSize=8:noTabs=true:
*/
|