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>
This commit is contained in:
Pascal Quantin 2015-06-13 14:31:42 +02:00
parent a57398dacb
commit 8e746bdd20
2 changed files with 16 additions and 9 deletions

View File

@ -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 );
}

View File

@ -191,6 +191,8 @@ proto_register_pw_eth(void)
"pwethheuristic");
proto_register_field_array(proto_pw_eth_cw, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
register_dissector("pw_eth_heuristic", dissect_pw_eth_heuristic,
proto_pw_eth_heuristic);
}
void
@ -206,7 +208,7 @@ proto_reg_handoff_pw_eth(void)
pw_eth_handle_nocw = create_dissector_handle( dissect_pw_eth_nocw, proto_pw_eth_nocw );
dissector_add_for_decode_as("mpls.label", pw_eth_handle_nocw);
pw_eth_handle_heuristic = create_dissector_handle( dissect_pw_eth_heuristic, proto_pw_eth_heuristic );
pw_eth_handle_heuristic = find_dissector("pw_eth_heuristic");
dissector_add_for_decode_as("mpls.label", pw_eth_handle_heuristic);
}