diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-09-13 07:56:53 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-09-13 07:56:53 +0000 |
commit | 2a148564d67964bef7eb5a2e8511fa431060850f (patch) | |
tree | fcf01dc61619d9bf3313007110cdf70e83dd7b6f /packet-nbns.c | |
parent | a37ddb63b14cc5b314fa476d79c6afc260416e2c (diff) |
TCP desegmentation support, and changes to the ONC RPC and NBSS
dissectors to use it, from Ronnie Sahlberg, with additional changes to
handle the case where a frame contains messages that don't run past the
end followed by one that does and where a reassembled chunk has, at the
end, a message that runs past the end of that chunk (because the
reassembly was for an earlier message).
svn path=/trunk/; revision=3923
Diffstat (limited to 'packet-nbns.c')
-rw-r--r-- | packet-nbns.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/packet-nbns.c b/packet-nbns.c index 42e268d08d..48cf6d54f5 100644 --- a/packet-nbns.c +++ b/packet-nbns.c @@ -4,7 +4,7 @@ * Gilbert Ramirez <gram@xiexie.org> * Much stuff added by Guy Harris <guy@alum.mit.edu> * - * $Id: packet-nbns.c,v 1.54 2001/08/05 10:00:35 guy Exp $ + * $Id: packet-nbns.c,v 1.55 2001/09/13 07:53:51 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -41,6 +41,7 @@ #include "packet-dns.h" #include "packet-netbios.h" #include "packet-smb.h" +#include "prefs.h" static int proto_nbns = -1; static int hf_nbns_response = -1; @@ -78,6 +79,10 @@ static int hf_nbss_flags = -1; static gint ett_nbss = -1; static gint ett_nbss_flags = -1; +/* desegmentation of NBSS over TCP */ +static gboolean nbss_desegment = FALSE; + + /* See RFC 1001 and 1002 for information on the first three, and see http://www.cifs.com/specs/draft-leach-cifs-v1-spec-01.txt @@ -1393,6 +1398,25 @@ dissect_nbss_packet(tvbuff_t *tvb, int offset, packet_info *pinfo, length += 65536; } + /*Desegmentation */ + if (nbss_desegment) { + if (pinfo->can_desegment + && length > tvb_length_remaining(tvb, offset+4)) { + /* + * This frame doesn't have all of the data for + * this message, but we can do reassembly on it. + * + * Tell the TCP dissector where the data for this + * message starts in the data it handed us, and + * how many more bytes we need, and return. + */ + pinfo->desegment_offset = offset; + pinfo->desegment_len = + length - tvb_length_remaining(tvb, offset+4); + return max_data; + } + } + if (tree) { ti = proto_tree_add_item(tree, proto_nbss, tvb, offset, length + 4, FALSE); nbss_tree = proto_item_add_subtree(ti, ett_nbss); @@ -1661,6 +1685,7 @@ proto_register_nbt(void) &ett_nbss, &ett_nbss_flags, }; + module_t *nbss_module; proto_nbns = proto_register_protocol("NetBIOS Name Service", "NBNS", "nbns"); proto_register_field_array(proto_nbns, hf_nbns, array_length(hf_nbns)); @@ -1674,6 +1699,12 @@ proto_register_nbt(void) proto_register_field_array(proto_nbss, hf_nbss, array_length(hf_nbss)); proto_register_subtree_array(ett, array_length(ett)); + + nbss_module = prefs_register_protocol(proto_nbss, NULL); + prefs_register_bool_preference(nbss_module, "desegment_nbss_commands", + "Desegment all NBSS commands spanning multiple TCP segments", + "Whether NBSS dissector should desegment all commands spanning multiple TCP segments", + &nbss_desegment); } void |