aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mint.c
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2013-10-19 09:04:10 +0000
committerJörg Mayer <jmayer@loplof.de>2013-10-19 09:04:10 +0000
commit141673b515eab34ccf6d8062351b3718e5348ca0 (patch)
treea57db37b9e1045b61845354e5ec33cd55dea4e38 /epan/dissectors/packet-mint.c
parent15549298628d2205c37afefd5699fdd3a27ad26d (diff)
Some more decoding of mint traffic, start reformatting (incomplete)
svn path=/trunk/; revision=52684
Diffstat (limited to 'epan/dissectors/packet-mint.c')
-rw-r--r--epan/dissectors/packet-mint.c265
1 files changed, 170 insertions, 95 deletions
diff --git a/epan/dissectors/packet-mint.c b/epan/dissectors/packet-mint.c
index acb23f7fd3..6923d4c729 100644
--- a/epan/dissectors/packet-mint.c
+++ b/epan/dissectors/packet-mint.c
@@ -51,39 +51,49 @@ static int proto_mint = -1;
static dissector_handle_t eth_handle;
/* ett handles */
+static int ett_mint_ethshim = -1;
+static int ett_mint = -1;
+static int ett_mint_header = -1;
static int ett_mint_control = -1;
static int ett_mint_data = -1;
static int ett_mint_eth = -1;
/* hf elements */
-/* MiNT Control */
-static int hf_mint_control_unknown1 = -1;
-/* MiNT Data */
-static int hf_mint_data_unknown1 = -1;
-static int hf_mint_data_unknown2 = -1;
-static int hf_mint_data_seqno = -1;
-/* MiNT Eth */
-static int hf_mint_eth_unknown = -1;
-static int hf_mint_eth_length = -1;
-static int hf_mint_eth_unknown1 = -1;
+/* MiNT Eth Shim */
+static int hf_mint_ethshim = -1;
+static int hf_mint_ethshim_unknown = -1;
+static int hf_mint_ethshim_length = -1;
/* MiNT common */
+static int hf_mint_header = -1;
static int hf_mint_header_unknown1 = -1;
-static int hf_mint_header_unknown2 = -1;
-static int hf_mint_header_unknown3 = -1;
static int hf_mint_header_srcid = -1;
static int hf_mint_header_dstid = -1;
static int hf_mint_header_srcdatatype = -1;
static int hf_mint_header_dstdatatype = -1;
+/* MiNT Data */
+static int hf_mint_data = -1;
+static int hf_mint_data_vlan = -1;
+static int hf_mint_data_seqno = -1;
+static int hf_mint_data_unknown1 = -1;
+/* MiNT Control */
+static int hf_mint_control = -1;
+static int hf_mint_control_unknown1 = -1;
+/* MiNT Eth */
+static int hf_mint_eth = -1;
+static int hf_mint_eth_unknown1 = -1;
#define PROTO_SHORT_NAME "MiNT"
#define PROTO_LONG_NAME "Media indepentend Network Transport"
+/* 0x8783 ETHERTYPE_MINT */
+/* 0x6000 */
#define PORT_MINT_CONTROL_TUNNEL 24576
+/* 0x6001 */
#define PORT_MINT_DATA_TUNNEL 24577
typedef enum {
- MINT_TYPE_DATA_0x01 = 0x01,
- MINT_TYPE_DATA_0x02 = 0x02,
+ MINT_TYPE_DATA_UC = 0x01,
+ MINT_TYPE_DATA_BCMC = 0x02,
MINT_TYPE_CTRL_0x0c = 0x0c,
MINT_TYPE_CTRL_0x0e = 0x0e,
MINT_TYPE_CTRL_0x1e = 0x1e,
@@ -91,8 +101,8 @@ typedef enum {
} mint_packettype_t;
static const value_string mint_packettype_vals[] = {
- { MINT_TYPE_DATA_0x01, "Unicast data"},
- { MINT_TYPE_DATA_0x02, "BC/MC data"},
+ { MINT_TYPE_DATA_UC, "Unicast data"},
+ { MINT_TYPE_DATA_BCMC, "BC/MC data"},
{ MINT_TYPE_CTRL_0x0c, "Ctrl_0x0c"},
{ MINT_TYPE_CTRL_0x0e, "Ctrl_0x0e"},
{ MINT_TYPE_CTRL_0x1e, "Ctrl_0x1e"},
@@ -102,7 +112,7 @@ static const value_string mint_packettype_vals[] = {
};
static int
-dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mint_tree,
+dissect_eth_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mint_tree,
volatile guint32 offset, guint32 length)
{
tvbuff_t *eth_tvb;
@@ -129,11 +139,12 @@ dissect_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mint_tree,
static int
dissect_mint_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- guint32 offset, guint32 packet_length, guint received_via _U_)
+ guint32 offset, guint32 packet_length, guint received_via)
{
proto_item *ti;
proto_tree *mint_tree = NULL;
- guint16 header_remain;
+ proto_tree *mint_header_tree = NULL;
+ guint16 bytes_remaining;
guint16 packet_type;
if (!tree)
@@ -145,60 +156,101 @@ dissect_mint_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
col_add_str(pinfo->cinfo, COL_INFO, val_to_str(packet_type,
mint_packettype_vals, "Type 0x%02x"));
- ti = proto_tree_add_item(tree, proto_mint, tvb, offset, -1,
- ENC_NA);
- mint_tree = proto_item_add_subtree(ti, ett_mint_data);
+ ti = proto_tree_add_item(tree, proto_mint, tvb,
+ offset, packet_length, ENC_NA);
+ mint_tree = proto_item_add_subtree(ti, ett_mint);
+
+ ti = proto_tree_add_item(mint_tree, hf_mint_header, tvb,
+ offset, 16, ENC_NA);
+ mint_header_tree = proto_item_add_subtree(ti, ett_mint_header);
/* MiNT header */
- proto_tree_add_item(mint_tree, hf_mint_header_unknown1, tvb, offset, 4,
- ENC_NA);
+ proto_tree_add_item(mint_header_tree, hf_mint_header_unknown1, tvb,
+ offset, 4, ENC_NA);
offset += 4;
- proto_tree_add_item(mint_tree, hf_mint_header_dstid, tvb, offset, 4,
- ENC_NA);
+ proto_tree_add_item(mint_header_tree, hf_mint_header_dstid, tvb,
+ offset, 4, ENC_NA);
offset += 4;
- proto_tree_add_item(mint_tree, hf_mint_header_srcid, tvb, offset, 4,
- ENC_NA);
+ proto_tree_add_item(mint_header_tree, hf_mint_header_srcid, tvb,
+ offset, 4, ENC_NA);
offset += 4;
- proto_tree_add_item(mint_tree, hf_mint_header_dstdatatype, tvb, offset, 2,
- ENC_BIG_ENDIAN);
+ proto_tree_add_item(mint_header_tree, hf_mint_header_dstdatatype, tvb,
+ offset, 2, ENC_BIG_ENDIAN);
offset += 2;
- proto_tree_add_item(mint_tree, hf_mint_header_srcdatatype, tvb, offset, 2,
- ENC_BIG_ENDIAN);
+ proto_tree_add_item(mint_header_tree, hf_mint_header_srcdatatype, tvb,
+ offset, 2, ENC_BIG_ENDIAN);
offset += 2;
/* FIXME: This is probably not the right way to determine the packet type.
* It's more likely something in mint_header_unknown1 but I haven't
* found out what. */
switch(packet_type) {
- case 1:
- proto_tree_add_item(mint_tree, hf_mint_data_unknown1, tvb, offset, 2,
- ENC_NA);
+ case MINT_TYPE_DATA_UC:
+ ti = proto_tree_add_item(mint_tree, hf_mint_data, tvb,
+ offset, packet_length - 16, ENC_NA);
+ proto_tree_add_item(mint_tree, hf_mint_data_unknown1, tvb,
+ offset, 2, ENC_NA);
offset += 2;
/* Transported user frame */
if (offset < packet_length)
- offset += dissect_eth(tvb, pinfo, tree, offset, packet_length - offset);
+ offset += dissect_eth_frame(tvb, pinfo, tree,
+ offset, packet_length - offset);
break;
- case 2:
- /* The only observed values in my traces are 0f:c8 and 0f:ca.
- * The traffic with 0f:ca seems to be subjected to guestportal
- * and NAT. */
- proto_tree_add_item(mint_tree, hf_mint_data_unknown1, tvb, offset, 2,
- ENC_NA);
+ case MINT_TYPE_DATA_BCMC:
+ ti = proto_tree_add_item(mint_tree, hf_mint_data, tvb,
+ offset, packet_length - 16, ENC_NA);
+ /* Decode as vlan only for now. To be verified against a capture
+ * with CoS != 0 */
+ proto_tree_add_item(mint_tree, hf_mint_data_vlan, tvb,
+ offset, 2, ENC_BIG_ENDIAN);
offset += 2;
- proto_tree_add_item(mint_tree, hf_mint_data_seqno, tvb, offset, 4,
- ENC_NA);
+ proto_tree_add_item(mint_tree, hf_mint_data_seqno, tvb,
+ offset, 4, ENC_NA);
offset += 4;
- proto_tree_add_item(mint_tree, hf_mint_data_unknown2, tvb, offset, 4,
- ENC_NA);
+ proto_tree_add_item(mint_tree, hf_mint_data_unknown1, tvb,
+ offset, 4, ENC_NA);
offset += 4;
/* Transported user frame */
if (offset < packet_length)
- offset += dissect_eth(tvb, pinfo, tree, offset, packet_length - offset);
+ offset += dissect_eth_frame(tvb, pinfo, tree,
+ offset, packet_length - offset);
+ break;
+ case MINT_TYPE_CTRL_0x0c:
+ case MINT_TYPE_CTRL_0x0e:
+ case MINT_TYPE_CTRL_0x1e:
+ ti = proto_tree_add_item(mint_tree, hf_mint_control, tvb,
+ offset, packet_length - 16, ENC_NA);
+ bytes_remaining = packet_length - offset;
+ proto_tree_add_item(mint_tree, hf_mint_control_unknown1, tvb,
+ offset, bytes_remaining, ENC_NA);
+ offset += bytes_remaining;
+ break;
+ case MINT_TYPE_ETH_0x22:
+ ti = proto_tree_add_item(mint_tree, hf_mint_eth, tvb,
+ offset, packet_length - 16, ENC_NA);
+ bytes_remaining = packet_length - offset;
+ proto_tree_add_item(mint_tree, hf_mint_eth_unknown1, tvb,
+ offset, bytes_remaining, ENC_NA);
+ offset += bytes_remaining;
break;
default:
- header_remain = packet_length - offset;
- proto_tree_add_item(mint_tree, hf_mint_data_unknown1, tvb, offset, header_remain,
- ENC_NA);
- offset += header_remain;
+ bytes_remaining = packet_length - offset;
+ switch(received_via) {
+ case PORT_MINT_CONTROL_TUNNEL:
+ proto_tree_add_item(mint_tree, hf_mint_control_unknown1, tvb,
+ offset, bytes_remaining, ENC_NA);
+ break;
+ case PORT_MINT_DATA_TUNNEL:
+ proto_tree_add_item(mint_tree, hf_mint_data_unknown1, tvb,
+ offset, bytes_remaining, ENC_NA);
+ break;
+ case ETHERTYPE_MINT:
+ proto_tree_add_item(mint_tree, hf_mint_eth_unknown1, tvb,
+ offset, bytes_remaining, ENC_NA);
+ break;
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ }
+ offset += bytes_remaining;
break;
}
return offset;
@@ -207,43 +259,50 @@ dissect_mint_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int
dissect_mint_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
+ guint32 offset = 0;
guint32 packet_length = tvb_length_remaining(tvb, 0);
- return dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
+ offset += dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
PORT_MINT_CONTROL_TUNNEL);
-;
+
+ return offset;
}
static int
dissect_mint_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
+ guint32 offset = 0;
guint32 packet_length = tvb_length_remaining(tvb, 0);
- return dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
+ offset += dissect_mint_common(tvb, pinfo, tree, 0, packet_length,
PORT_MINT_DATA_TUNNEL);
+
+ return offset;
}
static int
dissect_mint_eth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
- proto_tree *mint_eth_tree = NULL;
+ proto_tree *mint_ethshim_tree = NULL;
guint32 offset = 0;
guint32 packet_length;
- ti = proto_tree_add_item(tree, proto_mint, tvb, offset, 4,
- ENC_NA);
- mint_eth_tree = proto_item_add_subtree(ti, ett_mint_eth);
+ ti = proto_tree_add_item(tree, hf_mint_ethshim, tvb,
+ offset, 4, ENC_NA);
+ mint_ethshim_tree = proto_item_add_subtree(ti, ett_mint_ethshim);
- proto_tree_add_item(mint_eth_tree, hf_mint_eth_unknown, tvb, offset, 2,
- ENC_NA);
+ proto_tree_add_item(mint_ethshim_tree, hf_mint_ethshim_unknown, tvb,
+ offset, 2, ENC_NA);
offset += 2;
- proto_tree_add_item(mint_eth_tree, hf_mint_eth_length, tvb, offset, 2,
- ENC_BIG_ENDIAN);
+ proto_tree_add_item(mint_ethshim_tree, hf_mint_ethshim_length, tvb,
+ offset, 2, ENC_BIG_ENDIAN);
packet_length = tvb_get_ntohs(tvb, offset) + 4;
offset += 2;
- return dissect_mint_common(tvb, pinfo, tree, 4, packet_length, ETHERTYPE_MINT);
+ offset += dissect_mint_common(tvb, pinfo, tree, 4, packet_length, ETHERTYPE_MINT);
+
+ return offset;
}
static gboolean
@@ -326,68 +385,84 @@ proto_register_mint(void)
{
static hf_register_info hf[] = {
- /* MiNT Control */
- { &hf_mint_control_unknown1,
- { "Unknown1", "mint.control.unknown1", FT_BYTES, BASE_NONE, NULL,
+ /* MiNT Eth Shim */
+ { &hf_mint_ethshim,
+ { "MiNT Ethernet Shim", "mint.ethshim", FT_PROTOCOL, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- /* MiNT Data */
- { &hf_mint_data_seqno,
- { "Seqence Number", "mint.data.seqno", FT_UINT32, BASE_DEC, NULL,
+ { &hf_mint_ethshim_unknown,
+ { "Unknown", "mint.ethshim.unknown", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_data_unknown1,
- { "Unknown1", "mint.data.unknown1", FT_BYTES, BASE_NONE, NULL,
+ { &hf_mint_ethshim_length,
+ { "Length", "mint.ethshim.length", FT_UINT16, BASE_DEC, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_data_unknown2,
- { "Unknown2", "mint.data.unknown2", FT_BYTES, BASE_NONE, NULL,
+ /* MiNT common */
+ { &hf_mint_header,
+ { "Header", "mint.header", FT_PROTOCOL, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- /* MiNT Eth */
- { &hf_mint_eth_unknown,
- { "Unknown", "mint.eth.unknown", FT_BYTES, BASE_NONE, NULL,
+ { &hf_mint_header_unknown1,
+ { "HdrUnk1", "mint.header.unknown1", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_eth_length,
- { "Length", "mint.eth.length", FT_UINT16, BASE_DEC, NULL,
+ { &hf_mint_header_srcid,
+ { "Src MiNT ID", "mint.header.srcid", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_eth_unknown1,
- { "Unknown1", "mint.eth.unknown1", FT_BYTES, BASE_NONE, NULL,
+ { &hf_mint_header_dstid,
+ { "Dst MiNT ID", "mint.header.dstid", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- /* MiNT common */
- { &hf_mint_header_unknown1,
- { "Unknown1", "mint.header.unknown1", FT_BYTES, BASE_NONE, NULL,
+ { &hf_mint_header_srcdatatype,
+ { "Src type", "mint.header.srctype", FT_UINT16, BASE_DEC, VALS(mint_packettype_vals),
0x0, NULL, HFILL }},
- { &hf_mint_header_unknown2,
- { "Unknown2", "mint.header.unknown2", FT_BYTES, BASE_NONE, NULL,
+ { &hf_mint_header_dstdatatype,
+ { "Dst type", "mint.header.dsttype", FT_UINT16, BASE_DEC, VALS(mint_packettype_vals),
0x0, NULL, HFILL }},
- { &hf_mint_header_unknown3,
- { "Unknown3", "mint.header.unknown3", FT_BYTES, BASE_NONE, NULL,
+ /* MiNT Control */
+ { &hf_mint_control,
+ { "Control Frame", "mint.control", FT_PROTOCOL, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_header_srcid,
- { "Src MiNT ID", "mint.header.srcid", FT_BYTES, BASE_NONE, NULL,
+ { &hf_mint_control_unknown1,
+ { "CtrlUnk1", "mint.control.unknown1", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_header_dstid,
- { "Dst MiNT ID", "mint.header.dstid", FT_BYTES, BASE_NONE, NULL,
+ /* MiNT Data */
+ { &hf_mint_data,
+ { "Data Frame", "mint.data", FT_PROTOCOL, BASE_NONE, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_header_srcdatatype,
- { "Src type", "mint.header.srctype", FT_UINT16, BASE_DEC, VALS(mint_packettype_vals),
+ { &hf_mint_data_vlan,
+ { "Data VLAN", "mint.data.vlan", FT_UINT16, BASE_DEC, NULL,
0x0, NULL, HFILL }},
- { &hf_mint_header_dstdatatype,
- { "Dst type", "mint.header.dsttype", FT_UINT16, BASE_DEC, VALS(mint_packettype_vals),
+ { &hf_mint_data_seqno,
+ { "Seqence Number", "mint.data.seqno", FT_UINT32, BASE_DEC, NULL,
+ 0x0, NULL, HFILL }},
+
+ { &hf_mint_data_unknown1,
+ { "DataUnk1", "mint.data.unknown1", FT_BYTES, BASE_NONE, NULL,
+ 0x0, NULL, HFILL }},
+
+ /* MiNT Eth */
+ { &hf_mint_eth,
+ { "Ethernet Frame", "mint.eth", FT_PROTOCOL, BASE_NONE, NULL,
+ 0x0, NULL, HFILL }},
+
+ { &hf_mint_eth_unknown1,
+ { "EthUnk1", "mint.eth.unknown1", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
};
static gint *ett[] = {
+ &ett_mint_ethshim,
+ &ett_mint,
+ &ett_mint_header,
&ett_mint_control,
&ett_mint_data,
&ett_mint_eth,