[pnfs] wireshark

Benny Halevy bhalevy at panasas.com
Fri Jun 6 03:53:16 EDT 2008


On Jun. 03, 2008, 23:12 +0300, "J. Bruce Fields" <bfields at fieldses.org> wrote:
> On Mon, May 26, 2008 at 09:13:20AM +0200, Tigran Mkrtchyan wrote:
>> Subject: [PATCH 07/12] do not re-use v4 createmode. define a v4.1 specific ones.
> 
> I think you meant "do not re-use v3 createmode"?  Also, see comment at
> end:
> 
>> ---
>>  epan/dissectors/packet-nfs.c |   27 ++++++++++++++++++++++-----
>>  epan/dissectors/packet-nfs.h |   17 +++++++++++++++++
>>  2 files changed, 39 insertions(+), 5 deletions(-)
>>
>> diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c
>> index af4a9e3..ea4a446 100644
>> --- a/epan/dissectors/packet-nfs.c
>> +++ b/epan/dissectors/packet-nfs.c
>> @@ -347,6 +347,7 @@ static int hf_nfs_callback_ident = -1;
>>  static int hf_nfs_r_netid = -1;
>>  static int hf_nfs_gsshandle4 = -1;
>>  static int hf_nfs_r_addr = -1;
>> +static int hf_nfs_createmode4 = -1;
>>  
>>  /* NFSv4.1 */
>>  static int hf_nfs_length4_minlength = -1;
>> @@ -6964,26 +6965,38 @@ dissect_nfs_open_claim4(tvbuff_t *tvb, int offset,
>>  	return offset;
>>  }
>>  
>> +static const value_string names_createmode4[] = {
>> +	{	UNCHECKED4, "UNCHECKED4" },
>> +	{	GUARDED4,   "GUARDED4" },
>> +	{	EXCLUSIVE4, "EXCLUSIVE4" },
>> +	{	EXCLUSIVE4_1, "EXCLUSIVE4_1" },
>> +	{	0, NULL }
>> +};
>> +
>>  static int
>>  dissect_nfs_createhow4(tvbuff_t *tvb, int offset, packet_info *pinfo,
>>  	proto_tree *tree)
>>  {
>>  	guint mode;
>>  
>> -	/* This is intentional; we're using the same flags as NFSv3 */
>>  	mode = tvb_get_ntohl(tvb, offset);
>> -	proto_tree_add_uint(tree, hf_nfs_createmode3, tvb, offset, 4, mode);
>> +	proto_tree_add_uint(tree, hf_nfs_createmode4, tvb, offset, 4, mode);
>>  	offset += 4;
>>  
>>  	switch(mode)
>>  	{
>> -	case UNCHECKED:		/* UNCHECKED4 */
>> -	case GUARDED:		/* GUARDED4 */
>> +	case UNCHECKED4:
>> +	case GUARDED4:
>>  		offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
>>  		break;
>>  
>> -	case EXCLUSIVE:		/* EXCLUSIVE4 */
>> +	case EXCLUSIVE4:
>> +		offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
>> +		break;
>> +
>> +	case EXCLUSIVE4_1:
>>  		offset = dissect_rpc_uint64(tvb, tree, hf_nfs_verifier4, offset);
>> +		offset = dissect_nfs_fattr4(tvb, offset, pinfo, tree);
>>  		break;
>>  
>>  	default:
>> @@ -9912,6 +9925,10 @@ proto_register_nfs(void)
>>  			"owner", "nfs.lock_owner4", FT_BYTES, BASE_DEC,
>>  			NULL, 0, NULL, HFILL }},
>>  
>> +		{ &hf_nfs_createmode4, {
>> +			"Create Mode", "nfs.createmode4", FT_UINT32, BASE_DEC,
>> +			VALS(names_createmode4), 0, NULL, HFILL }},
>> +
>>  		{ &hf_nfs_secinfo_rpcsec_gss_info_service, {
>>  			"service", "nfs.secinfo.rpcsec_gss_info.service", FT_UINT32, BASE_DEC,
>>  			VALS(rpc_authgss_svc), 0, NULL, HFILL }},
>> diff --git a/epan/dissectors/packet-nfs.h b/epan/dissectors/packet-nfs.h
>> index dd0fa71..ad56014 100644
>> --- a/epan/dissectors/packet-nfs.h
>> +++ b/epan/dissectors/packet-nfs.h
>> @@ -144,6 +144,23 @@
>>  #define GUARDED 1
>>  #define EXCLUSIVE 2
>>  
>> +/* for create4 */
>> +#define UNCHECKED4 0
>> +#define GUARDED4 1
>> +/* Deprecated in NFSv4.1. */
>> +#define EXCLUSIVE4 2
>> +/*
>> +* New to NFSv4.1. If session is persistent,
>> +* GUARDED4 MUST be used. Otherwise, use
>> +* EXCLUSIVE4_1 instead of EXCLUSIVE4.
>> +*/
>> +#define EXCLUSIVE4_1 3
>> +/*
>> +* New to NFSv4.1. If session is persistent,
>> +* GUARDED4 MUST be used. Otherwise, use
>> +* EXCLUSIVE4_1 instead of EXCLUSIVE4.
>> +*/
> 
> Looks like the same comment got cut-and-pasted twice.

Yup.  And it doesn't really belong in wireshark either :)
(The "If session is ..."  part)
Also, a minor nit: multi-line comments are supposed to have a
space before the '*'s so they all align on the same column...

Benny

> 
> --b.
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs



More information about the pNFS mailing list