diff options
-rw-r--r-- | packet-dns.c | 41 | ||||
-rw-r--r-- | packet-nbns.c | 9 | ||||
-rw-r--r-- | packet-rpc.c | 4 |
3 files changed, 46 insertions, 8 deletions
diff --git a/packet-dns.c b/packet-dns.c index 507ffca4ea..39b3ec55d0 100644 --- a/packet-dns.c +++ b/packet-dns.c @@ -1,7 +1,7 @@ /* packet-dns.c * Routines for DNS packet disassembly * - * $Id: packet-dns.c,v 1.74 2001/09/17 00:36:04 guy Exp $ + * $Id: packet-dns.c,v 1.75 2001/09/17 02:07:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -39,6 +39,7 @@ #include "ipproto.h" #include "resolv.h" #include "packet-dns.h" +#include "prefs.h" static int proto_dns = -1; static int hf_dns_length = -1; @@ -59,6 +60,9 @@ static gint ett_dns_ans = -1; static gint ett_dns_flags = -1; static gint ett_t_key_flags = -1; +/* desegmentation of DNS over TCP */ +static gboolean dns_desegment = TRUE; + /* DNS structs and definitions */ /* Ports used for DNS. */ @@ -1964,9 +1968,37 @@ dissect_dns_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint16 plen; for (;;) { + /* + * XXX - should handle a length field split across segment + * boundaries. + */ if (!tvb_bytes_exist(tvb, offset, 2)) break; plen = tvb_get_ntohs(tvb, offset); + + /* + * Desegmentation check. + */ + if (dns_desegment) { + if (pinfo->can_desegment + && plen > tvb_length_remaining(tvb, offset+2)) { + /* + * 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 = + plen - tvb_length_remaining(tvb, offset+2); + return; + } + } + offset += 2; /* @@ -2033,10 +2065,17 @@ proto_register_dns(void) &ett_dns_flags, &ett_t_key_flags, }; + module_t *dns_module; proto_dns = proto_register_protocol("Domain Name Service", "DNS", "dns"); proto_register_field_array(proto_dns, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + dns_module = prefs_register_protocol(proto_dns, NULL); + prefs_register_bool_preference(dns_module, "desegment_dns_messages", + "Desegment all DNS messages spanning multiple TCP segments", + "Whether the DNS dissector should desegment all messages spanning multiple TCP segments", + &dns_desegment); } void diff --git a/packet-nbns.c b/packet-nbns.c index 48cf6d54f5..15a2c1116c 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.55 2001/09/13 07:53:51 guy Exp $ + * $Id: packet-nbns.c,v 1.56 2001/09/17 02:07:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -80,8 +80,7 @@ static gint ett_nbss = -1; static gint ett_nbss_flags = -1; /* desegmentation of NBSS over TCP */ -static gboolean nbss_desegment = FALSE; - +static gboolean nbss_desegment = TRUE; /* See RFC 1001 and 1002 for information on the first three, and see @@ -1702,8 +1701,8 @@ proto_register_nbt(void) 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", + "Desegment all NBSS packets spanning multiple TCP segments", + "Whether NBSS dissector should desegment all packets spanning multiple TCP segments", &nbss_desegment); } diff --git a/packet-rpc.c b/packet-rpc.c index dcd5412669..b5acb171f1 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de> * - * $Id: packet-rpc.c,v 1.71 2001/09/13 07:53:51 guy Exp $ + * $Id: packet-rpc.c,v 1.72 2001/09/17 02:07:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -62,7 +62,7 @@ #define RPC_RM_FRAGLEN 0x7fffffffL /* desegmentation of RPC over TCP */ -static gboolean rpc_desegment = FALSE; +static gboolean rpc_desegment = TRUE; static struct true_false_string yesno = { "Yes", "No" }; |