aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mpls.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-06-13 14:31:42 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-06-13 16:15:36 +0000
commit8e746bdd20d2619d4b163164011909781ec46134 (patch)
tree6249ae702ac76abef9bfc65f326bd471d97a3906 /epan/dissectors/packet-mpls.c
parenta57398dacb44b537d2fba0c0ce0c64a2d61a65ed (diff)
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 <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-mpls.c')
-rw-r--r--epan/dissectors/packet-mpls.c21
1 files changed, 13 insertions, 8 deletions
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 );
}