diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2009-09-10 15:30:10 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2009-09-10 15:30:10 +0000 |
commit | 037f83cb884dd848b35b03f18d94070b78994a9f (patch) | |
tree | df669e0023146b079797991688077bf5126b5ee1 /epan/dissectors/packet-mpls.c | |
parent | 48069c2b011bd76cac68f7dfe292c2b94fed206e (diff) |
From Artem Tamazov via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3903 :
Decoding of UDP-multiplexed CESoPSN and SAToP traffic.
svn path=/trunk/; revision=29842
Diffstat (limited to 'epan/dissectors/packet-mpls.c')
-rw-r--r-- | epan/dissectors/packet-mpls.c | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/epan/dissectors/packet-mpls.c b/epan/dissectors/packet-mpls.c index eb8bf0ad48..4e83dfcbe3 100644 --- a/epan/dissectors/packet-mpls.c +++ b/epan/dissectors/packet-mpls.c @@ -4,7 +4,7 @@ * * (c) Copyright Ashok Narayanan <ashokn@cisco.com> * - * (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 * - PW Associated Channel Header dissection as per RFC 4385 * - PW MPLS Control Word dissection as per RFC 4385 @@ -270,12 +270,12 @@ static const value_string oam_defect_type_vals[] = { }; #if 0 /*not used yet*/ -/* - * MPLS PW types +/* + * MPLS PW types * http://www.iana.org/assignments/pwe3-parameters */ static const value_string mpls_pw_types[] = { - { 0x0001, "Frame Relay DLCI ( Martini Mode )" }, + { 0x0001, "Frame Relay DLCI ( Martini Mode )" }, { 0x0002, "ATM AAL5 SDU VCC transport" }, { 0x0003, "ATM transparent cell transport" }, { 0x0004, "Ethernet Tagged Mode" }, @@ -310,10 +310,10 @@ static const value_string mpls_pw_types[] = { }; #endif -/* +/* * MPLS PW Associated Channel Types * as per http://www.iana.org/assignments/pwe3-parameters - * and http://tools.ietf.org/html/draft-ietf-pwe3-vccv-bfd-05 clause 3.2 + * and http://tools.ietf.org/html/draft-ietf-pwe3-vccv-bfd-05 clause 3.2 */ static const value_string mpls_pwac_types[] = { { 0x0007, "BFD Control, PW-ACH-encapsulated (BFD Without IP/UDP Headers)" }, @@ -389,10 +389,10 @@ dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } next_tvb = tvb_new_subset_remaining(tvb, 4); - if (0x21 == channel_type /*IPv4, RFC4385 clause 6.*/) + if (0x21 == channel_type /*IPv4, RFC4385 clause 6.*/) { call_dissector(dissector_ip, next_tvb, pinfo, tree); - } + } else if (0x7 == channel_type /*PWACH-encapsulated BFD, draft-ietf-pwe3-vccv-bfd-05 3.2*/ || mpls_pref_pwac_all_as_bfd_xipv4) { @@ -411,7 +411,7 @@ dissect_pw_ach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* XXX perhaps this code should be reconsidered */ /* non-standard extension, therefore controlled by option*/ /* appeared in revision 10862 from Carlos M. Pignataro */ - if (!dissector_try_port(ppp_subdissector_table, channel_type, + if (!dissector_try_port(ppp_subdissector_table, channel_type, next_tvb, pinfo, tree)) { call_dissector(dissector_data, next_tvb, pinfo, tree); } @@ -463,7 +463,7 @@ dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return; } - if ( dissect_try_cw_first_nibble( tvb, pinfo, tree )) + if ( dissect_try_cw_first_nibble( tvb, pinfo, tree )) return; /* bits 4 to 7 and FRG bits are displayed together */ @@ -490,24 +490,24 @@ dissect_pw_mcw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } static void -dissect_mpls_oam_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *mpls_tree, +dissect_mpls_oam_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *mpls_tree, int offset, guint8 exp, guint8 bos, guint8 ttl) { proto_tree *mpls_oam_tree = NULL; proto_item *ti = NULL; int functype = -1; const guint8 allone[] = { 0xff, 0xff }; - const guint8 allzero[] = { 0x00, 0x00, 0x00, 0x00, 0x00, + const guint8 allzero[] = { 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - + /* if called with main tree == null just set col info with func type string and return */ if (!tree) { if (check_col(pinfo->cinfo, COL_INFO)) { if (tvb_bytes_exist(tvb, offset, 1)) { functype = tvb_get_guint8(tvb, offset); - col_append_fstr(pinfo->cinfo, COL_INFO, " (OAM: %s)", + col_append_fstr(pinfo->cinfo, COL_INFO, " (OAM: %s)", (functype == 0x01) ? "CV" : (functype == 0x02) ? "FDI" : (functype == 0x03) ? "BDI" : @@ -516,7 +516,7 @@ dissect_mpls_oam_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ } return; } - + /* sanity checks */ if (!mpls_tree) return; @@ -526,65 +526,65 @@ dissect_mpls_oam_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ proto_tree_add_text(mpls_tree, tvb, offset, -1, "Error: must have a minimum payload length of 44 bytes"); return; } - + ti = proto_tree_add_text(mpls_tree, tvb, offset, 44, "MPLS Operation & Maintenance"); mpls_oam_tree = proto_item_add_subtree(ti, ett_mpls_oam); - - if (!mpls_oam_tree) + + if (!mpls_oam_tree) return; - + /* checks for exp, bos and ttl encoding */ - + if (exp!=0) proto_tree_add_text(mpls_oam_tree, tvb, offset - 2, 1, "Warning: Exp bits should be 0 for OAM"); if (bos!=1) proto_tree_add_text(mpls_oam_tree, tvb, offset - 2, 1, "Warning: S bit should be 1 for OAM"); - + if (ttl!=1) proto_tree_add_text(mpls_oam_tree, tvb, offset - 1, 1, "Warning: TTL should be 1 for OAM"); /* starting dissection */ - + functype = tvb_get_guint8(tvb, offset); proto_tree_add_item(mpls_oam_tree, hf_mpls_oam_function_type, tvb, offset, 1, TRUE); offset++; - + switch(functype) { case 0x01: /* CV */ { guint32 lsrid_ipv4addr; - + /* 3 octets reserved (all 0x00) */ if (tvb_memeql(tvb, offset, allzero, 3) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 3, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 3, "Error: these bytes are reserved and must be 0x00"); } offset+=3; - + /* ttsi (ipv4 flavor as in RFC 2373) */ if (tvb_memeql(tvb, offset, allzero, 10) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 10, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 10, "Error: these bytes are padding and must be 0x00"); } offset+=10; - + if (tvb_memeql(tvb, offset, allone, 2) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 2, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 2, "Error: these bytes are padding and must be 0xFF"); } offset+=2; - + lsrid_ipv4addr = tvb_get_ipv4(tvb, offset); proto_tree_add_text(mpls_oam_tree, tvb, offset, 4, "LSR ID: %s", ip_to_str((guint8 *)&lsrid_ipv4addr)); offset+=4; proto_tree_add_text(mpls_oam_tree, tvb, offset, 4, "LSP ID: %d", tvb_get_ntohl(tvb, offset)); offset+=4; - + /* 18 octets of padding (all 0x00) */ if (tvb_memeql(tvb, offset, allzero, 18) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 18, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 18, "Error: these bytes are padding and must be 0x00"); } offset+=18; @@ -595,10 +595,10 @@ dissect_mpls_oam_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ case 0x03: /* BDI */ { guint32 lsrid_ipv4addr; - + /* 1 octets reserved (all 0x00) */ if (tvb_memeql(tvb, offset, allzero, 1) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 3, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 3, "Error: this byte is reserved and must be 0x00"); } offset++; @@ -612,69 +612,69 @@ dissect_mpls_oam_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ offset+=20; } else { if (tvb_memeql(tvb, offset, allzero, 10) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 10, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 10, "Error: these bytes are padding and must be 0x00"); } offset+=10; - + if (tvb_memeql(tvb, offset, allone, 2) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 2, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 2, "Error: these bytes are padding and must be 0xFF"); } offset+=2; - + lsrid_ipv4addr = tvb_get_ipv4(tvb, offset); proto_tree_add_text(mpls_oam_tree, tvb, offset, 4, "LSR ID: %s", ip_to_str((guint8 *)&lsrid_ipv4addr)); offset+=4; - + proto_tree_add_text(mpls_oam_tree, tvb, offset, 4, "LSP ID: %d", tvb_get_ntohl(tvb, offset)); offset+=4; } - + /* defect location */ proto_tree_add_item(mpls_oam_tree, hf_mpls_oam_defect_location, tvb, offset, 4, TRUE); offset+=4; /* 14 octets of padding (all 0x00) */ if (tvb_memeql(tvb, offset, allzero, 14) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 14, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 14, "Error: these bytes are padding and must be 0x00"); } offset+=14; } break; - - case 0x07: /* FDD */ + + case 0x07: /* FDD */ { guint32 lsrid_ipv4addr; - + /* 3 octets reserved (all 0x00) */ if (tvb_memeql(tvb, offset, allzero, 3) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 3, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 3, "Error: these bytes are reserved and must be 0x00"); } offset+=3; - + /* ttsi (ipv4 flavor as in RFC 2373) */ if (tvb_memeql(tvb, offset, allzero, 10) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 10, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 10, "Error: these bytes are padding and must be 0x00"); } offset+=10; - + if (tvb_memeql(tvb, offset, allone, 2) == -1) { - proto_tree_add_text(mpls_oam_tree, tvb, offset, 2, + proto_tree_add_text(mpls_oam_tree, tvb, offset, 2, "Error: these bytes are padding and must be 0xFF"); } offset+=2; - + lsrid_ipv4addr = tvb_get_ipv4(tvb, offset); proto_tree_add_text(mpls_oam_tree, tvb, offset, 4, "LSR ID: %s", ip_to_str((guint8 *)&lsrid_ipv4addr)); offset+=4; proto_tree_add_text(mpls_oam_tree, tvb, offset, 4, "LSP ID: %d", tvb_get_ntohl(tvb, offset)); offset+=4; - + proto_tree_add_item(mpls_oam_tree, hf_mpls_oam_frequency, tvb, offset, 1, TRUE); offset++; @@ -691,7 +691,7 @@ dissect_mpls_oam_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_ proto_tree_add_text(mpls_oam_tree, tvb, offset - 1, -1, "Unknown MPLS OAM pdu"); return; } - + /* BIP16 */ proto_tree_add_item(mpls_oam_tree, hf_mpls_oam_bip16, tvb, offset, 2, TRUE); offset+=2; @@ -715,10 +715,10 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Start Decoding Here. */ while (tvb_reported_length_remaining(tvb, offset) > 0) { - + decode_mpls_label(tvb, offset, &label, &exp, &bos, &ttl); pinfo->mpls_label = label; - + if (tree) { ti = proto_tree_add_item(tree, proto_mpls, tvb, offset, 4, FALSE); @@ -747,11 +747,11 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(mpls_tree,mpls_filter[MPLSF_TTL], tvb, offset+3,1, ttl); - proto_item_append_text(ti, ", TTL: %u", ttl); + proto_item_append_text(ti, ", TTL: %u", ttl); } if (label == LABEL_OAM_ALERT) { - /* OAM pdus are injected in normal data plane flow in order to test a LSP, + /* OAM pdus are injected in normal data plane flow in order to test a LSP, * they carry no user data. */ dissect_mpls_oam_pdu(tvb, pinfo, tree, mpls_tree, offset + 4, exp, bos, ttl); @@ -807,7 +807,7 @@ dissect_mpls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case MDD_MPLS_PW_ATM_AAL5_SDU: call_dissector(dissector_mpls_pw_atm_aal5_sdu, next_tvb, pinfo, tree); break; - default: /*fallthrough*/ + default: /*fallthrough*/ case MDD_MPLS_PW_GENERIC: dissect_pw_mcw(next_tvb, pinfo, tree); break; @@ -839,31 +839,31 @@ proto_register_mpls(void) /* 1st nibble */ {&hf_mpls_1st_nibble, - {"MPLS 1st nibble", "mpls.1st_nibble", FT_UINT8, + {"MPLS 1st nibble", "mpls.1st_nibble", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, /* PW Associated Channel Header fields */ {&hf_mpls_pw_ach_ver, - {"PW Associated Channel Version", "pwach.ver", FT_UINT8, BASE_DEC, + {"PW Associated Channel Version", "pwach.ver", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, {&hf_mpls_pw_ach_res, - {"Reserved", "pwach.res", FT_UINT8, BASE_DEC, + {"Reserved", "pwach.res", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, {&hf_mpls_pw_ach_channel_type, - {"PW Associated Channel Type", "pwach.channel_type", FT_UINT16, BASE_HEX, + {"PW Associated Channel Type", "pwach.channel_type", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, 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, + BASE_HEX, NULL, 0x0, NULL, HFILL }}, {&hf_mpls_pw_mcw_length, {"Generic/Preferred PW MPLS Control Word Length", "pwmcw.length", FT_UINT8, - BASE_DEC, NULL, 0x0, NULL, + BASE_DEC, NULL, 0x0, NULL, HFILL }}, {&hf_mpls_pw_mcw_sequence_number, @@ -873,27 +873,27 @@ proto_register_mpls(void) /* OAM header fields */ {&hf_mpls_oam_function_type, - {"Function Type", "mpls.oam.function_type", FT_UINT8, + {"Function Type", "mpls.oam.function_type", FT_UINT8, BASE_HEX, VALS(oam_function_type_vals), 0x0, "Function Type codepoint", HFILL }}, {&hf_mpls_oam_ttsi, - {"Trail Termination Source Identifier", "mpls.oam.ttsi", FT_UINT32, + {"Trail Termination Source Identifier", "mpls.oam.ttsi", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, {&hf_mpls_oam_frequency, - {"Frequency", "mpls.oam.frequency", FT_UINT8, + {"Frequency", "mpls.oam.frequency", FT_UINT8, BASE_HEX, VALS(oam_frequency_vals), 0x0, "Frequency of probe injection", HFILL }}, {&hf_mpls_oam_defect_type, - {"Defect Type", "mpls.oam.defect_type", FT_UINT16, + {"Defect Type", "mpls.oam.defect_type", FT_UINT16, BASE_HEX, VALS(oam_defect_type_vals), 0x0, NULL, HFILL }}, {&hf_mpls_oam_defect_location, - {"Defect Location (AS)", "mpls.oam.defect_location", FT_UINT32, + {"Defect Location (AS)", "mpls.oam.defect_location", FT_UINT32, BASE_DEC, NULL, 0x0, "Defect Location", HFILL }}, {&hf_mpls_oam_bip16, - {"BIP16", "mpls.oam.bip16", FT_UINT16, + {"BIP16", "mpls.oam.bip16", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, }; @@ -907,7 +907,7 @@ proto_register_mpls(void) /* FF: mpls subdissector table is indexed by label */ mpls_subdissector_table = register_dissector_table("mpls.label", - "MPLS protocol", + "MPLS protocol", FT_UINT32, BASE_DEC); proto_mpls = proto_register_protocol("MultiProtocol Label Switching Header", "MPLS", "mpls"); @@ -996,13 +996,13 @@ proto_reg_handoff_mpls(void) dissector_pw_hdlc_nocw_hdlc_ppp = find_dissector("pw_hdlc_nocw_hdlc_ppp"); dissector_pw_eth_cw = find_dissector("pw_eth_cw"); dissector_pw_eth_nocw = find_dissector("pw_eth_nocw"); - dissector_pw_satop = find_dissector("pw_satop"); + dissector_pw_satop = find_dissector("pw_satop_mpls"); dissector_itdm = find_dissector("itdm"); dissector_mpls_pw_atm_n1_cw = find_dissector("mpls_pw_atm_n1_cw"); dissector_mpls_pw_atm_n1_nocw = find_dissector("mpls_pw_atm_n1_nocw"); dissector_mpls_pw_atm_11_aal5pdu= find_dissector("mpls_pw_atm_11_or_aal5_pdu"); dissector_mpls_pw_atm_aal5_sdu = find_dissector("mpls_pw_atm_aal5_sdu"); - dissector_pw_cesopsn = find_dissector("pw_cesopsn"); + dissector_pw_cesopsn = find_dissector("pw_cesopsn_mpls"); initialized = TRUE; } |