packet-mpls.c:
  - refactor dissect_pw_ach();
  - create/uer value_string_ext as appropriate;
  - use call_dissector() rather than direct dissector call in one cse;

 all:
  - use 'LABEL' prefix for a set of rather generic enum identifiers;
  - fix some cases of calling expert...() or sub-dissectors under 'if(tree)';
  - reformat some hf[] entries;
  - do some whitespace changes.

svn path=/trunk/; revision=45195
This commit is contained in:
Bill Meier 2012-09-28 19:50:49 +00:00
parent da4b39e720
commit 562c890560
12 changed files with 884 additions and 932 deletions

View File

@ -374,7 +374,7 @@ dissect_bfd_authentication(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
void
static void
dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint flags;
@ -564,7 +564,7 @@ dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
proto_item *ti = NULL;
if (tree) {
ti = proto_tree_add_text(bfd_tree, tvb, 24, bfd_length,
ti = proto_tree_add_text(bfd_tree, tvb, 24, bfd_length-24,
"Authentication: Length of the BFD frame is invalid (%d)", bfd_length);
}
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN,

View File

@ -24,7 +24,6 @@
#ifndef PACKET_BFD_H
#define PACKET_BFD_H
void dissect_bfd_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
void dissect_bfd_mep (tvbuff_t *tvb, proto_tree *tree);
#endif

View File

@ -12,8 +12,8 @@
* Krishnamurthy Mayya <krishnamurthy.mayya@ipinfusion.com>
* Nikitha Malgi <malgi.nikitha@ipinfusion.com>
* - Support for LSP Ping extensions as per RFC 6426
* Mayuresh Raut <msraut@ncsu.edu>
* - Support for LSP ping over MPLS as per RFC 6424
* Mayuresh Raut <msraut@ncsu.edu>
* - Support for LSP ping over MPLS as per RFC 6424
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib.h>
@ -220,22 +220,22 @@ static const value_string mpls_echo_replymode[] = {
/* http://www.iana.org/assignments/mpls-lsp-ping-parameters/mpls-lsp-ping-parameters.xml */
static const value_string mpls_echo_returncode[] = {
{0, "No return code"},
{1, "Malformed echo request received"},
{2, "One or more of the TLVs was not understood"},
{3, "Replying router is an egress for the FEC at stack depth RSC"},
{4, "Replying router has no mapping for the FEC at stack depth RSC"},
{5, "Downstream Mapping Mismatch"}, /*[RFC4379] */
{6, "Upstream Interface Index Unknown"}, /*[RFC4379]*/
{7, "Reserved"},
{8, "Label switched at stack-depth RSC"},
{9, "Label switched but no MPLS forwarding at stack-depth RSC"},
{ 0, "No return code"},
{ 1, "Malformed echo request received"},
{ 2, "One or more of the TLVs was not understood"},
{ 3, "Replying router is an egress for the FEC at stack depth RSC"},
{ 4, "Replying router has no mapping for the FEC at stack depth RSC"},
{ 5, "Downstream Mapping Mismatch"}, /*[RFC4379] */
{ 6, "Upstream Interface Index Unknown"}, /*[RFC4379]*/
{ 7, "Reserved"},
{ 8, "Label switched at stack-depth RSC"},
{ 9, "Label switched but no MPLS forwarding at stack-depth RSC"},
{10, "Mapping for this FEC is not the given label at stack depth RSC"},
{11, "No label entry at stack-depth RSC"},
{12, "Protocol not associated with interface at FEC stack depth RSC"},
{13, "Premature termination, label stack shrinking to a single label"},
{14, "See DDM TLV for meaning of Return Code and Return SubCode"}, /* [RFC6424] */
{15, "Label switched with FEC change"}, /* [RFC6424] */
{14, "See DDM TLV for meaning of Return Code and Return SubCode"}, /* [RFC6424] */
{15, "Label switched with FEC change"}, /* [RFC6424] */
/* 16-251 Unassigned */
/* 252-255 Reserved for Vendor private use [RFC4379 */
{0, NULL}
@ -266,7 +266,7 @@ static const value_string mpls_echo_returncode[] = {
static const value_string mpls_echo_tlv_type_names[] = {
{ TLV_TARGET_FEC_STACK, "Target FEC Stack" },
{ TLV_DOWNSTREAM_MAPPING, "Downstream Mapping" },
{ TLV_DETAILED_DOWNSTREAM, "Detailed Downstream Mapping"},
{ TLV_DETAILED_DOWNSTREAM, "Detailed Downstream Mapping"},
{ TLV_PAD, "Pad" },
{ TLV_ERROR_CODE, "Error Code" },
{ TLV_VENDOR_CODE, "Vendor Enterprise Code" },
@ -336,10 +336,10 @@ static const value_string mpls_echo_tlv_fec_names[] = {
#define TLV_FEC_STACK_CHANGE 3
static const value_string mpls_echo_subtlv_names[] = {
{ TLV_FEC_MULTIPATH_DATA, "Multipath data"},
{ TLV_FEC_LABEL_STACK, "Label stack"},
{ TLV_FEC_STACK_CHANGE, "FEC stack change"},
{ 0, NULL}
{ TLV_FEC_MULTIPATH_DATA, "Multipath data"},
{ TLV_FEC_LABEL_STACK, "Label stack"},
{ TLV_FEC_STACK_CHANGE, "FEC stack change"},
{ 0, NULL}
};
/* [RFC 6424] */
@ -350,12 +350,12 @@ static const value_string mpls_echo_subtlv_names[] = {
#define TLV_MULTIPATH_BIT_MASKED_LABEL_SET 9
static const value_string mpls_echo_multipathtlv_type[] = {
{ TLV_MULTIPATH_NO_MULTIPATH, "Empty (Multipath Length = 0)"},
{ TLV_MULTIPATH_IP_ADDRESS, "IP addresses"},
{ TLV_MULTIPATH_IP_ADDRESS_RANGE, "low/high address pairs"},
{ TLV_MULTIPATH_BIT_MASKED_IP, "IP address prefix and bit mask"},
{ TLV_MULTIPATH_BIT_MASKED_LABEL_SET, "Label prefix and bit mask"},
{ 0, NULL}
{ TLV_MULTIPATH_NO_MULTIPATH, "Empty (Multipath Length = 0)"},
{ TLV_MULTIPATH_IP_ADDRESS, "IP addresses"},
{ TLV_MULTIPATH_IP_ADDRESS_RANGE, "low/high address pairs"},
{ TLV_MULTIPATH_BIT_MASKED_IP, "IP address prefix and bit mask"},
{ TLV_MULTIPATH_BIT_MASKED_LABEL_SET, "Label prefix and bit mask"},
{ 0, NULL}
};
/* [RFC 6424] */
@ -363,9 +363,9 @@ static const value_string mpls_echo_multipathtlv_type[] = {
#define SUB_TLV_FEC_POP 2
const value_string mpls_echo_subtlv_op_types[] = {
{ SUB_TLV_FEC_PUSH, "Push"},
{ SUB_TLV_FEC_POP, "Pop"},
{ 0, NULL}
{ SUB_TLV_FEC_PUSH, "Push"},
{ SUB_TLV_FEC_POP, "Pop"},
{ 0, NULL}
};
/* [RFC 6424] */
@ -374,10 +374,10 @@ const value_string mpls_echo_subtlv_op_types[] = {
#define SUB_TLV_FEC_IPV6 2
const value_string mpls_echo_subtlv_addr_types[] = {
{ SUB_TLV_FEC_UNSPECIFIED, "Unspecified"},
{ SUB_TLV_FEC_IPV4, "IPv4"},
{ SUB_TLV_FEC_IPV6, "IPv6"},
{ 0, NULL}
{ SUB_TLV_FEC_UNSPECIFIED, "Unspecified"},
{ SUB_TLV_FEC_IPV4, "IPv4"},
{ SUB_TLV_FEC_IPV6, "IPv6"},
{ 0, NULL}
};
static const value_string mpls_echo_tlv_pad[] = {
@ -618,7 +618,7 @@ dissect_mpls_echo_tlv_fec(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem
nil_length = length;
while (nil_length >= 4) {
decode_mpls_label(tvb, offset + 4, &label, &exp, &bos, &ttl);
if (label <= LABEL_MAX_RESERVED) {
if (label <= MPLS_LABEL_MAX_RESERVED) {
proto_tree_add_uint_format(tlv_fec_tree, hf_mpls_echo_tlv_fec_nil_label,
tvb, offset + 4, 3, label, "Label %u: %u (%s)", nil_idx, label,
val_to_str_const(label, special_labels, "Reserved - Unknown"));
@ -707,7 +707,7 @@ dissect_mpls_echo_tlv_fec(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem
static void
dissect_mpls_echo_tlv_ds_map(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
{
proto_tree *ti = NULL, *tlv_ds_map_tree = NULL;
proto_tree *ti = NULL, *tlv_ds_map_tree = NULL;
guint16 mplen, idx = 1;
guint32 label;
guint8 exp, bos, proto;
@ -848,7 +848,7 @@ dissect_mpls_echo_tlv_ds_map(tvbuff_t *tvb, guint offset, proto_tree *tree, int
idx);
tlv_ds_map_tree = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ds_map);
proto_item_append_text(ti, ", Label: %u", label);
if (label <= LABEL_MAX_RESERVED) {
if (label <= MPLS_LABEL_MAX_RESERVED) {
proto_tree_add_uint_format(tlv_ds_map_tree, hf_mpls_echo_tlv_ds_map_mp_label,
tvb, offset, 3, label, "Downstream Label: %u (%s)", label,
val_to_str_const(label, special_labels, "Reserved - Unknown"));
@ -877,250 +877,250 @@ dissect_mpls_echo_tlv_ds_map(tvbuff_t *tvb, guint offset, proto_tree *tree, int
static void
dissect_mpls_echo_tlv_dd_map(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem)
{
proto_tree *ddti = NULL, *tlv_dd_map_tree = NULL, *tlv_ddstlv_map_tree = NULL;
proto_tree *ddsti = NULL, *ddsti2 = NULL;
guint16 subtlv_length, subtlv_type, multipath_length;
guint8 addr_type, multipath_type, address_type, fec_tlv_length;
guint16 idx = 1;
guint32 label;
guint8 tc, s_bit, proto;
proto_tree *ddti, *tlv_dd_map_tree, *tlv_ddstlv_map_tree = NULL;
proto_tree *ddsti = NULL, *ddsti2 = NULL;
guint16 subtlv_length, subtlv_type, multipath_length;
guint8 addr_type, multipath_type, address_type, fec_tlv_length;
guint16 idx = 1;
guint32 label;
guint8 tc, s_bit, proto;
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_mtu, tvb,
offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_addr_type, tvb,
offset + 2, 1, ENC_BIG_ENDIAN);
ddti = proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_res, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
tlv_dd_map_tree = proto_item_add_subtree(ddti, ett_mpls_echo_tlv_dd_map);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_mtu, tvb,
offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_addr_type, tvb,
offset + 2, 1, ENC_BIG_ENDIAN);
ddti = proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_res, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
tlv_dd_map_tree = proto_item_add_subtree(ddti, ett_mpls_echo_tlv_dd_map);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_flag_res, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_flag_i, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_flag_n, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_flag_res, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_flag_i, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_flag_n, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
addr_type = tvb_get_guint8(tvb, offset + 2);
switch(addr_type){
case TLV_ADDR_IPv4:
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_ds_ip, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_int_ip, tvb,
offset + 8, 4, ENC_BIG_ENDIAN);
break;
case TLV_ADDR_IPv6:
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_ds_ipv6, tvb,
offset + 4, 16, ENC_NA);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_int_ipv6, tvb,
offset + 20, 16, ENC_NA);
rem -= 24;
offset += 24;
addr_type = tvb_get_guint8(tvb, offset + 2);
switch(addr_type){
case TLV_ADDR_IPv4:
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_ds_ip, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_int_ip, tvb,
offset + 8, 4, ENC_BIG_ENDIAN);
break;
case TLV_ADDR_IPv6:
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_ds_ipv6, tvb,
offset + 4, 16, ENC_NA);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_int_ipv6, tvb,
offset + 20, 16, ENC_NA);
rem -= 24;
offset += 24;
break;
case TLV_ADDR_NONIP :
proto_tree_add_item (tree, hf_mpls_echo_tlv_dd_map_ingress_if_num, tvb,
(offset + 4), 4, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_mpls_echo_tlv_dd_map_egress_if_num, tvb,
(offset + 8), 4, ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_text(tree, tvb, offset + 4, 8,
"Error processing TLV: Unknown Address Type of %u",
addr_type);
break;
}
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_return_code, tvb,
offset + 12, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_return_subcode, tvb,
offset + 13, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_subtlv_len, tvb,
offset + 14, 2, ENC_BIG_ENDIAN);
/* Get the Sub-tlv Type and Length */
subtlv_type = tvb_get_ntohs(tvb, offset + 16);
subtlv_length = tvb_get_ntohs(tvb, offset + 18);
rem -= 20;
offset += 20;
if (rem < subtlv_length){
proto_tree_add_text(tree, tvb, offset, rem,
"Error processing TLV: Sub-tlv length is %d and reminder is %u",
subtlv_length, rem);
return;
}
while(rem > 4) {
switch(subtlv_type) {
case TLV_FEC_MULTIPATH_DATA:
multipath_type = tvb_get_guint8(tvb, offset);
multipath_length = tvb_get_ntohs(tvb, offset + 1);
ddsti = proto_tree_add_text(tree, tvb, offset - 4, multipath_length + 8,
"Multipath sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
switch(multipath_type) {
case TLV_MULTIPATH_NO_MULTIPATH:
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_type, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Empty (Multipath Length = 0)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
proto_tree_add_item(tlv_ddstlv_map_tree,
hf_mpls_echo_sub_tlv_multipath_info, tvb, offset + 4, multipath_length, ENC_BIG_ENDIAN);
break;
case TLV_ADDR_NONIP :
proto_tree_add_item (tree, hf_mpls_echo_tlv_dd_map_ingress_if_num, tvb,
(offset + 4), 4, ENC_BIG_ENDIAN);
proto_tree_add_item (tree, hf_mpls_echo_tlv_dd_map_egress_if_num, tvb,
(offset + 8), 4, ENC_BIG_ENDIAN);
case TLV_MULTIPATH_IP_ADDRESS:
if(multipath_length != 4) {
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, multipath_length,
"Multi Path length is %u and should be 4", multipath_length);
break;
}
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Multipath Information (IP addresses)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_multipath_ip, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
break;
default:
proto_tree_add_text(tree, tvb, offset + 4, 8,
"Error processing TLV: Unknown Address Type of %u",
addr_type);
break;
}
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_return_code, tvb,
offset + 12, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_return_subcode, tvb,
offset + 13, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_mpls_echo_tlv_dd_map_subtlv_len, tvb,
offset + 14, 2, ENC_BIG_ENDIAN);
/* Get the Sub-tlv Type and Length */
subtlv_type = tvb_get_ntohs(tvb, offset + 16);
subtlv_length = tvb_get_ntohs(tvb, offset + 18);
case TLV_MULTIPATH_IP_ADDRESS_RANGE:
if(multipath_length != 8) {
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, multipath_length,
"Multi Path length is %u and should be 8", multipath_length);
break;
}
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
rem -= 20;
offset += 20;
if (rem < subtlv_length){
proto_tree_add_text(tree, tvb, offset, rem,
"Error processing TLV: Sub-tlv length is %d and reminder is %u",
subtlv_length, rem);
return;
}
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Multipath Information (low/high address pairs)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
while(rem > 4) {
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_mp_ip_low, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_mp_ip_high, tvb,
offset + 8, 4, ENC_BIG_ENDIAN);
break;
switch(subtlv_type) {
case TLV_FEC_MULTIPATH_DATA:
multipath_type = tvb_get_guint8(tvb, offset);
multipath_length = tvb_get_ntohs(tvb, offset + 1);
ddsti = proto_tree_add_text(tree, tvb, offset - 4, multipath_length + 8,
"Multipath sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
case TLV_MULTIPATH_BIT_MASKED_IP:
if(multipath_length < 4) {
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, multipath_length,
"Multi Path length is %u and should be >= 4", multipath_length);
break;
}
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
switch(multipath_type) {
case TLV_MULTIPATH_NO_MULTIPATH:
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_type, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Empty (Multipath Length = 0)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
proto_tree_add_item(tlv_ddstlv_map_tree,
hf_mpls_echo_sub_tlv_multipath_info, tvb, offset + 4, multipath_length, ENC_BIG_ENDIAN);
break;
case TLV_MULTIPATH_IP_ADDRESS:
if(multipath_length != 4) {
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, multipath_length,
"Multi Path length is %u and should be 4", multipath_length);
break;
}
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Multipath Information (IP addresses)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Multipath Information (IP address prefix and bit mask)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_multipath_ip, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
break;
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_multipath_ip, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
if(multipath_length > 4)
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_mp_mask, tvb, offset + 8, multipath_length - 4, ENC_NA);
break;
case TLV_MULTIPATH_IP_ADDRESS_RANGE:
if(multipath_length != 8) {
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, multipath_length,
"Multi Path length is %u and should be 8", multipath_length);
break;
}
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
case TLV_MULTIPATH_BIT_MASKED_LABEL_SET:
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, 1,
"Multipath Information (Label prefix and bit mask)");
break;
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Multipath Information (low/high address pairs)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
default:
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, 1,
"Multipath Type not identified (%u)", multipath_type);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_value, tvb,
offset + 3, rem, ENC_BIG_ENDIAN);
break;
}
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_mp_ip_low, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_mp_ip_high, tvb,
offset + 8, 4, ENC_BIG_ENDIAN);
break;
rem -= (multipath_length + 4);
break;
case TLV_MULTIPATH_BIT_MASKED_IP:
if(multipath_length < 4) {
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, multipath_length,
"Multi Path length is %u and should be >= 4", multipath_length);
break;
}
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_resv, tvb,
offset + 3, 1, ENC_BIG_ENDIAN);
case TLV_FEC_LABEL_STACK:
ddsti = proto_tree_add_text(tree, tvb, offset - 4, subtlv_length + 4, "Label stack sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
ddsti2 = proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, multipath_length, "Multipath Information (IP address prefix and bit mask)");
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
while (rem >= 4) {
decode_mpls_label(tvb, offset, &label, &tc, &s_bit, &proto);
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_multipath_ip, tvb,
offset + 4, 4, ENC_BIG_ENDIAN);
if(multipath_length > 4)
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_sub_tlv_mp_mask, tvb, offset + 8, multipath_length - 4, ENC_NA);
break;
ddsti2 = proto_tree_add_text(tlv_dd_map_tree,
tvb, offset, 4, "Downstream Label Element %u", idx);
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
proto_item_append_text(ddsti2, ", Label: %u , Protocol: %u", label, proto);
proto_tree_add_text(tlv_ddstlv_map_tree, tvb, offset, 3, "Label: %u", label);
proto_tree_add_text(tlv_ddstlv_map_tree, tvb, offset + 2, 1, "Traffic Class: %u", tc);
proto_tree_add_text(tlv_ddstlv_map_tree, tvb, offset + 2, 1, "S bit: %u", s_bit);
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_tlv_ddstlv_map_mp_proto,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
case TLV_MULTIPATH_BIT_MASKED_LABEL_SET:
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, 1,
"Multipath Information (Label prefix and bit mask)");
break;
rem -= 4;
offset += 4;
idx++;
}
break;
default:
proto_tree_add_text(tlv_dd_map_tree, tvb, offset, 1,
"Multipath Type not identified (%u)", multipath_type);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_type, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree,
hf_mpls_echo_sub_tlv_multipath_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_multipath_value, tvb,
offset + 3, rem, ENC_BIG_ENDIAN);
break;
}
case TLV_FEC_STACK_CHANGE:
address_type = tvb_get_guint8(tvb, offset + 1);
fec_tlv_length = tvb_get_guint8(tvb, offset + 2);
ddsti = proto_tree_add_text(tree, tvb, offset - 4, fec_tlv_length + 12, "Stack change sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
rem -= (multipath_length + 4);
break;
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_op_type, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_addr_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_fec_tlv_value, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_res, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
switch(address_type) {
case SUB_TLV_FEC_UNSPECIFIED:
proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, 0, "Unspecified (Address Length = 0)");
rem += 4;
offset -= 4;
break;
case SUB_TLV_FEC_IPV4:
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_remote_peer_ip, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
break;
case SUB_TLV_FEC_IPV6:
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_remore_peer_ipv6, tvb, offset + 4, 16, ENC_NA);
rem -= 12;
offset += 12;
break;
}
case TLV_FEC_LABEL_STACK:
ddsti = proto_tree_add_text(tree, tvb, offset - 4, subtlv_length + 4, "Label stack sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
while (rem >= 4) {
decode_mpls_label(tvb, offset, &label, &tc, &s_bit, &proto);
ddsti2 = proto_tree_add_text(tlv_dd_map_tree,
tvb, offset, 4, "Downstream Label Element %u", idx);
tlv_ddstlv_map_tree = proto_item_add_subtree(ddsti2, ett_mpls_echo_tlv_ddstlv_map);
proto_item_append_text(ddsti2, ", Label: %u , Protocol: %u", label, proto);
proto_tree_add_text( tlv_ddstlv_map_tree, tvb, offset, 3, "Label: %u", label);
proto_tree_add_text(tlv_ddstlv_map_tree, tvb, offset + 2, 1, "Traffic Class: %u", tc);
proto_tree_add_text(tlv_ddstlv_map_tree, tvb, offset + 2, 1, "S bit: %u", s_bit);
proto_tree_add_item(tlv_ddstlv_map_tree, hf_mpls_echo_tlv_ddstlv_map_mp_proto,
tvb, offset + 3, 1, ENC_BIG_ENDIAN);
rem -= 4;
offset += 4;
idx++;
}
break;
offset -= 8;
dissect_mpls_echo_tlv_fec(tvb, offset, tlv_dd_map_tree, fec_tlv_length);
case TLV_FEC_STACK_CHANGE:
address_type = tvb_get_guint8(tvb, offset + 1);
fec_tlv_length = tvb_get_guint8(tvb, offset + 2);
ddsti = proto_tree_add_text(tree, tvb, offset - 4, fec_tlv_length + 12, "Stack change sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
rem -= (fec_tlv_length + 8);
break;
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_op_type, tvb, offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_addr_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_fec_tlv_value, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_res, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
switch(address_type) {
case SUB_TLV_FEC_UNSPECIFIED:
proto_tree_add_text(tlv_dd_map_tree, tvb, offset + 4, 0, "Unspecified (Address Length = 0)");
rem += 4;
offset -= 4;
break;
case SUB_TLV_FEC_IPV4:
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_remote_peer_ip, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
break;
case SUB_TLV_FEC_IPV6:
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_sub_tlv_remore_peer_ipv6, tvb, offset + 4, 16, ENC_NA);
rem -= 12;
offset += 12;
break;
}
offset -= 8;
dissect_mpls_echo_tlv_fec(tvb, offset, tlv_dd_map_tree, fec_tlv_length);
rem -= (fec_tlv_length + 8);
break;
default:
ddsti = proto_tree_add_text(tree, tvb, offset, subtlv_length, "Error processing sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_type, tvb, offset - 4, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_length, tvb, offset - 2, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_value, tvb, offset, subtlv_length, ENC_BIG_ENDIAN);
rem -= subtlv_length;
break;
}
}
default:
ddsti = proto_tree_add_text(tree, tvb, offset, subtlv_length, "Error processing sub-TLV");
tlv_dd_map_tree = proto_item_add_subtree(ddsti, ett_mpls_echo_tlv_dd_map);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_type, tvb, offset - 4, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_length, tvb, offset - 2, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(tlv_dd_map_tree, hf_mpls_echo_tlv_dd_map_value, tvb, offset, subtlv_length, ENC_BIG_ENDIAN);
rem -= subtlv_length;
break;
}
}
}
/*
@ -1189,7 +1189,7 @@ dissect_mpls_echo_tlv_ilso(tvbuff_t *tvb, guint offset, proto_tree *tree, int re
idx);
tlv_ilso = proto_item_add_subtree(ti, ett_mpls_echo_tlv_ilso);
proto_item_append_text(ti, ", Label: %u", label);
if (label <= LABEL_MAX_RESERVED) {
if (label <= MPLS_LABEL_MAX_RESERVED) {
proto_tree_add_uint_format(tlv_ilso, hf_mpls_echo_tlv_ilso_label,
tvb, offset, 3, label, "Label: %u (%s)", label,
val_to_str_const(label, special_labels, "Reserved - Unknown"));
@ -1251,10 +1251,10 @@ dissect_mpls_echo_tlv(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, gb
rem);
return rem;
}
type = tvb_get_ntohs(tvb, offset);
length = tvb_get_ntohs(tvb, offset + 2),
rem -= 4; /* do not count Type Length */
length = MIN(length, rem);
type = tvb_get_ntohs(tvb, offset);
length = tvb_get_ntohs(tvb, offset + 2);
rem -= 4; /* do not count Type Length */
length = MIN(length, rem);
if (tree) {
/* Check for Vendor Private TLVs */
@ -1358,15 +1358,15 @@ dissect_mpls_echo_tlv(tvbuff_t *tvb, guint offset, proto_tree *tree, int rem, gb
}
dissect_mpls_echo_tlv_ds_map(tvb, offset + 4, mpls_echo_tlv_tree, length);
break;
case TLV_DETAILED_DOWNSTREAM: /* [RFC 6424] */
if(length < 16) {
proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length,
"Error processing TLV: length is %d, should be >= 16",
length);
break;
}
dissect_mpls_echo_tlv_dd_map(tvb, offset + 4, mpls_echo_tlv_tree, length);
break;
case TLV_DETAILED_DOWNSTREAM: /* [RFC 6424] */
if(length < 16) {
proto_tree_add_text(mpls_echo_tlv_tree, tvb, offset + 4, length,
"Error processing TLV: length is %d, should be >= 16",
length);
break;
}
dissect_mpls_echo_tlv_dd_map(tvb, offset + 4, mpls_echo_tlv_tree, length);
break;
case TLV_ERRORED_TLV:
if (in_errored)
proto_tree_add_item(mpls_echo_tlv_tree, hf_mpls_echo_tlv_value, tvb,
@ -1509,17 +1509,17 @@ dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (MSGTYPE_MPLS_ECHO(msgtype)) {
offset += 32;
rem -= 32;
rem -= 32;
} else {
offset += 16;
rem -= 16;
rem -= 16;
}
/* Dissect all TLVs */
while(tvb_reported_length_remaining(tvb, offset) > 0 ) {
len = dissect_mpls_echo_tlv(tvb, offset, mpls_echo_tree, rem, FALSE);
offset += len;
rem -= len;
rem -= len;
}
}
@ -1963,159 +1963,159 @@ proto_register_mpls_echo(void)
},
{ &hf_mpls_echo_lspping_tlv_pw_agi_type,
{ "AGI TYPE", "mpls_echo.lspping.tlv.pw.agi.type",
FT_UINT8, BASE_DEC,NULL,0x0, "PW AGI TYPE",HFILL}
FT_UINT8, BASE_DEC, NULL, 0x0, "PW AGI TYPE", HFILL}
},
{ &hf_mpls_echo_lspping_tlv_pw_agi_len,
{ "AGI Length", "mpls_echo.lspping.tlv.pw.agi.len",
FT_UINT8, BASE_DEC,NULL,0x0, "PW AGI LENGTH",HFILL}
FT_UINT8, BASE_DEC, NULL, 0x0, "PW AGI LENGTH", HFILL}
},
{ &hf_mpls_echo_lspping_tlv_pw_agi_val,
{ "AGI VALUE", "mpls_echo.lspping.tlv.pw.agi.val",
FT_STRING, BASE_NONE,NULL,0x0, "PW AGI VALUE",HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_mtu,
{ "MTU", "mpls_echo.lspping.tlv.dd_map.mtu",
FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map MTU", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_addr_type,
{ "Address Type", "mpls_echo.tlv.dd_map.addr_type",
FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_addr_type), 0x0, "MPLS ECHO TLV Detailed Downstream Map Address Type", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_res,
{ "DS Flags", "mpls_echo.tlv.dd_map.res",
FT_UINT8, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map DS Flags", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_flag_res,
{ "MBZ", "mpls_echo.tlv.dd_map.flag_res",
FT_UINT8, BASE_HEX, NULL, 0xFC, "MPLS ECHO TLV Detailed Downstream Map Reserved Flags", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_flag_i,
{ "Interface and Label Stack Request", "mpls_echo.tlv.dd_map.flag_i",
FT_BOOLEAN, 8, NULL, 0x02, "MPLS ECHO TLV Detailed Downstream Map I-Flag", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_flag_n,
{ "Treat as Non-IP Packet", "mpls_echo.tlv.dd_map.flag_n",
FT_BOOLEAN, 8, NULL, 0x01, "MPLS ECHO TLV Detailed Downstream Map N-Flag", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_ds_ip,
{ "Downstream IP Address", "mpls_echo.tlv.dd_map.ds_ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map IP Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_int_ip,
{ "Downstream Interface Address", "mpls_echo.tlv.dd_map.int_ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Interface Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_ds_ipv6,
{ "Downstream IPv6 Address", "mpls_echo.tlv.dd_map.ds_ipv6",
FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map IPv6 Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_int_ipv6,
{ "Downstream Interface IPv6 Address", "mpls_echo.tlv.dd_map.int_ipv6",
FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Interface IPv6 Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_return_code,
{ "Return Code", "mpls_echo.tlv.dd_map.return_code",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Return Code", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_return_subcode,
{ "Return Subcode", "mpls_echo.tlv.dd_map.return_subcode",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Return Subcode", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_subtlv_len,
{ "Subtlv Length", "mpls_echo.tlv.dd_map.subtlv_len",
FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Subtlv Length", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_type,
{ "Multipath Type", "mpls_echo.subtlv.dd_map.multipath_type",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Multipath Type", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_length,
{ "Multipath Length", "mpls_echo.subtlv.dd_map.multipath_length",
FT_UINT16, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Multipath Length", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_value,
{ "Multipath Value", "mpls_echo.subtlv.dd_map.multipath_value",
FT_BYTES, BASE_NONE, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Multipath Value", HFILL}
},
{ &hf_mpls_echo_sub_tlv_resv,
{ "Reserved", "mpls_echo.subtlv.dd_map.reserved",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Reserved Bits", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_info,
{ "Multipath Information", "mpls_echo.subtlv.dd_map.multipath_info",
FT_BYTES, BASE_NONE, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Value", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_label,
{ "Downstream Label", "mpls_echo.tlv.ddstlv_map.mp_label",
FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV Detailed Downstream Map Downstream Label", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_proto,
{ "Downstream Protocol", "mpls_echo.tlv.ddstlv_map.mp_proto",
FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_ds_map_mp_proto), 0x0,
"MPLS ECHO TLV Detailed Downstream Map Downstream Protocol", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_exp,
{ "Downstream Experimental", "mpls_echo.tlv.ddstlv_map.mp_exp",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Downstream Experimental", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_bos,
{ "Downstream BOS", "mpls_echo.tlv.ddstlv_map.mp_bos",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Downstream BOS", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_ip,
{ "IP Address", "mpls_echo.tlv.ddstlv_map_mp.ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_mp_ip_low,
{ "IP Address Low", "mpls_echo.tlv.ddstlv_map_mp.ip_low",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath Low IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_mp_ip_high,
{ "IP Address High", "mpls_echo.tlv.ddstlv_map_mp.ip_high",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath High IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_mp_mask,
{ "Mask", "mpls_echo.tlv.ddstlv_map_mp.mask",
FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath Mask", HFILL}
},
{ &hf_mpls_echo_sub_tlv_op_type,
{ "Operation Type", "mpls_echo.tlv.ddstlv_map.op_type",
FT_UINT8, BASE_DEC, VALS(mpls_echo_subtlv_op_types), 0x0,
"MPLS ECHO TLV Detailed Downstream Map Stack Change Operation Type", HFILL}
},
{ &hf_mpls_echo_sub_tlv_addr_type,
{ "Address Type", "mpls_echo.tlv.ddstlv_map.address_type",
FT_UINT8, BASE_DEC, VALS(mpls_echo_subtlv_addr_types), 0x0,
"MPLS ECHO TLV Detailed Downstream Map Stack Change Address Type", HFILL}
},
{ &hf_mpls_echo_sub_tlv_fec_tlv_value,
{ "FEC tlv Length", "mpls_echo.subtlv.dd_map.fec_tlv_type",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Map FEC TLV Length", HFILL}
},
{ &hf_mpls_echo_sub_tlv_res,
{ "Reserved", "mpls_echo.subtlv.dd_map.reserved",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Map FEC Stack Change Reserved Bits", HFILL}
},
{ &hf_mpls_echo_sub_tlv_remote_peer_ip,
{ "Remote Peer IP Address", "mpls_echo.tlv.dd_map.remote_ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "Detailed Downstream Map FEC Stack Change Remote Peer IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_remore_peer_ipv6,
{ "Remote Peer IPv6 Address", "mpls_echo.tlv.dd_map.remote_ipv6",
FT_IPv6, BASE_NONE, NULL, 0x0, "Detailed Downstream Map FEC Stack Change Remote Peer IPv6 Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_type,
{ "Sub-TLV Type", "mpls_echo.subtlv.dd_map.type",
FT_UINT16, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Type", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_length,
{ "Sub-TLV Length", "mpls_echo.subtlv.dd_map.length",
FT_UINT16, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Length", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_value,
{ "Sub-TLV Value", "mpls_echo.subtlv.dd_map.value",
FT_BYTES, BASE_NONE, NULL, 0x0, "Detailed Downstream Mapping TLV Value", HFILL}
},
FT_STRING, BASE_NONE, NULL, 0x0, "PW AGI VALUE", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_mtu,
{ "MTU", "mpls_echo.lspping.tlv.dd_map.mtu",
FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map MTU", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_addr_type,
{ "Address Type", "mpls_echo.tlv.dd_map.addr_type",
FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_addr_type), 0x0, "MPLS ECHO TLV Detailed Downstream Map Address Type", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_res,
{ "DS Flags", "mpls_echo.tlv.dd_map.res",
FT_UINT8, BASE_HEX, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map DS Flags", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_flag_res,
{ "MBZ", "mpls_echo.tlv.dd_map.flag_res",
FT_UINT8, BASE_HEX, NULL, 0xFC, "MPLS ECHO TLV Detailed Downstream Map Reserved Flags", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_flag_i,
{ "Interface and Label Stack Request", "mpls_echo.tlv.dd_map.flag_i",
FT_BOOLEAN, 8, NULL, 0x02, "MPLS ECHO TLV Detailed Downstream Map I-Flag", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_flag_n,
{ "Treat as Non-IP Packet", "mpls_echo.tlv.dd_map.flag_n",
FT_BOOLEAN, 8, NULL, 0x01, "MPLS ECHO TLV Detailed Downstream Map N-Flag", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_ds_ip,
{ "Downstream IP Address", "mpls_echo.tlv.dd_map.ds_ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map IP Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_int_ip,
{ "Downstream Interface Address", "mpls_echo.tlv.dd_map.int_ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Interface Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_ds_ipv6,
{ "Downstream IPv6 Address", "mpls_echo.tlv.dd_map.ds_ipv6",
FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map IPv6 Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_int_ipv6,
{ "Downstream Interface IPv6 Address", "mpls_echo.tlv.dd_map.int_ipv6",
FT_IPv6, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Interface IPv6 Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_return_code,
{ "Return Code", "mpls_echo.tlv.dd_map.return_code",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Return Code", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_return_subcode,
{ "Return Subcode", "mpls_echo.tlv.dd_map.return_subcode",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Return Subcode", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_subtlv_len,
{ "Subtlv Length", "mpls_echo.tlv.dd_map.subtlv_len",
FT_UINT16, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Subtlv Length", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_type,
{ "Multipath Type", "mpls_echo.subtlv.dd_map.multipath_type",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Multipath Type", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_length,
{ "Multipath Length", "mpls_echo.subtlv.dd_map.multipath_length",
FT_UINT16, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Multipath Length", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_value,
{ "Multipath Value", "mpls_echo.subtlv.dd_map.multipath_value",
FT_BYTES, BASE_NONE, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Multipath Value", HFILL}
},
{ &hf_mpls_echo_sub_tlv_resv,
{ "Reserved", "mpls_echo.subtlv.dd_map.reserved",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Reserved Bits", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_info,
{ "Multipath Information", "mpls_echo.subtlv.dd_map.multipath_info",
FT_BYTES, BASE_NONE, NULL, 0x0, "Detailed Downstream Mapping TLV Multipath Data Sub-TLV Value", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_label,
{ "Downstream Label", "mpls_echo.tlv.ddstlv_map.mp_label",
FT_UINT24, BASE_DEC, VALS(special_labels), 0x0, "MPLS ECHO TLV Detailed Downstream Map Downstream Label", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_proto,
{ "Downstream Protocol", "mpls_echo.tlv.ddstlv_map.mp_proto",
FT_UINT8, BASE_DEC, VALS(mpls_echo_tlv_ds_map_mp_proto), 0x0,
"MPLS ECHO TLV Detailed Downstream Map Downstream Protocol", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_exp,
{ "Downstream Experimental", "mpls_echo.tlv.ddstlv_map.mp_exp",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Downstream Experimental", HFILL}
},
{ &hf_mpls_echo_tlv_ddstlv_map_mp_bos,
{ "Downstream BOS", "mpls_echo.tlv.ddstlv_map.mp_bos",
FT_UINT8, BASE_DEC, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Downstream BOS", HFILL}
},
{ &hf_mpls_echo_sub_tlv_multipath_ip,
{ "IP Address", "mpls_echo.tlv.ddstlv_map_mp.ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_mp_ip_low,
{ "IP Address Low", "mpls_echo.tlv.ddstlv_map_mp.ip_low",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath Low IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_mp_ip_high,
{ "IP Address High", "mpls_echo.tlv.ddstlv_map_mp.ip_high",
FT_IPv4, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath High IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_mp_mask,
{ "Mask", "mpls_echo.tlv.ddstlv_map_mp.mask",
FT_BYTES, BASE_NONE, NULL, 0x0, "MPLS ECHO TLV Detailed Downstream Map Multipath Mask", HFILL}
},
{ &hf_mpls_echo_sub_tlv_op_type,
{ "Operation Type", "mpls_echo.tlv.ddstlv_map.op_type",
FT_UINT8, BASE_DEC, VALS(mpls_echo_subtlv_op_types), 0x0,
"MPLS ECHO TLV Detailed Downstream Map Stack Change Operation Type", HFILL}
},
{ &hf_mpls_echo_sub_tlv_addr_type,
{ "Address Type", "mpls_echo.tlv.ddstlv_map.address_type",
FT_UINT8, BASE_DEC, VALS(mpls_echo_subtlv_addr_types), 0x0,
"MPLS ECHO TLV Detailed Downstream Map Stack Change Address Type", HFILL}
},
{ &hf_mpls_echo_sub_tlv_fec_tlv_value,
{ "FEC tlv Length", "mpls_echo.subtlv.dd_map.fec_tlv_type",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Map FEC TLV Length", HFILL}
},
{ &hf_mpls_echo_sub_tlv_res,
{ "Reserved", "mpls_echo.subtlv.dd_map.reserved",
FT_UINT8, BASE_DEC, NULL, 0x0, "Detailed Downstream Map FEC Stack Change Reserved Bits", HFILL}
},
{ &hf_mpls_echo_sub_tlv_remote_peer_ip,
{ "Remote Peer IP Address", "mpls_echo.tlv.dd_map.remote_ip",
FT_IPv4, BASE_NONE, NULL, 0x0, "Detailed Downstream Map FEC Stack Change Remote Peer IP Address", HFILL}
},
{ &hf_mpls_echo_sub_tlv_remore_peer_ipv6,
{ "Remote Peer IPv6 Address", "mpls_echo.tlv.dd_map.remote_ipv6",
FT_IPv6, BASE_NONE, NULL, 0x0, "Detailed Downstream Map FEC Stack Change Remote Peer IPv6 Address", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_type,
{ "Sub-TLV Type", "mpls_echo.subtlv.dd_map.type",
FT_UINT16, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Type", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_length,
{ "Sub-TLV Length", "mpls_echo.subtlv.dd_map.length",
FT_UINT16, BASE_DEC, NULL, 0x0, "Detailed Downstream Mapping TLV Length", HFILL}
},
{ &hf_mpls_echo_tlv_dd_map_value,
{ "Sub-TLV Value", "mpls_echo.subtlv.dd_map.value",
FT_BYTES, BASE_NONE, NULL, 0x0, "Detailed Downstream Mapping TLV Value", HFILL}
},
};
static gint *ett[] = {
@ -2124,9 +2124,9 @@ proto_register_mpls_echo(void)
&ett_mpls_echo_tlv,
&ett_mpls_echo_tlv_fec,
&ett_mpls_echo_tlv_ds_map,
&ett_mpls_echo_tlv_ilso,
&ett_mpls_echo_tlv_dd_map,
&ett_mpls_echo_tlv_ddstlv_map
&ett_mpls_echo_tlv_ilso,
&ett_mpls_echo_tlv_dd_map,
&ett_mpls_echo_tlv_ddstlv_map
};
module_t *mpls_echo_module;

View File

@ -29,7 +29,7 @@
/*
* FF: NOTES
*
* - this should dissect OAM pdus (identified by the LABEL_OAM_ALERT = 14
* - this should dissect OAM pdus (identified by the MPLS_LABEL_OAM_ALERT = 14
* label) as described in ITU-T Y.1711 and RFC 3429.
*
* - this code used to be (since 2006) in packet-mpls.c ... nobody on this
@ -114,12 +114,14 @@ dissect_mpls_y1711(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
0x00, 0x00, 0x00, 0x00, 0x00 };
functype = tvb_get_guint8(tvb, offset);
col_append_fstr(pinfo->cinfo, COL_INFO, " (Y.1711: %s)",
(functype == 0x01) ? "CV" :
(functype == 0x02) ? "FDI" :
(functype == 0x03) ? "BDI" :
(functype == 0x07) ? "FDD" :
"reserved/unknown");
if (check_col(pinfo->cinfo, COL_INFO)) {
col_append_fstr(pinfo->cinfo, COL_INFO, " (Y.1711: %s)",
(functype == 0x01) ? "CV" :
(functype == 0x02) ? "FDI" :
(functype == 0x03) ? "BDI" :
(functype == 0x07) ? "FDD" :
"reserved/unknown");
}
/* sanity checks */
if (tvb_reported_length(tvb) < 44) {
@ -143,10 +145,10 @@ dissect_mpls_y1711(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
mpls_y1711_tree = proto_item_add_subtree(ti, ett_mpls_y1711);
/* checks for exp, bos and ttl encoding */
if (mplsinfo->label != LABEL_OAM_ALERT)
if (mplsinfo->label != MPLS_LABEL_OAM_ALERT)
proto_tree_add_text(mpls_y1711_tree, tvb, offset - 4, 3,
"Warning: Y.1711 but no OAM alert label (%d) ?!",
LABEL_OAM_ALERT);
MPLS_LABEL_OAM_ALERT);
if (mplsinfo->exp != 0)
proto_tree_add_text(mpls_y1711_tree, tvb, offset - 2, 1,
@ -415,7 +417,7 @@ proto_reg_handoff_mpls_y1711(void)
{
mpls_y1711_handle = find_dissector("mpls_y1711");
dissector_add_uint("mpls.label",
LABEL_OAM_ALERT /* 14 */,
MPLS_LABEL_OAM_ALERT /* 14 */,
mpls_y1711_handle);
data_handle = find_dissector("data");

View File

@ -12,9 +12,9 @@
* - enhanced "what's past last mpls label?" heuristic
*
* (c) Copyright 2011, Shobhank Sharma <ssharma5@ncsu.edu>
* - Removed some mpls preferences which are no longer relevant/needed like
* - Removed some mpls preferences which are no longer relevant/needed like
* decode PWAC payloads as PPP traffic and assume all channel types except
* 0x21 are raw BFD.
* 0x21 are raw BFD.
* - MPLS extension from PW-ACH to MPLS Generic Associated Channel as per RFC 5586
* - Updated Pseudowire Associated Channel Types as per http://www.iana.org/assignments/pwe3-parameters
*
@ -76,15 +76,15 @@ static gint proto_pw_mcw = -1;
static gint ett_mpls = -1;
static gint ett_mpls_pw_ach = -1;
static gint ett_mpls_pw_mcw = -1;
static char PW_ACH[50]="PW Associated Channel Header";
static char PW_ACH[50] = "PW Associated Channel Header";
const value_string special_labels[] = {
{LABEL_IP4_EXPLICIT_NULL, "IPv4 Explicit-Null"},
{LABEL_ROUTER_ALERT, "Router Alert"},
{LABEL_IP6_EXPLICIT_NULL, "IPv6 Explicit-Null"},
{LABEL_IMPLICIT_NULL, "Implicit-Null"},
{LABEL_OAM_ALERT, "OAM Alert"},
{LABEL_GACH, "Generic Associated Channel Label (GAL)"},
{MPLS_LABEL_IP4_EXPLICIT_NULL, "IPv4 Explicit-Null"},
{MPLS_LABEL_ROUTER_ALERT, "Router Alert"},
{MPLS_LABEL_IP6_EXPLICIT_NULL, "IPv6 Explicit-Null"},
{MPLS_LABEL_IMPLICIT_NULL, "Implicit-Null"},
{MPLS_LABEL_OAM_ALERT, "OAM Alert"},
{MPLS_LABEL_GACH, "Generic Associated Channel Label (GAL)"},
{0, NULL }
};
@ -270,6 +270,7 @@ static const value_string mpls_pw_types[] = {
{ 0x001F, "Reserved" },/*[Bryant] 2008-04-17*/
{ 0, NULL }
};
static value_string_ext mpls_pw_types_ext = VALUE_STRING_EXT_INIT(mpls_pw_types);
#endif
/*
@ -305,6 +306,7 @@ static const value_string mpls_pwac_types[] = {
{ 0x7FFF, "Reserved for Experimental Use"},
{ 0, NULL }
};
static value_string_ext mpls_pwac_types_ext = VALUE_STRING_EXT_INIT(mpls_pwac_types);
static dissector_table_t mpls_subdissector_table;
@ -314,9 +316,10 @@ static dissector_table_t mpls_subdissector_table;
* Return the label in "label", EXP bits in "exp",
* bottom_of_stack in "bos", and TTL in "ttl"
*/
void decode_mpls_label(tvbuff_t *tvb, int offset,
guint32 *label, guint8 *exp,
guint8 *bos, guint8 *ttl)
void
decode_mpls_label(tvbuff_t *tvb, int offset,
guint32 *label, guint8 *exp,
guint8 *bos, guint8 *ttl)
{
guint8 octet0 = tvb_get_guint8(tvb, offset+0);
guint8 octet1 = tvb_get_guint8(tvb, offset+1);
@ -334,152 +337,121 @@ void decode_mpls_label(tvbuff_t *tvb, int offset,
static void
dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *mpls_pw_ach_tree = NULL;
proto_item *ti = NULL;
tvbuff_t *next_tvb = NULL;
int offset = 0;
guint8 ver = 0;
guint16 res = 0;
guint16 channel_type = 0;
tvbuff_t *next_tvb;
guint16 channel_type;
if (tvb_reported_length_remaining(tvb, 0) < 4) {
if (tree)
proto_tree_add_text(tree, tvb, 0, -1, "Error processing Message");
proto_tree_add_text(tree, tvb, 0, -1, "Error processing Message");
return;
}
ver = (tvb_get_guint8(tvb, 0) & 0x0F);
res = tvb_get_guint8(tvb, 1);
channel_type = tvb_get_ntohs(tvb, 2);
if (tree) {
proto_tree *mpls_pw_ach_tree;
proto_item *ti;
guint16 res;
ti = proto_tree_add_item(tree, proto_pw_ach, tvb, 0, 4, ENC_NA);
mpls_pw_ach_tree = proto_item_add_subtree(ti, ett_mpls_pw_ach);
if (mpls_pw_ach_tree == NULL)
return;
proto_tree_add_uint_format(mpls_pw_ach_tree, hf_mpls_pw_ach_ver,
tvb, 0, 1, ver, "Version: %d", ver);
ti = proto_tree_add_uint_format(mpls_pw_ach_tree, hf_mpls_pw_ach_res,
tvb, 1, 1, res, "Reserved: 0x%02x", res);
proto_tree_add_item(mpls_pw_ach_tree, hf_mpls_pw_ach_ver,
tvb, 0, 1, ENC_BIG_ENDIAN);
res = tvb_get_guint8(tvb, 1);
ti = proto_tree_add_uint(mpls_pw_ach_tree, hf_mpls_pw_ach_res,
tvb, 1, 1, res);
if (res != 0)
proto_tree_add_text(mpls_pw_ach_tree, tvb, 1, 1,
"Error: this byte is reserved and must be 0");
else
PROTO_ITEM_SET_HIDDEN(ti);
if ((channel_type == ACH_TYPE_BFD_CC) || (channel_type == ACH_TYPE_BFD_CV) ||
(channel_type == ACH_TYPE_ONDEMAND_CV)) {
switch (channel_type) {
case ACH_TYPE_BFD_CC:
proto_tree_add_uint_format_value(mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type,
tvb, 2, 2, channel_type,
"%s (0x%04x)",
val_to_str_ext_const(channel_type, &mpls_pwac_types_ext, "Unknown"),
channel_type);
proto_tree_add_uint_format (mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type,
tvb, (offset + 2), 2, channel_type,
"Channel Type: %s (0x%04x)",
val_to_str (channel_type, mpls_pwac_types,
"BFD CC"), channel_type);
offset = offset + 4;
next_tvb = tvb_new_subset_remaining (tvb, offset);
dissect_bfd_control (next_tvb, pinfo, tree);
} /* if (tree) */
break;
next_tvb = tvb_new_subset_remaining(tvb, 4);
case ACH_TYPE_BFD_CV:
switch (channel_type) {
case ACH_TYPE_BFD_CC:
call_dissector(dissector_bfd, next_tvb, pinfo, tree); /* bfd_control() */
break;
proto_tree_add_uint_format (mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type,
tvb, (offset + 2), 2, channel_type,
"Channel Type: %s (0x%04x)",
val_to_str (channel_type, mpls_pwac_types,
"BFD CV"), channel_type);
offset = offset + 4;
next_tvb = tvb_new_subset_remaining (tvb, offset);
dissect_bfd_control (next_tvb, pinfo, tree);
next_tvb = tvb_new_subset_remaining (tvb, offset);
dissect_bfd_mep (next_tvb, tree);
case ACH_TYPE_BFD_CV:
call_dissector(dissector_bfd, next_tvb, pinfo, tree); /* bfd_control() */
dissect_bfd_mep(next_tvb, tree);
break;
break;
case ACH_TYPE_ONDEMAND_CV:
dissect_mpls_echo(next_tvb, pinfo, tree);
break;
case ACH_TYPE_ONDEMAND_CV:
proto_tree_add_uint_format (mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type,
tvb, (offset + 2), 2, channel_type,
"Channel Type: %s (0x%04x)",
val_to_str (channel_type, mpls_pwac_types, "On-Demand CV"),
channel_type);
offset = offset + 4;
next_tvb = tvb_new_subset_remaining (tvb, offset);
dissect_mpls_echo (next_tvb, pinfo, tree);
break;
}
return;
}
case 0x21: /* IPv4, RFC4385 clause 6. */
call_dissector(dissector_ip, next_tvb, pinfo, tree);
break;
case 0x7: /* PWACH-encapsulated BFD, RFC 5885 */
call_dissector(dissector_bfd, next_tvb, pinfo, tree);
break;
proto_tree_add_uint_format(mpls_pw_ach_tree, hf_mpls_pw_ach_channel_type,
tvb, 2, 2, channel_type,
"Channel Type: %s (0x%04x)",
val_to_str(channel_type, mpls_pwac_types, "Unknown"),
channel_type);
}
next_tvb = tvb_new_subset_remaining(tvb, 4);
case 0x57: /* IPv6, RFC4385 clause 6. */
call_dissector(dissector_ipv6, next_tvb, pinfo, tree);
break;
if (0x21 == channel_type /*IPv4, RFC4385 clause 6.*/)
{
call_dissector(dissector_ip, next_tvb, pinfo, tree);
}
else if (0x7 == channel_type /*PWACH-encapsulated BFD, RFC 5885*/)
{
call_dissector(dissector_bfd, next_tvb, pinfo, tree);
}
else if (0x57 == channel_type /*IPv6, RFC4385 clause 6.*/)
{
call_dissector(dissector_ipv6, next_tvb, pinfo, tree);
}
else if (channel_type == 0x000A) /* FF: MPLS PM, RFC 6374, DLM */
{
call_dissector(dissector_mpls_pm_dlm, next_tvb, pinfo, tree);
}
else if (channel_type == 0x000B) /* FF: MPLS PM, RFC 6374, ILM */
{
call_dissector(dissector_mpls_pm_ilm, next_tvb, pinfo, tree);
}
else if (channel_type == 0x000C) /* FF: MPLS PM, RFC 6374, DM */
{
call_dissector(dissector_mpls_pm_dm, next_tvb, pinfo, tree);
}
else if (channel_type == 0x000D) /* FF: MPLS PM, RFC 6374, DLM+DM */
{
call_dissector(dissector_mpls_pm_dlm_dm, next_tvb, pinfo, tree);
}
else if (channel_type == 0x000E) /* FF: MPLS PM, RFC 6374, ILM+DM */
{
call_dissector(dissector_mpls_pm_ilm_dm, next_tvb, pinfo, tree);
}
else if (channel_type == 0x0024) /* FF: PSC, RFC 6378 */
{
call_dissector(dissector_mpls_psc, next_tvb, pinfo, tree);
}
else
{
call_dissector(dissector_data, next_tvb, pinfo, tree);
case 0x000A: /* FF: MPLS PM, RFC 6374, DLM */
call_dissector(dissector_mpls_pm_dlm, next_tvb, pinfo, tree);
break;
case 0x000B: /* FF: MPLS PM, RFC 6374, ILM */
call_dissector(dissector_mpls_pm_ilm, next_tvb, pinfo, tree);
break;
case 0x000C: /* FF: MPLS PM, RFC 6374, DM */
call_dissector(dissector_mpls_pm_dm, next_tvb, pinfo, tree);
break;
case 0x000D: /* FF: MPLS PM, RFC 6374, DLM+DM */
call_dissector(dissector_mpls_pm_dlm_dm, next_tvb, pinfo, tree);
break;
case 0x000E: /* FF: MPLS PM, RFC 6374, ILM+DM */
call_dissector(dissector_mpls_pm_ilm_dm, next_tvb, pinfo, tree);
break;
case 0x0024: /* FF: PSC, RFC 6378 */
call_dissector(dissector_mpls_psc, next_tvb, pinfo, tree);
break;
default:
call_dissector(dissector_data, next_tvb, pinfo, tree);
break;
}
}
gboolean dissect_try_cw_first_nibble( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
gboolean
dissect_try_cw_first_nibble( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
{
guint8 nibble;
nibble = (tvb_get_guint8(tvb, 0 ) >> 4) & 0x0F;
switch ( nibble )
{
case 6:
call_dissector( dissector_ipv6, tvb, pinfo, tree);
return TRUE;
case 4:
call_dissector( dissector_ip, tvb, pinfo, tree);
return TRUE;
case 1:
dissect_pw_ach( tvb, pinfo, tree );
return TRUE;
default:
break;
case 6:
call_dissector(dissector_ipv6, tvb, pinfo, tree);
return TRUE;
case 4:
call_dissector(dissector_ip, tvb, pinfo, tree);
return TRUE;
case 1:
dissect_pw_ach(tvb, pinfo, tree );
return TRUE;
default:
break;
}
return FALSE;
}
@ -490,17 +462,12 @@ gboolean dissect_try_cw_first_nibble( tvbuff_t *tvb, packet_info *pinfo, proto_t
static void
dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *mpls_pw_mcw_tree = NULL;
proto_item *ti = NULL;
tvbuff_t *next_tvb = NULL;
guint8 flags = 0;
guint8 frg = 0;
guint8 length = 0;
guint16 sequence_number = 0;
tvbuff_t *next_tvb;
guint8 length;
guint16 sequence_number;
if (tvb_reported_length_remaining(tvb, 0) < 4) {
if (tree)
proto_tree_add_text(tree, tvb, 0, -1, "Error processing Message");
proto_tree_add_text(tree, tvb, 0, -1, "Error processing Message");
return;
}
@ -508,45 +475,41 @@ dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
return;
/* bits 4 to 7 and FRG bits are displayed together */
flags = (tvb_get_guint8(tvb, 0) & 0x0F) << 2;
frg = (tvb_get_guint8(tvb, 1) & 0xC0) >> 6;
flags |= frg;
length = tvb_get_guint8(tvb, 1) & 0x3F;
length = tvb_get_guint8(tvb, 1) & 0x3F;
sequence_number = tvb_get_ntohs(tvb, 2);
if (tree) {
proto_tree *mpls_pw_mcw_tree;
proto_item *ti;
ti = proto_tree_add_item(tree, proto_pw_mcw, tvb, 0, 4, ENC_NA);
mpls_pw_mcw_tree = proto_item_add_subtree(ti, ett_mpls_pw_mcw);
if (mpls_pw_mcw_tree == NULL)
return;
proto_tree_add_uint_format(mpls_pw_mcw_tree, hf_mpls_pw_mcw_flags,
tvb, 0, 1, flags, "Flags: 0x%02x", flags);
proto_tree_add_uint_format(mpls_pw_mcw_tree, hf_mpls_pw_mcw_length,
tvb, 1, 1, length, "Length: %u", length);
proto_tree_add_uint_format(mpls_pw_mcw_tree, hf_mpls_pw_mcw_sequence_number,
tvb, 2, 2, sequence_number,
"Sequence Number: %d", sequence_number);
proto_tree_add_item(mpls_pw_mcw_tree, hf_mpls_pw_mcw_flags,
tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mpls_pw_mcw_tree, hf_mpls_pw_mcw_length,
tvb, 1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(mpls_pw_mcw_tree, hf_mpls_pw_mcw_sequence_number,
tvb, 2, 2, ENC_BIG_ENDIAN);
}
next_tvb = tvb_new_subset_remaining(tvb, 4);
call_dissector( dissector_data, next_tvb, pinfo, tree );
call_dissector(dissector_data, next_tvb, pinfo, tree);
}
static void
dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int offset = 0;
guint32 label = LABEL_INVALID;
guint8 exp;
guint8 bos;
guint8 ttl;
proto_tree *mpls_tree = NULL;
proto_item *ti;
int offset = 0;
guint32 label = MPLS_LABEL_INVALID;
guint8 exp;
guint8 bos;
guint8 ttl;
tvbuff_t *next_tvb;
gboolean found;
guint8 first_nibble;
struct mplsinfo mplsinfo;
int found = 0;
guint8 first_nibble;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPLS");
col_set_str(pinfo->cinfo, COL_INFO, "MPLS Label Switched Packet");
/* Start Decoding Here. */
@ -559,12 +522,15 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* update pinfo
*/
mplsinfo.label = pinfo->mpls_label = label;
mplsinfo.exp = exp;
mplsinfo.bos = bos;
mplsinfo.ttl = ttl;
mplsinfo.exp = exp;
mplsinfo.bos = bos;
mplsinfo.ttl = ttl;
pinfo->private_data = &mplsinfo;
if (tree) {
proto_item *ti;
proto_tree *mpls_tree;
ti = proto_tree_add_item(tree, proto_mpls, tvb, offset, 4, ENC_NA);
mpls_tree = proto_item_add_subtree(ti, ett_mpls);
@ -574,11 +540,11 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
proto_item_append_text(ti, ", Label: %u", label);
}
if (label <= LABEL_MAX_RESERVED){
if (label <= MPLS_LABEL_MAX_RESERVED){
proto_tree_add_item(mpls_tree, hf_mpls_label_special, tvb,
offset, 4, ENC_BIG_ENDIAN);
proto_item_append_text(ti, " (%s)", val_to_str(label,
special_labels, "Reserved - Unknown"));
proto_item_append_text(ti, " (%s)",
val_to_str_const(label, special_labels, "Reserved - Unknown"));
} else {
proto_tree_add_item(mpls_tree, hf_mpls_label, tvb, offset, 4,
ENC_BIG_ENDIAN);
@ -598,22 +564,22 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
offset += 4;
if (label == LABEL_GACH && !bos)
{
if ((label == MPLS_LABEL_GACH) && !bos) {
proto_tree_add_text(tree, tvb, 0, -1, "Invalid Label");
}
if (label == LABEL_GACH && bos) {
g_strlcpy(PW_ACH,"Generic Associated Channel Header",50);
if ((label == MPLS_LABEL_GACH) && bos) {
g_strlcpy(PW_ACH, "Generic Associated Channel Header",50);
next_tvb = tvb_new_subset_remaining(tvb, offset);
dissect_pw_ach( next_tvb, pinfo, tree );
return;
}
else
g_strlcpy(PW_ACH,"PW Associated Channel Header",50);
g_strlcpy(PW_ACH, "PW Associated Channel Header",50);
if (bos) break;
if (bos)
break;
}
first_nibble = (tvb_get_guint8(tvb, offset) >> 4) & 0x0F;
@ -621,7 +587,7 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
next_tvb = tvb_new_subset_remaining(tvb, offset);
/* 1) explicit label-to-dissector binding ? */
found = dissector_try_uint(mpls_subdissector_table, label,
found = dissector_try_uint(mpls_subdissector_table, label,
next_tvb, pinfo, tree);
if (found)
return;
@ -637,9 +603,9 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dissect_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
* 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.
*/
@ -647,49 +613,49 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* 3) use the mpls_default_payload info from user */
switch (mpls_default_payload) {
case MDD_PW_SATOP:
call_dissector(dissector_pw_satop, next_tvb, pinfo, tree);
break;
case MDD_PW_CESOPSN:
call_dissector(dissector_pw_cesopsn, next_tvb, pinfo, tree);
break;
case MDD_PW_ETH_HEUR:
call_dissector(dissector_pw_eth_heuristic, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_FR_DLCI:
call_dissector(dissector_pw_fr, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_HDLC_NOCW_FRPORT:
call_dissector(dissector_pw_hdlc_nocw_fr, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_HDLC_NOCW_HDLC_PPP:
call_dissector(dissector_pw_hdlc_nocw_hdlc_ppp,next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ETH_CW:
call_dissector(dissector_pw_eth_cw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ETH_NOCW:
call_dissector(dissector_pw_eth_nocw, next_tvb, pinfo, tree);
break;
case MDD_ITDM:
call_dissector(dissector_itdm, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_N1_CW:
call_dissector(dissector_mpls_pw_atm_n1_cw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_N1_NOCW:
call_dissector(dissector_mpls_pw_atm_n1_nocw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_11_OR_AAL5_PDU:
call_dissector(dissector_mpls_pw_atm_11_aal5pdu, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_AAL5_SDU:
call_dissector(dissector_mpls_pw_atm_aal5_sdu, next_tvb, pinfo, tree);
break;
default: /* fallthrough */
case MDD_MPLS_PW_GENERIC:
dissect_pw_mcw(next_tvb, pinfo, tree);
break;
case MDD_PW_SATOP:
call_dissector(dissector_pw_satop, next_tvb, pinfo, tree);
break;
case MDD_PW_CESOPSN:
call_dissector(dissector_pw_cesopsn, next_tvb, pinfo, tree);
break;
case MDD_PW_ETH_HEUR:
call_dissector(dissector_pw_eth_heuristic, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_FR_DLCI:
call_dissector(dissector_pw_fr, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_HDLC_NOCW_FRPORT:
call_dissector(dissector_pw_hdlc_nocw_fr, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_HDLC_NOCW_HDLC_PPP:
call_dissector(dissector_pw_hdlc_nocw_hdlc_ppp,next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ETH_CW:
call_dissector(dissector_pw_eth_cw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ETH_NOCW:
call_dissector(dissector_pw_eth_nocw, next_tvb, pinfo, tree);
break;
case MDD_ITDM:
call_dissector(dissector_itdm, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_N1_CW:
call_dissector(dissector_mpls_pw_atm_n1_cw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_N1_NOCW:
call_dissector(dissector_mpls_pw_atm_n1_nocw, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_11_OR_AAL5_PDU:
call_dissector(dissector_mpls_pw_atm_11_aal5pdu, next_tvb, pinfo, tree);
break;
case MDD_MPLS_PW_ATM_AAL5_SDU:
call_dissector(dissector_mpls_pw_atm_aal5_sdu, next_tvb, pinfo, tree);
break;
default: /* fallthrough */
case MDD_MPLS_PW_GENERIC:
dissect_pw_mcw(next_tvb, pinfo, tree);
break;
}
}
@ -700,53 +666,72 @@ proto_register_mpls(void)
/* MPLS header fields */
{&hf_mpls_label,
{"MPLS Label", "mpls.label", FT_UINT32, BASE_DEC, NULL, 0xFFFFF000,
NULL, HFILL }},
{"MPLS Label", "mpls.label",
FT_UINT32, BASE_DEC, NULL, 0xFFFFF000,
NULL, HFILL }
},
{&hf_mpls_label_special,
{"MPLS Label", "mpls.label", FT_UINT32, BASE_DEC, VALS(special_labels), 0xFFFFF000,
NULL, HFILL }},
{"MPLS Label", "mpls.label",
FT_UINT32, BASE_DEC, VALS(special_labels), 0xFFFFF000,
NULL, HFILL }
},
{&hf_mpls_exp,
{"MPLS Experimental Bits", "mpls.exp", FT_UINT32, BASE_DEC, NULL, 0x00000E00,
NULL, HFILL }},
{"MPLS Experimental Bits", "mpls.exp",
FT_UINT32, BASE_DEC, NULL, 0x00000E00,
NULL, HFILL }
},
{&hf_mpls_bos,
{"MPLS Bottom Of Label Stack", "mpls.bottom", FT_UINT32, BASE_DEC, NULL, 0x00000100,
NULL, HFILL }},
{"MPLS Bottom Of Label Stack", "mpls.bottom",
FT_UINT32, BASE_DEC, NULL, 0x00000100,
NULL, HFILL }
},
{&hf_mpls_ttl,
{"MPLS TTL", "mpls.ttl", FT_UINT32, BASE_DEC, NULL, 0x0000000FF,
NULL, HFILL }},
{"MPLS TTL", "mpls.ttl",
FT_UINT32, BASE_DEC, NULL, 0x0000000FF,
NULL, HFILL }
},
/* PW Associated Channel Header fields */
{&hf_mpls_pw_ach_ver,
{"PW Associated Channel Version", "pwach.ver", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }},
{"Channel Version", "pwach.ver",
FT_UINT8, BASE_DEC, NULL, 0x0F,
"PW Associated Channel Version", HFILL }
},
{&hf_mpls_pw_ach_res,
{"Reserved", "pwach.res", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }},
{"Reserved", "pwach.res",
FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{&hf_mpls_pw_ach_channel_type,
{"PW Associated Channel Type", "pwach.channel_type", FT_UINT16, BASE_HEX,
NULL, 0x0, NULL, HFILL }},
{"Channel Type", "pwach.channel_type",
FT_UINT16, BASE_HEX, NULL, 0x0,
"PW Associated Channel Type", HFILL }
},
/* Generic/Preferred PW MPLS Control Word fields */
{&hf_mpls_pw_mcw_flags,
{"Generic/Preferred PW MPLS Control Word Flags", "pwmcw.flags", FT_UINT8,
BASE_HEX, NULL, 0x0, NULL,
HFILL }},
{"Flags", "pwmcw.flags",
FT_UINT8, BASE_HEX, NULL, 0x0FC0,
"Generic/Preferred PW MPLS Control Word Flags", HFILL }
},
{&hf_mpls_pw_mcw_length,
{"Generic/Preferred PW MPLS Control Word Length", "pwmcw.length", FT_UINT8,
BASE_DEC, NULL, 0x0, NULL,
HFILL }},
{"Length", "pwmcw.length",
FT_UINT8, BASE_DEC, NULL, 0x3F,
"Generic/Preferred PW MPLS Control Word Length", HFILL }
},
{&hf_mpls_pw_mcw_sequence_number,
{"Generic/Preferred PW MPLS Control Word Sequence Number",
"pwmcw.sequence_number", FT_UINT16, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{"Sequence Number", "pwmcw.sequence_number",
FT_UINT16, BASE_DEC, NULL, 0x0,
"Generic/Preferred PW MPLS Control Word Sequence Number", HFILL }
},
};
static gint *ett[] = {
@ -805,7 +790,7 @@ proto_reg_handoff_mpls(void)
dissector_add_uint("ip.proto", IP_PROTO_MPLS_IN_IP, mpls_handle);
mpls_handle = find_dissector("mplspwcw");
dissector_add_uint( "mpls.label", LABEL_INVALID, mpls_handle );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, mpls_handle );
dissector_data = find_dissector("data");
dissector_ipv6 = find_dissector("ipv6");

View File

@ -3,7 +3,7 @@
* Author: Carlos Pignataro <cpignata@cisco.com>
* Copyright 2005, cisco Systems, Inc.
*
* (c) Copyright 2006, _FF_ Francesco Fondelli <francesco.fondelli@gmail.com>
* (c) Copyright 2006, _FF_ Francesco Fondelli <francesco.fondelli@gmail.com>
* added MPLS OAM support, ITU-T Y.1711
* (c) Copyright 2011, Shobhank Sharma <ssharma5@ncsu.edu>
* added MPLS Generic Associated Channel as per RFC 5586
@ -34,25 +34,25 @@
/* Special labels in MPLS */
enum {
LABEL_IP4_EXPLICIT_NULL = 0,
LABEL_ROUTER_ALERT,
LABEL_IP6_EXPLICIT_NULL,
LABEL_IMPLICIT_NULL,
LABEL_GACH = 13, /* aka GAL */
LABEL_OAM_ALERT = 14,
LABEL_MAX_RESERVED = 15,
LABEL_INVALID = 0xffffffff
MPLS_LABEL_IP4_EXPLICIT_NULL = 0,
MPLS_LABEL_ROUTER_ALERT,
MPLS_LABEL_IP6_EXPLICIT_NULL,
MPLS_LABEL_IMPLICIT_NULL,
MPLS_LABEL_GACH = 13, /* aka GAL */
MPLS_LABEL_OAM_ALERT = 14,
MPLS_LABEL_MAX_RESERVED = 15,
MPLS_LABEL_INVALID = 0xffffffff
};
/*
* FF: private data passed from the MPLS dissector to subdissectors
* FF: private data passed from the MPLS dissector to subdissectors
* (pinfo->private_data).
*/
struct mplsinfo {
guint32 label; /* last mpls label in label stack */
guint8 exp; /* former EXP bits of last mpls shim in stack */
guint8 bos; /* BOS bit of last mpls shim in stack */
guint8 ttl; /* TTL bits of last mpls shim in stack */
guint8 exp; /* former EXP bits of last mpls shim in stack */
guint8 bos; /* BOS bit of last mpls shim in stack */
guint8 ttl; /* TTL bits of last mpls shim in stack */
};
extern const value_string special_labels[];
@ -60,7 +60,7 @@ extern void decode_mpls_label(tvbuff_t *tvb, int offset,
guint32 *label, guint8 *exp,
guint8 *bos, guint8 *ttl);
extern gboolean dissect_try_cw_first_nibble(tvbuff_t *tvb, packet_info *pinfo,
extern gboolean dissect_try_cw_first_nibble(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree );
void dissect_mpls_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);

View File

@ -467,14 +467,11 @@ too_small_packet_or_notpw(tvbuff_t * tvb
*/
if (packet_size < 4) /* 4 is smallest size which may be sensible (for PWACH dissector) */
{
if (tree || pinfo->cinfo)
{
proto_item * item;
item = proto_tree_add_item(tree, proto_handler, tvb, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"PW packet size (%d) is too small to carry sensible information"
,(int)packet_size);
}
proto_item * item;
item = proto_tree_add_item(tree, proto_handler, tvb, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"PW packet size (%d) is too small to carry sensible information"
,(int)packet_size);
/* represent problems in the Packet List pane */
col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name_column);
col_set_str(pinfo->cinfo, COL_INFO, "Malformed: PW packet is too small");
@ -610,7 +607,6 @@ dissect_11_or_aal5_pdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
}
}
if (tree || pinfo->cinfo)
{
proto_item* item;
item = proto_tree_add_item(tree, proto_11_or_aal5_pdu, tvb, 0, -1, ENC_NA);
@ -848,7 +844,6 @@ dissect_aal5_sdu(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
col_append_pw_info(pinfo, payload_size, cells, padding_size);
}
if (tree || pinfo->cinfo)
{
proto_item* item;
item = proto_tree_add_item(tree, proto_aal5_sdu, tvb, 0, -1, ENC_NA);
@ -1023,7 +1018,6 @@ dissect_n1_cw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
}
}
if (tree || pinfo->cinfo)
{
proto_item* item;
item = proto_tree_add_item(tree, proto_n1_cw, tvb, 0, -1, ENC_NA);
@ -1103,7 +1097,6 @@ dissect_n1_nocw(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
}
}
if (tree || pinfo->cinfo)
{
proto_item* item;
item = proto_tree_add_item(tree, proto_n1_nocw, tvb, 0, -1, ENC_NA);
@ -1187,179 +1180,173 @@ dissect_control_word(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
size = tvb_reported_length_remaining(tvb, 0);
if (size < PWC_SIZEOF_CW)
{
if (tree || pinfo->cinfo)
{
proto_item *item;
item = proto_tree_add_item(tree, proto_control_word, tvb, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"Packet (size: %d) is too small to carry MPLS PW Control Word"
,(int)size);
}
proto_item *item;
item = proto_tree_add_item(tree, proto_control_word, tvb, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"Packet (size: %d) is too small to carry MPLS PW Control Word"
,(int)size);
return;
}
}
if (tree || pinfo->cinfo)
{
proto_item* item_top;
proto_tree* tree2;
proto_item* item;
item_top = proto_tree_add_item(tree, proto_control_word, tvb, 0, -1, ENC_NA);
pwc_item_append_cw(item_top, tvb_get_ntohl(tvb, 0), FALSE);
{
proto_tree* tree2;
tree2 = proto_item_add_subtree(item_top, ett_cw);
{
proto_item* item;
/* bits 0..3 */
item = proto_tree_add_item(tree2, hf_cw_bits03, tvb, 0, 1, ENC_BIG_ENDIAN);
if (pd->props & PWC_CW_BAD_BITS03)
{
/* add item to tree (and show it) only if its value is wrong*/
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bits 0..3 of Control Word must be 0");
}
else
{
PROTO_ITEM_SET_HIDDEN(item); /* show only in error cases */
}
tree2 = proto_item_add_subtree(item_top, ett_cw);
/* flags */
/* bits 0..3 */
item = proto_tree_add_item(tree2, hf_cw_bits03, tvb, 0, 1, ENC_BIG_ENDIAN);
if (pd->props & PWC_CW_BAD_BITS03)
{
/* add item to tree (and show it) only if its value is wrong*/
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bits 0..3 of Control Word must be 0");
}
else
{
PROTO_ITEM_SET_HIDDEN(item); /* show only in error cases */
}
/* flags */
if (MODE_N1(pd->mode))
{
item = proto_tree_add_item(tree2, hf_pref_cw_flags, tvb, 0, 1, ENC_BIG_ENDIAN);
if (pd->props & PWC_CW_BAD_FLAGS)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Flags must be 0 for PW ATM N:1 encapsulation");
}
}
if (pd->mode == PWATM_MODE_AAL5_SDU)
{
proto_tree_add_item(tree2, hf_pref_cw_a5s_t, tvb, 0, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree2, hf_pref_cw_a5s_e, tvb, 0, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree2, hf_pref_cw_a5s_c, tvb, 0, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree2, hf_pref_cw_a5s_u, tvb, 0, 1, ENC_BIG_ENDIAN);
/*
* rfc4717: [When FRF.8.1 Frame Relay/ATM PVC Service Interworking [RFC3916]
* traffic is being transported, the CPCS-UU Least Significant Bit
* (LSB) of the AAL5 CPCS-PDU may contain the Frame Relay C/R bit.
* The ingress router, PE1, SHOULD copy this bit to the U bit of the
* control word. The egress router, PE2, SHOULD copy the U bit to
* the CPCS-UU Least Significant Bit (LSB) of the AAL5 CPCS PDU.]
*
* Let's remember this bit (and then transfer it to ATM dissector).
*/
pd->aal5_sdu_frame_relay_cr_bit =
(0 == (tvb_get_guint8(tvb, 0) & 0x01 /*preferred_cw.U*/))
? FALSE : TRUE;
}
/* reserved bits */
if (MODE_11_OR_AAL5_PDU(pd->mode)
|| (MODE_N1(pd->mode) && !pref_n1_cw_extend_cw_length_with_rsvd)
/* for N:1 add RSV only if it is NOT used in length */
|| ((pd->mode == PWATM_MODE_AAL5_SDU) && !pref_aal5_sdu_extend_cw_length_with_rsvd)
/* for AAl5 SDU add RSV only if it is NOT used in length */)
{
if (MODE_11_OR_AAL5_PDU(pd->mode))
{
item = proto_tree_add_item(tree2
,hf_generic_cw_rsv, tvb, 0, 1, ENC_BIG_ENDIAN);
}
else
{ /*preferred cw*/
item = proto_tree_add_item(tree2
,hf_pref_cw_rsv, tvb, 1, 1, ENC_BIG_ENDIAN);
}
if (pd->props & PWC_CW_BAD_RSV)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Reserved bits in Control Word must be 0");
}
else
{
PROTO_ITEM_SET_HIDDEN(item); /*...and show only in error cases */
}
}
/* length */
if (MODE_N1(pd->mode)
|| (PWATM_MODE_AAL5_SDU == pd->mode))
{
{
int hf_len = hf_pref_cw_len;
if (MODE_N1(pd->mode))
{
item = proto_tree_add_item(tree2, hf_pref_cw_flags, tvb, 0, 1, ENC_BIG_ENDIAN);
if (pd->props & PWC_CW_BAD_FLAGS)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Flags must be 0 for PW ATM N:1 encapsulation");
}
if (pref_n1_cw_extend_cw_length_with_rsvd)
hf_len = hf_pref_cw_rsvlen;
}
if (pd->mode == PWATM_MODE_AAL5_SDU)
else /*PW_MODE_AAL5_SDU*/
{
proto_tree_add_item(tree2, hf_pref_cw_a5s_t, tvb, 0, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree2, hf_pref_cw_a5s_e, tvb, 0, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree2, hf_pref_cw_a5s_c, tvb, 0, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree2, hf_pref_cw_a5s_u, tvb, 0, 1, ENC_BIG_ENDIAN);
/*
* rfc4717: [When FRF.8.1 Frame Relay/ATM PVC Service Interworking [RFC3916]
* traffic is being transported, the CPCS-UU Least Significant Bit
* (LSB) of the AAL5 CPCS-PDU may contain the Frame Relay C/R bit.
* The ingress router, PE1, SHOULD copy this bit to the U bit of the
* control word. The egress router, PE2, SHOULD copy the U bit to
* the CPCS-UU Least Significant Bit (LSB) of the AAL5 CPCS PDU.]
*
* Let's remember this bit (and then transfer it to ATM dissector).
*/
pd->aal5_sdu_frame_relay_cr_bit =
(0 == (tvb_get_guint8(tvb, 0) & 0x01 /*preferred_cw.U*/))
? FALSE : TRUE;
}
/* reserved bits */
if (MODE_11_OR_AAL5_PDU(pd->mode)
|| (MODE_N1(pd->mode) && !pref_n1_cw_extend_cw_length_with_rsvd)
/* for N:1 add RSV only if it is NOT used in length */
|| ((pd->mode == PWATM_MODE_AAL5_SDU) && !pref_aal5_sdu_extend_cw_length_with_rsvd)
/* for AAl5 SDU add RSV only if it is NOT used in length */)
{
if (MODE_11_OR_AAL5_PDU(pd->mode))
{
item = proto_tree_add_item(tree2
,hf_generic_cw_rsv, tvb, 0, 1, ENC_BIG_ENDIAN);
}
else
{ /*preferred cw*/
item = proto_tree_add_item(tree2
,hf_pref_cw_rsv, tvb, 1, 1, ENC_BIG_ENDIAN);
}
if (pd->props & PWC_CW_BAD_RSV)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Reserved bits in Control Word must be 0");
}
else
{
PROTO_ITEM_SET_HIDDEN(item); /*...and show only in error cases */
}
}
/* length */
if (MODE_N1(pd->mode)
|| (PWATM_MODE_AAL5_SDU == pd->mode))
{
{
int hf_len = hf_pref_cw_len;
if (MODE_N1(pd->mode))
{
if (pref_n1_cw_extend_cw_length_with_rsvd)
hf_len = hf_pref_cw_rsvlen;
}
else /*PW_MODE_AAL5_SDU*/
{
if (pref_aal5_sdu_extend_cw_length_with_rsvd)
hf_len = hf_pref_cw_rsvlen;
}
item = proto_tree_add_item(tree2, hf_len, tvb, 1, 1, ENC_BIG_ENDIAN);
}
if (pd->props & PWC_CW_BAD_LEN_MUST_BE_0)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: must be 0 for this encapsulation");
}
if (pd->props & PWC_CW_BAD_PAYLEN_LE_0)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: too small, must be >= %d"
,(int)(PWC_SIZEOF_CW+SIZEOF_N1_PW_CELL));
}
if (pd->props & PWC_CW_BAD_PAYLEN_GT_PACKET)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: must be <= than PSN packet size (%d)"
,(int)pd->packet_size);
}
if (pd->props & PWC_CW_BAD_PADDING_NE_0)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: must be == PSN packet size (%d), no padding allowed"
,(int)pd->packet_size);
}
}
/* sequence number */
proto_tree_add_item(tree2, hf_cw_seq, tvb
,MODE_11_OR_AAL5_PDU(pd->mode) ? 1 : 2, 2, ENC_BIG_ENDIAN);
/* atm-specific byte */
if (MODE_11(pd->mode))
{
proto_tree_add_item(tree2, hf_gen_cw_atmbyte, tvb, 3, 1, ENC_BIG_ENDIAN);
/*
* no need to highlight item in the tree, therefore
* expert_add_info_format() is not used here.
*/
item = proto_tree_add_text(tree2, tvb, 3, 1
,"ATM-specific byte of CW is fully dissected below as %s%s"
,(PWATM_MODE_11_VPC == pd->mode) ? "a part of " : ""
,"PW ATM Cell Header [000]");
PROTO_ITEM_SET_GENERATED(item);
/*
* Note: if atm-specific byte contains something wrong
* (e.g. non-zero RSV or inadequate V), CW is not
* marked as "bad".
*/
}
/*3rd byte of CW*/
if (PWATM_MODE_AAL5_PDU == pd->mode)
{
tvbuff_t* tvb_2;
tvb_2 = tvb_new_subset_remaining(tvb, (PWC_SIZEOF_CW-1));
call_dissector(dh_cell_header, tvb_2, pinfo, tree2);
proto_item_append_text(item_top, ", ");
proto_item_append_text_cwb3_fields(item_top, pd);
if (pref_aal5_sdu_extend_cw_length_with_rsvd)
hf_len = hf_pref_cw_rsvlen;
}
item = proto_tree_add_item(tree2, hf_len, tvb, 1, 1, ENC_BIG_ENDIAN);
}
if (pd->props & PWC_CW_BAD_LEN_MUST_BE_0)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: must be 0 for this encapsulation");
}
if (pd->props & PWC_CW_BAD_PAYLEN_LE_0)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: too small, must be >= %d"
,(int)(PWC_SIZEOF_CW+SIZEOF_N1_PW_CELL));
}
if (pd->props & PWC_CW_BAD_PAYLEN_GT_PACKET)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: must be <= than PSN packet size (%d)"
,(int)pd->packet_size);
}
if (pd->props & PWC_CW_BAD_PADDING_NE_0)
{
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR
,"Bad Length: must be == PSN packet size (%d), no padding allowed"
,(int)pd->packet_size);
}
}
/* sequence number */
proto_tree_add_item(tree2, hf_cw_seq, tvb
,MODE_11_OR_AAL5_PDU(pd->mode) ? 1 : 2, 2, ENC_BIG_ENDIAN);
/* atm-specific byte */
if (MODE_11(pd->mode))
{
proto_tree_add_item(tree2, hf_gen_cw_atmbyte, tvb, 3, 1, ENC_BIG_ENDIAN);
/*
* no need to highlight item in the tree, therefore
* expert_add_info_format() is not used here.
*/
item = proto_tree_add_text(tree2, tvb, 3, 1
,"ATM-specific byte of CW is fully dissected below as %s%s"
,(PWATM_MODE_11_VPC == pd->mode) ? "a part of " : ""
,"PW ATM Cell Header [000]");
PROTO_ITEM_SET_GENERATED(item);
/*
* Note: if atm-specific byte contains something wrong
* (e.g. non-zero RSV or inadequate V), CW is not
* marked as "bad".
*/
}
/*3rd byte of CW*/
if (PWATM_MODE_AAL5_PDU == pd->mode)
{
tvbuff_t* tvb_2;
tvb_2 = tvb_new_subset_remaining(tvb, (PWC_SIZEOF_CW-1));
call_dissector(dh_cell_header, tvb_2, pinfo, tree2);
proto_item_append_text(item_top, ", ");
proto_item_append_text_cwb3_fields(item_top, pd);
}
}
return;
@ -1479,7 +1466,6 @@ dissect_cell_header(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
}
}
if (tree || pinfo->cinfo)
{
proto_item* item;
@ -1646,7 +1632,6 @@ dissect_cell(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data
* NB: do not touch columns -- keep info from previous dissector
*/
if (tree || pinfo->cinfo)
{
proto_item* item;
item = proto_tree_add_item(tree, proto_cell, tvb, 0, dissect_size, ENC_NA);
@ -1969,13 +1954,13 @@ proto_reg_handoff_pw_atm_ata(void)
{
dissector_handle_t h;
h = find_dissector("mpls_pw_atm_n1_cw");
dissector_add_uint( "mpls.label", LABEL_INVALID, h );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, h );
h = find_dissector("mpls_pw_atm_n1_nocw");
dissector_add_uint( "mpls.label", LABEL_INVALID, h );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, h );
h = find_dissector("mpls_pw_atm_11_or_aal5_pdu");
dissector_add_uint( "mpls.label", LABEL_INVALID, h );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, h );
h = find_dissector("mpls_pw_atm_aal5_sdu");
dissector_add_uint( "mpls.label", LABEL_INVALID, h );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, h );
dh_cell = find_dissector("mpls_pw_atm_cell");
dh_cell_header = find_dissector("mpls_pw_atm_cell_header");

View File

@ -83,9 +83,9 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original
,pwc_demux_type_t demux)
{
const int encaps_size = 4; /*RTP header in encapsulation is not supported yet*/
gint packet_size;
gint payload_size;
gint padding_size;
gint packet_size;
gint payload_size;
gint padding_size;
pwc_packet_properties_t properties;
packet_size = tvb_reported_length_remaining(tvb_original, 0);
@ -97,18 +97,12 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original
*/
if (packet_size < 4) /* 4 is smallest size which may be sensible (for PWACH dissector) */
{
if (tree)
{
proto_item *item;
item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"PW packet size (%d) is too small to carry sensible information"
,(int)packet_size);
}
if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);
}
proto_item *item;
item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"PW packet size (%d) is too small to carry sensible information"
,(int)packet_size);
col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);
col_set_str(pinfo->cinfo, COL_INFO, "Malformed: PW packet is too small");
return;
}
@ -153,7 +147,7 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original
*
* We will use RFC5086's definition here.
*/
int cw_len;
int cw_len;
gint payload_size_from_packet;
cw_len = tvb_get_guint8(tvb_original, 1) & 0x3f;
@ -226,10 +220,7 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original
}
/* fill up columns*/
if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);
if (check_col(pinfo->cinfo, COL_INFO))
{
col_clear(pinfo->cinfo, COL_INFO);
@ -443,7 +434,7 @@ void proto_reg_handoff_pw_cesopsn(void)
{
data_handle = find_dissector("data");
pw_padding_handle = find_dissector("pw_padding");
dissector_add_uint("mpls.label", LABEL_INVALID, find_dissector("pw_cesopsn_mpls"));
dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, find_dissector("pw_cesopsn_mpls"));
dissector_add_handle("udp.port", find_dissector("pw_cesopsn_udp")); /* For Decode-As */
return;
}

View File

@ -52,10 +52,8 @@ static dissector_handle_t pw_eth_handle_nocw;
static void
dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *pw_eth_tree = NULL;
proto_item *ti = NULL;
tvbuff_t *next_tvb = NULL;
guint16 sequence_number = 0;
tvbuff_t *next_tvb;
guint16 sequence_number;
if (tvb_reported_length_remaining(tvb, 0) < 4) {
if (tree)
@ -70,6 +68,9 @@ dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
sequence_number = tvb_get_ntohs(tvb, 2);
if (tree) {
proto_tree *pw_eth_tree;
proto_item *ti;
ti = proto_tree_add_boolean(tree, hf_pw_eth_cw,
tvb, 0, 0, TRUE);
PROTO_ITEM_SET_HIDDEN(ti);
@ -77,9 +78,6 @@ dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, 0, 4, ENC_NA);
pw_eth_tree = proto_item_add_subtree(ti, ett_pw_eth);
if (pw_eth_tree == NULL)
return;
proto_tree_add_uint_format(pw_eth_tree,
hf_pw_eth_cw_sequence_number,
tvb, 2, 2, sequence_number,
@ -112,10 +110,10 @@ dissect_pw_eth_cw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static void
dissect_pw_eth_nocw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
tvbuff_t *next_tvb = NULL;
proto_item *ti = NULL;
tvbuff_t *next_tvb;
if (tree) {
proto_item *ti;
ti = proto_tree_add_boolean(tree, hf_pw_eth, tvb, 0, 0, TRUE);
PROTO_ITEM_SET_HIDDEN(ti);
}
@ -135,8 +133,8 @@ dissect_pw_eth_nocw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static gboolean
looks_like_plain_eth(tvbuff_t *tvb _U_)
{
const gchar *manuf_name_da = NULL;
const gchar *manuf_name_sa = NULL;
const gchar *manuf_name_da;
const gchar *manuf_name_sa;
if (tvb_reported_length_remaining(tvb, 0) < 14) {
return FALSE;
@ -230,13 +228,13 @@ proto_reg_handoff_pw_eth(void)
eth_withoutfcs_handle = find_dissector("eth_withoutfcs");
pw_eth_handle_cw = find_dissector("pw_eth_cw");
dissector_add_uint("mpls.label", LABEL_INVALID, pw_eth_handle_cw);
dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, pw_eth_handle_cw);
pw_eth_handle_nocw = find_dissector("pw_eth_nocw");
dissector_add_uint("mpls.label", LABEL_INVALID, pw_eth_handle_nocw);
dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, pw_eth_handle_nocw);
pw_eth_handle_heuristic = find_dissector("pw_eth_heuristic");
dissector_add_uint("mpls.label", LABEL_INVALID, pw_eth_handle_heuristic);
dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, pw_eth_handle_heuristic);
}
/*

View File

@ -83,7 +83,6 @@ dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree )
packet_size = tvb_reported_length_remaining(tvb, 0);
if (packet_size < encaps_size)
{
if (tree)
{
proto_item *item;
item = proto_tree_add_item(tree, proto_encaps, tvb, 0, -1, ENC_NA);
@ -178,7 +177,6 @@ dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree )
}
}
if (tree)
{
proto_tree* subtree;
proto_item* item_headline;
@ -197,9 +195,9 @@ dissect_pw_fr( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree )
(void)proto_tree_add_item( subtree, hf_cw_fecn, tvb, 0, 1, ENC_BIG_ENDIAN );
(void)proto_tree_add_item( subtree, hf_cw_becn, tvb, 0, 1, ENC_BIG_ENDIAN );
(void)proto_tree_add_item( subtree, hf_cw_de, tvb, 0, 1, ENC_BIG_ENDIAN );
(void)proto_tree_add_item( subtree, hf_cw_cr, tvb, 0, 1, ENC_BIG_ENDIAN );
(void)proto_tree_add_item( subtree, hf_cw_frg, tvb, 1, 1, ENC_BIG_ENDIAN );
(void)proto_tree_add_item( subtree, hf_cw_de, tvb, 0, 1, ENC_BIG_ENDIAN );
(void)proto_tree_add_item( subtree, hf_cw_cr, tvb, 0, 1, ENC_BIG_ENDIAN );
(void)proto_tree_add_item( subtree, hf_cw_frg, tvb, 1, 1, ENC_BIG_ENDIAN );
item = proto_tree_add_item( subtree, hf_cw_len, tvb, 1, 1, ENC_BIG_ENDIAN );
if (packet_quality & PQ_CW_BAD_LEN_GT_PACKET)
@ -295,6 +293,6 @@ proto_reg_handoff_pw_fr(void)
{
dissector_handle_t h;
h = find_dissector("pw_fr");
dissector_add_uint("mpls.label", LABEL_INVALID, h);
dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, h);
fr_stripped_address_handle = find_dissector("fr_stripped_address");
}

View File

@ -248,10 +248,10 @@ void proto_reg_handoff_pw_hdlc(void)
dissector_handle_t handle;
handle = find_dissector("pw_hdlc_nocw_fr");
dissector_add_uint( "mpls.label", LABEL_INVALID, handle );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, handle );
handle = find_dissector("pw_hdlc_nocw_hdlc_ppp");
dissector_add_uint( "mpls.label", LABEL_INVALID, handle );
dissector_add_uint( "mpls.label", MPLS_LABEL_INVALID, handle );
ppp_handle = find_dissector( "ppp" );
fr_handle = find_dissector( "fr" );

View File

@ -69,10 +69,11 @@ void dissect_pw_satop(tvbuff_t * tvb_original
,pwc_demux_type_t demux)
{
const int encaps_size = 4; /*RTP header in encapsulation is not supported yet*/
gint packet_size;
gint payload_size;
gint padding_size;
gint packet_size;
gint payload_size;
gint padding_size;
pwc_packet_properties_t properties;
enum {
PAY_NO_IDEA = 0
,PAY_LIKE_E1
@ -89,14 +90,11 @@ void dissect_pw_satop(tvbuff_t * tvb_original
*/
if (packet_size < 4) /* 4 is smallest size which may be sensible (for PWACH dissector) */
{
if (tree)
{
proto_item *item;
item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"PW packet size (%d) is too small to carry sensible information"
,(int)packet_size);
}
proto_item *item;
item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA);
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR,
"PW packet size (%d) is too small to carry sensible information"
,(int)packet_size);
col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);
col_set_str(pinfo->cinfo, COL_INFO, "Malformed: PW packet is too small");
return;
@ -145,7 +143,7 @@ void dissect_pw_satop(tvbuff_t * tvb_original
*
* We will use RFC4553's definition here.
*/
int cw_len;
int cw_len;
gint payload_size_from_packet;
cw_len = tvb_get_guint8(tvb_original, 1) & 0x3f;
@ -221,10 +219,7 @@ void dissect_pw_satop(tvbuff_t * tvb_original
}
/* fill up columns*/
if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname);
if (check_col(pinfo->cinfo, COL_INFO))
{
col_clear(pinfo->cinfo, COL_INFO);
@ -249,7 +244,6 @@ void dissect_pw_satop(tvbuff_t * tvb_original
}
if (tree)
{
proto_item* item;
item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA);
@ -456,6 +450,6 @@ void proto_reg_handoff_pw_satop(void)
{
data_handle = find_dissector("data");
pw_padding_handle = find_dissector("pw_padding");
dissector_add_uint("mpls.label", LABEL_INVALID, find_dissector("pw_satop_mpls"));
dissector_add_uint("mpls.label", MPLS_LABEL_INVALID, find_dissector("pw_satop_mpls"));
dissector_add_handle("udp.port", find_dissector("pw_satop_udp")); /* for Decode-As */
}