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>
This commit is contained in:
Guy Harris 2017-01-07 18:32:59 -08:00
parent 2009dcc98d
commit 082ba063ef
1 changed files with 42 additions and 3 deletions

View File

@ -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: