diff options
author | Guy Harris <guy@alum.mit.edu> | 2001-10-01 08:29:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2001-10-01 08:29:37 +0000 |
commit | d627904aba3732e3badbca8467f88758c2668b25 (patch) | |
tree | 469015385bd66c0d924f444094baf9b94145393e /packet-rlogin.c | |
parent | 3869ff8bfb9804ff27c558196efffbd75dc27263 (diff) | |
download | wireshark-d627904aba3732e3badbca8467f88758c2668b25.tar.gz wireshark-d627904aba3732e3badbca8467f88758c2668b25.tar.bz2 wireshark-d627904aba3732e3badbca8467f88758c2668b25.zip |
Have a flag in the "packet_info" structure, which indicates whether the
stuff currently being dissected is part of a packet included in an error
packet (e.g., an ICMP Unreachable packet). Have the TCP dissector not
bother doing reassembly if the TCP segment is part of an error packet,
rather than an actual TCP transmission; other dissectors might want to
treat those packets specially as well.
Add to the "tcpinfo" structure a flag indicating whether the URG flag
was set, rather than having the zero or non-zero value of the urgent
pointer indicate that. (Yes, at least as I read RFC 793, a zero urgent
pointer value isn't useful, as it means "the stuff before this segment
is urgent", but it's certainly possible to put onto the wire a TCP
segment with URG set and a zero urgent pointer.)
Don't dissect the TCP header by grabbing the entire header with
"tvb_memcpy()" and then pulling stuff out of it - extract stuff with
individual tvbuff calls, and put stuff into the protocol tree and the
Info column as we extract it, so that we can dissect a partial header.
This lets us, for example, get the source and destination ports from the
TCP header of the part of a TCP segment included in a minimum-length
ICMPv4 error packet.
svn path=/trunk/; revision=3986
Diffstat (limited to 'packet-rlogin.c')
-rw-r--r-- | packet-rlogin.c | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/packet-rlogin.c b/packet-rlogin.c index c93f096d65..503c189d86 100644 --- a/packet-rlogin.c +++ b/packet-rlogin.c @@ -2,7 +2,7 @@ * Routines for unix rlogin packet dissection * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet-rlogin.c,v 1.20 2001/09/30 23:14:43 guy Exp $ + * $Id: packet-rlogin.c,v 1.21 2001/10/01 08:29:35 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -198,7 +198,13 @@ static void rlogin_display( rlogin_hash_entry_t *hash_info, tvbuff_t *tvb, if ( length == 0) /* exit if no captured data */ return; - if ( tcpinfo->urgent_pointer && /* if control message */ + /* + * XXX - this works only if the urgent pointer points to something + * in this segment; to make it work if the urgent pointer points + * to something past this segment, we'd have to remember the urgent + * pointer setting for this conversation. + */ + if ( tcpinfo->urgent && /* if urgent pointer set */ length >= tcpinfo->urgent_pointer) { /* and it's in this frame */ int urgent_offset = tcpinfo->urgent_pointer - 1; @@ -338,6 +344,7 @@ dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) struct tcpinfo *tcpinfo = pinfo->private; conversation_t *conversation; rlogin_hash_entry_t *hash_info; + guint length; gint ti_offset; /* Lookup this connection*/ @@ -374,29 +381,33 @@ dissect_rlogin(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else temp[0] = 0; - if ( tvb_get_guint8(tvb, 0) == '\0') - strcat( temp, "Start Handshake"); - else if ( tcpinfo->urgent_pointer) - strcat( temp, "Control Message"); - - else { /* check for terminal info */ - ti_offset = tvb_find_guint8(tvb, 0, -1, 0xff); - if (ti_offset != -1 && - tvb_bytes_exist(tvb, ti_offset + 1, 1) && - tvb_get_guint8(tvb, ti_offset + 1) == 0xff) - strcat( temp, "Terminal Info"); - else { - int i; - int bytes_to_copy; - - strcat( temp, "Data: "); - i = strlen( temp); - bytes_to_copy = tvb_length(tvb); - if (bytes_to_copy > 128) - bytes_to_copy = 128; - tvb_memcpy(tvb, (guint8 *)&temp[i], 0, - bytes_to_copy); - temp[i + bytes_to_copy] = '\0'; + length = tvb_length(tvb); + if (length != 0) { + if ( tvb_get_guint8(tvb, 0) == '\0') + strcat( temp, "Start Handshake"); + else if ( tcpinfo->urgent && + length >= tcpinfo->urgent_pointer ) + strcat( temp, "Control Message"); + + else { /* check for terminal info */ + ti_offset = tvb_find_guint8(tvb, 0, -1, 0xff); + if (ti_offset != -1 && + tvb_bytes_exist(tvb, ti_offset + 1, 1) && + tvb_get_guint8(tvb, ti_offset + 1) == 0xff) + strcat( temp, "Terminal Info"); + else { + int i; + int bytes_to_copy; + + strcat( temp, "Data: "); + i = strlen( temp); + bytes_to_copy = tvb_length(tvb); + if (bytes_to_copy > 128) + bytes_to_copy = 128; + tvb_memcpy(tvb, (guint8 *)&temp[i], 0, + bytes_to_copy); + temp[i + bytes_to_copy] = '\0'; + } } } |