In some versions of GRE, you can have ACK-only packets; if a packet

doesn't have the S bit set, check whether it has any payload before
attempting to hand off the payload to the next dissector.

svn path=/trunk/; revision=4069
This commit is contained in:
Guy Harris 2001-10-23 19:02:59 +00:00
parent c68d6a7158
commit 7e9e5de290
1 changed files with 21 additions and 2 deletions

View File

@ -2,12 +2,11 @@
* Routines for the Generic Routing Encapsulation (GRE) protocol
* Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
*
* $Id: packet-gre.c,v 1.44 2001/06/18 02:17:46 guy Exp $
* $Id: packet-gre.c,v 1.45 2001/10/23 19:02:59 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -43,6 +42,14 @@
#include "greproto.h"
#include "ipproto.h"
/*
* See RFC 1701 "Generic Routing Encapsulation (GRE)", RFC 1702
* "Generic Routing Encapsulation over IPv4 networks", RFC 2637
* "Point-to-Point Tunneling Protocol (PPTP)", RFC 2784 "Generic
* Routing Encapsulation (GRE)", and RFC 2890 "Key and Sequence
* Number Extensions to GRE".
*/
static int proto_gre = -1;
static int hf_gre_proto = -1;
@ -253,6 +260,18 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 4;
}
}
/* If the S bit is not set, this packet might not have a payload, so
check whether there's any data left, first.
XXX - the S bit isn't in RFC 2784, which deprecates that bit
and some other bits in RFC 1701 and says that they should be
zero for RFC 2784-compliant GRE; as such, the absence of the
S bit doesn't necessarily mean there's no payload. */
if (!(flags_and_ver & GH_B_S)) {
if (tvb_reported_length_remaining(tvb, offset) <= 0)
return; /* no payload */
}
next_tvb = tvb_new_subset(tvb, offset, -1, -1);
if (!dissector_try_port(gre_dissector_table, type, next_tvb, pinfo, tree))
dissect_data(next_tvb, 0, pinfo, gre_tree);