aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-couchbase.c
diff options
context:
space:
mode:
authorMatt Carabine <matt.carabine@hotmail.co.uk>2019-09-16 11:58:14 +0100
committerAnders Broman <a.broman58@gmail.com>2019-09-16 16:20:45 +0000
commit9159c060bcc125c65dd76e477b5e2f5548bec0c1 (patch)
treeb8fe8efb027c866a81cf2ba2a305c935dd6a8400 /epan/dissectors/packet-couchbase.c
parentac5d7af0ca397f8e8801c036585d6f9753855eaa (diff)
Couchbase: Handle extras in mutation responses
Previously extras in any mutation (e.g. ADD, SET) response would be marked as illegal, as these used to return no extras. More recently, extras can be returned in mutations if the connection has negotiated the MUTATION_SEQNO feature. The extras can contain the mutation's sequence number and the vBucket UUID. This commit adds a new field (couchbase.extras.mutation_seqno) to achieve this, as the existing field couchbase.extras.seqno is used for a different purpose and is only a UINT32, whereas a UINT64 is returned as part of the extras; the existing couchbase.extras.vbucket_uuid is used for the vBucket UUID. Change-Id: If8a5148f2115fce7a777b96ad22ba92d95c9ff71 Reviewed-on: https://code.wireshark.org/review/34540 Reviewed-by: Dave Rigby <daver@couchbase.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-couchbase.c')
-rw-r--r--epan/dissectors/packet-couchbase.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/epan/dissectors/packet-couchbase.c b/epan/dissectors/packet-couchbase.c
index 158b315df7..e9f1e11a18 100644
--- a/epan/dissectors/packet-couchbase.c
+++ b/epan/dissectors/packet-couchbase.c
@@ -381,6 +381,7 @@ static int hf_subdoc_flags_xattrpath = -1;
static int hf_subdoc_flags_expandmacros = -1;
static int hf_subdoc_flags_reserved = -1;
static int hf_extras_seqno = -1;
+static int hf_extras_mutation_seqno = -1;
static int hf_extras_opaque = -1;
static int hf_extras_reserved = -1;
static int hf_extras_start_seqno = -1;
@@ -1097,8 +1098,11 @@ dissect_extras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(extras_tree, hf_extras_expiration, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
} else {
- /* Response shall not have extras */
- illegal = TRUE;
+ proto_tree_add_item(extras_tree, hf_extras_vbucket_uuid, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+
+ proto_tree_add_item(extras_tree, hf_extras_mutation_seqno, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
}
} else if (request) {
/* Request must have extras */
@@ -1121,8 +1125,11 @@ dissect_extras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(extras_tree, hf_extras_expiration, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
} else {
- /* Response must not have extras (response is in Value) */
- illegal = TRUE;
+ proto_tree_add_item(extras_tree, hf_extras_vbucket_uuid, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+
+ proto_tree_add_item(extras_tree, hf_extras_mutation_seqno, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
}
} else if (request) {
/* Request must have extras */
@@ -1140,13 +1147,27 @@ dissect_extras(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
case PROTOCOL_BINARY_CMD_DELETE:
case PROTOCOL_BINARY_CMD_DELETEQ:
- case PROTOCOL_BINARY_CMD_QUIT:
- case PROTOCOL_BINARY_CMD_QUITQ:
- case PROTOCOL_BINARY_CMD_VERSION:
case PROTOCOL_BINARY_CMD_APPEND:
case PROTOCOL_BINARY_CMD_APPENDQ:
case PROTOCOL_BINARY_CMD_PREPEND:
case PROTOCOL_BINARY_CMD_PREPENDQ:
+ if (extlen) {
+ if (request) {
+ /* Must not have extras */
+ illegal = TRUE;
+ } else {
+ proto_tree_add_item(extras_tree, hf_extras_vbucket_uuid, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+
+ proto_tree_add_item(extras_tree, hf_extras_mutation_seqno, tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ }
+ }
+ break;
+
+ case PROTOCOL_BINARY_CMD_QUIT:
+ case PROTOCOL_BINARY_CMD_QUITQ:
+ case PROTOCOL_BINARY_CMD_VERSION:
case PROTOCOL_BINARY_CMD_STAT:
case PROTOCOL_BINARY_CMD_OBSERVE:
case PROTOCOL_BINARY_CMD_OBSERVE_SEQNO:
@@ -2860,6 +2881,7 @@ proto_register_couchbase(void)
{ &hf_extras_flags_dcp_collections, {"Enable Collections", "couchbase.extras.flags.dcp_collections", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x10, "Indicates the server should stream collections", HFILL} },
{ &hf_extras_flags_dcp_include_delete_times, {"Include Delete Times", "couchbase.extras.flags.dcp_include_delete_times", FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x20, "Indicates the server should include delete timestamps", HFILL} },
{ &hf_extras_seqno, { "Sequence number", "couchbase.extras.seqno", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_extras_mutation_seqno, { "Mutation Sequence Number", "couchbase.extras.mutation_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_extras_opaque, { "Opaque (vBucket identifier)", "couchbase.extras.opaque", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_extras_reserved, { "Reserved", "couchbase.extras.reserved", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_extras_start_seqno, { "Start Sequence Number", "couchbase.extras.start_seqno", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } },