aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dissectors/CMakeLists.txt1
-rw-r--r--epan/dissectors/Makefile.am1
-rw-r--r--epan/dissectors/packet-mpls-mac.c259
-rw-r--r--epan/dissectors/packet-mpls.c1
-rw-r--r--epan/dissectors/packet-mpls.h2
5 files changed, 264 insertions, 0 deletions
diff --git a/epan/dissectors/CMakeLists.txt b/epan/dissectors/CMakeLists.txt
index 4478e994a1..e120443ba9 100644
--- a/epan/dissectors/CMakeLists.txt
+++ b/epan/dissectors/CMakeLists.txt
@@ -1318,6 +1318,7 @@ set(DISSECTOR_SRC
${CMAKE_CURRENT_SOURCE_DIR}/packet-mpeg-sect.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-mpeg1.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-mpls-echo.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/packet-mpls-mac.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-mpls-pm.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-mpls-psc.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-mplstp-oam.c
diff --git a/epan/dissectors/Makefile.am b/epan/dissectors/Makefile.am
index 95f600805c..974e37877b 100644
--- a/epan/dissectors/Makefile.am
+++ b/epan/dissectors/Makefile.am
@@ -943,6 +943,7 @@ DISSECTOR_SRC = \
packet-mpeg-sect.c \
packet-mpeg1.c \
packet-mpls-echo.c \
+ packet-mpls-mac.c \
packet-mpls-pm.c \
packet-mpls-psc.c \
packet-mplstp-oam.c \
diff --git a/epan/dissectors/packet-mpls-mac.c b/epan/dissectors/packet-mpls-mac.c
new file mode 100644
index 0000000000..64925e0b28
--- /dev/null
+++ b/epan/dissectors/packet-mpls-mac.c
@@ -0,0 +1,259 @@
+/* packet-mpls-mac.c
+ *
+ * Routines for MPLS Media Access Control (MAC) Address Withdrawal over Static Pseudowire.
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <epan/packet.h>
+#include "packet-mpls.h"
+
+void proto_register_mpls_mac(void);
+void proto_reg_handoff_mpls_mac(void);
+
+static gint proto_mpls_mac = -1;
+
+static gint ett_mpls_mac = -1;
+static gint ett_mpls_mac_flags = -1;
+static gint ett_mpls_mac_tlv = -1;
+
+static int hf_mpls_mac_reserved = -1;
+static int hf_mpls_mac_tlv_length_total = -1;
+static int hf_mpls_mac_flags = -1;
+static int hf_mpls_mac_flags_a = -1;
+static int hf_mpls_mac_flags_r = -1;
+static int hf_mpls_mac_flags_reserved = -1;
+static int hf_mpls_mac_tlv = -1;
+static int hf_mpls_mac_tlv_res = -1;
+static int hf_mpls_mac_tlv_type = -1;
+static int hf_mpls_mac_tlv_length = -1;
+static int hf_mpls_mac_tlv_value = -1;
+static int hf_mpls_mac_tlv_sequence_number = -1;
+
+
+static const int *mpls_mac_flags[] = {
+ &hf_mpls_mac_flags_a,
+ &hf_mpls_mac_flags_r,
+ &hf_mpls_mac_flags_reserved,
+ NULL
+};
+
+static int
+dissect_mpls_mac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti;
+ proto_tree *mac_tree;
+ guint32 offset = 0, tlv_length, offset_end;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPLS-MAC");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ ti = proto_tree_add_item(tree, proto_mpls_mac, tvb, 0, -1, ENC_NA);
+ mac_tree = proto_item_add_subtree(ti, ett_mpls_mac);
+ /* Reserved */
+ proto_tree_add_item(mac_tree, hf_mpls_mac_reserved, tvb, offset, 2, ENC_NA);
+ offset += 2;
+ /* TLV length */
+ proto_tree_add_item_ret_uint(mac_tree, hf_mpls_mac_tlv_length_total, tvb, offset, 1, ENC_BIG_ENDIAN, &tlv_length);
+ offset += 1;
+ /* Flags */
+ proto_tree_add_bitmask(mac_tree, tvb, offset, hf_mpls_mac_flags,
+ ett_mpls_mac_flags,
+ mpls_mac_flags,
+ ENC_BIG_ENDIAN);
+ offset += 1;
+ offset_end = offset + tlv_length;
+
+ while(offset < offset_end){
+ guint32 type, length;
+ proto_tree *tlv_tree;
+
+ ti = proto_tree_add_item(mac_tree, hf_mpls_mac_tlv, tvb, offset, 4, ENC_NA);
+
+ tlv_tree = proto_item_add_subtree(ti, ett_mpls_mac_tlv);
+ /* res(erved) */
+ proto_tree_add_item(tlv_tree, hf_mpls_mac_tlv_res, tvb, offset, 2, ENC_BIG_ENDIAN);
+
+ /* TLV Type */
+ proto_tree_add_item_ret_uint(tlv_tree, hf_mpls_mac_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN, &type);
+ offset += 2;
+
+ /* TLV Length */
+ proto_tree_add_item_ret_uint(tlv_tree, hf_mpls_mac_tlv_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
+ offset += 2;
+ proto_item_set_len(ti, 2+2+length);
+ proto_item_append_text(ti, " (t=0x%x, l=%u)", type, length);
+
+ /* TLV Value */
+ proto_tree_add_item(tlv_tree, hf_mpls_mac_tlv_value, tvb, offset, length, ENC_NA);
+
+ switch(type){
+ case 0x0001:
+ proto_tree_add_item(tlv_tree, hf_mpls_mac_tlv_sequence_number, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ break;
+ default:
+ offset += length;
+ break;
+ }
+
+ }
+ return offset;
+}
+
+void
+proto_register_mpls_mac(void)
+{
+ static hf_register_info hf[] = {
+ {
+ &hf_mpls_mac_reserved,
+ {
+ "Reserved", "mpls_mac.reserved",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_tlv_length_total,
+ {
+ "TLV Length (Total)", "mpls_mac.tlv_length_total",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_flags,
+ {
+ "Flags", "mpls_mac.flags",
+ FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_flags_a,
+ {
+ "Flags A", "mpls_mac.flags.a",
+ FT_BOOLEAN, 8, NULL, 0x80,
+ "set by a receiver to acknowledge receipt and processing of a MAC Address Withdraw OAM Message", HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_flags_r,
+ {
+ "Flags R", "mpls_mac.flags.r",
+ FT_BOOLEAN, 8, NULL, 0x40,
+ "Set to indicate if the sender is requesting reset of the sequence numbers", HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_flags_reserved,
+ {
+ "Flags Reserved", "mpls_mac.flags.reserved",
+ FT_UINT8, BASE_HEX, NULL, 0x3F,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_tlv,
+ {
+ "TLV", "mpls_mac.tlv",
+ FT_NONE, BASE_NONE, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_tlv_res,
+ {
+ "Res(erved)", "mpls_mac.tlv.res",
+ FT_UINT16, BASE_HEX, NULL, 0xC000,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_tlv_type,
+ {
+ "TLV Type", "mpls_mac.tlv.type",
+ FT_UINT16, BASE_HEX, NULL, 0x3FFF,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_tlv_length,
+ {
+ "TLV Length", "mpls_mac.tlv.length",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_tlv_value,
+ {
+ "TLV Value", "mpls_mac.tlv.value",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ {
+ &hf_mpls_mac_tlv_sequence_number,
+ {
+ "Sequence Number", "mpls_mac.tlv.sequence_number",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
+ };
+
+ static gint *ett[] = {
+ &ett_mpls_mac,
+ &ett_mpls_mac_flags,
+ &ett_mpls_mac_tlv,
+ };
+
+ proto_mpls_mac =
+ proto_register_protocol("MPLS-MAC",
+ "Media Access Control (MAC) Address Withdrawal over Static Pseudowire",
+ "mpls_mac");
+
+ proto_register_field_array(proto_mpls_mac, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+}
+
+void
+proto_reg_handoff_mpls_mac(void)
+{
+ dissector_handle_t mpls_mac_handle;
+
+ mpls_mac_handle = create_dissector_handle( dissect_mpls_mac, proto_mpls_mac );
+ dissector_add_uint("pwach.channel_type", PW_ACH_TYPE_MAC, mpls_mac_handle);
+}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */
diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c
index 06aaf27a5b..c9daeb88ee 100644
--- a/epan/dissectors/packet-mpls.c
+++ b/epan/dissectors/packet-mpls.c
@@ -189,6 +189,7 @@ static const value_string mpls_pwac_types[] = {
{ 0x0025, "On-Demand CV"},
{ 0x0026, "LI"},
{ 0x0027, "Pseudo-Wire OAM"},
+ { 0x0028, "MAC Withdraw OAM Msg"},
{ 0x0057, "IPv6 packet" },
{ 0x0058, "Fault OAM"},
{ 0x7FF8, "Reserved for Experimental Use"},
diff --git a/epan/dissectors/packet-mpls.h b/epan/dissectors/packet-mpls.h
index bbd73fa315..5b6fbdc35f 100644
--- a/epan/dissectors/packet-mpls.h
+++ b/epan/dissectors/packet-mpls.h
@@ -62,6 +62,8 @@ enum {
#define PW_ACH_TYPE_ONDEMAND_CV 0x0025
/* As per RFC 6478 */
#define PW_ACH_TYPE_PW_OAM 0x0027
+/* As per RFC 7769 */
+#define PW_ACH_TYPE_MAC 0x0028
/* As per RFC 4385 clause 6 */
#define PW_ACH_TYPE_IPV6 0x0057
/* As per RFC 6427 */