[pnfs] yet another attempt for wireshark patches
J. Bruce Fields
bfields at fieldses.org
Fri Jun 20 18:15:02 EDT 2008
On Thu, Jun 19, 2008 at 10:32:33PM +0200, Tigran Mkrtchyan wrote:
> >From b8359295df0bd201eb42df3e34bebc2697f2f1e2 Mon Sep 17 00:00:00 2001
> From: Tigran Mkrtchyan <tigran.mkrtchyan at desy.de>
> Date: Thu, 19 Jun 2008 21:28:03 +0200
> Subject: [wireshark 03/12] fixed layoutget reply decode according to draft >= 19
>
> added definition of layouttype4 constants
> ---
> epan/dissectors/packet-nfs.c | 84 +++++++++++++++++++++++++++++------------
> epan/dissectors/packet-nfs.h | 19 +++++++--
> 2 files changed, 74 insertions(+), 29 deletions(-)
>
> diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c
> index 680711c..65a75bd 100644
> --- a/epan/dissectors/packet-nfs.c
> +++ b/epan/dissectors/packet-nfs.c
> @@ -408,6 +408,8 @@ static int hf_nfs_layout_count = -1;
> static int hf_nfs_pattern_offset = -1;
> static int hf_nfs_notification_bitmap4 = -1;
> static int hf_nfs_lrs_present = -1;
> +static int hf_nfs_nfl_util = -1;
> +static int hf_nfs_nfl_first_stripe_index = -1;
>
> /* Hidden field for v2, v3, and v4 status */
> int hf_nfs_nfsstat = -1;
> @@ -565,6 +567,8 @@ static gint ett_nfs_uid4 = -1;
> static gint ett_nfs_gid4 = -1;
> static gint ett_nfs_service4 = -1;
> static gint ett_nfs_sessionid4 = -1;
> +static gint ett_nfs_layoutseg = -1;
> +static gint ett_nfs_layoutseg_fh = -1;
>
> /* what type of fhandles shoudl we dissect as */
> static dissector_table_t nfs_fhandle_table;
> @@ -7952,31 +7956,58 @@ static int
> dissect_nfs_layout(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
> {
> guint layout_type;
> + guint fh_num;
> + guint lo_seg_count;
> + guint i, lo_seg;
> + proto_item *fitem;
> + proto_item *fh_fitem;
> + proto_tree *newtree = NULL;
> + proto_tree *fh_tree = NULL;
> +
> + lo_seg_count = tvb_get_ntohl(tvb, offset);
> +
> + fitem = proto_tree_add_text(tree, tvb, offset, 4,
> + "Layout Segment (count: %u)", lo_seg_count);
> + offset += 4;
> +
> + newtree = proto_item_add_subtree(fitem, ett_nfs_layoutseg);
> +
> + for (lo_seg = 0; lo_seg < lo_seg_count; lo_seg++) {
> + offset = dissect_rpc_uint64(tvb, newtree, hf_nfs_offset4, offset);
> + offset = dissect_rpc_uint64(tvb, newtree, hf_nfs_length4, offset);
> +
> + offset = dissect_rpc_uint32(tvb, newtree, hf_nfs_iomode4, offset);
>
> layout_type = tvb_get_ntohl(tvb, offset);
I've fixed the odd indent here.
> - offset = dissect_rpc_uint32(tvb, tree, hf_nfs_layouttype4, offset);
> + offset = dissect_rpc_uint32(tvb, newtree, hf_nfs_layouttype4, offset);
> +
> + /* If not files layout type eat the rest and move on.. */
> + if (layout_type != LAYOUT4_NFSV4_1_FILES) {
> + offset = dissect_nfsdata(tvb, offset, newtree, hf_nfs_layout4);
> + continue;
> + }
>
> - if (layout_type == 1) { /* NFS Files */
> - guint num;
> - guint i;
> + /* NFS Files */
> offset += 4; /* Skip past opaque count */
> - offset = dissect_rpc_opaque_data(tvb, offset, tree, NULL,
> - hf_nfs_deviceid4, TRUE, 16,
> - FALSE, NULL, NULL);
>
> - offset = dissect_rpc_uint32(tvb, tree, hf_nfs_util4, offset);
> - offset = dissect_rpc_uint32(tvb, tree, hf_nfs_first_stripe_idx4, offset);
> - offset = dissect_rpc_uint64(tvb, tree, hf_nfs_pattern_offset, offset);
> + offset = dissect_rpc_opaque_data(tvb, offset, newtree, NULL,
> + hf_nfs_deviceid4, TRUE, 16, FALSE, NULL, NULL);
> +
> + offset = dissect_rpc_uint32(tvb, newtree, hf_nfs_nfl_util, offset);
> + offset = dissect_rpc_uint32(tvb, newtree, hf_nfs_nfl_first_stripe_index, offset);
> + offset = dissect_rpc_uint64(tvb, newtree, hf_nfs_offset4, offset);
> +
> + fh_num = tvb_get_ntohl(tvb, offset); /* Len of FH list */
>
> - num = tvb_get_ntohl(tvb, offset); /* Len of dev list */
> + fh_fitem = proto_tree_add_text(newtree, tvb, offset, 4,
> + "File Handles (count: %u)", fh_num);
> offset += 4;
> - for (i = 0; i < num; i++) {
> - offset = dissect_nfs_fh4(tvb, offset, pinfo, tree, "filehandle");
> +
> + fh_tree = proto_item_add_subtree(fh_fitem, ett_nfs_layoutseg_fh);
> + for (i = 0; i < fh_num; i++) {
> + offset = dissect_nfs_fh4(tvb, offset, pinfo, fh_tree, "lo_filehandle");
> }
> - } else {
> - offset = dissect_nfsdata(tvb, offset, tree, hf_nfs_layout4);
> }
> -
> return offset;
> }
>
> @@ -8437,7 +8468,7 @@ static int
> dissect_nfs_resop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
> proto_tree *tree)
> {
> - guint32 ops, ops_counter, count;
> + guint32 ops, ops_counter;
> guint32 opcode;
> proto_item *fitem;
> proto_tree *ftree = NULL;
> @@ -8650,14 +8681,7 @@ dissect_nfs_resop4(tvbuff_t *tvb, int offset, packet_info *pinfo,
> offset = dissect_rpc_bool(tvb, newftree, hf_nfs_return_on_close4,
> offset);
> offset = dissect_nfs_stateid4(tvb, offset, newftree);
> - count = tvb_get_ntohl(tvb, offset);
> - offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_layout_count, offset);
> - while (count-- > 0) {
> - offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_offset4, offset);
> - offset = dissect_rpc_uint64(tvb, newftree, hf_nfs_length4, offset);
> - offset = dissect_rpc_uint32(tvb, newftree, hf_nfs_iomode4, offset);
> offset = dissect_nfs_layout(tvb, offset, pinfo, newftree);
> - }
> break;
>
> case NFS4_OP_LAYOUTCOMMIT:
> @@ -10140,6 +10164,14 @@ proto_register_nfs(void)
> "return on close?", "nfs.retclose4", FT_BOOLEAN, BASE_NONE,
> TFS(&tfs_yes_no), 0, NULL, HFILL }},
>
> + { &hf_nfs_nfl_util, {
> + "nfl_util", "nfs.nfl_util", FT_UINT32, BASE_HEX,
> + NULL, 0, NULL, HFILL }},
> +
> + { &hf_nfs_nfl_first_stripe_index, {
> + "first stripe to use index", "nfs.nfl_first_stripe_index", FT_UINT32, BASE_DEC,
> + NULL, 0, NULL, HFILL }},
> +
> { &hf_nfs_slotid4, {
> "slot ID", "nfs.slotid4", FT_UINT32, BASE_DEC,
> NULL, 0, NULL, HFILL }},
> @@ -10421,7 +10453,9 @@ proto_register_nfs(void)
> &ett_nfs_uid4,
> &ett_nfs_gid4,
> &ett_nfs_service4,
> - &ett_nfs_sessionid4
> + &ett_nfs_sessionid4,
> + &ett_nfs_layoutseg,
> + &ett_nfs_layoutseg_fh
> };
> module_t *nfs_module;
>
> diff --git a/epan/dissectors/packet-nfs.h b/epan/dissectors/packet-nfs.h
> index b569341..05f5233 100644
> --- a/epan/dissectors/packet-nfs.h
> +++ b/epan/dissectors/packet-nfs.h
> @@ -105,19 +105,25 @@
> #define NFS4_OP_WRITE 38
> #define NFS4_OP_RELEASE_LOCKOWNER 39
> /* Minor version 1 */
> +#define NFS4_OP_BACKCHANNEL_CTL 40
> +#define NFS4_OP_BIND_CONN_TO_SESSION 41
> #define NFS4_OP_EXCHANGE_ID 42
> #define NFS4_OP_CREATE_SESSION 43
> #define NFS4_OP_DESTROY_SESSION 44
> +#define NFS4_OP_FREE_STATEID 45
> +#define NFS4_OP_GET_DIR_DELEGATION 46
> #define NFS4_OP_GETDEVINFO 47
> #define NFS4_OP_GETDEVLIST 48
> #define NFS4_OP_LAYOUTCOMMIT 49
> #define NFS4_OP_LAYOUTGET 50
> #define NFS4_OP_LAYOUTRETURN 51
> +#define NFS4_OP_SECINFO_NO_NAME 52
> #define NFS4_OP_SEQUENCE 53
> -#define NFS4_OP_NOTIFYDS 60
> -#define NFS4_OP_PNFS_CREATE 61
> -#define NFS4_OP_PNFS_WRITE 62
> -#define NFS4_OP_PNFS_READ 63
> +#define NFS4_OP_SET_SSV 54
> +#define NFS4_OP_TEST_STATEID 55
> +#define NFS4_OP_WANT_DELEGATION 56
> +#define NFS4_OP_DESTROY_CLIENTID 57
> +#define NFS4_OP_RECLAIM_COMPLETE 58
>
> #define NFS4_OP_ILLEGAL 10044
>
> @@ -131,6 +137,11 @@
> #define GUARDED 1
> #define EXCLUSIVE 2
>
> +/* pNFS layout types */
> +#define LAYOUT4_NFSV4_1_FILES 1
> +#define LAYOUT4_OSD2_OBJECTS 2
> +#define LAYOUT4_BLOCK_VOLUME 3
> +
> extern gboolean nfs_file_name_snooping;
>
> extern int dissect_fhandle(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
> --
> 1.5.4.5
>
More information about the pNFS
mailing list