diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-01-07 18:32:59 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-01-08 02:33:53 +0000 |
commit | 082ba063efd2a7faf6bd25d73b08197708e117b8 (patch) | |
tree | 118ad618367c2a7480a9fe4adc9fec6b0632a960 /epan | |
parent | 2009dcc98dc46712c8b64ae30408c4d53c64980b (diff) |
Comments on the first nibble stuff.
If you don't have control words - and several MPLS pseudo-wire RFCs say
"in these cases, a control word isn't necessary, and isn't useful, so
you might want to leave it out" - the first nibble values of 0, 1, 4,
and 6 could just be part of the packet header.
Explain some other stuff as well.
Change-Id: I2f1aae2ab8653bdd7f8b3b52ef450f6d43a1afcd
Reviewed-on: https://code.wireshark.org/review/19583
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-mpls.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c index 54dc835de5..59e9a206a2 100644 --- a/epan/dissectors/packet-mpls.c +++ b/epan/dissectors/packet-mpls.c @@ -312,12 +312,24 @@ dissect_try_cw_first_nibble( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree switch ( nibble ) { case 6: + /* + * XXX - this could be from an pseudo-wire without a control + * word, with the packet's first nibble being 6. + */ call_dissector(dissector_ipv6, tvb, pinfo, tree); return TRUE; case 4: + /* + * XXX - this could be from an pseudo-wire without a control + * word, with the packet's first nibble being 4. + */ call_dissector(dissector_ip, tvb, pinfo, tree); return TRUE; case 1: + /* + * XXX - this could be from an pseudo-wire without a control + * word, with the packet's first nibble being 1. + */ call_dissector(dissector_pw_ach, tvb, pinfo, tree ); return TRUE; default: @@ -454,30 +466,57 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ next_tvb = tvb_new_subset_remaining(tvb, offset); - /* 1) explicit label-to-dissector binding ? */ + /* + * Is there an explicit label-to-dissector binding? + * If so, use it. + */ found = dissector_try_uint_new(mpls_subdissector_table, label, next_tvb, pinfo, tree, FALSE, &mplsinfo); - if (found) + if (found) { + /* Yes, there is. */ return tvb_captured_length(tvb); + } - /* 2) use the 1st nibble logic (see BCP 4928, RFC 4385 and 5586) */ + /* + * No, there isn't, so use the 1st nibble logic (see BCP 4928, + * RFC 4385 and 5586). + */ switch(first_nibble) { case 4: + /* + * XXX - this could be from an Ethernet pseudo-wire without a + * control word, with the MAC address's first nibble being 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)); break; case 6: + /* + * XXX - this could be from an Ethernet pseudo-wire without a + * control word, with the MAC address's first nibble being 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)); break; case 1: + /* + * XXX - this could be from an Ethernet pseudo-wire without a + * control word, with the MAC address's first nibble being 1. + */ call_dissector(dissector_pw_ach, next_tvb, pinfo, tree); break; case 0: + /* + * If this is an Ethernet pseudo-wire, this could either be + * Ethernet without a control word and with the first nibble + * of the destination MAC address being 0 or it could be + * Ethernet with a control word. Let the "pw_eth_heuristic" + * dissector try to figure it out. + */ call_dissector(dissector_pw_eth_heuristic, next_tvb, pinfo, tree); break; default: |