diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-03-04 21:44:41 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-03-04 21:44:41 +0100 |
commit | d3f6b678c381e8e046be9f0f60a4c212bfdfc9aa (patch) | |
tree | 9465f67c62f47de398c9927cc195cbea7633cc1e /src/wireshark | |
parent | 86dced0b2ded533eddddfbe0bce34e3dcfc28a37 (diff) |
update wireshakr gsmtap patch with the 2nd version submitted to wireshark
We now
* properly decode the L1 header of SACCH frames
* properly hand-off SACCH payload such as SI5/SI6
* display the summary of the GSMTAP and SACCH_L1 dissectors in the protocol tree
Diffstat (limited to 'src/wireshark')
-rw-r--r-- | src/wireshark/gsmtap.patch | 199 |
1 files changed, 133 insertions, 66 deletions
diff --git a/src/wireshark/gsmtap.patch b/src/wireshark/gsmtap.patch index 947a53a3..019c8b49 100644 --- a/src/wireshark/gsmtap.patch +++ b/src/wireshark/gsmtap.patch @@ -2,12 +2,14 @@ Index: epan/dissectors/packet-gsmtap.c =================================================================== --- /dev/null +++ epan/dissectors/packet-gsmtap.c -@@ -0,0 +1,277 @@ +@@ -0,0 +1,345 @@ +/* packet-gsmtap.c + * Routines for GSMTAP captures + * + * (C) 2008-2010 by Harald Welte <laforge@gnumonks.org> + * ++ * $Id$ ++ * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs @@ -56,6 +58,7 @@ Index: epan/dissectors/packet-gsmtap.c +static int hf_gsmtap_timeslot = -1; +static int hf_gsmtap_subslot = -1; +static int hf_gsmtap_arfcn = -1; ++static int hf_gsmtap_uplink = -1; +static int hf_gsmtap_noise_dbm = -1; +static int hf_gsmtap_signal_dbm = -1; +static int hf_gsmtap_frame_nr = -1; @@ -63,20 +66,22 @@ Index: epan/dissectors/packet-gsmtap.c +static int hf_gsmtap_channel_type = -1; +static int hf_gsmtap_antenna = -1; + ++static int hf_sacch_l1h_power_lev = -1; ++static int hf_sacch_l1h_fpc = -1; ++static int hf_sacch_l1h_ta = -1; ++ +static gint ett_gsmtap = -1; + +enum { -+ SUB_DATA = 0, -+ SUB_UM, -+ SUB_UM_LAPDM, -+ SUB_ABIS, ++ GSMTAP_SUB_DATA = 0, ++ GSMTAP_SUB_UM, ++ GSMTAP_SUB_UM_LAPDM, ++ GSMTAP_SUB_ABIS, + -+ SUB_MAX ++ GSMTAP_SUB_MAX +}; + -+typedef gboolean (*sub_checkfunc_t)(packet_info *); -+ -+static dissector_handle_t sub_handles[SUB_MAX]; ++static dissector_handle_t sub_handles[GSMTAP_SUB_MAX]; + +static const value_string gsmtap_bursts[] = { + { GSMTAP_BURST_UNKNOWN, "UNKNOWN" }, @@ -104,7 +109,7 @@ Index: epan/dissectors/packet-gsmtap.c + { GSMTAP_CHANNEL_TCH_F, "FACCH/F" }, + { GSMTAP_CHANNEL_TCH_H, "FACCH/H" }, + { GSMTAP_CHANNEL_ACCH| -+ GSMTAP_CHANNEL_SDCCH, "SACCH" }, ++ GSMTAP_CHANNEL_SDCCH, "LSACCH" }, + { GSMTAP_CHANNEL_ACCH| + GSMTAP_CHANNEL_SDCCH4, "SACCH/4" }, + { GSMTAP_CHANNEL_ACCH| @@ -123,13 +128,38 @@ Index: epan/dissectors/packet-gsmtap.c + { 0, NULL }, +}; + ++/* dissect a SACCH L1 header which is included in the first 2 bytes ++ * of every SACCH frame (according to TS 04.04) */ ++static void ++dissect_sacch_l1h(tvbuff_t *tvb, proto_tree *tree) ++{ ++ proto_item *ti; ++ proto_tree *l1h_tree = NULL; ++ ++ if (!tree) ++ return; ++ ++ ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, 0, 2, ++ "SACCH L1 Header, Power Level: %u, Timing Advance: %u", ++ tvb_get_guint8(tvb, 0) & 0x1f, ++ tvb_get_guint8(tvb, 1)); ++ l1h_tree = proto_item_add_subtree(ti, ett_gsmtap); ++ /* Power Level */ ++ proto_tree_add_item(l1h_tree, hf_sacch_l1h_power_lev, tvb, 0, 1, FALSE); ++ /* Fast Power Control */ ++ proto_tree_add_item(l1h_tree, hf_sacch_l1h_fpc, tvb, 0, 1, FALSE); ++ /* Acutal Timing Advance */ ++ proto_tree_add_item(l1h_tree, hf_sacch_l1h_ta, tvb, 1, 1, FALSE); ++} ++ ++/* dissect a GSMTAP header and hand payload off to respective dissector */ +static void +dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + int sub_handle, len, offset = 0; + proto_item *ti; + proto_tree *gsmtap_tree = NULL; -+ tvbuff_t *payload_tvb; ++ tvbuff_t *payload_tvb, *l1h_tvb = NULL; + guint8 hdr_len, type, sub_type; + guint16 arfcn; + @@ -140,26 +170,40 @@ Index: epan/dissectors/packet-gsmtap.c + sub_type = tvb_get_guint8(tvb, offset + 12); + arfcn = tvb_get_ntohs(tvb, offset + 4); + -+ payload_tvb = tvb_new_subset(tvb, hdr_len, len-hdr_len, len-hdr_len); ++ /* In case of a SACCH, there is a two-byte L1 header in front ++ * of the packet (see TS 04.04) */ ++ if (type == GSMTAP_TYPE_UM && ++ sub_type & GSMTAP_CHANNEL_ACCH) { ++ l1h_tvb = tvb_new_subset(tvb, hdr_len, 2, 2); ++ payload_tvb = tvb_new_subset(tvb, hdr_len+2, len-(hdr_len+2), ++ len-(hdr_len+2)); ++ } else { ++ payload_tvb = tvb_new_subset(tvb, hdr_len, len-hdr_len, ++ len-hdr_len); ++ } ++ ++ /* We don't want any UDP related info left in the INFO field, as the ++ * gsm_a_dtap dissector will not clear but only append */ ++ col_clear(pinfo->cinfo, COL_INFO); + -+ col_add_fstr(pinfo->cinfo, COL_INFO, "GSM TAP, %d bytes", len); ++ col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSMTAP"); + + if (arfcn & GSMTAP_ARFCN_F_UPLINK) { -+ col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "MS"); -+ col_set_str(pinfo->cinfo, COL_RES_DL_DST, "BTS"); ++ col_append_str(pinfo->cinfo, COL_RES_NET_SRC, "MS"); ++ col_append_str(pinfo->cinfo, COL_RES_NET_DST, "BTS"); + /* p2p_dir is used by the LAPDm dissector */ + pinfo->p2p_dir = P2P_DIR_SENT; + } else { -+ col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "BTS"); ++ col_set_str(pinfo->cinfo, COL_RES_NET_SRC, "BTS"); + switch (sub_type & ~GSMTAP_CHANNEL_ACCH) { + case GSMTAP_CHANNEL_BCCH: + case GSMTAP_CHANNEL_CCCH: + case GSMTAP_CHANNEL_PCH: + case GSMTAP_CHANNEL_AGCH: -+ col_set_str(pinfo->cinfo, COL_RES_DL_DST, "Broadcast"); ++ col_set_str(pinfo->cinfo, COL_RES_NET_DST, "Broadcast"); + break; + default: -+ col_set_str(pinfo->cinfo, COL_RES_DL_DST, "MS"); ++ col_set_str(pinfo->cinfo, COL_RES_NET_DST, "MS"); + break; + } + /* p2p_dir is used by the LAPDm dissector */ @@ -167,9 +211,13 @@ Index: epan/dissectors/packet-gsmtap.c + } + + if (tree) { -+ ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, -+ 0, hdr_len, -+ "GSM TAP Header"); ++ ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, 0, hdr_len, ++ "GSM TAP Header, ARFCN: %u (%s), TS: %u, Channel: %s (%u)", ++ arfcn & GSMTAP_ARFCN_MASK, ++ arfcn & GSMTAP_ARFCN_F_UPLINK ? "Uplink" : "Downlink", ++ tvb_get_guint8(tvb, offset+3), ++ match_strval(tvb_get_guint8(tvb, offset+12), gsmtap_channels), ++ tvb_get_guint8(tvb, offset+14)); + gsmtap_tree = proto_item_add_subtree(ti, ett_gsmtap); + proto_tree_add_item(gsmtap_tree, hf_gsmtap_version, + tvb, offset, 1, FALSE); @@ -178,58 +226,68 @@ Index: epan/dissectors/packet-gsmtap.c + "Header length: %u bytes", hdr_len); + proto_tree_add_item(gsmtap_tree, hf_gsmtap_type, + tvb, offset+2, 1, FALSE); -+ if (type == GSMTAP_TYPE_UM_BURST) -+ proto_tree_add_item(gsmtap_tree, hf_gsmtap_burst_type, -+ tvb, offset+12, 1, FALSE); -+ else if (type == GSMTAP_TYPE_UM) -+ proto_tree_add_item(gsmtap_tree, hf_gsmtap_channel_type, -+ tvb, offset+12, 1, FALSE); -+ proto_tree_add_item(gsmtap_tree, hf_gsmtap_arfcn, -+ tvb, offset+4, 2, FALSE); + proto_tree_add_item(gsmtap_tree, hf_gsmtap_timeslot, + tvb, offset+3, 1, FALSE); -+ proto_tree_add_item(gsmtap_tree, hf_gsmtap_subslot, -+ tvb, offset+14, 1, FALSE); -+ proto_tree_add_item(gsmtap_tree, hf_gsmtap_antenna, -+ tvb, offset+13, 1, FALSE); ++ proto_tree_add_item(gsmtap_tree, hf_gsmtap_arfcn, ++ tvb, offset+4, 2, FALSE); ++ proto_tree_add_item(gsmtap_tree, hf_gsmtap_uplink, ++ tvb, offset+4, 2, FALSE); + proto_tree_add_item(gsmtap_tree, hf_gsmtap_noise_dbm, + tvb, offset+6, 1, FALSE); + proto_tree_add_item(gsmtap_tree, hf_gsmtap_signal_dbm, + tvb, offset+7, 1, FALSE); + proto_tree_add_item(gsmtap_tree, hf_gsmtap_frame_nr, + tvb, offset+8, 4, FALSE); ++ if (type == GSMTAP_TYPE_UM_BURST) ++ proto_tree_add_item(gsmtap_tree, hf_gsmtap_burst_type, ++ tvb, offset+12, 1, FALSE); ++ else if (type == GSMTAP_TYPE_UM) ++ proto_tree_add_item(gsmtap_tree, hf_gsmtap_channel_type, ++ tvb, offset+12, 1, FALSE); ++ proto_tree_add_item(gsmtap_tree, hf_gsmtap_antenna, ++ tvb, offset+13, 1, FALSE); ++ proto_tree_add_item(gsmtap_tree, hf_gsmtap_subslot, ++ tvb, offset+14, 1, FALSE); + } ++ + switch (type) { + case GSMTAP_TYPE_UM: ++ if (l1h_tvb) ++ dissect_sacch_l1h(l1h_tvb, tree); + switch (sub_type & ~GSMTAP_CHANNEL_ACCH) { + case GSMTAP_CHANNEL_BCCH: + case GSMTAP_CHANNEL_CCCH: + case GSMTAP_CHANNEL_PCH: + case GSMTAP_CHANNEL_AGCH: + /* FIXME: we might want to skip idle frames */ -+ sub_handle = SUB_UM; ++ sub_handle = GSMTAP_SUB_UM; + break; + case GSMTAP_CHANNEL_SDCCH: + case GSMTAP_CHANNEL_SDCCH4: + case GSMTAP_CHANNEL_SDCCH8: + case GSMTAP_CHANNEL_TCH_F: + case GSMTAP_CHANNEL_TCH_H: -+ sub_handle = SUB_UM_LAPDM; ++ sub_handle = GSMTAP_SUB_UM_LAPDM; + break; + case GSMTAP_CHANNEL_RACH: + default: -+ sub_handle = SUB_DATA; ++ sub_handle = GSMTAP_SUB_DATA; + break; + } + break; + case GSMTAP_TYPE_UM_BURST: + default: -+ sub_handle = SUB_DATA; ++ sub_handle = GSMTAP_SUB_DATA; + break; + } + call_dissector(sub_handles[sub_handle], payload_tvb, pinfo, tree); +} + ++static const true_false_string sacch_l1h_fpc_mode_vals = { ++ "In use", ++ "Not in use" ++}; ++ +void +proto_register_gsmtap(void) +{ @@ -238,17 +296,19 @@ Index: epan/dissectors/packet-gsmtap.c + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_gsmtap_hdrlen, { "Header Length", "gsmtap.hdr_len", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, -+ { &hf_gsmtap_type, { "Type", "gsmtap.type", ++ { &hf_gsmtap_type, { "Payload Type", "gsmtap.type", + FT_UINT8, BASE_DEC, VALS(gsmtap_types), 0, NULL, HFILL } }, + { &hf_gsmtap_timeslot, { "Time Slot", "gsmtap.ts", -+ FT_UINT8, BASE_DEC, NULL, GSMTAP_ARFCN_MASK, NULL, HFILL } }, ++ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_gsmtap_arfcn, { "ARFCN", "gsmtap.arfcn", -+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } }, -+ { &hf_gsmtap_noise_dbm, { "Noise dBm", "gsmtap.noise_dbm", ++ FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_MASK, NULL, HFILL } }, ++ { &hf_gsmtap_uplink, { "Uplink", "gsmtap.uplink", ++ FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_F_UPLINK, NULL, HFILL } }, ++ { &hf_gsmtap_noise_dbm, { "Signal/Noise Ratio (dB)", "gsmtap.snr_db", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, -+ { &hf_gsmtap_signal_dbm, { "Signal dBm", "gsmtap.signal_dbm", ++ { &hf_gsmtap_signal_dbm, { "Signal Level (dBm)", "gsmtap.signal_dbm", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, -+ { &hf_gsmtap_frame_nr, { "Frame Number", "gsmtap.frame_nr", ++ { &hf_gsmtap_frame_nr, { "GSM Frame Number", "gsmtap.frame_nr", + FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_gsmtap_burst_type, { "Burst Type", "gsmtap.burst_type", + FT_UINT8, BASE_DEC, VALS(gsmtap_bursts), 0, NULL, HFILL }}, @@ -258,6 +318,14 @@ Index: epan/dissectors/packet-gsmtap.c + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, + { &hf_gsmtap_subslot, { "Sub-Slot", "gsmtap.sub_slot", + FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, ++ ++ { &hf_sacch_l1h_power_lev, { "MS power level", "gsmtap.sacch_l1.power_lev", ++ FT_UINT8, BASE_DEC, NULL, 0x1f, NULL, HFILL } }, ++ { &hf_sacch_l1h_fpc, { "FPC", "gsmtap.sacch_l1.fpc", ++ FT_BOOLEAN, 8, TFS(&sacch_l1h_fpc_mode_vals), 0x04, ++ NULL, HFILL } }, ++ { &hf_sacch_l1h_ta, { "Actual Timing Advance", "gsmtap.sacch_l1.ta", ++ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } }, + }; + static gint *ett[] = { + &ett_gsmtap @@ -273,10 +341,10 @@ Index: epan/dissectors/packet-gsmtap.c +{ + dissector_handle_t gsmtap_handle; + -+ sub_handles[SUB_DATA] = find_dissector("data"); -+ sub_handles[SUB_UM] = find_dissector("gsm_a_ccch"); -+ sub_handles[SUB_UM_LAPDM] = find_dissector("lapdm"); -+ sub_handles[SUB_ABIS] = find_dissector("gsm_a_dtap"); ++ sub_handles[GSMTAP_SUB_DATA] = find_dissector("data"); ++ sub_handles[GSMTAP_SUB_UM] = find_dissector("gsm_a_ccch"); ++ sub_handles[GSMTAP_SUB_UM_LAPDM] = find_dissector("lapdm"); ++ sub_handles[GSMTAP_SUB_ABIS] = find_dissector("gsm_a_dtap"); + gsmtap_handle = create_dissector_handle(dissect_gsmtap, proto_gsmtap); + dissector_add("udp.port", GSMTAP_UDP_PORT, gsmtap_handle); +} @@ -284,11 +352,11 @@ Index: epan/dissectors/packet-gsmtap.h =================================================================== --- /dev/null +++ epan/dissectors/packet-gsmtap.h -@@ -0,0 +1,71 @@ +@@ -0,0 +1,70 @@ +#ifndef _GSMTAP_H +#define _GSMTAP_H + -+/* gsmtap header, pseudo-header in front of the actua GSM payload */ ++/* gsmtap header, pseudo-header in front of the actua/ GSM payload */ + +/* GSMTAP is a generic header format for GSM protocol captures, + * it uses the IANA-assigned UDP port number 4729 and carries @@ -299,10 +367,6 @@ Index: epan/dissectors/packet-gsmtap.h + * (http://airprobe.org/) or OsmocomBB (http://bb.osmocom.org/) + */ + -+#include <sys/types.h> -+ -+#define GSMTAP_VERSION 0x02 -+ +#define GSMTAP_TYPE_UM 0x01 +#define GSMTAP_TYPE_ABIS 0x02 +#define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */ @@ -337,24 +401,27 @@ Index: epan/dissectors/packet-gsmtap.h + +#define GSMTAP_UDP_PORT 4729 + ++/* This is the header as it is used by gsmtap-generating software. ++ * It is not used by the wireshark dissector and provided for reference only. +struct gsmtap_hdr { -+ guint8 version; /* version, set to 0x01 currently */ -+ guint8 hdr_len; /* length in number of 32bit words */ -+ guint8 type; /* see GSMTAP_TYPE_* */ -+ guint8 timeslot; /* timeslot (0..7 on Um) */ ++ guint8 version; // version, set to 0x01 currently ++ guint8 hdr_len; // length in number of 32bit words ++ guint8 type; // see GSMTAP_TYPE_* ++ guint8 timeslot; // timeslot (0..7 on Um) + -+ guint16 arfcn; /* ARFCN (frequency) */ -+ gint8 signal_dbm; /* signal level in dBm */ -+ gint8 snr_db; /* signal/noise ratio in dB */ ++ guint16 arfcn; // ARFCN (frequency) ++ gint8 signal_dbm; // signal level in dBm ++ gint8 snr_db; // signal/noise ratio in dB + -+ guint32 frame_number; /* GSM Frame Number (FN) */ ++ guint32 frame_number; // GSM Frame Number (FN) + -+ guint8 sub_type; /* Type of burst/channel, see above */ -+ guint8 antenna_nr; /* Antenna Number */ -+ guint8 sub_slot; /* sub-slot within timeslot */ -+ guint8 res; /* reserved for future use (RFU) */ ++ guint8 sub_type; // Type of burst/channel, see above ++ guint8 antenna_nr; // Antenna Number ++ guint8 sub_slot; // sub-slot within timeslot ++ guint8 res; // reserved for future use (RFU) ++} ++ */ + -+} __attribute__((packed)); +#endif /* _GSMTAP_H */ Index: epan/dissectors/Makefile.common =================================================================== |