From 88099534302fa6459c95b6e3c2300c6e0466e54b Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Sun, 18 Oct 2009 13:36:01 +0000 Subject: From Kip McAtee: Suppress spurious packet length error message for LCP or IPCP in PPPoE. svn path=/trunk/; revision=30594 --- epan/dissectors/packet-pppoe.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'epan/dissectors/packet-pppoe.c') diff --git a/epan/dissectors/packet-pppoe.c b/epan/dissectors/packet-pppoe.c index 213bcb1bec..6888ff6bff 100644 --- a/epan/dissectors/packet-pppoe.c +++ b/epan/dissectors/packet-pppoe.c @@ -33,6 +33,7 @@ #include #include #include +#include static int proto_pppoed = -1; @@ -701,6 +702,7 @@ static void dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint actual_payload_length; gint length, reported_length; gint credit_offset = 0, tagstart = 0; + guint16 cp_code; proto_tree *pppoe_tree; proto_item *ti = NULL; @@ -812,13 +814,21 @@ static void dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * to the length field, *after* it does all the * FCS heuristics. */ - if ((reported_payload_length != actual_payload_length) && - ((reported_payload_length + 4) != actual_payload_length)) { - proto_item_append_text(ti, " [incorrect, should be %u]", - actual_payload_length); - expert_add_info_format(pinfo, ti, PI_MALFORMED, - PI_WARN, "Possible bad payload length %u != %u", - reported_payload_length, actual_payload_length); + + /* retrieve the control protocol code if it's there */ + cp_code = tvb_get_ntohs(tvb, 6); + /* + * The session payload length expressly does not include pad bytes + * when LCP or IPCP are present, so avoid the spurious error message + */ + if ((cp_code != PPP_LCP) && (cp_code != PPP_IPCP) && + (reported_payload_length != actual_payload_length) && + ((reported_payload_length + 4) != actual_payload_length)) { + proto_item_append_text(ti, " [incorrect, should be %u]", + actual_payload_length); + expert_add_info_format(pinfo, ti, PI_MALFORMED, + PI_WARN, "Possible bad payload length %u != %u", + reported_payload_length, actual_payload_length); } } -- cgit v1.2.3