aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-mpls.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-12-31 15:16:23 -0500
committerMichael Mann <mmann78@netscape.net>2016-01-01 17:56:42 +0000
commit376b156333fe63d082d7f809f452feb65045b532 (patch)
treec943c3a4f1fe8fe2740e90a56bc82a68b2656f34 /epan/dissectors/packet-mpls.c
parentb344107d757466e0768a3ef8927852479e926cf6 (diff)
Only use nibble logic to determine MPLS payload
Bug: 11949 Change-Id: I625d80ce01918bd050889d21236aaa4cde4af8d0 Reviewed-on: https://code.wireshark.org/review/12961 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-mpls.c')
-rw-r--r--epan/dissectors/packet-mpls.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c
index 1e67b7afae..130a688d18 100644
--- a/epan/dissectors/packet-mpls.c
+++ b/epan/dissectors/packet-mpls.c
@@ -458,33 +458,29 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
return tvb_captured_length(tvb);
/* 2) use the 1st nibble logic (see BCP 4928, RFC 4385 and 5586) */
- if (first_nibble == 4) {
+ switch(first_nibble) {
+ case 4:
call_dissector(dissector_ip, next_tvb, pinfo, tree);
/* IP dissector may reduce the length of the tvb.
We need to do the same, so that ethernet trailer is detected. */
set_actual_length(tvb, offset+tvb_reported_length(next_tvb));
- return tvb_captured_length(tvb);
- } else if (first_nibble == 6) {
+ break;
+ case 6:
call_dissector(dissector_ipv6, next_tvb, pinfo, tree);
/* IPv6 dissector may reduce the length of the tvb.
We need to do the same, so that ethernet trailer is detected. */
set_actual_length(tvb, offset+tvb_reported_length(next_tvb));
- return tvb_captured_length(tvb);
- } else if (first_nibble == 1) {
+ break;
+ case 1:
call_dissector(dissector_pw_ach, next_tvb, pinfo, tree);
- return tvb_captured_length(tvb);
- } 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 tvb_captured_length(tvb);
- }
+ break;
+ case 0:
+ call_dissector(dissector_pw_eth_heuristic, next_tvb, pinfo, tree);
+ break;
+ default:
+ call_dissector(dissector_data, next_tvb, pinfo, tree);
+ break;
}
- call_dissector(dissector_data, next_tvb, pinfo, tree);
return tvb_captured_length(tvb);
}