diff options
-rw-r--r-- | epan/column-utils.c | 7 | ||||
-rw-r--r-- | epan/column-utils.h | 3 | ||||
-rw-r--r-- | packet-gtp.c | 74 | ||||
-rw-r--r-- | packet-ppp.c | 20 | ||||
-rw-r--r-- | packet-ppp.h | 8 |
5 files changed, 62 insertions, 50 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c index baf2deb061..856ffcfe9c 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -1,7 +1,7 @@ /* column-utils.c * Routines for column utilities. * - * $Id: column-utils.c,v 1.24 2002/10/23 04:23:03 guy Exp $ + * $Id: column-utils.c,v 1.25 2002/11/11 19:23:14 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -60,16 +60,11 @@ col_init(column_info *col_info, gint num_cols) col_info->col_expr_val = (gchar **) g_malloc(sizeof(gchar *) * num_cols); } -#if 0 -/* - * This function does not appear to be used anywhere... - */ gboolean col_get_writable(column_info *cinfo) { return (cinfo ? cinfo->writable : FALSE); } -#endif void col_set_writable(column_info *cinfo, gboolean writable) diff --git a/epan/column-utils.h b/epan/column-utils.h index 64ceee70ea..7800469950 100644 --- a/epan/column-utils.h +++ b/epan/column-utils.h @@ -1,7 +1,7 @@ /* column-utils.h * Definitions for column utility structures and routines * - * $Id: column-utils.h,v 1.7 2002/08/28 20:40:44 jmayer Exp $ + * $Id: column-utils.h,v 1.8 2002/11/11 19:23:14 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -39,6 +39,7 @@ extern void col_init(column_info *, gint); /* Utility routines used by packet*.c */ +extern gboolean col_get_writable(column_info *); extern void col_set_writable(column_info *, gboolean); extern gint check_col(column_info *, gint); extern void col_clear(column_info *, gint); diff --git a/packet-gtp.c b/packet-gtp.c index a84a759ab0..76e5cfba07 100644 --- a/packet-gtp.c +++ b/packet-gtp.c @@ -4,7 +4,7 @@ * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com> * Nicolas Balkota <balkota@mac.com> * - * $Id: packet-gtp.c,v 1.45 2002/11/11 17:41:37 guy Exp $ + * $Id: packet-gtp.c,v 1.46 2002/11/11 19:23:11 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -38,7 +38,7 @@ #include <epan/packet.h> #include "packet-gtp.h" #include "packet-ipv6.h" -#include "ppptypes.h" +#include "packet-ppp.h" #include "prefs.h" /* @@ -347,7 +347,6 @@ static gboolean gtpv1_etsi_order = FALSE; static int gtpv0_port = 0; static int gtpv1c_port = 0; static int gtpv1u_port = 0; -static gboolean ppp_reorder = TRUE; /* Definition of flags masks */ #define GTP_VER_MASK 0xE0 @@ -1332,6 +1331,7 @@ static const value_string cdr_close_type[] = { static dissector_handle_t ip_handle; static dissector_handle_t ipv6_handle; static dissector_handle_t ppp_handle; +static dissector_handle_t data_handle; static int decode_gtp_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); static int decode_gtp_imsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); @@ -3751,10 +3751,12 @@ int decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint16 length, proto_offset; - guint8 *ptr, conf, proto_len, tmp, msg, cnt = 1; + guint16 proto_id; + guint8 conf, proto_len, cnt = 1; tvbuff_t *next_tvb; proto_tree *ext_tree_proto; proto_item *te; + gboolean save_writable; length = tvb_get_ntohs(tvb, offset + 1); @@ -3773,36 +3775,39 @@ decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree for (;;) { if (proto_offset >= length) break; + proto_id = tvb_get_ntohs (tvb, offset); proto_len = tvb_get_guint8 (tvb, offset + 2); proto_offset += proto_len + 3; /* 3 = proto id + length byte */ - if ((proto_len > 0) && ppp_reorder) { - - /* this part changes layout of GTP payload: - * it swaps "length field" with "protocol header" */ - - ptr = (guint8 *)tvb_get_ptr(tvb, offset, 3); - - tmp = ptr[2]; - ptr[2] = ptr[1]; - ptr[1] = ptr[0]; - ptr[0] = tmp; - - proto_tree_add_text (ext_tree_proto, tvb, offset, 3, "[WARNING] Next 3 bytes were swapped to allow processing PPP section"); - proto_tree_add_text (ext_tree_proto, tvb, offset, 1, "Protocol %u length: %u", cnt, proto_len); - - next_tvb = tvb_new_subset (tvb, offset + 1, proto_len + 2, proto_len + 2); - call_dissector(ppp_handle, next_tvb, pinfo, ext_tree_proto); - - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP"); - - if (check_col(pinfo->cinfo, COL_INFO)) { - - msg = tvb_get_guint8(tvb, 1); - - col_set_str(pinfo->cinfo, COL_INFO, val_to_str(msg, message_type, "Unknown")); + if (proto_len > 0) { + + proto_tree_add_text (ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)", + cnt, val_to_str(proto_id, ppp_vals, "Unknown"), + proto_id); + proto_tree_add_text (ext_tree_proto, tvb, offset+2, 1, "Protocol %u length: %u", cnt, proto_len); + + /* + * Don't allow the dissector for the configuration + * protocol in question to update the columns - this + * is GTP, not PPP. + */ + save_writable = col_get_writable(pinfo->cinfo); + col_set_writable(pinfo->cinfo, FALSE); + + /* + * XXX - should we have our own dissector table, + * solely for configuration protocols, so that bogus + * values don't cause us to dissect the protocol + * data as, for example, IP? + */ + next_tvb = tvb_new_subset (tvb, offset + 3, proto_len, proto_len); + if (!dissector_try_port(ppp_subdissector_table, + proto_id, next_tvb, pinfo, ext_tree_proto)) { + call_dissector(data_handle, next_tvb, pinfo, + ext_tree_proto); } + + col_set_writable(pinfo->cinfo, save_writable); } offset += proto_len + 3; @@ -4923,7 +4928,7 @@ dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* this might be an address field, even it shouldn't be here */ guint8 control_field = tvb_get_guint8(tvb,GTPv0_HDR_LENGTH + 1); if (control_field == 0x03) { - /* now we are pretty sure that adress and control field are mistakenly inserted -> ignore it for PPP dissection */ + /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */ acfield_len = 2; } } @@ -5075,7 +5080,7 @@ dissect_gtpv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { control_field = tvb_get_guint8(tvb,GTPv1_HDR_LENGTH - hdr_offset + 1); if (control_field == 0x03) { - /* now we are pretty sure that adress and control field are mistakenly inserted -> ignore it for PPP dissection */ + /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */ acfield_len = 2; } } @@ -5325,11 +5330,10 @@ proto_register_gtp(void) prefs_register_enum_preference(gtp_module, "gtpv0_dissect_cdr_as", "Dissect GTP'v0 CDRs as ", "Dissect GTP'v0 CDRs as", >pv0_cdr_as, gtpv0_cdr_options, FALSE); prefs_register_bool_preference(gtp_module, "gtpv0_check_etsi", "Compare GTPv0 order with ETSI ", "GTPv0 ETSI order", >pv0_etsi_order); prefs_register_bool_preference(gtp_module, "gtpv1_check_etsi", "Compare GTPv1 order with ETSI ", "GTPv1 ETSI order", >pv1_etsi_order); - prefs_register_bool_preference(gtp_module, "ppp_reorder", "Reorder & dissect PPP in Protocol conf. options", "Reorder & dissect PPP inside of Protocol Configuration Options, 3 bytes will be swapped to allow processing PPP section: 1 byte of length with 2 bytes of protocol id (refer to ETSI 29.060, 7.7.21 & 24.008 10.5.6.3)", &ppp_reorder); + prefs_register_obsolete_preference(gtp_module, "ppp_reorder"); register_dissector("gtpv0", dissect_gtpv0, proto_gtpv0); register_dissector("gtpv1", dissect_gtpv1, proto_gtpv1); - } void @@ -5373,9 +5377,9 @@ proto_reg_handoff_gtp(void) dissector_add("tcp.port", g_gtpv1c_port, gtpv1_handle); dissector_add("udp.port", g_gtpv1u_port, gtpv1_handle); dissector_add("tcp.port", g_gtpv1u_port, gtpv1_handle); - dissector_add("ppp.protocol", PPP_IP, ip_handle); ip_handle = find_dissector("ip"); ipv6_handle = find_dissector("ipv6"); ppp_handle = find_dissector("ppp"); + data_handle = find_dissector("data"); } diff --git a/packet-ppp.c b/packet-ppp.c index 97ea238ac7..abfe56036b 100644 --- a/packet-ppp.c +++ b/packet-ppp.c @@ -1,7 +1,7 @@ /* packet-ppp.c * Routines for ppp packet disassembly * - * $Id: packet-ppp.c,v 1.99 2002/11/04 03:57:34 gerald Exp $ + * $Id: packet-ppp.c,v 1.100 2002/11/11 19:23:11 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -157,7 +157,10 @@ static gint ett_ipv6cp_options = -1; static gint ett_ipv6cp_if_token_opt = -1; static gint ett_ipv6cp_compressprot_opt = -1; -static dissector_table_t subdissector_table; +/* + * Used by the GTP dissector as well. + */ +dissector_table_t ppp_subdissector_table; static dissector_handle_t chdlc_handle; static dissector_handle_t data_handle; @@ -178,7 +181,10 @@ static guint pppmux_def_prot_id = 0; /* PPP definitions */ -static const value_string ppp_vals[] = { +/* + * Used by the GTP dissector as well. + */ +const value_string ppp_vals[] = { {PPP_PADDING, "Padding Protocol" }, {PPP_ROHC_SCID, "ROHC small-CID" }, {PPP_ROHC_LCID, "ROHC large-CID" }, @@ -294,7 +300,7 @@ static const value_string ppp_vals[] = { {PPP_BACP, "Bandwidth Allocation Control Protocol" }, {PPP_BAP, "Bandwitdh Allocation Protocol" }, {PPP_CONTCP, "Container Control Protocol" }, - {PPP_CHAP, "Cryptographic Handshake Auth. Protocol" }, + {PPP_CHAP, "Challenge Handshake Authentication Protocol" }, {PPP_RSAAP, "RSA Authentication Protocol" }, {PPP_EAP, "Extensible Authentication Protocol" }, {PPP_SIEP, "Mitsubishi Security Information Exchange Protocol"}, @@ -2422,7 +2428,7 @@ dissect_ppp_common( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, next_tvb = tvb_new_subset(tvb, proto_len, -1, -1); /* do lookup with the subdissector table */ - if (!dissector_try_port(subdissector_table, ppp_prot, next_tvb, pinfo, tree)) { + if (!dissector_try_port(ppp_subdissector_table, ppp_prot, next_tvb, pinfo, tree)) { if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_add_fstr(pinfo->cinfo, COL_PROTOCOL, "0x%04x", ppp_prot); if (check_col(pinfo->cinfo, COL_INFO)) @@ -2645,7 +2651,7 @@ dissect_pppmux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset(tvb,offset,length,-1); - if (!dissector_try_port(subdissector_table, pid, next_tvb, pinfo, info_tree)) { + if (!dissector_try_port(ppp_subdissector_table, pid, next_tvb, pinfo, info_tree)) { call_dissector(data_handle, next_tvb, pinfo, info_tree); } offset += length; @@ -3188,7 +3194,7 @@ proto_register_ppp(void) proto_register_subtree_array(ett, array_length(ett)); /* subdissector code */ - subdissector_table = register_dissector_table("ppp.protocol", + ppp_subdissector_table = register_dissector_table("ppp.protocol", "PPP protocol", FT_UINT16, BASE_HEX); register_dissector("ppp_hdlc", dissect_ppp_hdlc, proto_ppp); diff --git a/packet-ppp.h b/packet-ppp.h index 6332addbb9..30dd083d80 100644 --- a/packet-ppp.h +++ b/packet-ppp.h @@ -1,6 +1,6 @@ /* packet-ppp.h * - * $Id: packet-ppp.h,v 1.11 2002/08/28 21:00:25 jmayer Exp $ + * $Id: packet-ppp.h,v 1.12 2002/11/11 19:23:12 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -29,4 +29,10 @@ extern gboolean ppp_vj_decomp;/* FALSE = No VJ header decompression, TRUE = Decompress VJ */ void capture_ppp_hdlc(const guchar *, int, int, packet_counts *); +/* + * Used by the GTP dissector as well. + */ +extern dissector_table_t ppp_subdissector_table; +extern const value_string ppp_vals[]; + #endif |