From addf8f6012b91c0a26628f12a127faf39107df4a Mon Sep 17 00:00:00 2001 From: Josef Baumgartner Date: Wed, 22 Apr 2015 09:21:46 +0200 Subject: [PATCH] epl: Add support for AMNI frame The "EPSG Draft Standard 302-A: High Availability" introduces the new frame "AMNI". This change adds support to correctly dissect POWERLINK AMNI frames. Change-Id: I9e402423296c4e82a25e897de964629bb695d566 Reviewed-on: https://code.wireshark.org/review/8215 Reviewed-by: Roland Knall Petri-Dish: Pascal Quantin Reviewed-by: Pascal Quantin --- epan/dissectors/packet-epl.c | 21 ++++++++++++++++++++- wka.tmpl | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index fbe64000bb..742f283b16 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -17,6 +17,9 @@ * Copyright (c) 2013: B&R Industrieelektronik GmbH * http://www.br-automation.com * + * - Christoph Schlosser + * - Lukas Emersberger + * - Josef Baumgartner * - Roland Knall * - Extended to be similair in handling as to B&R plugin * - Multiple SOD Read/Write dissection @@ -128,6 +131,7 @@ static const gchar* addr_str_abbr_res = " (res.)"; #define EPL_PRES 0x04 #define EPL_SOA 0x05 #define EPL_ASND 0x06 +#define EPL_AMNI 0x07 #define EPL_AINV 0x0D static const value_string mtyp_vals[] = { @@ -137,6 +141,7 @@ static const value_string mtyp_vals[] = { {EPL_SOA, "Start of Asynchronous (SoA)" }, {EPL_ASND, "Asynchronous Send (ASnd)" }, {EPL_AINV, "Asynchronous Invite (AInv)" }, + {EPL_AMNI, "ActiveManagingNodeIndication (AMNI)" }, {0,NULL} }; @@ -1205,6 +1210,8 @@ static const gchar* addr_str_res = " (reserved)"; static dissector_handle_t data_dissector = NULL; +static gint dissect_epl_payload ( proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint offset, gint len, guint8 msgType ); + static gint dissect_epl_soc(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint offset); static gint dissect_epl_preq(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, gint offset); static gint dissect_epl_pres(proto_tree *epl_tree, tvbuff_t *tvb, packet_info *pinfo, guint8 epl_src, gint offset); @@ -1662,7 +1669,7 @@ dissect_eplpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean udp /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; proto_tree *epl_tree = NULL, *epl_src_item, *epl_dest_item; - gint offset = 0; + gint offset = 0, size = 0; heur_dtbl_entry_t *hdtbl_entry; if (tvb_reported_length(tvb) < 3) @@ -1751,6 +1758,10 @@ dissect_eplpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean udp } break; + case EPL_AMNI: + col_add_fstr(pinfo->cinfo, COL_INFO, "%3d->%3d AMNI ", epl_src, epl_dest); + break; + default: /* no valid EPL packet */ return FALSE; } @@ -1812,6 +1823,14 @@ dissect_eplpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean udp offset = dissect_epl_ainv(epl_tree, tvb, pinfo, epl_src, offset); break; + case EPL_AMNI: + /* Currently all fields in the AMNI frame are reserved. Therefore + * there's nothing to dissect! Everything is given to the heuristic, + * which will dissect as data, if no heuristic dissector uses it. */ + size = tvb_captured_length_remaining(tvb, offset); + offset = dissect_epl_payload(epl_tree, tvb, pinfo, offset, size, EPL_AMNI); + break; + /* Default case can not happen as it is caught by an earlier switch * statement */ } diff --git a/wka.tmpl b/wka.tmpl index dfdca875d4..4a5cb5012a 100644 --- a/wka.tmpl +++ b/wka.tmpl @@ -78,6 +78,7 @@ 01-11-1E-00-00-02 EPLv2_PRes 01-11-1E-00-00-03 EPLv2_SoA 01-11-1E-00-00-04 EPLv2_ASnd +01-11-1E-00-00-05 EPLv2_AMNI 01-20-25/25 Control-Technology-Inc's-Industrial-Ctrl-Proto. 01-80-24-00-00-00 Kalpana-Etherswitch-every-60-seconds 01-80-C2-00-00-00/44 Spanning-tree-(for-bridges)