From 8e746bdd20d2619d4b163164011909781ec46134 Mon Sep 17 00:00:00 2001 From: Pascal Quantin Date: Sat, 13 Jun 2015 14:31:42 +0200 Subject: MPLS: always display payload when no 'Decode As' preference is set Based on the heuristic suggested by Jasper, check whether ethertype matches IPv4, ARP, RARP, VLAN or IPv6 and decode payload as Ethernet PW (CW heuristic) by default. Otherwise display payload as data by default. This can be overridden by the 'Decode As' configuration. Follow up of g7ca0472 Bug: 11271 Change-Id: Idb2ce1f8b967813a8f4a5e29e6005d5442729395 Reviewed-on: https://code.wireshark.org/review/8912 Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann Reviewed-by: Pascal Quantin --- epan/dissectors/packet-mpls.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'epan/dissectors/packet-mpls.c') diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c index f14182c450..86265052a0 100644 --- a/epan/dissectors/packet-mpls.c +++ b/epan/dissectors/packet-mpls.c @@ -94,7 +94,7 @@ static dissector_handle_t dissector_data; static dissector_handle_t dissector_ipv6; static dissector_handle_t dissector_ip; static dissector_handle_t dissector_pw_ach; - +static dissector_handle_t dissector_pw_eth_heuristic; /* For RFC6391 - Flow aware transport of pseudowire over a mpls PSN*/ static gboolean mpls_bos_flowlabel = FALSE; @@ -470,14 +470,18 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } else if (first_nibble == 1) { call_dissector(dissector_pw_ach, next_tvb, pinfo, tree); return; - } else if (first_nibble == 0) { - /* - * FF: it should be a PW with a CW but... it's not - * guaranteed (e.g. an Ethernet PW w/o CW and a DA MAC - * address like 00:xx:xx:xx:xx:xx). So, let the user and - * eventually any further PW heuristics decide. - */ + } else if (tvb_captured_length(next_tvb) >= 14) { + guint16 etype = tvb_get_ntohs(next_tvb, 12); + if ((etype == ETHERTYPE_IP) ||(etype == ETHERTYPE_ARP) || + (etype == ETHERTYPE_ARP) ||(etype == ETHERTYPE_VLAN) || + (etype ==ETHERTYPE_IPv6)) { + /* This looks like an ethernet packet with a known ethertype. + Decode payload as Ethernet PW */ + call_dissector(dissector_pw_eth_heuristic, next_tvb, pinfo, tree); + return; + } } + call_dissector(dissector_data, next_tvb, pinfo, tree); } void @@ -646,6 +650,7 @@ proto_reg_handoff_mpls(void) dissector_data = find_dissector("data"); dissector_ipv6 = find_dissector("ipv6"); dissector_ip = find_dissector("ip"); + dissector_pw_eth_heuristic = find_dissector("pw_eth_heuristic"); dissector_pw_ach = create_dissector_handle(dissect_pw_ach, proto_pw_ach ); } -- cgit v1.2.3