From 8d2506a80027288ff83b5a399097f51abfc5d844 Mon Sep 17 00:00:00 2001 From: morriss Date: Tue, 6 Jan 2009 14:23:38 +0000 Subject: Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3175 by making WCCP a a "new style" dissector: if the message type is unknown then don't try to dissect the packet as WCCP. Update the URL to the (expired) ID for the v2 spec. Note in a comment that the UDP port in the spec is not IANA assigned. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27165 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-wccp.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'epan/dissectors/packet-wccp.c') diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c index 7d42908dae..72ba4a9811 100644 --- a/epan/dissectors/packet-wccp.c +++ b/epan/dissectors/packet-wccp.c @@ -75,11 +75,12 @@ static gint ett_unknown_info = -1; * * At * - * http://search.ietf.org/internet-drafts/draft-wilson-wrec-wccp-v2-01.txt + * http://tools.ietf.org/id/draft-wilson-wrec-wccp-v2-01.txt * * is an Internet-Draft for WCCP 2.0. */ +/* This is NOT IANA assigned */ #define UDP_PORT_WCCP 2048 #define WCCPv1 4 @@ -184,7 +185,7 @@ static void dissect_32_bit_capability_flags(tvbuff_t *tvb, int curr_offset, guint16 capability_val_len, gint ett, const capability_flag *flags, proto_tree *element_tree); -static void +static int dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; @@ -196,6 +197,12 @@ dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint32 ipaddr; guint i; + wccp_message_type = tvb_get_ntohl(tvb, offset); + + /* Check if this is really a WCCP message */ + if (match_strval(wccp_message_type, wccp_type_vals) == NULL) + return 0; + if(check_col(pinfo->cinfo, COL_PROTOCOL)) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "WCCP"); } @@ -203,7 +210,6 @@ dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_clear(pinfo->cinfo, COL_INFO); } - wccp_message_type = tvb_get_ntohl(tvb, offset); if(check_col(pinfo->cinfo, COL_INFO)) { col_add_str(pinfo->cinfo, COL_INFO, val_to_str(wccp_message_type, @@ -301,6 +307,8 @@ dissect_wccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } } + + return(tvb_length(tvb)); } static void @@ -1308,6 +1316,6 @@ proto_reg_handoff_wccp(void) { dissector_handle_t wccp_handle; - wccp_handle = create_dissector_handle(dissect_wccp, proto_wccp); + wccp_handle = new_create_dissector_handle(dissect_wccp, proto_wccp); dissector_add("udp.port", UDP_PORT_WCCP, wccp_handle); } -- cgit v1.2.3