diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-05-21 10:17:30 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2002-05-21 10:17:30 +0000 |
commit | 3143c595a413604bfbc26902c1ce2d5deaa3ffd8 (patch) | |
tree | 07f8a52717b39abc2c3cb0c9e88942553a95c5ca /packet-nlm.c | |
parent | 198c46df1e2e41e408ae09057899cf847ae5a1f6 (diff) |
Option to make filtering on nfs fhandles stateful.
When this ption is enabled in Protocols/NFS displayfilters for fhandle fields
such as nfs.fh.{hash|name|full_name} will find both the request and matching
response packets even if the fhandle is only present in one of the packets.
The option supports all NFS and related protocols which use nfs fhandles
including async NLM.
The option will not work with nfs packets containing multiple fhandles in
one PDU, nor will it work if tcp collapses multiple segments/pdus into
one larger segment.
It only works for async NLM if one first enables the MSG/RES stateful
matching for async NLM.
svn path=/trunk/; revision=5515
Diffstat (limited to 'packet-nlm.c')
-rw-r--r-- | packet-nlm.c | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/packet-nlm.c b/packet-nlm.c index fb5d880bb8..afb5a5186e 100644 --- a/packet-nlm.c +++ b/packet-nlm.c @@ -1,7 +1,7 @@ /* packet-nlm.c * Routines for nlm dissection * - * $Id: packet-nlm.c,v 1.26 2002/05/08 12:51:45 sahlberg Exp $ + * $Id: packet-nlm.c,v 1.27 2002/05/21 10:17:27 sahlberg Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -230,6 +230,40 @@ nlm_print_msgres_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb) proto_tree_add_uint(tree, hf_nlm_reply_in, tvb, 0, 0, md->rep_frame); } } +static void +nlm_match_fhandle_reply(packet_info *pinfo, proto_tree *tree) +{ + nlm_msg_res_matched_data *md; + + md=g_hash_table_lookup(nlm_msg_res_matched, (gconstpointer)pinfo->fd->num); + if(md && md->rep_frame){ + nfs_fhandle_data_t *fhd; + fhd=(nfs_fhandle_data_t *)g_hash_table_lookup( + nfs_fhandle_frame_table, + (gconstpointer)md->req_frame); + if(fhd){ + dissect_fhandle_hidden(pinfo, + tree, fhd); + } + } +} +static void +nlm_match_fhandle_request(packet_info *pinfo, proto_tree *tree) +{ + nlm_msg_res_matched_data *md; + + md=g_hash_table_lookup(nlm_msg_res_matched, (gconstpointer)pinfo->fd->num); + if(md && md->rep_frame){ + nfs_fhandle_data_t *fhd; + fhd=(nfs_fhandle_data_t *)g_hash_table_lookup( + nfs_fhandle_frame_table, + (gconstpointer)md->rep_frame); + if(fhd){ + dissect_fhandle_hidden(pinfo, + tree, fhd); + } + } +} static void nlm_register_unmatched_res(packet_info *pinfo, tvbuff_t *tvb, int offset) @@ -399,6 +433,11 @@ dissect_nlm_test(tvbuff_t *tvb, int offset, packet_info *pinfo, } else { nlm_print_msgres_request(pinfo, tree, tvb); } + /* for the fhandle matching that finds both request and + response packet */ + if(nfs_fhandle_reqrep_matching){ + nlm_match_fhandle_request(pinfo, tree); + } } } @@ -421,6 +460,11 @@ dissect_nlm_lock(tvbuff_t *tvb, int offset, packet_info *pinfo, } else { nlm_print_msgres_request(pinfo, tree, tvb); } + /* for the fhandle matching that finds both request and + response packet */ + if(nfs_fhandle_reqrep_matching){ + nlm_match_fhandle_request(pinfo, tree); + } } } @@ -445,6 +489,11 @@ dissect_nlm_cancel(tvbuff_t *tvb, int offset, packet_info *pinfo, } else { nlm_print_msgres_request(pinfo, tree, tvb); } + /* for the fhandle matching that finds both request and + response packet */ + if(nfs_fhandle_reqrep_matching){ + nlm_match_fhandle_request(pinfo, tree); + } } } @@ -467,6 +516,11 @@ dissect_nlm_unlock(tvbuff_t *tvb, int offset, packet_info *pinfo, } else { nlm_print_msgres_request(pinfo, tree, tvb); } + /* for the fhandle matching that finds both request and + response packet */ + if(nfs_fhandle_reqrep_matching){ + nlm_match_fhandle_request(pinfo, tree); + } } } @@ -487,8 +541,14 @@ dissect_nlm_granted(tvbuff_t *tvb, int offset, packet_info *pinfo, } else { nlm_print_msgres_request(pinfo, tree, tvb); } + /* for the fhandle matching that finds both request and + response packet */ + if(nfs_fhandle_reqrep_matching){ + nlm_match_fhandle_request(pinfo, tree); + } } } + offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset); offset = dissect_rpc_bool(tvb, tree, hf_nlm_exclusive, offset); offset = dissect_lock(tvb, pinfo, tree, version, offset); @@ -511,6 +571,11 @@ dissect_nlm_test_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, } else { nlm_print_msgres_reply(pinfo, tree, tvb); } + /* for the fhandle matching that finds both request and + response packet */ + if(nfs_fhandle_reqrep_matching){ + nlm_match_fhandle_reply(pinfo, tree); + } } } @@ -638,6 +703,11 @@ dissect_nlm_gen_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, } else { nlm_print_msgres_reply(pinfo, tree, tvb); } + /* for the fhandle matching that finds both request and + response packet */ + if(nfs_fhandle_reqrep_matching){ + nlm_match_fhandle_reply(pinfo, tree); + } } } |