diff options
author | Tom Haynes <loghyr@primarydata.com> | 2015-09-17 14:40:23 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-09-21 04:18:10 +0000 |
commit | 3b09a9e4570a876faec23ba7a1d8be8ac981f92a (patch) | |
tree | 50a8576e7dea585c8b95d6bf578b65abf663e8f9 /epan/dissectors/packet-nfs.c | |
parent | 741ee8cce595866746a9da4d9d094729a42551c1 (diff) |
nfs: Register CB program statically and not whilst parsing it
The existing code parsed the callback program number from
a packet and then registered the callback program number.
But since the RPC dissector checks for valid and known
program numbers, it never parses it out.
Anyway, NFS4_CALLBACK is a well known number - use it!
Change-Id: Ia812359102bf6620e3b83109eb918032155cd8d3
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Reviewed-on: https://code.wireshark.org/review/10558
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-nfs.c')
-rw-r--r-- | epan/dissectors/packet-nfs.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 5c82f7125e..caa1e113ae 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -908,8 +908,6 @@ static gboolean display_major_nfs4_ops = TRUE; static int dissect_nfs4_stateid(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 *hash); -static void reg_callback(int cbprog); - static void nfs_prompt(packet_info *pinfo _U_, gchar* result) { g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "Decode NFS file handles as"); @@ -7408,10 +7406,8 @@ dissect_nfs4_cb_client4(tvbuff_t *tvb, int offset, proto_tree *tree) { proto_tree *cb_location; proto_item *fitem; - int cbprog, old_offset; + int old_offset; - cbprog = tvb_get_ntohl(tvb, offset); - reg_callback(cbprog); offset = dissect_rpc_uint32(tvb, tree, hf_nfs4_cb_program, offset); old_offset = offset; cb_location = proto_tree_add_subtree(tree, tvb, offset, 0, ett_nfs4_clientaddr, &fitem, "cb_location"); @@ -9282,7 +9278,6 @@ dissect_nfs4_request_op(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre const char *source_name = NULL; const char *dest_name = NULL; const char *opname = NULL; - int cbprog; guint opcode; guint highest_tier = 5; guint current_tier = 5; @@ -9724,8 +9719,6 @@ dissect_nfs4_request_op(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre hf_nfs4_create_session_flags_csa); offset = dissect_rpc_chanattrs4(tvb, offset, newftree, "csa_fore_chan_attrs"); offset = dissect_rpc_chanattrs4(tvb, offset, newftree, "csa_back_chan_attrs"); - cbprog = tvb_get_ntohl(tvb, offset); - reg_callback(cbprog); offset = dissect_rpc_uint32(tvb, newftree, hf_nfs4_cb_program, offset); offset = dissect_rpc_secparms4(tvb, offset, newftree); break; @@ -11154,13 +11147,6 @@ static const rpc_prog_vers_info nfs_cb_vers_info[] = { { 4, nfs_cb_proc, &hf_nfs4_cb_procedure }, }; -void reg_callback(int cbprog) -{ - /* Register the protocol as RPC */ - rpc_init_prog(proto_nfs, cbprog, ett_nfs, - G_N_ELEMENTS(nfs_cb_vers_info), nfs_cb_vers_info); -} - void proto_register_nfs(void) { @@ -13744,6 +13730,10 @@ proto_reg_handoff_nfs(void) rpc_init_prog(proto_nfs, NFS_PROGRAM, ett_nfs, G_N_ELEMENTS(nfs_vers_info), nfs_vers_info); + /* Register the CB protocol as RPC */ + rpc_init_prog(proto_nfs, NFS_CB_PROGRAM, ett_nfs, + G_N_ELEMENTS(nfs_cb_vers_info), nfs_cb_vers_info); + fhandle_handle = create_dissector_handle(dissect_fhandle_data_SVR4, proto_nfs_svr4); dissector_add_for_decode_as("nfs_fhandle.type", fhandle_handle); |