diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-slowprotocols.c | 1508 | ||||
-rw-r--r-- | epan/dissectors/packet-smb-sidsnooping.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-smb.c | 114 | ||||
-rw-r--r-- | epan/dissectors/packet-smtp.c | 50 | ||||
-rw-r--r-- | epan/dissectors/packet-socks.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 1421 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.c | 64 | ||||
-rw-r--r-- | epan/dissectors/packet-tds.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-tpncp.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-turbocell.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.c | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-usb.c | 14 | ||||
-rw-r--r-- | epan/dissectors/packet-v52.c | 23 | ||||
-rw-r--r-- | epan/dissectors/packet-v5ua.c | 8 |
14 files changed, 1621 insertions, 1624 deletions
diff --git a/epan/dissectors/packet-slowprotocols.c b/epan/dissectors/packet-slowprotocols.c index 3465132a86..f781cdc1ca 100644 --- a/epan/dissectors/packet-slowprotocols.c +++ b/epan/dissectors/packet-slowprotocols.c @@ -828,23 +828,23 @@ static int hf_esmc_quality_level_invalid = -1; static int hf_esmc_timestamp = -1; static int hf_esmc_padding = -1; - /* - * The Timestamp TLV and Timestamp Valid Flag fields - * are proposed in WD56 document for G.8264. - * WD56 is not accepted at this moment (June 2009). - * - * The following variable controls dissection of Timestamp fields. - * Implementation is not fully complete yet -- in this version - * Timestamp dissection is always enabled. - * - * I expect that when WD56 proposal for G.8264 will be accepted, - * ESMC Version would be used to control Timestamp dissection. - * In this case this variable will be eliminated (replaced). - * - * Until that, a preference which controls Timestamp - * dissection may be added, if such need arise. - * At the moment this is not practical as nobody needs this. - */ +/* + * The Timestamp TLV and Timestamp Valid Flag fields + * are proposed in WD56 document for G.8264. + * WD56 is not accepted at this moment (June 2009). + * + * The following variable controls dissection of Timestamp fields. + * Implementation is not fully complete yet -- in this version + * Timestamp dissection is always enabled. + * + * I expect that when WD56 proposal for G.8264 will be accepted, + * ESMC Version would be used to control Timestamp dissection. + * In this case this variable will be eliminated (replaced). + * + * Until that, a preference which controls Timestamp + * dissection may be added, if such need arise. + * At the moment this is not practical as nobody needs this. + */ static gboolean pref_decode_esmc_timestamp = TRUE; /* MARKER */ @@ -964,20 +964,20 @@ static const char cont_sep[] = ", "; static dissector_handle_t dh_data; #define APPEND_BOOLEAN_FLAG(flag, item, string) \ - if(flag){ \ - if(item) \ + if(flag){ \ + if(item) \ proto_item_append_text(item, string, sep); \ - sep = cont_sep; \ + sep = cont_sep; \ } #define APPEND_OUI_NAME(item, string, mac) \ - if(item){ \ - string = get_manuf_name(mac); \ - proto_item_append_text(item, " ("); \ - proto_item_append_text(item, "%s", string); \ - proto_item_append_text(item, ")"); \ - } + if(item){ \ + string = get_manuf_name(mac); \ + proto_item_append_text(item, " ("); \ + proto_item_append_text(item, "%s", string); \ + proto_item_append_text(item, ")"); \ + } static void dissect_lacp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); @@ -1538,7 +1538,7 @@ dissect_marker_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * "TLVs for ESMC and Querying Capability". */ static void -dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *treex) { gint offset = 0; /*starting from Slow Protocol Subtype*/ gboolean event_flag; @@ -1546,53 +1546,53 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) gint ql = -1; /*negative means unknown:*/ gboolean timestamp_valid_flag = FALSE; /*set if timestamp valid*/ gint32 timestamp = -1; /*nanoseconds*/ - proto_item *item; + proto_item *item_a; col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESMC"); - item = proto_tree_add_item(tree, proto_slow, tvb, offset, -1, FALSE); - proto_item_append_text(item, ": ESMC"); + item_a = proto_tree_add_item(treex, proto_slow, tvb, offset, -1, FALSE); + proto_item_append_text(item_a, ": ESMC"); { - proto_tree *tree; - tree = proto_item_add_subtree(item, ett_esmc); + proto_tree *tree_a; + tree_a = proto_item_add_subtree(item_a, ett_esmc); - proto_tree_add_item(tree, hf_slow_subtype, tvb, offset, 1, FALSE); + proto_tree_add_item(tree_a, hf_slow_subtype, tvb, offset, 1, FALSE); offset +=1; { /* itu-oui */ const guint8 itu_oui[ESMC_ITU_OUI_SIZE] = {ESMC_ITU_OUI_0,ESMC_ITU_OUI_1,ESMC_ITU_OUI_2}; guint8 itu_oui_read[sizeof(itu_oui)]; - proto_item *item; + proto_item *item_b; tvb_memcpy(tvb, itu_oui_read, offset, sizeof(itu_oui)); - item = proto_tree_add_bytes(tree, hf_esmc_itu_oui, tvb, offset + item_b = proto_tree_add_bytes(tree_a, hf_esmc_itu_oui, tvb, offset , sizeof(itu_oui), itu_oui_read); offset += sizeof(itu_oui); if (memcmp(itu_oui_read, itu_oui, sizeof(itu_oui))) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR + expert_add_info_format(pinfo, item_b, PI_MALFORMED, PI_ERROR ,"IEEE assigned OUI must be %.2X-%.2X-%.2X" ,ESMC_ITU_OUI_0, ESMC_ITU_OUI_1, ESMC_ITU_OUI_2); } } { /* itu subtype */ - proto_item *item; - item = proto_tree_add_item(tree, hf_esmc_itu_subtype, tvb, offset, 2, FALSE); + proto_item *item_b; + item_b = proto_tree_add_item(tree_a, hf_esmc_itu_subtype, tvb, offset, 2, FALSE); if (tvb_get_ntohs(tvb, offset) != ESMC_ITU_SUBTYPE) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR + expert_add_info_format(pinfo, item_b, PI_MALFORMED, PI_ERROR ,"ITU Subtype must be 0x%.4x for all usages defined by G.8264/Y.1364" ,ESMC_ITU_SUBTYPE); } offset += 2; } { /* version */ - proto_item *item; - item = proto_tree_add_item(tree, hf_esmc_version, tvb, offset, 1, FALSE); + proto_item *item_b; + item_b = proto_tree_add_item(tree_a, hf_esmc_version, tvb, offset, 1, FALSE); if ((tvb_get_guint8(tvb, offset) >> 4) != ESMC_VERSION_1) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR + expert_add_info_format(pinfo, item_b, PI_MALFORMED, PI_ERROR ,"Version must be 0x%.1x claim compliance with Version 1 of this protocol" ,ESMC_VERSION_1); } @@ -1600,70 +1600,70 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } { /* event flag */ event_flag = ((tvb_get_guint8(tvb, offset) & 0x08) != 0); - proto_tree_add_item(tree, hf_esmc_event_flag, tvb, offset, 1, FALSE); + proto_tree_add_item(tree_a, hf_esmc_event_flag, tvb, offset, 1, FALSE); /*stay at the same octet in tvb*/ } if (pref_decode_esmc_timestamp) { /* timestamp valid flag */ timestamp_valid_flag = ((tvb_get_guint8(tvb, offset) & 0x04) != 0); - proto_tree_add_item(tree, hf_esmc_timestamp_valid_flag, tvb, offset, 1, FALSE); + proto_tree_add_item(tree_a, hf_esmc_timestamp_valid_flag, tvb, offset, 1, FALSE); /*stay at the same octet in tvb*/ } { /* reserved bits */ - proto_item *item; + proto_item *item_b; guint32 reserved; reserved = tvb_get_ntohl(tvb, offset) & (pref_decode_esmc_timestamp ? 0x3ffffff : 0x7ffffff); - item = proto_tree_add_uint_format_value(tree, hf_esmc_reserved_32, tvb, offset, 4 + item_b = proto_tree_add_uint_format_value(tree_a, hf_esmc_reserved_32, tvb, offset, 4 , reserved, "0x%.7x", reserved); if (reserved != 0x0) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN + expert_add_info_format(pinfo, item_b, PI_MALFORMED, PI_WARN ,"Reserved bits must be set to all zero on transmitter"); } offset += 4; } - proto_item_append_text(item, ", Event:%s", event_flag ? "1" : "0"); + proto_item_append_text(item_a, ", Event:%s", event_flag ? "1" : "0"); /* * Quality Level TLV is mandatory at fixed location. */ { - proto_item *item; + proto_item *item_b; guint8 type; - item = proto_tree_add_item(tree, hf_esmc_tlv, tvb, offset, 4, FALSE); + item_b = proto_tree_add_item(tree_a, hf_esmc_tlv, tvb, offset, 4, FALSE); { - proto_tree *tree; - tree = proto_item_add_subtree(item, ett_esmc); + proto_tree *tree_b; + tree_b = proto_item_add_subtree(item_b, ett_esmc); { - proto_item *item; + proto_item *item_c; guint16 length; guint8 unused; /* type */ type = tvb_get_guint8(tvb, offset); - item = proto_tree_add_item(tree, hf_esmc_tlv_type, tvb, offset, 1, FALSE); + item_c = proto_tree_add_item(tree_b, hf_esmc_tlv_type, tvb, offset, 1, FALSE); if (type != ESMC_QL_TLV_TYPE) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR + expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR ,"TLV Type must be == 0x%.2x (QL) because QL TLV must be first in the ESMC PDU" ,ESMC_QL_TLV_TYPE); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_NOTE + expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE ,"Let's decode as if this is QL TLV"); } offset += 1; /* length */ length = tvb_get_ntohs(tvb, offset); - item = proto_tree_add_item(tree, hf_esmc_tlv_length, tvb, offset, 2, FALSE); + item_c = proto_tree_add_item(tree_b, hf_esmc_tlv_length, tvb, offset, 2, FALSE); if (length != ESMC_QL_TLV_LENGTH) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR + expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR ,"QL TLV Length must be == 0x%.4x", ESMC_QL_TLV_LENGTH); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_NOTE + expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE ,"Let's decode this TLV as if Length has valid value"); } offset += 2; @@ -1672,30 +1672,30 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) unused = tvb_get_guint8(tvb, offset); /*as temp var*/ ql = unused & 0x0f; unused &= 0xf0; - item = proto_tree_add_item(tree, hf_esmc_tlv_ql_unused, tvb, offset, 1, FALSE); + item_c = proto_tree_add_item(tree_b, hf_esmc_tlv_ql_unused, tvb, offset, 1, FALSE); if (unused != 0x00) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN + expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_WARN ,"Unused bits of TLV must be all zeroes"); } if (NULL != match_strval(ql, esmc_quality_level_opt_1_vals)) { - proto_tree_add_item(tree, hf_esmc_quality_level_opt_1, tvb, offset, 1, FALSE); + proto_tree_add_item(tree_b, hf_esmc_quality_level_opt_1, tvb, offset, 1, FALSE); } else { - item = proto_tree_add_item(tree, hf_esmc_quality_level_invalid, tvb, offset, 1, FALSE); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN + item_c = proto_tree_add_item(tree_b, hf_esmc_quality_level_invalid, tvb, offset, 1, FALSE); + expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_WARN ,"Invalid SSM message, unknown QL code"); } offset += 1; } } - proto_item_append_text(item, ", %s" + proto_item_append_text(item_b, ", %s" , val_to_str(ql, esmc_quality_level_opt_1_vals_short, "QL-INV%d")); } - proto_item_append_text(item, ", %s" + proto_item_append_text(item_a, ", %s" , val_to_str(ql, esmc_quality_level_opt_1_vals_short, "QL-INV%d")); if (pref_decode_esmc_timestamp) @@ -1710,67 +1710,67 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (timestamp_valid_flag || type == ESMC_TIMESTAMP_TLV_TYPE) { - proto_item *item; - item = proto_tree_add_item(tree, hf_esmc_tlv, tvb, offset, 8, FALSE); + proto_item *item_b; + item_b = proto_tree_add_item(tree_a, hf_esmc_tlv, tvb, offset, 8, FALSE); { - proto_tree *tree; - tree = proto_item_add_subtree(item, ett_esmc); + proto_tree *tree_b; + tree_b = proto_item_add_subtree(item_b, ett_esmc); { - proto_item *item; + proto_item *item_c; guint16 length; guint8 reserved; /* type */ - item = proto_tree_add_item(tree, hf_esmc_tlv_type, tvb, offset, 1, FALSE); + item_c = proto_tree_add_item(tree_b, hf_esmc_tlv_type, tvb, offset, 1, FALSE); if (type != ESMC_TIMESTAMP_TLV_TYPE) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR + expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR ,"TLV Type must be == 0x%.2x (Timestamp) because Timestamp Valid Flag is set" ,ESMC_TIMESTAMP_TLV_TYPE); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_NOTE + expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE ,"Let's decode as if this is Timestamp TLV"); } offset += 1; /* length */ length = tvb_get_ntohs(tvb, offset); - item = proto_tree_add_item(tree, hf_esmc_tlv_length, tvb, offset, 2, FALSE); + item_c = proto_tree_add_item(tree_b, hf_esmc_tlv_length, tvb, offset, 2, FALSE); if (length != ESMC_TIMESTAMP_TLV_LENGTH) { malformed = TRUE; - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR + expert_add_info_format(pinfo, item_c, PI_MALFORMED, PI_ERROR ,"Timestamp TLV Length must be == 0x%.4x" ,ESMC_TIMESTAMP_TLV_LENGTH); - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_NOTE + expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_NOTE ,"Let's decode this TLV as if Length has valid value"); } offset += 2; /* value */ timestamp = (gint32)tvb_get_ntohl(tvb, offset); - item = proto_tree_add_item(tree, hf_esmc_timestamp, tvb, offset, 4, FALSE); - if (!timestamp_valid_flag) proto_item_append_text(item, " [invalid]"); + item_c = proto_tree_add_item(tree_b, hf_esmc_timestamp, tvb, offset, 4, FALSE); + if (!timestamp_valid_flag) proto_item_append_text(item_c, " [invalid]"); offset += 4; /* reserved */ reserved = tvb_get_guint8(tvb, offset); - item = proto_tree_add_item(tree, hf_esmc_tlv_ts_reserved, tvb, offset, 1, FALSE); + item_c = proto_tree_add_item(tree_b, hf_esmc_tlv_ts_reserved, tvb, offset, 1, FALSE); if (reserved != 0x0) { - expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN + expert_add_info_format(pinfo, item_c, PI_UNDECODED, PI_WARN ,"Reserved bits must be set to all zero"); } offset += 1; } } - proto_item_append_text(item, ", Timestamp: %d ns", timestamp); - if (!timestamp_valid_flag) proto_item_append_text(item, " [invalid]"); + proto_item_append_text(item_b, ", Timestamp: %d ns", timestamp); + if (!timestamp_valid_flag) proto_item_append_text(item_b, " [invalid]"); } } if (timestamp_valid_flag) { - proto_item_append_text(item, ", Timestamp:%d", timestamp); + proto_item_append_text(item_a, ", Timestamp:%d", timestamp); } } @@ -1779,19 +1779,19 @@ dissect_esmc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) padding_size = tvb_length_remaining(tvb, offset); if (0 != padding_size) { - proto_tree* tree; - tree = proto_item_add_subtree(item, ett_esmc); + proto_tree* tree_a; + tree_a = proto_item_add_subtree(item_a, ett_esmc); { - proto_item* item; + proto_item* item_b; tvbuff_t* tvb_next; tvb_next = tvb_new_subset(tvb, offset, padding_size, -1); - item = proto_tree_add_item(tree, hf_esmc_padding, tvb_next, 0, -1, FALSE); - proto_item_append_text(item, ", %d %s%s", padding_size + item_b = proto_tree_add_item(tree_a, hf_esmc_padding, tvb_next, 0, -1, FALSE); + proto_item_append_text(item_b, ", %d %s%s", padding_size , "octet", plurality(padding_size,"","s")); { - proto_tree* tree; - tree = proto_item_add_subtree(item, ett_esmc); - call_dissector(dh_data, tvb_next, pinfo, tree); + proto_tree* tree_b; + tree_b = proto_item_add_subtree(item_b, ett_esmc); + call_dissector(dh_data, tvb_next, pinfo, tree_b); } } } @@ -2777,708 +2777,708 @@ proto_register_slow_protocols(void) { /* Setup list of header fields */ - static hf_register_info hf[] = { + static hf_register_info hf[] = { /* * Generic slow protocol portion */ - { &hf_slow_subtype, - { "Slow Protocols subtype", "slow.subtype", - FT_UINT8, BASE_HEX, VALS(subtype_vals), 0x0, - "Identifies the LACP version", HFILL }}, + { &hf_slow_subtype, + { "Slow Protocols subtype", "slow.subtype", + FT_UINT8, BASE_HEX, VALS(subtype_vals), 0x0, + "Identifies the LACP version", HFILL }}, /* * LACP portion */ - { &hf_lacpdu_version_number, - { "LACP Version Number", "slow.lacp.version", - FT_UINT8, BASE_HEX, NULL, 0x0, - "Identifies the LACP version", HFILL }}, - - { &hf_lacpdu_actor_type, - { "Actor Information", "slow.lacp.actorInfo", - FT_UINT8, BASE_HEX, NULL, 0x0, - "TLV type = Actor", HFILL }}, - - { &hf_lacpdu_actor_info_len, - { "Actor Information Length", "slow.lacp.actorInfoLen", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The length of the Actor TLV", HFILL }}, - - { &hf_lacpdu_actor_sys_priority, - { "Actor System Priority", "slow.lacp.actorSysPriority", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The priority assigned to this System by management or admin", HFILL }}, - - { &hf_lacpdu_actor_sys, - { "Actor System", "slow.lacp.actorSystem", - FT_ETHER, BASE_NONE, NULL, 0x0, - "The Actor's System ID encoded as a MAC address", HFILL }}, - - { &hf_lacpdu_actor_key, - { "Actor Key", "slow.lacp.actorKey", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The operational Key value assigned to the port by the Actor", HFILL }}, - - { &hf_lacpdu_actor_port_priority, - { "Actor Port Priority", "slow.lacp.actorPortPriority", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The priority assigned to the port by the Actor (via Management or Admin)", HFILL }}, - - { &hf_lacpdu_actor_port, - { "Actor Port", "slow.lacp.actorPort", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The port number assigned to the port by the Actor (via Management or Admin)", HFILL }}, - - { &hf_lacpdu_actor_state, - { "Actor State", "slow.lacp.actorState", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The Actor's state variables for the port, encoded as bits within a single octet", HFILL }}, - - { &hf_lacpdu_flags_a_activity, - { "LACP Activity", "slow.lacp.actorState.activity", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_ACTIVITY, - "Activity control value for this link. Active = 1, Passive = 0", HFILL }}, - - { &hf_lacpdu_flags_a_timeout, - { "LACP Timeout", "slow.lacp.actorState.timeout", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_TIMEOUT, - "Timeout control value for this link. Short Timeout = 1, Long Timeout = 0", HFILL }}, - - { &hf_lacpdu_flags_a_aggregation, - { "Aggregation", "slow.lacp.actorState.aggregation", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_AGGREGATION, - "Aggregatable = 1, Individual = 0", HFILL }}, - - { &hf_lacpdu_flags_a_sync, - { "Synchronization", "slow.lacp.actorState.synchronization", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_SYNC, - "In Sync = 1, Out of Sync = 0", HFILL }}, - - { &hf_lacpdu_flags_a_collecting, - { "Collecting", "slow.lacp.actorState.collecting", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_COLLECTING, - "Collection of incoming frames is: Enabled = 1, Disabled = 0", HFILL }}, - - { &hf_lacpdu_flags_a_distrib, - { "Distributing", "slow.lacp.actorState.distributing", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DISTRIB, - "Distribution of outgoing frames is: Enabled = 1, Disabled = 0", HFILL }}, - - { &hf_lacpdu_flags_a_defaulted, - { "Defaulted", "slow.lacp.actorState.defaulted", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DEFAULTED, - "1 = Actor Rx machine is using DEFAULT Partner info, 0 = using info in Rx'd LACPDU", HFILL }}, - - { &hf_lacpdu_flags_a_expired, - { "Expired", "slow.lacp.actorState.expired", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_EXPIRED, - "1 = Actor Rx machine is EXPIRED, 0 = is NOT EXPIRED", HFILL }}, - - { &hf_lacpdu_actor_reserved, - { "Reserved", "slow.lacp.reserved", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_lacpdu_partner_type, - { "Partner Information", "slow.lacp.partnerInfo", - FT_UINT8, BASE_HEX, NULL, 0x0, - "TLV type = Partner", HFILL }}, - - { &hf_lacpdu_partner_info_len, - { "Partner Information Length", "slow.lacp.partnerInfoLen", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The length of the Partner TLV", HFILL }}, - - { &hf_lacpdu_partner_sys_priority, - { "Partner System Priority", "slow.lacp.partnerSysPriority", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The priority assigned to the Partner System by management or admin", HFILL }}, - - { &hf_lacpdu_partner_sys, - { "Partner System", "slow.lacp.partnerSystem", - FT_ETHER, BASE_NONE, NULL, 0x0, - "The Partner's System ID encoded as a MAC address", HFILL }}, - - { &hf_lacpdu_partner_key, - { "Partner Key", "slow.lacp.partnerKey", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The operational Key value assigned to the port associated with this link by the Partner", HFILL }}, - - { &hf_lacpdu_partner_port_priority, - { "Partner Port Priority", "slow.lacp.partnerPortPriority", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The priority assigned to the port by the Partner (via Management or Admin)", HFILL }}, - - { &hf_lacpdu_partner_port, - { "Partner Port", "slow.lacp.partnerPort", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The port number associated with this link assigned to the port by the Partner (via Management or Admin)", HFILL }}, - - { &hf_lacpdu_partner_state, - { "Partner State", "slow.lacp.partnerState", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The Partner's state variables for the port, encoded as bits within a single octet", HFILL }}, - - { &hf_lacpdu_flags_p_activity, - { "LACP Activity", "slow.lacp.partnerState.activity", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_ACTIVITY, - "Activity control value for this link. Active = 1, Passive = 0", HFILL }}, - - { &hf_lacpdu_flags_p_timeout, - { "LACP Timeout", "slow.lacp.partnerState.timeout", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_TIMEOUT, - "Timeout control value for this link. Short Timeout = 1, Long Timeout = 0", HFILL }}, - - { &hf_lacpdu_flags_p_aggregation, - { "Aggregation", "slow.lacp.partnerState.aggregation", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_AGGREGATION, - "Aggregatable = 1, Individual = 0", HFILL }}, - - { &hf_lacpdu_flags_p_sync, - { "Synchronization", "slow.lacp.partnerState.synchronization", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_SYNC, - "In Sync = 1, Out of Sync = 0", HFILL }}, - - { &hf_lacpdu_flags_p_collecting, - { "Collecting", "slow.lacp.partnerState.collecting", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_COLLECTING, - "Collection of incoming frames is: Enabled = 1, Disabled = 0", HFILL }}, - - { &hf_lacpdu_flags_p_distrib, - { "Distributing", "slow.lacp.partnerState.distributing", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DISTRIB, - "Distribution of outgoing frames is: Enabled = 1, Disabled = 0", HFILL }}, - - { &hf_lacpdu_flags_p_defaulted, - { "Defaulted", "slow.lacp.partnerState.defaulted", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DEFAULTED, - "1 = Actor Rx machine is using DEFAULT Partner info, 0 = using info in Rx'd LACPDU", HFILL }}, - - { &hf_lacpdu_flags_p_expired, - { "Expired", "slow.lacp.partnerState.expired", - FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_EXPIRED, - "1 = Actor Rx machine is EXPIRED, 0 = is NOT EXPIRED", HFILL }}, - - { &hf_lacpdu_partner_reserved, - { "Reserved", "slow.lacp.reserved", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_lacpdu_coll_type, - { "Collector Information", "slow.lacp.collectorInfo", - FT_UINT8, BASE_HEX, NULL, 0x0, - "TLV type = Collector", HFILL }}, - - { &hf_lacpdu_coll_info_len, - { "Collector Information Length", "slow.lacp.collectorInfoLen", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The length of the Collector TLV", HFILL }}, - - { &hf_lacpdu_coll_max_delay, - { "Collector Max Delay", "slow.lacp.collectorMaxDelay", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The max delay of the station tx'ing the LACPDU (in tens of usecs)", HFILL }}, - - { &hf_lacpdu_coll_reserved, - { "Reserved", "slow.lacp.coll_reserved", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_lacpdu_term_type, - { "Terminator Information", "slow.lacp.termInfo", - FT_UINT8, BASE_HEX, NULL, 0x0, - "TLV type = Terminator", HFILL }}, - - { &hf_lacpdu_term_len, - { "Terminator Length", "slow.lacp.termLen", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The length of the Terminator TLV", HFILL }}, - - { &hf_lacpdu_term_reserved, - { "Reserved", "slow.lacp.term_reserved", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, + { &hf_lacpdu_version_number, + { "LACP Version Number", "slow.lacp.version", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Identifies the LACP version", HFILL }}, + + { &hf_lacpdu_actor_type, + { "Actor Information", "slow.lacp.actorInfo", + FT_UINT8, BASE_HEX, NULL, 0x0, + "TLV type = Actor", HFILL }}, + + { &hf_lacpdu_actor_info_len, + { "Actor Information Length", "slow.lacp.actorInfoLen", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The length of the Actor TLV", HFILL }}, + + { &hf_lacpdu_actor_sys_priority, + { "Actor System Priority", "slow.lacp.actorSysPriority", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The priority assigned to this System by management or admin", HFILL }}, + + { &hf_lacpdu_actor_sys, + { "Actor System", "slow.lacp.actorSystem", + FT_ETHER, BASE_NONE, NULL, 0x0, + "The Actor's System ID encoded as a MAC address", HFILL }}, + + { &hf_lacpdu_actor_key, + { "Actor Key", "slow.lacp.actorKey", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The operational Key value assigned to the port by the Actor", HFILL }}, + + { &hf_lacpdu_actor_port_priority, + { "Actor Port Priority", "slow.lacp.actorPortPriority", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The priority assigned to the port by the Actor (via Management or Admin)", HFILL }}, + + { &hf_lacpdu_actor_port, + { "Actor Port", "slow.lacp.actorPort", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The port number assigned to the port by the Actor (via Management or Admin)", HFILL }}, + + { &hf_lacpdu_actor_state, + { "Actor State", "slow.lacp.actorState", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The Actor's state variables for the port, encoded as bits within a single octet", HFILL }}, + + { &hf_lacpdu_flags_a_activity, + { "LACP Activity", "slow.lacp.actorState.activity", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_ACTIVITY, + "Activity control value for this link. Active = 1, Passive = 0", HFILL }}, + + { &hf_lacpdu_flags_a_timeout, + { "LACP Timeout", "slow.lacp.actorState.timeout", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_TIMEOUT, + "Timeout control value for this link. Short Timeout = 1, Long Timeout = 0", HFILL }}, + + { &hf_lacpdu_flags_a_aggregation, + { "Aggregation", "slow.lacp.actorState.aggregation", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_AGGREGATION, + "Aggregatable = 1, Individual = 0", HFILL }}, + + { &hf_lacpdu_flags_a_sync, + { "Synchronization", "slow.lacp.actorState.synchronization", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_SYNC, + "In Sync = 1, Out of Sync = 0", HFILL }}, + + { &hf_lacpdu_flags_a_collecting, + { "Collecting", "slow.lacp.actorState.collecting", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_COLLECTING, + "Collection of incoming frames is: Enabled = 1, Disabled = 0", HFILL }}, + + { &hf_lacpdu_flags_a_distrib, + { "Distributing", "slow.lacp.actorState.distributing", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DISTRIB, + "Distribution of outgoing frames is: Enabled = 1, Disabled = 0", HFILL }}, + + { &hf_lacpdu_flags_a_defaulted, + { "Defaulted", "slow.lacp.actorState.defaulted", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DEFAULTED, + "1 = Actor Rx machine is using DEFAULT Partner info, 0 = using info in Rx'd LACPDU", HFILL }}, + + { &hf_lacpdu_flags_a_expired, + { "Expired", "slow.lacp.actorState.expired", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_EXPIRED, + "1 = Actor Rx machine is EXPIRED, 0 = is NOT EXPIRED", HFILL }}, + + { &hf_lacpdu_actor_reserved, + { "Reserved", "slow.lacp.reserved", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_lacpdu_partner_type, + { "Partner Information", "slow.lacp.partnerInfo", + FT_UINT8, BASE_HEX, NULL, 0x0, + "TLV type = Partner", HFILL }}, + + { &hf_lacpdu_partner_info_len, + { "Partner Information Length", "slow.lacp.partnerInfoLen", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The length of the Partner TLV", HFILL }}, + + { &hf_lacpdu_partner_sys_priority, + { "Partner System Priority", "slow.lacp.partnerSysPriority", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The priority assigned to the Partner System by management or admin", HFILL }}, + + { &hf_lacpdu_partner_sys, + { "Partner System", "slow.lacp.partnerSystem", + FT_ETHER, BASE_NONE, NULL, 0x0, + "The Partner's System ID encoded as a MAC address", HFILL }}, + + { &hf_lacpdu_partner_key, + { "Partner Key", "slow.lacp.partnerKey", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The operational Key value assigned to the port associated with this link by the Partner", HFILL }}, + + { &hf_lacpdu_partner_port_priority, + { "Partner Port Priority", "slow.lacp.partnerPortPriority", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The priority assigned to the port by the Partner (via Management or Admin)", HFILL }}, + + { &hf_lacpdu_partner_port, + { "Partner Port", "slow.lacp.partnerPort", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The port number associated with this link assigned to the port by the Partner (via Management or Admin)", HFILL }}, + + { &hf_lacpdu_partner_state, + { "Partner State", "slow.lacp.partnerState", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The Partner's state variables for the port, encoded as bits within a single octet", HFILL }}, + + { &hf_lacpdu_flags_p_activity, + { "LACP Activity", "slow.lacp.partnerState.activity", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_ACTIVITY, + "Activity control value for this link. Active = 1, Passive = 0", HFILL }}, + + { &hf_lacpdu_flags_p_timeout, + { "LACP Timeout", "slow.lacp.partnerState.timeout", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_TIMEOUT, + "Timeout control value for this link. Short Timeout = 1, Long Timeout = 0", HFILL }}, + + { &hf_lacpdu_flags_p_aggregation, + { "Aggregation", "slow.lacp.partnerState.aggregation", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_AGGREGATION, + "Aggregatable = 1, Individual = 0", HFILL }}, + + { &hf_lacpdu_flags_p_sync, + { "Synchronization", "slow.lacp.partnerState.synchronization", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_SYNC, + "In Sync = 1, Out of Sync = 0", HFILL }}, + + { &hf_lacpdu_flags_p_collecting, + { "Collecting", "slow.lacp.partnerState.collecting", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_COLLECTING, + "Collection of incoming frames is: Enabled = 1, Disabled = 0", HFILL }}, + + { &hf_lacpdu_flags_p_distrib, + { "Distributing", "slow.lacp.partnerState.distributing", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DISTRIB, + "Distribution of outgoing frames is: Enabled = 1, Disabled = 0", HFILL }}, + + { &hf_lacpdu_flags_p_defaulted, + { "Defaulted", "slow.lacp.partnerState.defaulted", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_DEFAULTED, + "1 = Actor Rx machine is using DEFAULT Partner info, 0 = using info in Rx'd LACPDU", HFILL }}, + + { &hf_lacpdu_flags_p_expired, + { "Expired", "slow.lacp.partnerState.expired", + FT_BOOLEAN, 8, TFS(&tfs_yes_no), LACPDU_FLAGS_EXPIRED, + "1 = Actor Rx machine is EXPIRED, 0 = is NOT EXPIRED", HFILL }}, + + { &hf_lacpdu_partner_reserved, + { "Reserved", "slow.lacp.reserved", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_lacpdu_coll_type, + { "Collector Information", "slow.lacp.collectorInfo", + FT_UINT8, BASE_HEX, NULL, 0x0, + "TLV type = Collector", HFILL }}, + + { &hf_lacpdu_coll_info_len, + { "Collector Information Length", "slow.lacp.collectorInfoLen", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The length of the Collector TLV", HFILL }}, + + { &hf_lacpdu_coll_max_delay, + { "Collector Max Delay", "slow.lacp.collectorMaxDelay", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The max delay of the station tx'ing the LACPDU (in tens of usecs)", HFILL }}, + + { &hf_lacpdu_coll_reserved, + { "Reserved", "slow.lacp.coll_reserved", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_lacpdu_term_type, + { "Terminator Information", "slow.lacp.termInfo", + FT_UINT8, BASE_HEX, NULL, 0x0, + "TLV type = Terminator", HFILL }}, + + { &hf_lacpdu_term_len, + { "Terminator Length", "slow.lacp.termLen", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The length of the Terminator TLV", HFILL }}, + + { &hf_lacpdu_term_reserved, + { "Reserved", "slow.lacp.term_reserved", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, /* * MARKER portion */ - { &hf_marker_version_number, - { "Version Number", "slow.marker.version", - FT_UINT8, BASE_HEX, NULL, 0x0, - "Identifies the Marker version", HFILL }}, + { &hf_marker_version_number, + { "Version Number", "slow.marker.version", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Identifies the Marker version", HFILL }}, - { &hf_marker_tlv_type, - { "TLV Type", "slow.marker.tlvType", - FT_UINT8, BASE_HEX, VALS(marker_vals), 0x0, - "Marker TLV type", HFILL }}, + { &hf_marker_tlv_type, + { "TLV Type", "slow.marker.tlvType", + FT_UINT8, BASE_HEX, VALS(marker_vals), 0x0, + "Marker TLV type", HFILL }}, - { &hf_marker_tlv_length, - { "TLV Length", "slow.marker.tlvLen", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The length of the Actor TLV", HFILL }}, + { &hf_marker_tlv_length, + { "TLV Length", "slow.marker.tlvLen", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The length of the Actor TLV", HFILL }}, - { &hf_marker_req_port, - { "Requester Port", "slow.marker.requesterPort", - FT_UINT16, BASE_DEC, NULL, 0x0, - "The Requester Port", HFILL }}, + { &hf_marker_req_port, + { "Requester Port", "slow.marker.requesterPort", + FT_UINT16, BASE_DEC, NULL, 0x0, + "The Requester Port", HFILL }}, - { &hf_marker_req_system, - { "Requester System", "slow.marker.requesterSystem", - FT_ETHER, BASE_NONE, NULL, 0x0, - "The Requester System ID encoded as a MAC address", HFILL }}, + { &hf_marker_req_system, + { "Requester System", "slow.marker.requesterSystem", + FT_ETHER, BASE_NONE, NULL, 0x0, + "The Requester System ID encoded as a MAC address", HFILL }}, - { &hf_marker_req_trans_id, - { "Requester Transaction ID", "slow.marker.requesterTransId", - FT_UINT32, BASE_DEC, NULL, 0x0, - "The Requester Transaction ID", HFILL }}, + { &hf_marker_req_trans_id, + { "Requester Transaction ID", "slow.marker.requesterTransId", + FT_UINT32, BASE_DEC, NULL, 0x0, + "The Requester Transaction ID", HFILL }}, /* * ESMC portion */ - { &hf_esmc_itu_oui, - { "ITU-OUI", "slow.esmc.itu_oui", - FT_BYTES, BASE_NONE, NULL, 0, - "IEEE assigned Organizationally Unique Identifier for ITU-T", HFILL }}, - - { &hf_esmc_itu_subtype, - { "ITU Subtype", "slow.esmc.itu_subtype", - FT_UINT16, BASE_HEX, NULL, 0, - "The ITU Subtype is assigned by the ITU-T TSB", HFILL }}, - - { &hf_esmc_version, - { "Version", "slow.esmc.version", - FT_UINT8, BASE_HEX, NULL, 0xf0, - "This field indicates the version of ITU-T SG15 Q13 OSSP frame format", HFILL }}, - - { &hf_esmc_event_flag, - { "Event Flag", "slow.esmc.event_flag", - FT_UINT8, BASE_HEX, VALS(esmc_event_flag_vals), 0x08, - "This bit distinguishes the critical, time sensitive behaviour of the" - " ESMC Event PDU from the ESMC Information PDU", HFILL }}, - - { &hf_esmc_timestamp_valid_flag, - { "Timestamp Valid Flag", "slow.esmc.timestamp_valid_flag", - FT_UINT8, BASE_HEX, VALS(esmc_timestamp_valid_flag_vals), 0x04, - "Indicates validity (i.e. presence) of the Timestamp TLV", HFILL }}, - - { &hf_esmc_reserved_32, - { "Reserved", "slow.esmc.reserved", - FT_UINT32, BASE_HEX, NULL, 0, - "Reserved. Set to all zero at the transmitter and ignored by the receiver", HFILL }}, - - { &hf_esmc_tlv, - { "ESMC TLV", "slow.esmc.tlv", - FT_NONE, BASE_NONE, NULL, 0, - NULL, HFILL }}, - - { &hf_esmc_tlv_type, - { "TLV Type", "slow.esmc.tlv_type", - FT_UINT8, BASE_HEX, VALS(esmc_tlv_type_vals), 0, - NULL, HFILL }}, - - { &hf_esmc_tlv_length, - { "TLV Length", "slow.esmc.tlv_length", - FT_UINT16, BASE_HEX, NULL, 0, - NULL, HFILL }}, - - { &hf_esmc_tlv_ql_unused, - { "Unused", "slow.esmc.tlv_ql_unused", - FT_UINT8, BASE_HEX, NULL, 0xf0, - "This field is not used in QL TLV", HFILL }}, - - { &hf_esmc_quality_level_opt_1, - { "SSM Code", "slow.esmc.ql", - FT_UINT8, BASE_HEX, VALS(esmc_quality_level_opt_1_vals), 0x0f, - "Quality Level information", HFILL }}, + { &hf_esmc_itu_oui, + { "ITU-OUI", "slow.esmc.itu_oui", + FT_BYTES, BASE_NONE, NULL, 0, + "IEEE assigned Organizationally Unique Identifier for ITU-T", HFILL }}, + + { &hf_esmc_itu_subtype, + { "ITU Subtype", "slow.esmc.itu_subtype", + FT_UINT16, BASE_HEX, NULL, 0, + "The ITU Subtype is assigned by the ITU-T TSB", HFILL }}, + + { &hf_esmc_version, + { "Version", "slow.esmc.version", + FT_UINT8, BASE_HEX, NULL, 0xf0, + "This field indicates the version of ITU-T SG15 Q13 OSSP frame format", HFILL }}, + + { &hf_esmc_event_flag, + { "Event Flag", "slow.esmc.event_flag", + FT_UINT8, BASE_HEX, VALS(esmc_event_flag_vals), 0x08, + "This bit distinguishes the critical, time sensitive behaviour of the" + " ESMC Event PDU from the ESMC Information PDU", HFILL }}, + + { &hf_esmc_timestamp_valid_flag, + { "Timestamp Valid Flag", "slow.esmc.timestamp_valid_flag", + FT_UINT8, BASE_HEX, VALS(esmc_timestamp_valid_flag_vals), 0x04, + "Indicates validity (i.e. presence) of the Timestamp TLV", HFILL }}, + + { &hf_esmc_reserved_32, + { "Reserved", "slow.esmc.reserved", + FT_UINT32, BASE_HEX, NULL, 0, + "Reserved. Set to all zero at the transmitter and ignored by the receiver", HFILL }}, + + { &hf_esmc_tlv, + { "ESMC TLV", "slow.esmc.tlv", + FT_NONE, BASE_NONE, NULL, 0, + NULL, HFILL }}, + + { &hf_esmc_tlv_type, + { "TLV Type", "slow.esmc.tlv_type", + FT_UINT8, BASE_HEX, VALS(esmc_tlv_type_vals), 0, + NULL, HFILL }}, + + { &hf_esmc_tlv_length, + { "TLV Length", "slow.esmc.tlv_length", + FT_UINT16, BASE_HEX, NULL, 0, + NULL, HFILL }}, + + { &hf_esmc_tlv_ql_unused, + { "Unused", "slow.esmc.tlv_ql_unused", + FT_UINT8, BASE_HEX, NULL, 0xf0, + "This field is not used in QL TLV", HFILL }}, + + { &hf_esmc_quality_level_opt_1, + { "SSM Code", "slow.esmc.ql", + FT_UINT8, BASE_HEX, VALS(esmc_quality_level_opt_1_vals), 0x0f, + "Quality Level information", HFILL }}, #if 0 /*not used yet*/ - { &hf_esmc_quality_level_opt_2, - { "SSM Code", "slow.esmc.ql", - FT_UINT8, BASE_HEX, VALS(esmc_quality_level_opt_2_vals), 0x0f, - "Quality Level information", HFILL }}, + { &hf_esmc_quality_level_opt_2, + { "SSM Code", "slow.esmc.ql", + FT_UINT8, BASE_HEX, VALS(esmc_quality_level_opt_2_vals), 0x0f, + "Quality Level information", HFILL }}, #endif - { &hf_esmc_quality_level_invalid, - { "SSM Code", "slow.esmc.ql", - FT_UINT8, BASE_HEX, VALS(esmc_quality_level_invalid_vals), 0x0f, - "Quality Level information", HFILL }}, + { &hf_esmc_quality_level_invalid, + { "SSM Code", "slow.esmc.ql", + FT_UINT8, BASE_HEX, VALS(esmc_quality_level_invalid_vals), 0x0f, + "Quality Level information", HFILL }}, - { &hf_esmc_timestamp, - { "Timestamp (ns)", "slow.esmc.timestamp", - FT_INT32, BASE_DEC, NULL, 0, - "Timestamp according to the \"whole nanoseconds\" part of the IEEE 1588 originTimestamp", HFILL }}, + { &hf_esmc_timestamp, + { "Timestamp (ns)", "slow.esmc.timestamp", + FT_INT32, BASE_DEC, NULL, 0, + "Timestamp according to the \"whole nanoseconds\" part of the IEEE 1588 originTimestamp", HFILL }}, - { &hf_esmc_tlv_ts_reserved, - { "Reserved", "slow.esmc.tlv_ts_reserved", - FT_UINT8, BASE_HEX, NULL, 0, - "Reserved. Set to all zero at the transmitter and ignored by the receiver", HFILL }}, + { &hf_esmc_tlv_ts_reserved, + { "Reserved", "slow.esmc.tlv_ts_reserved", + FT_UINT8, BASE_HEX, NULL, 0, + "Reserved. Set to all zero at the transmitter and ignored by the receiver", HFILL }}, - { &hf_esmc_padding, - { "Padding", "slow.esmc.padding", - FT_BYTES, BASE_NONE, NULL, 0x0, - "This field contains necessary padding to achieve the minimum frame size of 64 bytes at least", HFILL }}, + { &hf_esmc_padding, + { "Padding", "slow.esmc.padding", + FT_BYTES, BASE_NONE, NULL, 0x0, + "This field contains necessary padding to achieve the minimum frame size of 64 bytes at least", HFILL }}, /* * OAMPDU portion */ - { &hf_oampdu_flags, - { "Flags", "slow.oam.flags", - FT_UINT16, BASE_HEX, NULL, 0x0, - "The Flags Field", HFILL }}, - - { &hf_oampdu_flags_link_fault, - { "Link Fault", "slow.oam.flags.linkFault", - FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_LINK_FAULT, - "The PHY detected a fault in the receive direction. True = 1, False = 0", HFILL }}, - - { &hf_oampdu_flags_dying_gasp, - { "Dying Gasp", "slow.oam.flags.dyingGasp", - FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_DYING_GASP, - "An unrecoverable local failure occured. True = 1, False = 0", HFILL }}, - - { &hf_oampdu_flags_critical_event, - { "Critical Event", "slow.oam.flags.criticalEvent", - FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_CRITICAL_EVENT, - "A critical event has occurred. True = 1, False = 0", HFILL }}, - - { &hf_oampdu_flags_local_evaluating, - { "Local Evaluating", "slow.oam.flags.localEvaluating", - FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_LOCAL_EVAL, - "Local DTE Discovery process in progress. True = 1, False = 0", HFILL }}, - - { &hf_oampdu_flags_local_stable, - { "Local Stable", "slow.oam.flags.localStable", - FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_LOCAL_STABLE, - "Local DTE is Stable. True = 1, False = 0", HFILL }}, - - { &hf_oampdu_flags_remote_evaluating, - { "Remote Evaluating", "slow.oam.flags.remoteEvaluating", - FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_REMOTE_EVAL, - "Remote DTE Discovery process in progress. True = 1, False = 0", HFILL }}, - - { &hf_oampdu_flags_remote_stable, - { "Remote Stable", "slow.oam.flags.remoteStable", - FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_REMOTE_STABLE, - "Remote DTE is Stable. True = 1, False = 0", HFILL }}, - - { &hf_oampdu_code, - { "OAMPDU code", "slow.oam.code", - FT_UINT8, BASE_HEX, VALS(code_vals), 0x0, - "Identifies the TLVs code", HFILL }}, - - { &hf_oampdu_info_type, - { "Type", "slow.oam.info.type", - FT_UINT8, BASE_HEX, VALS(info_type_vals), 0x0, - "Identifies the TLV type", HFILL }}, - - { &hf_oampdu_info_len, - { "TLV Length", "slow.oam.info.length", - FT_UINT8, BASE_DEC, NULL, 0x0, - "Identifies the TLVs type", HFILL }}, - - { &hf_oampdu_info_version, - { "TLV Version", "slow.oam.info.version", - FT_UINT8, BASE_HEX, NULL, 0x0, - "Identifies the TLVs version", HFILL }}, - - { &hf_oampdu_info_revision, - { "TLV Revision", "slow.oam.info.revision", - FT_UINT16, BASE_DEC, NULL, 0x0, - "Identifies the TLVs revision", HFILL }}, - - { &hf_oampdu_info_state, - { "OAM DTE States", "slow.oam.info.state", - FT_UINT8, BASE_HEX, NULL, 0x0, - "OAM DTE State of the Mux and the Parser", HFILL }}, - - { &hf_oampdu_info_state_parser, - { "Parser Action", "slow.oam.info.state.parser", - FT_UINT8, BASE_HEX, VALS(parser_vals), 0x03, - NULL, HFILL }}, - - { &hf_oampdu_info_state_mux, - { "Muxiplexer Action", "slow.oam.info.state.muxiplexer", - FT_BOOLEAN, 8, TFS(&mux), 0x04, - NULL, HFILL }}, - - { &hf_oampdu_info_oamConfig, - { "OAM Configuration", "slow.oam.info.oamConfig", - FT_UINT8, BASE_HEX, NULL, 0x0, - NULL, HFILL }}, - - { &hf_oampdu_info_oamConfig_mode, - { "OAM Mode", "slow.oam.info.oamConfig.mode", - FT_BOOLEAN, 8, TFS(&oam_mode), OAMPDU_INFO_CONFIG_MODE, - NULL, HFILL }}, - - { &hf_oampdu_info_oamConfig_uni, - { "Unidirectional support", "slow.oam.flags.dyingGasp", - FT_BOOLEAN, 8, TFS(&oam_uni), OAMPDU_INFO_CONFIG_UNI, - NULL, HFILL }}, - - { &hf_oampdu_info_oamConfig_lpbk, - { "Loopback support", "slow.oam.flags.criticalEvent", - FT_BOOLEAN, 8, TFS(&oam_lpbk), OAMPDU_INFO_CONFIG_LPBK, - NULL, HFILL }}, - - { &hf_oampdu_info_oamConfig_event, - { "Link Events support", "slow.oam.flags.localEvaluating", - FT_BOOLEAN, 8, TFS(&oam_event), OAMPDU_INFO_CONFIG_EVENT, - NULL, HFILL }}, - - { &hf_oampdu_info_oamConfig_var, - { "Variable Retrieval", "slow.oam.flags.localStable", - FT_BOOLEAN, 8, TFS(&oam_var), OAMPDU_INFO_CONFIG_VAR, - "Variable Retrieval support", HFILL }}, - - { &hf_oampdu_info_oampduConfig, - { "Max OAMPDU Size", "slow.oam.info.oampduConfig", - FT_UINT16, BASE_DEC, NULL, 0x0, - "OAMPDU Configuration", HFILL }}, - - { &hf_oampdu_info_oui, - { "Organizationally Unique Identifier", "slow.oam.info.oui", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - { &hf_oampdu_info_vendor, - { "Vendor Specific Information", "slow.oam.info.vendor", - FT_BYTES, BASE_NONE, NULL, 0x0, - NULL, HFILL }}, - - /* - * Event notification definitions - */ - { &hf_oampdu_event_sequence, - { "Sequence Number", "slow.oam.event.sequence", - FT_UINT16, BASE_DEC, NULL, 0x0, - "Identifies the Event Notification TLVs", HFILL }}, - - { &hf_oampdu_event_type, - { "Event Type", "slow.oam.event.type", - FT_UINT8, BASE_HEX, VALS(event_type_vals), 0x0, - "Identifies the TLV type", HFILL }}, - - { &hf_oampdu_event_length, - { "Event Length", "slow.oam.event.length", - FT_UINT8, BASE_HEX, NULL, 0x0, - "This field indicates the length in octets of the TLV-tuple", HFILL }}, - - { &hf_oampdu_event_timeStamp, - { "Event Timestamp (100ms)", "slow.oam.event.timestamp", - FT_UINT16, BASE_DEC, NULL, 0x0, - "Event Time Stamp in term of 100 ms intervals", HFILL }}, - - /* Errored Symbol Period Event TLV */ - { &hf_oampdu_event_espeWindow, - { "Errored Symbol Window", "slow.oam.event.espeWindow", - FT_UINT64, BASE_DEC, NULL, 0x0, - "Number of symbols in the period", HFILL }}, - - { &hf_oampdu_event_espeThreshold, - { "Errored Symbol Threshold", "slow.oam.event.espeThreshold", - FT_UINT64, BASE_DEC, NULL, 0x0, - "Number of symbols required to generate the Event", HFILL }}, - - { &hf_oampdu_event_espeErrors, - { "Errored Symbols", "slow.oam.event.espeErrors", - FT_UINT64, BASE_DEC, NULL, 0x0, - "Number of symbols in error", HFILL }}, - - { &hf_oampdu_event_espeTotalErrors, - { "Error Running Total", "slow.oam.event.espeTotalErrors", - FT_UINT64, BASE_DEC, NULL, 0x0, - "Number of symbols in error since reset of the sublayer", HFILL }}, - - { &hf_oampdu_event_espeTotalEvents, - { "Event Running Total", "slow.oam.event.espeTotalEvents", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Total Event generated since reset of the sublayer", HFILL }}, - - /* Errored Frame Event TLV */ - { &hf_oampdu_event_efeWindow, - { "Errored Frame Window", "slow.oam.event.efeWindow", - FT_UINT16, BASE_DEC, NULL, 0x0, - "Number of symbols in the period", HFILL }}, - - { &hf_oampdu_event_efeThreshold, - { "Errored Frame Threshold", "slow.oam.event.efeThreshold", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Number of frames required to generate the Event", HFILL }}, - - { &hf_oampdu_event_efeErrors, - { "Errored Frames", "slow.oam.event.efeErrors", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Number of symbols in error", HFILL }}, - - { &hf_oampdu_event_efeTotalErrors, - { "Error Running Total", "slow.oam.event.efeTotalErrors", - FT_UINT64, BASE_DEC, NULL, 0x0, - "Number of frames in error since reset of the sublayer", HFILL }}, - - { &hf_oampdu_event_efeTotalEvents, - { "Event Running Total", "slow.oam.event.efeTotalEvents", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Total Event generated since reset of the sublayer", HFILL }}, - - /* Errored Frame Period Event TLV */ - { &hf_oampdu_event_efpeWindow, - { "Errored Frame Window", "slow.oam.event.efpeWindow", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Number of frame in error during the period", HFILL }}, - - { &hf_oampdu_event_efpeThreshold, - { "Errored Frame Threshold", "slow.oam.event.efpeThreshold", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Number of frames required to generate the Event", HFILL }}, - - { &hf_oampdu_event_efpeErrors, - { "Errored Frames", "slow.oam.event.efeErrors", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Number of symbols in error", HFILL }}, - - { &hf_oampdu_event_efpeTotalErrors, - { "Error Running Total", "slow.oam.event.efpeTotalErrors", - FT_UINT64, BASE_DEC, NULL, 0x0, - "Number of frames in error since reset of the sublayer", HFILL }}, - - { &hf_oampdu_event_efpeTotalEvents, - { "Event Running Total", "slow.oam.event.efpeTotalEvents", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Total Event generated since reset of the sublayer", HFILL }}, - - /* Errored Frame Second Summary Event TLV */ - { &hf_oampdu_event_efsseWindow, - { "Errored Frame Window", "slow.oam.event.efsseWindow", - FT_UINT16, BASE_DEC, NULL, 0x0, - "Number of frame in error during the period", HFILL }}, - - { &hf_oampdu_event_efsseThreshold, - { "Errored Frame Threshold", "slow.oam.event.efsseThreshold", - FT_UINT16, BASE_DEC, NULL, 0x0, - "Number of frames required to generate the Event", HFILL }}, - - { &hf_oampdu_event_efsseErrors, - { "Errored Frames", "slow.oam.event.efeErrors", - FT_UINT16, BASE_DEC, NULL, 0x0, - "Number of symbols in error", HFILL }}, - - { &hf_oampdu_event_efsseTotalErrors, - { "Error Running Total", "slow.oam.event.efsseTotalErrors", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Number of frames in error since reset of the sublayer", HFILL }}, - - { &hf_oampdu_event_efsseTotalEvents, - { "Event Running Total", "slow.oam.event.efsseTotalEvents", - FT_UINT32, BASE_DEC, NULL, 0x0, - "Total Event generated since reset of the sublayer", HFILL }}, - - /* Variable request and response definitions*/ - { &hf_oampdu_variable_branch, - { "Branch", "slow.oam.variable.branch", - FT_UINT8, BASE_HEX, VALS(branch_vals), 0x0, - "Variable Branch, derived from the CMIP protocol in Annex 30A", HFILL }}, - - { &hf_oampdu_variable_object, - { "Leaf", "slow.oam.variable.object", - FT_UINT16, BASE_HEX, VALS(object_vals), 0x0, - "Object, derived from the CMIP protocol in Annex 30A", HFILL }}, - - { &hf_oampdu_variable_package, - { "Leaf", "slow.oam.variable.package", - FT_UINT16, BASE_HEX, VALS(package_vals), 0x0, - "Package, derived from the CMIP protocol in Annex 30A", HFILL }}, - - { &hf_oampdu_variable_binding, - { "Leaf", "slow.oam.variable.binding", - FT_UINT16, BASE_HEX, VALS(binding_vals), 0x0, - "Binding, derived from the CMIP protocol in Annex 30A", HFILL }}, - - { &hf_oampdu_variable_attribute, - { "Leaf", "slow.oam.variable.attribute", - FT_UINT16, BASE_HEX, VALS(attribute_vals), 0x0, - "Attribute, derived from the CMIP protocol in Annex 30A", HFILL }}, - - { &hf_oampdu_variable_width, - { "Variable Width", "slow.oam.variable.width", - FT_UINT8, BASE_DEC, NULL, 0x0, - "Width", HFILL }}, - - { &hf_oampdu_variable_indication, - { "Variable indication", "slow.oam.variable.indication", - FT_UINT8, BASE_HEX, VALS(indication_vals), 0x0, - NULL, HFILL }}, - - { &hf_oampdu_variable_value, - { "Variable Value", "slow.oam.variable.value", - FT_BYTES, BASE_NONE, NULL, 0x0, - "Value", HFILL }}, - - /* Loopback Control definitions*/ - { &hf_oampdu_lpbk, - { "Commands", "slow.oam.lpbk.commands", - FT_UINT8, BASE_HEX, NULL, 0x0, - "The List of Loopback Commands", HFILL }}, - - { &hf_oampdu_lpbk_enable, - { "Enable Remote Loopback", "slow.oam.lpbk.commands.enable", - FT_BOOLEAN, 8, NULL, OAMPDU_LPBK_ENABLE, - "Enable Remote Loopback Command", HFILL }}, - - { &hf_oampdu_lpbk_disable, - { "Disable Remote Loopback", "slow.oam.lpbk.commands.disable", - FT_BOOLEAN, 8, NULL, OAMPDU_LPBK_DISABLE, - "Disable Remote Loopback Command", HFILL }}, - }; - - /* Setup protocol subtree array */ - - static gint *ett[] = { - &ett_pdu, - &ett_lacpdu, - &ett_lacpdu_a_flags, - &ett_lacpdu_p_flags, - &ett_marker, - &ett_esmc, - &ett_oampdu, - &ett_oampdu_flags, - &ett_oampdu_local_info, - &ett_oampdu_local_info_state, - &ett_oampdu_local_info_config, - &ett_oampdu_remote_info, - &ett_oampdu_remote_info_state, - &ett_oampdu_remote_info_config, - &ett_oampdu_org_info, - &ett_oampdu_event_espe, - &ett_oampdu_event_efe, - &ett_oampdu_event_efpe, - &ett_oampdu_event_efsse, - &ett_oampdu_event_ose, - &ett_oampdu_lpbk_ctrl, - - }; - - /* Register the protocol name and description */ - - proto_slow = proto_register_protocol("Slow Protocols", "802.3 Slow protocols", "slow"); - - /* Required function calls to register the header fields and subtrees used */ - - proto_register_field_array(proto_slow, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); + { &hf_oampdu_flags, + { "Flags", "slow.oam.flags", + FT_UINT16, BASE_HEX, NULL, 0x0, + "The Flags Field", HFILL }}, + + { &hf_oampdu_flags_link_fault, + { "Link Fault", "slow.oam.flags.linkFault", + FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_LINK_FAULT, + "The PHY detected a fault in the receive direction. True = 1, False = 0", HFILL }}, + + { &hf_oampdu_flags_dying_gasp, + { "Dying Gasp", "slow.oam.flags.dyingGasp", + FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_DYING_GASP, + "An unrecoverable local failure occured. True = 1, False = 0", HFILL }}, + + { &hf_oampdu_flags_critical_event, + { "Critical Event", "slow.oam.flags.criticalEvent", + FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_CRITICAL_EVENT, + "A critical event has occurred. True = 1, False = 0", HFILL }}, + + { &hf_oampdu_flags_local_evaluating, + { "Local Evaluating", "slow.oam.flags.localEvaluating", + FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_LOCAL_EVAL, + "Local DTE Discovery process in progress. True = 1, False = 0", HFILL }}, + + { &hf_oampdu_flags_local_stable, + { "Local Stable", "slow.oam.flags.localStable", + FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_LOCAL_STABLE, + "Local DTE is Stable. True = 1, False = 0", HFILL }}, + + { &hf_oampdu_flags_remote_evaluating, + { "Remote Evaluating", "slow.oam.flags.remoteEvaluating", + FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_REMOTE_EVAL, + "Remote DTE Discovery process in progress. True = 1, False = 0", HFILL }}, + + { &hf_oampdu_flags_remote_stable, + { "Remote Stable", "slow.oam.flags.remoteStable", + FT_BOOLEAN, 8, TFS(&tfs_true_false), OAMPDU_FLAGS_REMOTE_STABLE, + "Remote DTE is Stable. True = 1, False = 0", HFILL }}, + + { &hf_oampdu_code, + { "OAMPDU code", "slow.oam.code", + FT_UINT8, BASE_HEX, VALS(code_vals), 0x0, + "Identifies the TLVs code", HFILL }}, + + { &hf_oampdu_info_type, + { "Type", "slow.oam.info.type", + FT_UINT8, BASE_HEX, VALS(info_type_vals), 0x0, + "Identifies the TLV type", HFILL }}, + + { &hf_oampdu_info_len, + { "TLV Length", "slow.oam.info.length", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Identifies the TLVs type", HFILL }}, + + { &hf_oampdu_info_version, + { "TLV Version", "slow.oam.info.version", + FT_UINT8, BASE_HEX, NULL, 0x0, + "Identifies the TLVs version", HFILL }}, + + { &hf_oampdu_info_revision, + { "TLV Revision", "slow.oam.info.revision", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Identifies the TLVs revision", HFILL }}, + + { &hf_oampdu_info_state, + { "OAM DTE States", "slow.oam.info.state", + FT_UINT8, BASE_HEX, NULL, 0x0, + "OAM DTE State of the Mux and the Parser", HFILL }}, + + { &hf_oampdu_info_state_parser, + { "Parser Action", "slow.oam.info.state.parser", + FT_UINT8, BASE_HEX, VALS(parser_vals), 0x03, + NULL, HFILL }}, + + { &hf_oampdu_info_state_mux, + { "Muxiplexer Action", "slow.oam.info.state.muxiplexer", + FT_BOOLEAN, 8, TFS(&mux), 0x04, + NULL, HFILL }}, + + { &hf_oampdu_info_oamConfig, + { "OAM Configuration", "slow.oam.info.oamConfig", + FT_UINT8, BASE_HEX, NULL, 0x0, + NULL, HFILL }}, + + { &hf_oampdu_info_oamConfig_mode, + { "OAM Mode", "slow.oam.info.oamConfig.mode", + FT_BOOLEAN, 8, TFS(&oam_mode), OAMPDU_INFO_CONFIG_MODE, + NULL, HFILL }}, + + { &hf_oampdu_info_oamConfig_uni, + { "Unidirectional support", "slow.oam.flags.dyingGasp", + FT_BOOLEAN, 8, TFS(&oam_uni), OAMPDU_INFO_CONFIG_UNI, + NULL, HFILL }}, + + { &hf_oampdu_info_oamConfig_lpbk, + { "Loopback support", "slow.oam.flags.criticalEvent", + FT_BOOLEAN, 8, TFS(&oam_lpbk), OAMPDU_INFO_CONFIG_LPBK, + NULL, HFILL }}, + + { &hf_oampdu_info_oamConfig_event, + { "Link Events support", "slow.oam.flags.localEvaluating", + FT_BOOLEAN, 8, TFS(&oam_event), OAMPDU_INFO_CONFIG_EVENT, + NULL, HFILL }}, + + { &hf_oampdu_info_oamConfig_var, + { "Variable Retrieval", "slow.oam.flags.localStable", + FT_BOOLEAN, 8, TFS(&oam_var), OAMPDU_INFO_CONFIG_VAR, + "Variable Retrieval support", HFILL }}, + + { &hf_oampdu_info_oampduConfig, + { "Max OAMPDU Size", "slow.oam.info.oampduConfig", + FT_UINT16, BASE_DEC, NULL, 0x0, + "OAMPDU Configuration", HFILL }}, + + { &hf_oampdu_info_oui, + { "Organizationally Unique Identifier", "slow.oam.info.oui", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_oampdu_info_vendor, + { "Vendor Specific Information", "slow.oam.info.vendor", + FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + /* + * Event notification definitions + */ + { &hf_oampdu_event_sequence, + { "Sequence Number", "slow.oam.event.sequence", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Identifies the Event Notification TLVs", HFILL }}, + + { &hf_oampdu_event_type, + { "Event Type", "slow.oam.event.type", + FT_UINT8, BASE_HEX, VALS(event_type_vals), 0x0, + "Identifies the TLV type", HFILL }}, + + { &hf_oampdu_event_length, + { "Event Length", "slow.oam.event.length", + FT_UINT8, BASE_HEX, NULL, 0x0, + "This field indicates the length in octets of the TLV-tuple", HFILL }}, + + { &hf_oampdu_event_timeStamp, + { "Event Timestamp (100ms)", "slow.oam.event.timestamp", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Event Time Stamp in term of 100 ms intervals", HFILL }}, + + /* Errored Symbol Period Event TLV */ + { &hf_oampdu_event_espeWindow, + { "Errored Symbol Window", "slow.oam.event.espeWindow", + FT_UINT64, BASE_DEC, NULL, 0x0, + "Number of symbols in the period", HFILL }}, + + { &hf_oampdu_event_espeThreshold, + { "Errored Symbol Threshold", "slow.oam.event.espeThreshold", + FT_UINT64, BASE_DEC, NULL, 0x0, + "Number of symbols required to generate the Event", HFILL }}, + + { &hf_oampdu_event_espeErrors, + { "Errored Symbols", "slow.oam.event.espeErrors", + FT_UINT64, BASE_DEC, NULL, 0x0, + "Number of symbols in error", HFILL }}, + + { &hf_oampdu_event_espeTotalErrors, + { "Error Running Total", "slow.oam.event.espeTotalErrors", + FT_UINT64, BASE_DEC, NULL, 0x0, + "Number of symbols in error since reset of the sublayer", HFILL }}, + + { &hf_oampdu_event_espeTotalEvents, + { "Event Running Total", "slow.oam.event.espeTotalEvents", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Total Event generated since reset of the sublayer", HFILL }}, + + /* Errored Frame Event TLV */ + { &hf_oampdu_event_efeWindow, + { "Errored Frame Window", "slow.oam.event.efeWindow", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of symbols in the period", HFILL }}, + + { &hf_oampdu_event_efeThreshold, + { "Errored Frame Threshold", "slow.oam.event.efeThreshold", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Number of frames required to generate the Event", HFILL }}, + + { &hf_oampdu_event_efeErrors, + { "Errored Frames", "slow.oam.event.efeErrors", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Number of symbols in error", HFILL }}, + + { &hf_oampdu_event_efeTotalErrors, + { "Error Running Total", "slow.oam.event.efeTotalErrors", + FT_UINT64, BASE_DEC, NULL, 0x0, + "Number of frames in error since reset of the sublayer", HFILL }}, + + { &hf_oampdu_event_efeTotalEvents, + { "Event Running Total", "slow.oam.event.efeTotalEvents", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Total Event generated since reset of the sublayer", HFILL }}, + + /* Errored Frame Period Event TLV */ + { &hf_oampdu_event_efpeWindow, + { "Errored Frame Window", "slow.oam.event.efpeWindow", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Number of frame in error during the period", HFILL }}, + + { &hf_oampdu_event_efpeThreshold, + { "Errored Frame Threshold", "slow.oam.event.efpeThreshold", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Number of frames required to generate the Event", HFILL }}, + + { &hf_oampdu_event_efpeErrors, + { "Errored Frames", "slow.oam.event.efeErrors", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Number of symbols in error", HFILL }}, + + { &hf_oampdu_event_efpeTotalErrors, + { "Error Running Total", "slow.oam.event.efpeTotalErrors", + FT_UINT64, BASE_DEC, NULL, 0x0, + "Number of frames in error since reset of the sublayer", HFILL }}, + + { &hf_oampdu_event_efpeTotalEvents, + { "Event Running Total", "slow.oam.event.efpeTotalEvents", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Total Event generated since reset of the sublayer", HFILL }}, + + /* Errored Frame Second Summary Event TLV */ + { &hf_oampdu_event_efsseWindow, + { "Errored Frame Window", "slow.oam.event.efsseWindow", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of frame in error during the period", HFILL }}, + + { &hf_oampdu_event_efsseThreshold, + { "Errored Frame Threshold", "slow.oam.event.efsseThreshold", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of frames required to generate the Event", HFILL }}, + + { &hf_oampdu_event_efsseErrors, + { "Errored Frames", "slow.oam.event.efeErrors", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Number of symbols in error", HFILL }}, + + { &hf_oampdu_event_efsseTotalErrors, + { "Error Running Total", "slow.oam.event.efsseTotalErrors", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Number of frames in error since reset of the sublayer", HFILL }}, + + { &hf_oampdu_event_efsseTotalEvents, + { "Event Running Total", "slow.oam.event.efsseTotalEvents", + FT_UINT32, BASE_DEC, NULL, 0x0, + "Total Event generated since reset of the sublayer", HFILL }}, + + /* Variable request and response definitions*/ + { &hf_oampdu_variable_branch, + { "Branch", "slow.oam.variable.branch", + FT_UINT8, BASE_HEX, VALS(branch_vals), 0x0, + "Variable Branch, derived from the CMIP protocol in Annex 30A", HFILL }}, + + { &hf_oampdu_variable_object, + { "Leaf", "slow.oam.variable.object", + FT_UINT16, BASE_HEX, VALS(object_vals), 0x0, + "Object, derived from the CMIP protocol in Annex 30A", HFILL }}, + + { &hf_oampdu_variable_package, + { "Leaf", "slow.oam.variable.package", + FT_UINT16, BASE_HEX, VALS(package_vals), 0x0, + "Package, derived from the CMIP protocol in Annex 30A", HFILL }}, + + { &hf_oampdu_variable_binding, + { "Leaf", "slow.oam.variable.binding", + FT_UINT16, BASE_HEX, VALS(binding_vals), 0x0, + "Binding, derived from the CMIP protocol in Annex 30A", HFILL }}, + + { &hf_oampdu_variable_attribute, + { "Leaf", "slow.oam.variable.attribute", + FT_UINT16, BASE_HEX, VALS(attribute_vals), 0x0, + "Attribute, derived from the CMIP protocol in Annex 30A", HFILL }}, + + { &hf_oampdu_variable_width, + { "Variable Width", "slow.oam.variable.width", + FT_UINT8, BASE_DEC, NULL, 0x0, + "Width", HFILL }}, + + { &hf_oampdu_variable_indication, + { "Variable indication", "slow.oam.variable.indication", + FT_UINT8, BASE_HEX, VALS(indication_vals), 0x0, + NULL, HFILL }}, + + { &hf_oampdu_variable_value, + { "Variable Value", "slow.oam.variable.value", + FT_BYTES, BASE_NONE, NULL, 0x0, + "Value", HFILL }}, + + /* Loopback Control definitions*/ + { &hf_oampdu_lpbk, + { "Commands", "slow.oam.lpbk.commands", + FT_UINT8, BASE_HEX, NULL, 0x0, + "The List of Loopback Commands", HFILL }}, + + { &hf_oampdu_lpbk_enable, + { "Enable Remote Loopback", "slow.oam.lpbk.commands.enable", + FT_BOOLEAN, 8, NULL, OAMPDU_LPBK_ENABLE, + "Enable Remote Loopback Command", HFILL }}, + + { &hf_oampdu_lpbk_disable, + { "Disable Remote Loopback", "slow.oam.lpbk.commands.disable", + FT_BOOLEAN, 8, NULL, OAMPDU_LPBK_DISABLE, + "Disable Remote Loopback Command", HFILL }}, + }; + + /* Setup protocol subtree array */ + + static gint *ett[] = { + &ett_pdu, + &ett_lacpdu, + &ett_lacpdu_a_flags, + &ett_lacpdu_p_flags, + &ett_marker, + &ett_esmc, + &ett_oampdu, + &ett_oampdu_flags, + &ett_oampdu_local_info, + &ett_oampdu_local_info_state, + &ett_oampdu_local_info_config, + &ett_oampdu_remote_info, + &ett_oampdu_remote_info_state, + &ett_oampdu_remote_info_config, + &ett_oampdu_org_info, + &ett_oampdu_event_espe, + &ett_oampdu_event_efe, + &ett_oampdu_event_efpe, + &ett_oampdu_event_efsse, + &ett_oampdu_event_ose, + &ett_oampdu_lpbk_ctrl, + + }; + + /* Register the protocol name and description */ + + proto_slow = proto_register_protocol("Slow Protocols", "802.3 Slow protocols", "slow"); + + /* Required function calls to register the header fields and subtrees used */ + + proto_register_field_array(proto_slow, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); } void proto_reg_handoff_slow_protocols(void) { - dissector_handle_t slow_protocols_handle; + dissector_handle_t slow_protocols_handle; - slow_protocols_handle = create_dissector_handle(dissect_slow_protocols, proto_slow); - dissector_add("ethertype", ETHERTYPE_SLOW_PROTOCOLS, slow_protocols_handle); - dh_data = find_dissector("data"); + slow_protocols_handle = create_dissector_handle(dissect_slow_protocols, proto_slow); + dissector_add("ethertype", ETHERTYPE_SLOW_PROTOCOLS, slow_protocols_handle); + dh_data = find_dissector("data"); } diff --git a/epan/dissectors/packet-smb-sidsnooping.c b/epan/dissectors/packet-smb-sidsnooping.c index 930f742bdd..bbb9bb07bd 100644 --- a/epan/dissectors/packet-smb-sidsnooping.c +++ b/epan/dissectors/packet-smb-sidsnooping.c @@ -116,7 +116,7 @@ samr_query_dispinfo(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt, co field_info *fi; field_info *fi_rid; field_info *fi_name; - char sid_name[256]; + char sid_name_str[256]; int info_level; gp=proto_get_finfo_ptr_array(edt->tree, hf_samr_level); @@ -208,10 +208,10 @@ samr_query_dispinfo(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt, co fi_rid=gp_rids->pdata[num_rids-1]; fi_name=gp_names->pdata[num_rids-1]; - g_strlcpy(sid_name, sid, 256); - sid_name[len++]='-'; - g_snprintf(sid_name+len, 256-len, "%d",fi_rid->value.value.sinteger); - add_sid_name_mapping(sid_name, fi_name->value.value.string); + g_strlcpy(sid_name_str, sid, 256); + sid_name_str[len++]='-'; + g_snprintf(sid_name_str+len, 256-len, "%d",fi_rid->value.value.sinteger); + add_sid_name_mapping(sid_name_str, fi_name->value.value.string); } return 1; } diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index 86dd3f6b24..e1a78aa55f 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -786,7 +786,7 @@ static const fragment_items smb_frag_items = { "segments" }; -static proto_tree *top_tree=NULL; /* ugly */ +static proto_tree *top_tree_global=NULL; /* ugly */ static const char *decode_smb_name(guint8); static int dissect_smb_command(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *smb_tree, guint8 cmd, gboolean first_pdu); @@ -4209,7 +4209,7 @@ dissect_read_file_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr /* file data, might be DCERPC on a pipe */ if(bc){ offset = dissect_file_data_maybe_dcerpc(tvb, pinfo, tree, - top_tree, offset, bc, bc, 0, (guint16) fid); + top_tree_global, offset, bc, bc, 0, (guint16) fid); bc = 0; } @@ -4334,7 +4334,7 @@ dissect_write_file_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr /* file data, might be DCERPC on a pipe */ if (bc != 0) { offset = dissect_file_data_maybe_dcerpc(tvb, pinfo, tree, - top_tree, offset, bc, bc, ofs, fid); + top_tree_global, offset, bc, bc, ofs, fid); bc = 0; } @@ -4697,26 +4697,26 @@ dissect_write_and_close_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr available at http://us1.samba.org/samba/ftp/SMB-info/DOSEXTP.TXT */ static gchar * -smbext20_timeout_msecs_to_str(gint32 time) +smbext20_timeout_msecs_to_str(gint32 timeout) { gchar *buf; #define SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN 60 - if (time <= 0) { + if (timeout <= 0) { buf=ep_alloc(SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1); - if (time == 0) { + if (timeout == 0) { g_snprintf(buf, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1, "Return immediately (0)"); - } else if (time == -1) { + } else if (timeout == -1) { g_snprintf(buf, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1, "Wait indefinitely (-1)"); - } else if (time == -2) { + } else if (timeout == -2) { g_snprintf(buf, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1, "Use default timeout (-2)"); } else { - g_snprintf(buf, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1, "Unknown reserved value (%d)", time); + g_snprintf(buf, SMBEXT20_TIMEOUT_MSECS_TO_STR_MAXLEN+1, "Unknown reserved value (%d)", timeout); } return buf; } - return time_msecs_to_str(time); + return time_msecs_to_str(timeout); } static int @@ -5570,8 +5570,8 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * "Unlocks"); tr = proto_item_add_subtree(it, ett_smb_unlocks); while(un--){ - proto_item *litem = NULL; - proto_tree *ltree = NULL; + proto_item *litem_2 = NULL; + proto_tree *ltree_2 = NULL; if(lt&0x10){ guint64 val; guint16 lock_pid; @@ -5579,19 +5579,19 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * guint64 lock_length; /* large lock format */ - litem = proto_tree_add_text(tr, tvb, offset, 20, + litem_2 = proto_tree_add_text(tr, tvb, offset, 20, "Unlock"); - ltree = proto_item_add_subtree(litem, ett_smb_unlock); + ltree_2 = proto_item_add_subtree(litem_2, ett_smb_unlock); /* PID */ CHECK_BYTE_COUNT(2); lock_pid=tvb_get_letohs(tvb, offset); - proto_tree_add_item(ltree, hf_smb_pid, tvb, offset, 2, TRUE); + proto_tree_add_item(ltree_2, hf_smb_pid, tvb, offset, 2, TRUE); COUNT_BYTES(2); /* 2 reserved bytes */ CHECK_BYTE_COUNT(2); - proto_tree_add_item(ltree, hf_smb_reserved, tvb, offset, 2, TRUE); + proto_tree_add_item(ltree_2, hf_smb_reserved, tvb, offset, 2, TRUE); COUNT_BYTES(2); /* offset */ @@ -5599,7 +5599,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * val=((guint64)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_offset=val; - proto_tree_add_uint64(ltree, hf_smb_lock_long_offset, tvb, offset, 8, val); + proto_tree_add_uint64(ltree_2, hf_smb_lock_long_offset, tvb, offset, 8, val); COUNT_BYTES(8); /* length */ @@ -5607,7 +5607,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * val=((guint64)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_length=val; - proto_tree_add_uint64(ltree, hf_smb_lock_long_length, tvb, offset, 8, val); + proto_tree_add_uint64(ltree_2, hf_smb_lock_long_length, tvb, offset, 8, val); COUNT_BYTES(8); /* remember the unlock for the reply */ @@ -5622,23 +5622,23 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * } } else { /* normal lock format */ - litem = proto_tree_add_text(tr, tvb, offset, 10, + litem_2 = proto_tree_add_text(tr, tvb, offset, 10, "Unlock"); - ltree = proto_item_add_subtree(litem, ett_smb_unlock); + ltree_2 = proto_item_add_subtree(litem_2, ett_smb_unlock); /* PID */ CHECK_BYTE_COUNT(2); - proto_tree_add_item(ltree, hf_smb_pid, tvb, offset, 2, TRUE); + proto_tree_add_item(ltree_2, hf_smb_pid, tvb, offset, 2, TRUE); COUNT_BYTES(2); /* offset */ CHECK_BYTE_COUNT(4); - proto_tree_add_item(ltree, hf_smb_offset, tvb, offset, 4, TRUE); + proto_tree_add_item(ltree_2, hf_smb_offset, tvb, offset, 4, TRUE); COUNT_BYTES(4); /* lock count */ CHECK_BYTE_COUNT(4); - proto_tree_add_item(ltree, hf_smb_count, tvb, offset, 4, TRUE); + proto_tree_add_item(ltree_2, hf_smb_count, tvb, offset, 4, TRUE); COUNT_BYTES(4); } } @@ -5654,8 +5654,8 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * "Locks"); tr = proto_item_add_subtree(it, ett_smb_locks); while(ln--){ - proto_item *litem = NULL; - proto_tree *ltree = NULL; + proto_item *litem_2 = NULL; + proto_tree *ltree_2 = NULL; if(lt&0x10){ guint64 val; guint16 lock_pid; @@ -5663,19 +5663,19 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * guint64 lock_length; /* large lock format */ - litem = proto_tree_add_text(tr, tvb, offset, 20, + litem_2 = proto_tree_add_text(tr, tvb, offset, 20, "Lock"); - ltree = proto_item_add_subtree(litem, ett_smb_lock); + ltree_2 = proto_item_add_subtree(litem_2, ett_smb_lock); /* PID */ CHECK_BYTE_COUNT(2); lock_pid=tvb_get_letohs(tvb, offset); - proto_tree_add_item(ltree, hf_smb_pid, tvb, offset, 2, TRUE); + proto_tree_add_item(ltree_2, hf_smb_pid, tvb, offset, 2, TRUE); COUNT_BYTES(2); /* 2 reserved bytes */ CHECK_BYTE_COUNT(2); - proto_tree_add_item(ltree, hf_smb_reserved, tvb, offset, 2, TRUE); + proto_tree_add_item(ltree_2, hf_smb_reserved, tvb, offset, 2, TRUE); COUNT_BYTES(2); /* offset */ @@ -5683,7 +5683,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * val=((guint64)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_offset=val; - proto_tree_add_uint64(ltree, hf_smb_lock_long_offset, tvb, offset, 8, val); + proto_tree_add_uint64(ltree_2, hf_smb_lock_long_offset, tvb, offset, 8, val); COUNT_BYTES(8); /* length */ @@ -5691,7 +5691,7 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * val=((guint64)tvb_get_letohl(tvb, offset)) << 32 | tvb_get_letohl(tvb, offset+4); lock_length=val; - proto_tree_add_uint64(ltree, hf_smb_lock_long_length, tvb, offset, 8, val); + proto_tree_add_uint64(ltree_2, hf_smb_lock_long_length, tvb, offset, 8, val); COUNT_BYTES(8); /* remember the lock for the reply */ @@ -5706,23 +5706,23 @@ dissect_locking_andx_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * } } else { /* normal lock format */ - litem = proto_tree_add_text(tr, tvb, offset, 10, + litem_2 = proto_tree_add_text(tr, tvb, offset, 10, "Lock"); - ltree = proto_item_add_subtree(litem, ett_smb_lock); + ltree_2 = proto_item_add_subtree(litem_2, ett_smb_lock); /* PID */ CHECK_BYTE_COUNT(2); - proto_tree_add_item(ltree, hf_smb_pid, tvb, offset, 2, TRUE); + proto_tree_add_item(ltree_2, hf_smb_pid, tvb, offset, 2, TRUE); COUNT_BYTES(2); /* offset */ CHECK_BYTE_COUNT(4); - proto_tree_add_item(ltree, hf_smb_offset, tvb, offset, 4, TRUE); + proto_tree_add_item(ltree_2, hf_smb_offset, tvb, offset, 4, TRUE); COUNT_BYTES(4); /* lock count */ CHECK_BYTE_COUNT(4); - proto_tree_add_item(ltree, hf_smb_count, tvb, offset, 4, TRUE); + proto_tree_add_item(ltree_2, hf_smb_count, tvb, offset, 4, TRUE); COUNT_BYTES(4); } } @@ -6053,7 +6053,7 @@ static const value_string ipc_state_read_mode_vals[] = { int dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset, - gboolean setstate) + gboolean setstate_flag) { guint16 mask; proto_item *item; @@ -6068,7 +6068,7 @@ dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset, proto_tree_add_boolean(tree, hf_smb_ipc_state_nonblocking, tvb, offset, 2, mask); - if (!setstate) { + if (!setstate_flag) { proto_tree_add_uint(tree, hf_smb_ipc_state_endpoint, tvb, offset, 2, mask); proto_tree_add_uint(tree, hf_smb_ipc_state_pipe_type, @@ -6076,7 +6076,7 @@ dissect_ipc_state(tvbuff_t *tvb, proto_tree *parent_tree, int offset, } proto_tree_add_uint(tree, hf_smb_ipc_state_read_mode, tvb, offset, 2, mask); - if (!setstate) { + if (!setstate_flag) { proto_tree_add_uint(tree, hf_smb_ipc_state_icount, tvb, offset, 2, mask); } @@ -6410,7 +6410,7 @@ dissect_read_andx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* file data, might be DCERPC on a pipe */ if(bc){ offset = dissect_file_data_maybe_dcerpc(tvb, pinfo, tree, - top_tree, offset, bc, (guint16) datalen, 0, (guint16) fid); + top_tree_global, offset, bc, (guint16) datalen, 0, (guint16) fid); bc = 0; } @@ -6572,7 +6572,7 @@ dissect_write_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* file data, might be DCERPC on a pipe */ if (bc != 0) { offset = dissect_file_data_maybe_dcerpc(tvb, pinfo, tree, - top_tree, offset, bc, (guint16) datalen, 0, (guint16) fid); + top_tree_global, offset, bc, (guint16) datalen, 0, (guint16) fid); bc = 0; } @@ -8223,7 +8223,7 @@ dissect_nt_trans_data_request(tvbuff_t *tvb, packet_info *pinfo, int offset, pro case NT_TRANS_IOCTL: /* ioctl data */ ioctl_tvb=tvb_new_subset(tvb, offset, MIN((int)bc, tvb_length_remaining(tvb, offset)), bc); - dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree, nti->ioctl_function, TRUE); + dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, TRUE); offset += bc; @@ -8768,7 +8768,7 @@ dissect_nt_trans_data_response(tvbuff_t *tvb, packet_info *pinfo, case NT_TRANS_IOCTL: /* ioctl data */ ioctl_tvb=tvb_new_subset(tvb, offset, MIN((int)len, tvb_length_remaining(tvb, offset)), len); - dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree, nti->ioctl_function, FALSE); + dissect_smb2_ioctl_data(ioctl_tvb, pinfo, tree, top_tree_global, nti->ioctl_function, FALSE); offset += len; @@ -11248,7 +11248,7 @@ dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo, while(numref--){ proto_item *ri = NULL; proto_tree *rt = NULL; - int old_offset=offset; + int old_offset_2=offset; guint16 version; if(tree){ @@ -11295,17 +11295,17 @@ dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo, break; case 2: - offset = dissect_dfs_referral_entry_v2(tvb, rt, old_offset, offset, + offset = dissect_dfs_referral_entry_v2(tvb, rt, old_offset_2, offset, refflags, bcp, si->unicode, &ucstring_end); break; case 3: - offset = dissect_dfs_referral_entry_v3(tvb, rt, old_offset, offset, + offset = dissect_dfs_referral_entry_v3(tvb, rt, old_offset_2, offset, refflags, bcp, si->unicode, &ucstring_end); break; case 4: /* V4 is extactly same as V3, except the version number and * one more ReferralEntryFlags */ - offset = dissect_dfs_referral_entry_v3(tvb, rt, old_offset, offset, + offset = dissect_dfs_referral_entry_v3(tvb, rt, old_offset_2, offset, refflags, bcp, si->unicode, &ucstring_end); break; } @@ -11314,7 +11314,7 @@ dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo, * Show anything beyond the length of the referral * as unknown data. */ - unklen = (old_offset + refsize) - offset; + unklen = (old_offset_2 + refsize) - offset; if (unklen < 0) { /* * XXX - the length is bogus. @@ -11328,7 +11328,7 @@ dissect_get_dfs_referral_data(tvbuff_t *tvb, packet_info *pinfo, COUNT_BYTES_TRANS_SUBR(unklen); } - proto_item_set_len(ri, offset-old_offset); + proto_item_set_len(ri, offset-old_offset_2); } /* @@ -13316,7 +13316,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissected_trans = dissect_pipe_smb(sp_tvb, s_tvb, pd_tvb, p_tvb, d_tvb, an+6, pinfo, - top_tree); + top_tree_global); /* In case we did not see the TreeConnect call, store this TID here as well as a IPC TID @@ -13337,7 +13337,7 @@ dissect_transaction_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ sp_tvb = tvb_new_subset(tvb, spo, spc, spc); dissected_trans = dissect_mailslot_smb(sp_tvb, - s_tvb, d_tvb, an+10, pinfo, top_tree); + s_tvb, d_tvb, an+10, pinfo, top_tree_global); } if (!dissected_trans) dissect_trans_data(s_tvb, p_tvb, d_tvb, tree); @@ -14791,7 +14791,7 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, offset = dissect_qfsi_FS_ATTRIBUTE_INFO(tvb, pinfo, tree, offset, bcp, si->unicode); break; case 0x200: { /* SMB_QUERY_CIFS_UNIX_INFO */ - proto_item *item = NULL; + proto_item *item_2 = NULL; proto_tree *subtree = NULL; guint32 caps_lo, caps_hi; @@ -14813,11 +14813,11 @@ dissect_qfsi_vals(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, caps_hi = tvb_get_letohl(tvb, offset + 4); if (tree) { - item = proto_tree_add_text( + item_2 = proto_tree_add_text( tree, tvb, offset, 8, "Capabilities: 0x%08x%08x", caps_hi, caps_lo); subtree = proto_item_add_subtree( - item, ett_smb_unix_capabilities); + item_2, ett_smb_unix_capabilities); } proto_tree_add_boolean( @@ -15670,7 +15670,7 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * if( pd_tvb) { dissected_trans = dissect_pipe_smb( sp_tvb, s_tvb, pd_tvb, p_tvb, - d_tvb, NULL, pinfo, top_tree); + d_tvb, NULL, pinfo, top_tree_global); } break; @@ -15681,7 +15681,7 @@ dissect_transaction_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree * if(d_tvb){ dissected_trans = dissect_mailslot_smb( sp_tvb, s_tvb, d_tvb, NULL, pinfo, - top_tree); + top_tree_global); } break; } @@ -16668,7 +16668,7 @@ dissect_smb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) si=ep_alloc0(sizeof(smb_info_t)); - top_tree=parent_tree; + top_tree_global=parent_tree; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMB"); col_clear(pinfo->cinfo, COL_INFO); diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index a13c7cdf48..5fec35fd68 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -246,7 +246,7 @@ dissect_smtp_data(tvbuff_t *tvb, int offset, proto_tree *smtp_tree) static void dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - struct smtp_proto_data *frame_data; + struct smtp_proto_data *spd_frame_data; proto_tree *smtp_tree = NULL; proto_tree *cmdresp_tree; proto_item *ti, *hidden_item; @@ -336,9 +336,9 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Is there any data attached to this frame? */ - frame_data = p_get_proto_data(pinfo->fd, proto_smtp); + spd_frame_data = p_get_proto_data(pinfo->fd, proto_smtp); - if (!frame_data) { + if (!spd_frame_data) { /* * No frame data. @@ -348,12 +348,12 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Create a frame data structure and attach it to the packet. */ - frame_data = se_alloc0(sizeof(struct smtp_proto_data)); + spd_frame_data = se_alloc0(sizeof(struct smtp_proto_data)); - frame_data->conversation_id = conversation->index; - frame_data->more_frags = TRUE; + spd_frame_data->conversation_id = conversation->index; + spd_frame_data->more_frags = TRUE; - p_add_proto_data(pinfo->fd, proto_smtp, frame_data); + p_add_proto_data(pinfo->fd, proto_smtp, spd_frame_data); } @@ -425,14 +425,14 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * EOM. * Everything that comes after it is commands. */ - frame_data->pdu_type = SMTP_PDU_EOM; + spd_frame_data->pdu_type = SMTP_PDU_EOM; session_state->smtp_state = READING_CMDS; break; } else { /* * Message data with no EOM. */ - frame_data->pdu_type = SMTP_PDU_MESSAGE; + spd_frame_data->pdu_type = SMTP_PDU_MESSAGE; if (session_state->msg_tot_len > 0) { /* @@ -453,7 +453,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * We have found the LAST data chunk. * The message can now be reassembled. */ - frame_data->more_frags = FALSE; + spd_frame_data->more_frags = FALSE; } break; /* no need to go through the remaining lines */ @@ -481,7 +481,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * This is a command, but everything that comes after it, * until an EOM, is data. */ - frame_data->pdu_type = SMTP_PDU_CMD; + spd_frame_data->pdu_type = SMTP_PDU_CMD; session_state->smtp_state = READING_DATA; session_state->data_seen = TRUE; } else if (g_ascii_strncasecmp(line, "BDAT", 4) == 0) { @@ -494,7 +494,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) msg_len = strtoul (line+5, NULL, 10); - frame_data->pdu_type = SMTP_PDU_CMD; + spd_frame_data->pdu_type = SMTP_PDU_CMD; session_state->data_seen = TRUE; session_state->msg_tot_len += msg_len; @@ -516,7 +516,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * No more data to expect. * The message can now be reassembled. */ - frame_data->more_frags = FALSE; + spd_frame_data->more_frags = FALSE; } } else { session_state->msg_last = FALSE; @@ -528,18 +528,18 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * everything after the response is TLS. */ session_state->smtp_state = AWAITING_STARTTLS_RESPONSE; - frame_data->pdu_type = SMTP_PDU_CMD; + spd_frame_data->pdu_type = SMTP_PDU_CMD; } else { /* * Regular command. */ - frame_data->pdu_type = SMTP_PDU_CMD; + spd_frame_data->pdu_type = SMTP_PDU_CMD; } } else { /* * Assume it's message data. */ - frame_data->pdu_type = session_state->data_seen ? SMTP_PDU_MESSAGE : SMTP_PDU_CMD; + spd_frame_data->pdu_type = session_state->data_seen ? SMTP_PDU_MESSAGE : SMTP_PDU_CMD; } } } @@ -569,7 +569,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (request) { /* We must have frame_data here ... */ - switch (frame_data->pdu_type) { + switch (spd_frame_data->pdu_type) { case SMTP_PDU_MESSAGE: length_remaining = tvb_length_remaining(tvb, offset); @@ -643,13 +643,13 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * On the first pass, we will not have any info on the packets * On second and subsequent passes, we will. */ - switch (frame_data->pdu_type) { + switch (spd_frame_data->pdu_type) { case SMTP_PDU_MESSAGE: if (smtp_data_desegment) { - frag_msg = fragment_add_seq_next(tvb, 0, pinfo, frame_data->conversation_id, + frag_msg = fragment_add_seq_next(tvb, 0, pinfo, spd_frame_data->conversation_id, smtp_data_segment_table, smtp_data_reassembled_table, - tvb_length(tvb), frame_data->more_frags); + tvb_length(tvb), spd_frame_data->more_frags); } else { /* * Message body. @@ -673,12 +673,12 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (smtp_data_desegment) { /* add final data segment */ if (loffset) - fragment_add_seq_next(tvb, 0, pinfo, frame_data->conversation_id, + fragment_add_seq_next(tvb, 0, pinfo, spd_frame_data->conversation_id, smtp_data_segment_table, smtp_data_reassembled_table, - loffset, frame_data->more_frags); + loffset, spd_frame_data->more_frags); /* terminate the desegmentation */ - frag_msg = fragment_end_seq_next (pinfo, frame_data->conversation_id, smtp_data_segment_table, + frag_msg = fragment_end_seq_next (pinfo, spd_frame_data->conversation_id, smtp_data_segment_table, smtp_data_reassembled_table); } break; @@ -723,9 +723,9 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) loffset + 5, linelen - 5, FALSE); } - if (smtp_data_desegment && !frame_data->more_frags) { + if (smtp_data_desegment && !spd_frame_data->more_frags) { /* terminate the desegmentation */ - frag_msg = fragment_end_seq_next (pinfo, frame_data->conversation_id, smtp_data_segment_table, + frag_msg = fragment_end_seq_next (pinfo, spd_frame_data->conversation_id, smtp_data_segment_table, smtp_data_reassembled_table); } diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c index 5244fb030c..c91c18cddc 100644 --- a/epan/dissectors/packet-socks.c +++ b/epan/dissectors/packet-socks.c @@ -259,7 +259,7 @@ static int display_string(tvbuff_t *tvb, int offset, int length = tvb_get_guint8(tvb, offset); tvb_memcpy(tvb, (guint8 *)temp, offset+1, length); - temp[ length ] = 0; + temp[ length ] = '\0'; ti = proto_tree_add_text(tree, tvb, offset, length + 1, "%s: %s" , label, temp); @@ -818,7 +818,7 @@ state_machine_v5( socks_hash_entry_t *hash_info, tvbuff_t *tvb, else if ( hash_info->state == V5Command) { /* Handle V5 Command */ - guint temp; + /** ?? guint temp; **/ hash_info->command = tvb_get_guint8(tvb, offset + 1); /* get command */ @@ -833,7 +833,7 @@ state_machine_v5( socks_hash_entry_t *hash_info, tvbuff_t *tvb, offset = get_address_v5(tvb, offset, hash_info); - temp = tvb_get_guint8(tvb, offset); + /** temp = tvb_get_guint8(tvb, offset); XX: what was this for ? **/ if (( hash_info->command == CONNECT_COMMAND) || ( hash_info->command == UDP_ASSOCIATE_COMMAND)) diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index 07c874175e..b27bacf4f8 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -483,8 +483,8 @@ const value_string ssl_31_ciphersuite[] = { { 0x001c, "SSL_FORTEZZA_KEA_WITH_NULL_SHA" }, { 0x001d, "SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA" }, #if 0 /* Because it clashes with KRB5, is never used any more, and is safe - to remove according to David Hopwood <david.hopwood@zetnet.co.uk> - of the ietf-tls list */ + to remove according to David Hopwood <david.hopwood@zetnet.co.uk> + of the ietf-tls list */ { 0x001e, "SSL_FORTEZZA_KEA_WITH_RC4_128_SHA" }, #endif @@ -704,79 +704,79 @@ const value_string pct_msg_types[] = { }; const value_string pct_cipher_type[] = { - { PCT_CIPHER_DES, "DES" }, - { PCT_CIPHER_IDEA, "IDEA" }, - { PCT_CIPHER_RC2, "RC2" }, - { PCT_CIPHER_RC4, "RC4" }, - { PCT_CIPHER_DES_112, "DES 112 bit" }, - { PCT_CIPHER_DES_168, "DES 168 bit" }, - { 0x00, NULL } + { PCT_CIPHER_DES, "DES" }, + { PCT_CIPHER_IDEA, "IDEA" }, + { PCT_CIPHER_RC2, "RC2" }, + { PCT_CIPHER_RC4, "RC4" }, + { PCT_CIPHER_DES_112, "DES 112 bit" }, + { PCT_CIPHER_DES_168, "DES 168 bit" }, + { 0x00, NULL } }; const value_string pct_hash_type[] = { - { PCT_HASH_MD5, "MD5" }, - { PCT_HASH_MD5_TRUNC_64, "MD5_TRUNC_64"}, - { PCT_HASH_SHA, "SHA"}, - { PCT_HASH_SHA_TRUNC_80, "SHA_TRUNC_80"}, - { PCT_HASH_DES_DM, "DES_DM"}, - { 0x00, NULL } + { PCT_HASH_MD5, "MD5" }, + { PCT_HASH_MD5_TRUNC_64, "MD5_TRUNC_64"}, + { PCT_HASH_SHA, "SHA"}, + { PCT_HASH_SHA_TRUNC_80, "SHA_TRUNC_80"}, + { PCT_HASH_DES_DM, "DES_DM"}, + { 0x00, NULL } }; const value_string pct_cert_type[] = { - { PCT_CERT_NONE, "None" }, - { PCT_CERT_X509, "X.509" }, - { PCT_CERT_PKCS7, "PKCS #7" }, - { 0x00, NULL } + { PCT_CERT_NONE, "None" }, + { PCT_CERT_X509, "X.509" }, + { PCT_CERT_PKCS7, "PKCS #7" }, + { 0x00, NULL } }; const value_string pct_sig_type[] = { - { PCT_SIG_NONE, "None" }, - { PCT_SIG_RSA_MD5, "MD5" }, - { PCT_SIG_RSA_SHA, "RSA SHA" }, - { PCT_SIG_DSA_SHA, "DSA SHA" }, - { 0x00, NULL } + { PCT_SIG_NONE, "None" }, + { PCT_SIG_RSA_MD5, "MD5" }, + { PCT_SIG_RSA_SHA, "RSA SHA" }, + { PCT_SIG_DSA_SHA, "DSA SHA" }, + { 0x00, NULL } }; const value_string pct_exch_type[] = { - { PCT_EXCH_RSA_PKCS1, "RSA PKCS#1" }, - { PCT_EXCH_RSA_PKCS1_TOKEN_DES, "RSA PKCS#1 Token DES" }, - { PCT_EXCH_RSA_PKCS1_TOKEN_DES3, "RSA PKCS#1 Token 3DES" }, - { PCT_EXCH_RSA_PKCS1_TOKEN_RC2, "RSA PKCS#1 Token RC-2" }, - { PCT_EXCH_RSA_PKCS1_TOKEN_RC4, "RSA PKCS#1 Token RC-4" }, - { PCT_EXCH_DH_PKCS3, "DH PKCS#3" }, - { PCT_EXCH_DH_PKCS3_TOKEN_DES, "DH PKCS#3 Token DES" }, - { PCT_EXCH_DH_PKCS3_TOKEN_DES3, "DH PKCS#3 Token 3DES" }, - { PCT_EXCH_FORTEZZA_TOKEN, "Fortezza" }, - { 0x00, NULL } + { PCT_EXCH_RSA_PKCS1, "RSA PKCS#1" }, + { PCT_EXCH_RSA_PKCS1_TOKEN_DES, "RSA PKCS#1 Token DES" }, + { PCT_EXCH_RSA_PKCS1_TOKEN_DES3, "RSA PKCS#1 Token 3DES" }, + { PCT_EXCH_RSA_PKCS1_TOKEN_RC2, "RSA PKCS#1 Token RC-2" }, + { PCT_EXCH_RSA_PKCS1_TOKEN_RC4, "RSA PKCS#1 Token RC-4" }, + { PCT_EXCH_DH_PKCS3, "DH PKCS#3" }, + { PCT_EXCH_DH_PKCS3_TOKEN_DES, "DH PKCS#3 Token DES" }, + { PCT_EXCH_DH_PKCS3_TOKEN_DES3, "DH PKCS#3 Token 3DES" }, + { PCT_EXCH_FORTEZZA_TOKEN, "Fortezza" }, + { 0x00, NULL } }; const value_string pct_error_code[] = { - { PCT_ERR_BAD_CERTIFICATE, "PCT_ERR_BAD_CERTIFICATE" }, - { PCT_ERR_CLIENT_AUTH_FAILED, "PCT_ERR_CLIENT_AUTH_FAILE" }, - { PCT_ERR_ILLEGAL_MESSAGE, "PCT_ERR_ILLEGAL_MESSAGE" }, - { PCT_ERR_INTEGRITY_CHECK_FAILED, "PCT_ERR_INTEGRITY_CHECK_FAILED" }, - { PCT_ERR_SERVER_AUTH_FAILED, "PCT_ERR_SERVER_AUTH_FAILED" }, - { PCT_ERR_SPECS_MISMATCH, "PCT_ERR_SPECS_MISMATCH" }, - { 0x00, NULL } + { PCT_ERR_BAD_CERTIFICATE, "PCT_ERR_BAD_CERTIFICATE" }, + { PCT_ERR_CLIENT_AUTH_FAILED, "PCT_ERR_CLIENT_AUTH_FAILE" }, + { PCT_ERR_ILLEGAL_MESSAGE, "PCT_ERR_ILLEGAL_MESSAGE" }, + { PCT_ERR_INTEGRITY_CHECK_FAILED, "PCT_ERR_INTEGRITY_CHECK_FAILED" }, + { PCT_ERR_SERVER_AUTH_FAILED, "PCT_ERR_SERVER_AUTH_FAILED" }, + { PCT_ERR_SPECS_MISMATCH, "PCT_ERR_SPECS_MISMATCH" }, + { 0x00, NULL } }; /* RFC 4366 */ const value_string tls_hello_extension_types[] = { - { 0, "server_name" }, - { 1, "max_fragment_length" }, - { 2, "client_certificate_url" }, - { 3, "trusted_ca_keys" }, - { 4, "truncated_hmac" }, - { 5, "status_request" }, - { 6, "user_mapping" }, /* RFC 4681 */ - { 7, "Reserved" }, - { 8, "Reserved" }, - { 9, "cert_type" }, /* RFC 5081 */ - { 10, "elliptic_curves" }, /* RFC 4492 */ - { 11, "ec_point_formats" }, /* RFC 4492 */ - { 12, "srp" }, /* RFC 5054 */ - { 13, "signature_algorithms" }, /* RFC 5246 */ - { 35, "SessionTicket TLS" }, /* RFC 4507 */ - { 0, NULL } + { 0, "server_name" }, + { 1, "max_fragment_length" }, + { 2, "client_certificate_url" }, + { 3, "trusted_ca_keys" }, + { 4, "truncated_hmac" }, + { 5, "status_request" }, + { 6, "user_mapping" }, /* RFC 4681 */ + { 7, "Reserved" }, + { 8, "Reserved" }, + { 9, "cert_type" }, /* RFC 5081 */ + { 10, "elliptic_curves" }, /* RFC 4492 */ + { 11, "ec_point_formats" }, /* RFC 4492 */ + { 12, "srp" }, /* RFC 5054 */ + { 13, "signature_algorithms" }, /* RFC 5246 */ + { 35, "SessionTicket TLS" }, /* RFC 4507 */ + { 0, NULL } }; @@ -821,17 +821,17 @@ static gint ver_major, ver_minor, ver_patch; static inline gint ssl_hmac_init(SSL_HMAC* md, const void * key, gint len, gint algo) { - gcry_error_t err; - const char *err_str, *err_src; + gcry_error_t err; + const char *err_str, *err_src; err = gcry_md_open(md,algo, GCRY_MD_FLAG_HMAC); - if (err != 0) { - err_str = gcry_strerror(err); - err_src = gcry_strsource(err); - ssl_debug_printf("ssl_hmac_init(): gcry_md_open failed %s/%s", err_str, err_src); - return -1; - } + if (err != 0) { + err_str = gcry_strerror(err); + err_src = gcry_strsource(err); + ssl_debug_printf("ssl_hmac_init(): gcry_md_open failed %s/%s", err_str, err_src); + return -1; + } gcry_md_setkey (*(md), key, len); - return 0; + return 0; } static inline void ssl_hmac_update(SSL_HMAC* md, const void* data, gint len) @@ -860,15 +860,15 @@ ssl_hmac_cleanup(SSL_HMAC* md) static inline gint ssl_md_init(SSL_MD* md, gint algo) { - gcry_error_t err; - const char *err_str, *err_src; + gcry_error_t err; + const char *err_str, *err_src; err = gcry_md_open(md,algo, 0); - if (err != 0) { - err_str = gcry_strerror(err); - err_src = gcry_strsource(err); - ssl_debug_printf("ssl_md_init(): gcry_md_open failed %s/%s", err_str, err_src); - return -1; - } + if (err != 0) { + err_str = gcry_strerror(err); + err_src = gcry_strsource(err); + ssl_debug_printf("ssl_md_init(): gcry_md_open failed %s/%s", err_str, err_src); + return -1; + } return 0; } static inline void @@ -943,30 +943,30 @@ ssl_md5_cleanup(SSL_MD5_CTX* md) gint ssl_cipher_setiv(SSL_CIPHER_CTX *cipher, guchar* iv, gint iv_len) { - /* guchar * ivp; */ - gint ret; - /* gint i; */ - gcry_cipher_hd_t c; - ret=0; - c=(gcry_cipher_hd_t)*cipher; + /* guchar * ivp; */ + gint ret; + /* gint i; */ + gcry_cipher_hd_t c; + ret=0; + c=(gcry_cipher_hd_t)*cipher; - ssl_debug_printf("--------------------------------------------------------------------"); - /*for(ivp=c->iv,i=0; i < iv_len; i++ ) - { - ssl_debug_printf("%d ",ivp[i]); - i++; - } - */ - ssl_debug_printf("--------------------------------------------------------------------"); - ret = gcry_cipher_setiv(*(cipher), iv, iv_len); - /*for(ivp=c->iv,i=0; i < iv_len; i++ ) - { - ssl_debug_printf("%d ",ivp[i]); - i++; - } - */ - ssl_debug_printf("--------------------------------------------------------------------"); - return ret; + ssl_debug_printf("--------------------------------------------------------------------"); + /*for(ivp=c->iv,i=0; i < iv_len; i++ ) + { + ssl_debug_printf("%d ",ivp[i]); + i++; + } + */ + ssl_debug_printf("--------------------------------------------------------------------"); + ret = gcry_cipher_setiv(*(cipher), iv, iv_len); + /*for(ivp=c->iv,i=0; i < iv_len; i++ ) + { + ssl_debug_printf("%d ",ivp[i]); + i++; + } + */ + ssl_debug_printf("--------------------------------------------------------------------"); + return ret; } /* stream cipher abstraction layer*/ static gint @@ -1021,22 +1021,23 @@ _gcry_rsa_decrypt (int algo, gcry_mpi_t *result, gcry_mpi_t *data, #define PUBKEY_FLAG_NO_BLINDING (1 << 0) const gchar* -ssl_private_key_to_str(SSL_PRIVATE_KEY* pk) { - const gchar *str="NULL"; - size_t n; - gchar *buf; +ssl_private_key_to_str(SSL_PRIVATE_KEY* pk) +{ + const gchar *str="NULL"; + size_t n; + gchar *buf; - if (!pk) return str; + if (!pk) return str; #ifndef SSL_FAST - n = gcry_sexp_sprint(pk, GCRYSEXP_FMT_ADVANCED, NULL, 0); - buf = ep_alloc(n); - n = gcry_sexp_sprint(pk, GCRYSEXP_FMT_ADVANCED, buf, n); - str = buf; + n = gcry_sexp_sprint(pk, GCRYSEXP_FMT_ADVANCED, NULL, 0); + buf = ep_alloc(n); + n = gcry_sexp_sprint(pk, GCRYSEXP_FMT_ADVANCED, buf, n); + str = buf; #else /* SSL_FAST */ - str = "TO DO: dump mpi gcry_mpi_print()"; + str = "TO DO: dump mpi gcry_mpi_print()"; #endif /* SSL_FAST */ - return str; + return str; } /* decrypt data with private key. Store decrypted data directly into input @@ -1063,7 +1064,7 @@ ssl_private_decrypt(guint len, guchar* encr_data, SSL_PRIVATE_KEY* pk) return 0; } - /*ssl_debug_printf("pcry_private_decrypt: pk=%s\n", ssl_private_key_to_str(pk));*/ + /*ssl_debug_printf("pcry_private_decrypt: pk=%s\n", ssl_private_key_to_str(pk));*/ #ifndef SSL_FAST /* put the data into a simple list */ @@ -1198,19 +1199,19 @@ ssl_data_copy(StringInfo* dst, StringInfo* src) tls_prf(secret,usage,rnd1,rnd2,out)) static const gchar *digests[]={ - "MD5", - "SHA1" + "MD5", + "SHA1" }; static const gchar *ciphers[]={ - "DES", - "3DES", - "ARCFOUR", /* gnutls does not support rc4, but this should be 100% compatible*/ - "RC2", - "IDEA", - "AES", - "AES256", - "*UNKNOWN*" + "DES", + "3DES", + "ARCFOUR", /* gnutls does not support rc4, but this should be 100% compatible*/ + "RC2", + "IDEA", + "AES", + "AES256", + "*UNKNOWN*" }; static SslCipherSuite cipher_suites[]={ @@ -1476,48 +1477,48 @@ ssl_create_flow(void) /* memory allocation functions for zlib initialization */ static void* ssl_zalloc(void* opaque _U_, unsigned int no, unsigned int size) { - return g_malloc0(no*size); + return g_malloc0(no*size); } -static void ssl_zfree(void* opaque _U_, void* address) +static void ssl_zfree(void* opaque _U_, void* addr) { - g_free(address); + g_free(addr); } #endif static SslDecompress* ssl_create_decompressor(gint compression) { - SslDecompress *decomp; + SslDecompress *decomp; #ifdef HAVE_LIBZ - int err; + int err; #endif - if (compression == 0) return NULL; - ssl_debug_printf("ssl_create_decompressor: compression method %d\n", compression); - decomp = se_alloc(sizeof(SslDecompress)); - decomp->compression = compression; - switch (decomp->compression) { + if (compression == 0) return NULL; + ssl_debug_printf("ssl_create_decompressor: compression method %d\n", compression); + decomp = se_alloc(sizeof(SslDecompress)); + decomp->compression = compression; + switch (decomp->compression) { #ifdef HAVE_LIBZ - case 1: /* DEFLATE */ - decomp->istream.zalloc = ssl_zalloc; - decomp->istream.zfree = ssl_zfree; - decomp->istream.opaque = Z_NULL; - decomp->istream.next_in = Z_NULL; - decomp->istream.next_out = Z_NULL; - decomp->istream.avail_in = 0; - decomp->istream.avail_out = 0; - err = inflateInit_(&decomp->istream, ZLIB_VERSION, sizeof(z_stream)); - if (err != Z_OK) { - ssl_debug_printf("ssl_create_decompressor: inflateInit_() failed - %d\n", err); - return NULL; - } - break; + case 1: /* DEFLATE */ + decomp->istream.zalloc = ssl_zalloc; + decomp->istream.zfree = ssl_zfree; + decomp->istream.opaque = Z_NULL; + decomp->istream.next_in = Z_NULL; + decomp->istream.next_out = Z_NULL; + decomp->istream.avail_in = 0; + decomp->istream.avail_out = 0; + err = inflateInit_(&decomp->istream, ZLIB_VERSION, sizeof(z_stream)); + if (err != Z_OK) { + ssl_debug_printf("ssl_create_decompressor: inflateInit_() failed - %d\n", err); + return NULL; + } + break; #endif - default: - ssl_debug_printf("ssl_create_decompressor: unsupported compression method %d\n", decomp->compression); - return NULL; - } - return decomp; + default: + ssl_debug_printf("ssl_create_decompressor: unsupported compression method %d\n", decomp->compression); + return NULL; + } + return decomp; } static SslDecoder* @@ -1796,14 +1797,14 @@ fail: void ssl_change_cipher(SslDecryptSession *ssl_session, gboolean server) { - ssl_debug_printf("ssl_change_cipher %s\n", (server)?"SERVER":"CLIENT"); - if (server) { - ssl_session->server = ssl_session->server_new; - ssl_session->server_new = NULL; - } else { - ssl_session->client = ssl_session->client_new; - ssl_session->client_new = NULL; - } + ssl_debug_printf("ssl_change_cipher %s\n", (server)?"SERVER":"CLIENT"); + if (server) { + ssl_session->server = ssl_session->server_new; + ssl_session->server_new = NULL; + } else { + ssl_session->client = ssl_session->client_new; + ssl_session->client_new = NULL; + } } int @@ -1875,7 +1876,7 @@ tls_check_mac(SslDecoder*decoder, gint ct, gint ver, guint8* data, digests[decoder->cipher_suite->dig-0x40], md); if (ssl_hmac_init(&hm,decoder->mac_key.data,decoder->mac_key.data_len,md) != 0) - return -1;; + return -1;; /* hash sequence number */ fmt_seq(decoder->seq,buf); @@ -1904,8 +1905,8 @@ tls_check_mac(SslDecoder*decoder, gint ct, gint ver, guint8* data, ssl_hmac_final(&hm,buf,&len); ssl_hmac_cleanup(&hm); ssl_print_data("Mac", buf, len); - if(memcmp(mac,buf,len)) - return -1; + if(memcmp(mac,buf,len)) + return -1; return 0; } @@ -1926,7 +1927,7 @@ ssl3_check_mac(SslDecoder*decoder,int ct,guint8* data, /* get cipher used for digest comptuation */ md=ssl_get_digest_by_name(digests[decoder->cipher_suite->dig-0x40]); if (ssl_md_init(&mc,md) !=0) - return -1; + return -1; /* do hash computation on data && padding */ ssl_md_update(&mc,decoder->mac_key.data,decoder->mac_key.data_len); @@ -1989,7 +1990,7 @@ dtls_check_mac(SslDecoder*decoder, gint ct,int ver, guint8* data, digests[decoder->cipher_suite->dig-0x40], md); if (ssl_hmac_init(&hm,decoder->mac_key.data,decoder->mac_key.data_len,md) != 0) - return -1; + return -1; ssl_debug_printf("dtls_check_mac seq: %d epoch: %d\n",decoder->seq,decoder->epoch); /* hash sequence number */ fmt_seq(decoder->seq,buf); @@ -2024,38 +2025,38 @@ dtls_check_mac(SslDecoder*decoder, gint ct,int ver, guint8* data, int ssl_decompress_record(SslDecompress* decomp, const guchar* in, guint inl, StringInfo* out_str, guint* outl) { - gint err; + gint err; - switch (decomp->compression) { - case 1: /* DEFLATE */ - err = Z_OK; - if (out_str->data_len < 16384) { /* maximal plain length */ - ssl_data_realloc(out_str, 16384); - } - decomp->istream.next_in = (guchar*)in; - decomp->istream.avail_in = inl; - decomp->istream.next_out = out_str->data; - decomp->istream.avail_out = out_str->data_len; - if (inl > 0) - err = inflate(&decomp->istream, Z_SYNC_FLUSH); - if (err != Z_OK) { - ssl_debug_printf("ssl_decompress_record: inflate() failed - %d\n", err); - return -1; - } - *outl = out_str->data_len - decomp->istream.avail_out; - break; - default: - ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression); - return -1; - } - return 0; + switch (decomp->compression) { + case 1: /* DEFLATE */ + err = Z_OK; + if (out_str->data_len < 16384) { /* maximal plain length */ + ssl_data_realloc(out_str, 16384); + } + decomp->istream.next_in = (guchar*)in; + decomp->istream.avail_in = inl; + decomp->istream.next_out = out_str->data; + decomp->istream.avail_out = out_str->data_len; + if (inl > 0) + err = inflate(&decomp->istream, Z_SYNC_FLUSH); + if (err != Z_OK) { + ssl_debug_printf("ssl_decompress_record: inflate() failed - %d\n", err); + return -1; + } + *outl = out_str->data_len - decomp->istream.avail_out; + break; + default: + ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression); + return -1; + } + return 0; } #else int ssl_decompress_record(SslDecompress* decomp _U_, const guchar* in _U_, guint inl _U_, StringInfo* out_str _U_, guint* outl _U_) { - ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression); - return -1; + ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression); + return -1; } #endif @@ -2174,9 +2175,9 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) gcry_sexp_t rsa_priv_key; gint major, minor, patch; gint i, p_idx, q_idx; - int ret; - size_t buf_len; - unsigned char buf_keyid[32]; + int ret; + size_t buf_len; + unsigned char buf_keyid[32]; #ifdef SSL_FAST gcry_mpi_t* rsa_params = g_malloc(sizeof(gcry_mpi_t)*RSA_PARS); @@ -2184,13 +2185,13 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) gcry_mpi_t rsa_params[RSA_PARS]; #endif - buf_len = sizeof(buf_keyid); - ret = gnutls_x509_privkey_get_key_id(priv_key, 0, buf_keyid, &buf_len); - if (ret != 0) { - ssl_debug_printf( "gnutls_x509_privkey_get_key_id(ssl_pkey, 0, buf_keyid, &buf_len) - %s\n", gnutls_strerror(ret)); - } else { - ssl_debug_printf( "Private key imported: KeyID %s\n", bytes_to_str_punct(buf_keyid, (int) buf_len, ':')); - } + buf_len = sizeof(buf_keyid); + ret = gnutls_x509_privkey_get_key_id(priv_key, 0, buf_keyid, &buf_len); + if (ret != 0) { + ssl_debug_printf( "gnutls_x509_privkey_get_key_id(ssl_pkey, 0, buf_keyid, &buf_len) - %s\n", gnutls_strerror(ret)); + } else { + ssl_debug_printf( "Private key imported: KeyID %s\n", bytes_to_str_punct(buf_keyid, (int) buf_len, ':')); + } /* * note: openssl and gnutls use 'p' and 'q' with opposite meaning: @@ -2198,14 +2199,19 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) */ #if (LIBGNUTLS_VERSION_MAJOR>2)||((LIBGNUTLS_VERSION_MAJOR==2)&&(LIBGNUTLS_VERSION_MINOR>=5)) - p_idx = 3; q_idx = 4; + p_idx = 3; q_idx = 4; #else /* versions 2.4.x and older need 'p' and 'q' swapped */ - p_idx = 4; q_idx = 3; + p_idx = 4; q_idx = 3; #endif /* RSA get parameter */ if (gnutls_x509_privkey_export_rsa_raw(priv_key, - &rsa_datum[0], &rsa_datum[1], &rsa_datum[2], &rsa_datum[p_idx], &rsa_datum[q_idx], &rsa_datum[5]) != 0) { + &rsa_datum[0], + &rsa_datum[1], + &rsa_datum[2], + &rsa_datum[p_idx], + &rsa_datum[q_idx], + &rsa_datum[5]) != 0) { ssl_debug_printf("ssl_load_key: can't export rsa param (is a rsa private key file ?!?)\n"); #ifdef SSL_FAST g_free(rsa_params); @@ -2250,11 +2256,8 @@ ssl_privkey_to_sexp(struct gnutls_x509_privkey_int* priv_key) #if SSL_FAST return rsa_params; #else - { - gint i; - for (i=0; i< 6; i++) - gcry_mpi_release(rsa_params[i]); - } + for (i=0; i< 6; i++) + gcry_mpi_release(rsa_params[i]); return rsa_priv_key; #endif @@ -2326,171 +2329,171 @@ ssl_load_key(FILE* fp) } const char *BAGTYPE(gnutls_pkcs12_bag_type_t x) { - switch (x) { - case GNUTLS_BAG_EMPTY: return "Empty"; - case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: return "PKCS#8 Encrypted key"; - case GNUTLS_BAG_PKCS8_KEY: return "PKCS#8 Key"; - case GNUTLS_BAG_CERTIFICATE: return "Certificate"; - case GNUTLS_BAG_CRL: return "CRL"; - case GNUTLS_BAG_ENCRYPTED: return "Encrypted"; - case GNUTLS_BAG_UNKNOWN: return "Unknown"; - default: return "<undefined>"; + switch (x) { + case GNUTLS_BAG_EMPTY: return "Empty"; + case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: return "PKCS#8 Encrypted key"; + case GNUTLS_BAG_PKCS8_KEY: return "PKCS#8 Key"; + case GNUTLS_BAG_CERTIFICATE: return "Certificate"; + case GNUTLS_BAG_CRL: return "CRL"; + case GNUTLS_BAG_ENCRYPTED: return "Encrypted"; + case GNUTLS_BAG_UNKNOWN: return "Unknown"; + default: return "<undefined>"; } } Ssl_private_key_t * ssl_load_pkcs12(FILE* fp, const gchar *cert_passwd) { - int i, j, ret; - int rest; - unsigned char *p; - gnutls_datum_t data; - gnutls_pkcs12_bag_t bag = NULL; - gnutls_pkcs12_bag_type_t bag_type; - size_t len, buf_len; - static char buf_name[256]; - static char buf_email[128]; - unsigned char buf_keyid[32]; - - gnutls_pkcs12_t ssl_p12 = NULL; - gnutls_x509_crt_t ssl_cert = NULL; - gnutls_x509_privkey_t ssl_pkey = NULL; - - Ssl_private_key_t *private_key = g_malloc(sizeof(Ssl_private_key_t)); - private_key->x509_cert = 0; - private_key->x509_pkey = 0; - private_key->sexp_pkey = 0; - - rest = 4096; - data.data = g_malloc(rest); - data.size = rest; - p = data.data; - while ((len = fread(p, 1, rest, fp)) > 0) { - p += len; - rest -= (int) len; - if (!rest) { - rest = 1024; - data.data = g_realloc(data.data, data.size + rest); - p = data.data + data.size; - data.size += rest; - } - } - data.size -= rest; - ssl_debug_printf("%d bytes read\n", data.size); - if (!feof(fp)) { - ssl_debug_printf( "Error during certificate reading.\n"); - g_free(private_key); - return 0; - } - - ret = gnutls_pkcs12_init(&ssl_p12); - if (ret < 0) { - ssl_debug_printf("gnutls_pkcs12_init(&st_p12) - %s", gnutls_strerror(ret)); - g_free(private_key); - return 0; - } - ret = gnutls_pkcs12_import(ssl_p12, &data, GNUTLS_X509_FMT_DER, 0); - g_free(data.data); - if (ret < 0) { - ssl_debug_printf("gnutls_pkcs12_import(ssl_p12, &data, GNUTLS_X509_FMT_DER, 0) - %s\n", gnutls_strerror(ret)); - g_free(private_key); - return 0; - } - - ssl_debug_printf( "PKCS#12 imported\n"); - - for (i=0; ret==0; i++) { - - if (bag) { gnutls_pkcs12_bag_deinit(bag); bag = NULL; } + int i, j, ret; + int rest; + unsigned char *p; + gnutls_datum_t data; + gnutls_pkcs12_bag_t bag = NULL; + gnutls_pkcs12_bag_type_t bag_type; + size_t len, buf_len; + static char buf_name[256]; + static char buf_email[128]; + unsigned char buf_keyid[32]; + + gnutls_pkcs12_t ssl_p12 = NULL; + gnutls_x509_crt_t ssl_cert = NULL; + gnutls_x509_privkey_t ssl_pkey = NULL; - ret = gnutls_pkcs12_bag_init(&bag); - if (ret < 0) continue; + Ssl_private_key_t *private_key = g_malloc(sizeof(Ssl_private_key_t)); + private_key->x509_cert = 0; + private_key->x509_pkey = 0; + private_key->sexp_pkey = 0; - ret = gnutls_pkcs12_get_bag(ssl_p12, i, bag); - if (ret < 0) continue; + rest = 4096; + data.data = g_malloc(rest); + data.size = rest; + p = data.data; + while ((len = fread(p, 1, rest, fp)) > 0) { + p += len; + rest -= (int) len; + if (!rest) { + rest = 1024; + data.data = g_realloc(data.data, data.size + rest); + p = data.data + data.size; + data.size += rest; + } + } + data.size -= rest; + ssl_debug_printf("%d bytes read\n", data.size); + if (!feof(fp)) { + ssl_debug_printf( "Error during certificate reading.\n"); + g_free(private_key); + return 0; + } - for (j=0; ret==0 && j<gnutls_pkcs12_bag_get_count(bag); j++) { + ret = gnutls_pkcs12_init(&ssl_p12); + if (ret < 0) { + ssl_debug_printf("gnutls_pkcs12_init(&st_p12) - %s", gnutls_strerror(ret)); + g_free(private_key); + return 0; + } + ret = gnutls_pkcs12_import(ssl_p12, &data, GNUTLS_X509_FMT_DER, 0); + g_free(data.data); + if (ret < 0) { + ssl_debug_printf("gnutls_pkcs12_import(ssl_p12, &data, GNUTLS_X509_FMT_DER, 0) - %s\n", gnutls_strerror(ret)); + g_free(private_key); + return 0; + } - bag_type = gnutls_pkcs12_bag_get_type(bag, j); - if (bag_type >= GNUTLS_BAG_UNKNOWN) continue; - ssl_debug_printf( "Bag %d/%d: %s\n", i, j, BAGTYPE(bag_type)); - if (bag_type == GNUTLS_BAG_ENCRYPTED) { - ret = gnutls_pkcs12_bag_decrypt(bag, cert_passwd); - if (ret == 0) { - bag_type = gnutls_pkcs12_bag_get_type(bag, j); - if (bag_type >= GNUTLS_BAG_UNKNOWN) continue; - ssl_debug_printf( "Bag %d/%d decrypted: %s\n", i, j, BAGTYPE(bag_type)); - } - ret = 0; - } + ssl_debug_printf( "PKCS#12 imported\n"); - ret = gnutls_pkcs12_bag_get_data(bag, j, &data); - if (ret < 0) continue; + for (i=0; ret==0; i++) { - switch (bag_type) { + if (bag) { gnutls_pkcs12_bag_deinit(bag); bag = NULL; } - case GNUTLS_BAG_CERTIFICATE: + ret = gnutls_pkcs12_bag_init(&bag); + if (ret < 0) continue; - ret = gnutls_x509_crt_init(&ssl_cert); - if (ret < 0) { - ssl_debug_printf( "gnutls_x509_crt_init(&ssl_cert) - %s\n", gnutls_strerror(ret)); - g_free(private_key); - return 0; - } + ret = gnutls_pkcs12_get_bag(ssl_p12, i, bag); + if (ret < 0) continue; - ret = gnutls_x509_crt_import(ssl_cert, &data, GNUTLS_X509_FMT_DER); - if (ret < 0) { - ssl_debug_printf( "gnutls_x509_crt_import(ssl_cert, &data, GNUTLS_X509_FMT_DER) - %s\n", gnutls_strerror(ret)); - g_free(private_key); - return 0; - } - - buf_len = sizeof(buf_name); - ret = gnutls_x509_crt_get_dn_by_oid(ssl_cert, GNUTLS_OID_X520_COMMON_NAME, 0, 0, buf_name, &buf_len); - if (ret < 0) { g_strlcpy(buf_name, "<ERROR>", 256); } - buf_len = sizeof(buf_email); - ret = gnutls_x509_crt_get_dn_by_oid(ssl_cert, GNUTLS_OID_PKCS9_EMAIL, 0, 0, buf_email, &buf_len); - if (ret < 0) { g_strlcpy(buf_email, "<ERROR>", 128); } - - buf_len = sizeof(buf_keyid); - ret = gnutls_x509_crt_get_key_id(ssl_cert, 0, buf_keyid, &buf_len); - if (ret < 0) { g_strlcpy(buf_keyid, "<ERROR>", 32); } - - private_key->x509_cert = ssl_cert; - ssl_debug_printf( "Certificate imported: %s <%s>, KeyID %s\n", buf_name, buf_email, bytes_to_str(buf_keyid, (int) buf_len)); - break; - - case GNUTLS_BAG_PKCS8_KEY: - case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: - - ret = gnutls_x509_privkey_init(&ssl_pkey); - if (ret < 0) { - ssl_debug_printf( "gnutls_x509_privkey_init(&ssl_pkey) - %s\n", gnutls_strerror(ret)); - g_free(private_key); - return 0; - } - ret = gnutls_x509_privkey_import_pkcs8(ssl_pkey, &data, GNUTLS_X509_FMT_DER, cert_passwd, - (bag_type==GNUTLS_BAG_PKCS8_KEY) ? GNUTLS_PKCS_PLAIN : 0); - if (ret < 0) { - ssl_debug_printf( "Can not decrypt private key - %s\n", gnutls_strerror(ret)); - g_free(private_key); - return 0; - } + for (j=0; ret==0 && j<gnutls_pkcs12_bag_get_count(bag); j++) { - private_key->x509_pkey = ssl_pkey; - private_key->sexp_pkey = ssl_privkey_to_sexp(ssl_pkey); - if ( !private_key->sexp_pkey ) { - g_free(private_key); - return NULL; - } - break; + bag_type = gnutls_pkcs12_bag_get_type(bag, j); + if (bag_type >= GNUTLS_BAG_UNKNOWN) continue; + ssl_debug_printf( "Bag %d/%d: %s\n", i, j, BAGTYPE(bag_type)); + if (bag_type == GNUTLS_BAG_ENCRYPTED) { + ret = gnutls_pkcs12_bag_decrypt(bag, cert_passwd); + if (ret == 0) { + bag_type = gnutls_pkcs12_bag_get_type(bag, j); + if (bag_type >= GNUTLS_BAG_UNKNOWN) continue; + ssl_debug_printf( "Bag %d/%d decrypted: %s\n", i, j, BAGTYPE(bag_type)); + } + ret = 0; + } - default: ; - } - } /* j */ - } /* i */ + ret = gnutls_pkcs12_bag_get_data(bag, j, &data); + if (ret < 0) continue; + + switch (bag_type) { + + case GNUTLS_BAG_CERTIFICATE: + + ret = gnutls_x509_crt_init(&ssl_cert); + if (ret < 0) { + ssl_debug_printf( "gnutls_x509_crt_init(&ssl_cert) - %s\n", gnutls_strerror(ret)); + g_free(private_key); + return 0; + } + + ret = gnutls_x509_crt_import(ssl_cert, &data, GNUTLS_X509_FMT_DER); + if (ret < 0) { + ssl_debug_printf( "gnutls_x509_crt_import(ssl_cert, &data, GNUTLS_X509_FMT_DER) - %s\n", gnutls_strerror(ret)); + g_free(private_key); + return 0; + } + + buf_len = sizeof(buf_name); + ret = gnutls_x509_crt_get_dn_by_oid(ssl_cert, GNUTLS_OID_X520_COMMON_NAME, 0, 0, buf_name, &buf_len); + if (ret < 0) { g_strlcpy(buf_name, "<ERROR>", 256); } + buf_len = sizeof(buf_email); + ret = gnutls_x509_crt_get_dn_by_oid(ssl_cert, GNUTLS_OID_PKCS9_EMAIL, 0, 0, buf_email, &buf_len); + if (ret < 0) { g_strlcpy(buf_email, "<ERROR>", 128); } + + buf_len = sizeof(buf_keyid); + ret = gnutls_x509_crt_get_key_id(ssl_cert, 0, buf_keyid, &buf_len); + if (ret < 0) { g_strlcpy(buf_keyid, "<ERROR>", 32); } + + private_key->x509_cert = ssl_cert; + ssl_debug_printf( "Certificate imported: %s <%s>, KeyID %s\n", buf_name, buf_email, bytes_to_str(buf_keyid, (int) buf_len)); + break; + + case GNUTLS_BAG_PKCS8_KEY: + case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: + + ret = gnutls_x509_privkey_init(&ssl_pkey); + if (ret < 0) { + ssl_debug_printf( "gnutls_x509_privkey_init(&ssl_pkey) - %s\n", gnutls_strerror(ret)); + g_free(private_key); + return 0; + } + ret = gnutls_x509_privkey_import_pkcs8(ssl_pkey, &data, GNUTLS_X509_FMT_DER, cert_passwd, + (bag_type==GNUTLS_BAG_PKCS8_KEY) ? GNUTLS_PKCS_PLAIN : 0); + if (ret < 0) { + ssl_debug_printf( "Can not decrypt private key - %s\n", gnutls_strerror(ret)); + g_free(private_key); + return 0; + } + + private_key->x509_pkey = ssl_pkey; + private_key->sexp_pkey = ssl_privkey_to_sexp(ssl_pkey); + if ( !private_key->sexp_pkey ) { + g_free(private_key); + return NULL; + } + break; + + default: ; + } + } /* j */ + } /* i */ - return private_key; + return private_key; } @@ -2504,67 +2507,67 @@ void ssl_free_key(Ssl_private_key_t* key) gcry_sexp_release(key->sexp_pkey); #endif - if (!key->x509_cert) - gnutls_x509_crt_deinit (key->x509_cert); + if (!key->x509_cert) + gnutls_x509_crt_deinit (key->x509_cert); - if (!key->x509_pkey) - gnutls_x509_privkey_deinit(key->x509_pkey); + if (!key->x509_pkey) + gnutls_x509_privkey_deinit(key->x509_pkey); - g_free((Ssl_private_key_t*)key); + g_free((Ssl_private_key_t*)key); } gint ssl_find_private_key(SslDecryptSession *ssl_session, GHashTable *key_hash, GTree* associations, packet_info *pinfo) { - SslService dummy; - char ip_addr_any[] = {0,0,0,0}; - guint32 port = 0; - Ssl_private_key_t * private_key; - - /* we need to know which side of the conversation is speaking */ - if (ssl_packet_from_server(ssl_session, associations, pinfo)) { - dummy.addr = pinfo->src; - dummy.port = port = pinfo->srcport; - } else { - dummy.addr = pinfo->dst; - dummy.port = port = pinfo->destport; - } - ssl_debug_printf("ssl_find_private_key server %s:%u\n", - ep_address_to_str(&dummy.addr),dummy.port); + SslService dummy; + char ip_addr_any[] = {0,0,0,0}; + guint32 port = 0; + Ssl_private_key_t * private_key; + + /* we need to know which side of the conversation is speaking */ + if (ssl_packet_from_server(ssl_session, associations, pinfo)) { + dummy.addr = pinfo->src; + dummy.port = port = pinfo->srcport; + } else { + dummy.addr = pinfo->dst; + dummy.port = port = pinfo->destport; + } + ssl_debug_printf("ssl_find_private_key server %s:%u\n", + ep_address_to_str(&dummy.addr),dummy.port); - /* try to retrieve private key for this service. Do it now 'cause pinfo - * is not always available - * Note that with HAVE_LIBGNUTLS undefined private_key is allways 0 - * and thus decryption never engaged*/ + /* try to retrieve private key for this service. Do it now 'cause pinfo + * is not always available + * Note that with HAVE_LIBGNUTLS undefined private_key is allways 0 + * and thus decryption never engaged*/ - ssl_session->private_key = 0; - private_key = g_hash_table_lookup(key_hash, &dummy); + ssl_session->private_key = 0; + private_key = g_hash_table_lookup(key_hash, &dummy); - if (!private_key) { - ssl_debug_printf("ssl_find_private_key can't find private key for this server! Try it again with universal port 0\n"); + if (!private_key) { + ssl_debug_printf("ssl_find_private_key can't find private key for this server! Try it again with universal port 0\n"); - dummy.port = 0; - private_key = g_hash_table_lookup(key_hash, &dummy); - } + dummy.port = 0; + private_key = g_hash_table_lookup(key_hash, &dummy); + } - if (!private_key) { - ssl_debug_printf("ssl_find_private_key can't find private key for this server (universal port)! Try it again with universal address 0.0.0.0\n"); + if (!private_key) { + ssl_debug_printf("ssl_find_private_key can't find private key for this server (universal port)! Try it again with universal address 0.0.0.0\n"); - dummy.addr.type = AT_IPv4; - dummy.addr.len = 4; - dummy.addr.data = ip_addr_any; + dummy.addr.type = AT_IPv4; + dummy.addr.len = 4; + dummy.addr.data = ip_addr_any; - dummy.port = port; - private_key = g_hash_table_lookup(key_hash, &dummy); - } + dummy.port = port; + private_key = g_hash_table_lookup(key_hash, &dummy); + } - if (!private_key) { - ssl_debug_printf("ssl_find_private_key can't find any private key!\n"); - } else { - ssl_session->private_key = private_key->sexp_pkey; - } + if (!private_key) { + ssl_debug_printf("ssl_find_private_key can't find any private key!\n"); + } else { + ssl_session->private_key = private_key->sexp_pkey; + } - return 0; + return 0; } void @@ -2695,71 +2698,71 @@ ssl_set_server(SslDecryptSession* ssl, address *addr, port_type ptype, guint32 p gint ssl_equal (gconstpointer v, gconstpointer v2) { - const StringInfo *val1; - const StringInfo *val2; - val1 = (const StringInfo *)v; - val2 = (const StringInfo *)v2; + const StringInfo *val1; + const StringInfo *val2; + val1 = (const StringInfo *)v; + val2 = (const StringInfo *)v2; - if (val1->data_len == val2->data_len && - !memcmp(val1->data, val2->data, val2->data_len)) { - return 1; - } - return 0; + if (val1->data_len == val2->data_len && + !memcmp(val1->data, val2->data, val2->data_len)) { + return 1; + } + return 0; } guint ssl_hash (gconstpointer v) { - guint l,hash; - const StringInfo* id; - const guint* cur; - hash = 0; - id = (const StringInfo*) v; - - /* id and id->data are mallocated in ssl_save_session(). As such 'data' - * should be aligned for any kind of access (for example as a guint as - * is done below). The intermediate void* cast is to prevent "cast - * increases required alignment of target type" warnings on CPUs (such - * as SPARCs) that do not allow misaligned memory accesses. - */ - cur = (const guint*)(void*) id->data; + guint l,hash; + const StringInfo* id; + const guint* cur; + hash = 0; + id = (const StringInfo*) v; + + /* id and id->data are mallocated in ssl_save_session(). As such 'data' + * should be aligned for any kind of access (for example as a guint as + * is done below). The intermediate void* cast is to prevent "cast + * increases required alignment of target type" warnings on CPUs (such + * as SPARCs) that do not allow misaligned memory accesses. + */ + cur = (const guint*)(void*) id->data; - for (l=4; (l < id->data_len); l+=4, cur++) - hash = hash ^ (*cur); + for (l=4; (l < id->data_len); l+=4, cur++) + hash = hash ^ (*cur); - return hash; + return hash; } gint ssl_private_key_equal (gconstpointer v, gconstpointer v2) { - const SslService *val1; - const SslService *val2; - val1 = (const SslService *)v; - val2 = (const SslService *)v2; + const SslService *val1; + const SslService *val2; + val1 = (const SslService *)v; + val2 = (const SslService *)v2; - if ((val1->port == val2->port) && - ! CMP_ADDRESS(&val1->addr, &val2->addr)) { - return 1; - } - return 0; + if ((val1->port == val2->port) && + ! CMP_ADDRESS(&val1->addr, &val2->addr)) { + return 1; + } + return 0; } guint ssl_private_key_hash (gconstpointer v) { - const SslService *key; - guint l, hash, len ; - const guint* cur; - key = (const SslService *)v; - hash = key->port; - len = key->addr.len; - cur = (const guint*) key->addr.data; + const SslService *key; + guint l, hash, len ; + const guint* cur; + key = (const SslService *)v; + hash = key->port; + len = key->addr.len; + cur = (const guint*) key->addr.data; - for (l=4; (l<len); l+=4, cur++) - hash = hash ^ (*cur); + for (l=4; (l<len); l+=4, cur++) + hash = hash ^ (*cur); - return hash; + return hash; } /* private key table entries have a scope 'larger' then packet capture, @@ -2767,8 +2770,8 @@ ssl_private_key_hash (gconstpointer v) void ssl_private_key_free(gpointer id, gpointer key, gpointer dummy _U_) { - g_free(id); - ssl_free_key((Ssl_private_key_t*) key); + g_free(id); + ssl_free_key((Ssl_private_key_t*) key); } /* handling of association between tls/dtls ports and clear text protocol */ @@ -2776,119 +2779,119 @@ void ssl_association_add(GTree* associations, dissector_handle_t handle, guint port, const gchar *protocol, gboolean tcp, gboolean from_key_list) { - SslAssociation* assoc; - assoc = g_malloc(sizeof(SslAssociation)); + SslAssociation* assoc; + assoc = g_malloc(sizeof(SslAssociation)); - assoc->tcp = tcp; - assoc->ssl_port = port; - assoc->info=g_strdup(protocol); - assoc->handle = find_dissector(protocol); - assoc->from_key_list = from_key_list; + assoc->tcp = tcp; + assoc->ssl_port = port; + assoc->info=g_strdup(protocol); + assoc->handle = find_dissector(protocol); + assoc->from_key_list = from_key_list; - ssl_debug_printf("association_add %s port %d protocol %s handle %p\n", - (assoc->tcp)?"TCP":"UDP", port, protocol, (void *)(assoc->handle)); + ssl_debug_printf("association_add %s port %d protocol %s handle %p\n", + (assoc->tcp)?"TCP":"UDP", port, protocol, (void *)(assoc->handle)); - if (!assoc->handle) { - ssl_debug_printf("association_add could not find handle for protocol '%s', try to find 'data' dissector\n", protocol); - assoc->handle = find_dissector("data"); - } + if (!assoc->handle) { + ssl_debug_printf("association_add could not find handle for protocol '%s', try to find 'data' dissector\n", protocol); + assoc->handle = find_dissector("data"); + } - if(!assoc->handle) { - fprintf(stderr, "association_add() could not find handle for protocol:%s\n",protocol); - } else { - if(port) { - if(tcp) - dissector_add("tcp.port", port, handle); - else - dissector_add("udp.port", port, handle); + if(!assoc->handle) { + fprintf(stderr, "association_add() could not find handle for protocol:%s\n",protocol); + } else { + if(port) { + if(tcp) + dissector_add("tcp.port", port, handle); + else + dissector_add("udp.port", port, handle); + } + g_tree_insert(associations, assoc, assoc); } - g_tree_insert(associations, assoc, assoc); - } } void ssl_association_remove(GTree* associations, SslAssociation *assoc) { - ssl_debug_printf("ssl_association_remove removing %s %u - %s handle %p\n", - (assoc->tcp)?"TCP":"UDP", assoc->ssl_port, assoc->info, (void *)(assoc->handle)); - if (assoc->handle) - dissector_delete((assoc->tcp)?"tcp.port":"udp.port", assoc->ssl_port, assoc->handle); + ssl_debug_printf("ssl_association_remove removing %s %u - %s handle %p\n", + (assoc->tcp)?"TCP":"UDP", assoc->ssl_port, assoc->info, (void *)(assoc->handle)); + if (assoc->handle) + dissector_delete((assoc->tcp)?"tcp.port":"udp.port", assoc->ssl_port, assoc->handle); - g_free(assoc->info); + g_free(assoc->info); - g_tree_remove(associations, assoc); - g_free(assoc); + g_tree_remove(associations, assoc); + g_free(assoc); } gint ssl_association_cmp(gconstpointer a, gconstpointer b) { - const SslAssociation *assoc_a=a, *assoc_b=b; - if (assoc_a->tcp != assoc_b->tcp) return (assoc_a->tcp)?1:-1; - return assoc_a->ssl_port - assoc_b->ssl_port; + const SslAssociation *assoc_a=a, *assoc_b=b; + if (assoc_a->tcp != assoc_b->tcp) return (assoc_a->tcp)?1:-1; + return assoc_a->ssl_port - assoc_b->ssl_port; } SslAssociation* ssl_association_find(GTree * associations, guint port, gboolean tcp) { - register SslAssociation* ret; - SslAssociation assoc_tmp; + register SslAssociation* ret; + SslAssociation assoc_tmp; - assoc_tmp.tcp = tcp; - assoc_tmp.ssl_port = port; - ret = g_tree_lookup(associations, &assoc_tmp); + assoc_tmp.tcp = tcp; + assoc_tmp.ssl_port = port; + ret = g_tree_lookup(associations, &assoc_tmp); - ssl_debug_printf("association_find: %s port %d found %p\n", (tcp)?"TCP":"UDP", port, (void *)ret); - return ret; + ssl_debug_printf("association_find: %s port %d found %p\n", (tcp)?"TCP":"UDP", port, (void *)ret); + return ret; } gint ssl_assoc_from_key_list(gpointer key _U_, gpointer data, gpointer user_data) { - if (((SslAssociation*)data)->from_key_list) - ep_stack_push((ep_stack_t)user_data, data); - return FALSE; + if (((SslAssociation*)data)->from_key_list) + ep_stack_push((ep_stack_t)user_data, data); + return FALSE; } int ssl_packet_from_server(SslDecryptSession* ssl, GTree* associations, packet_info *pinfo) { - gint ret; - if (ssl && (ssl->srv_ptype != PT_NONE)) { - ret = (ssl->srv_ptype == pinfo->ptype) && (ssl->srv_port == pinfo->srcport) && ADDRESSES_EQUAL(&ssl->srv_addr, &pinfo->src); - } else { - ret = ssl_association_find(associations, pinfo->srcport, pinfo->ptype == PT_TCP) != 0; - } + gint ret; + if (ssl && (ssl->srv_ptype != PT_NONE)) { + ret = (ssl->srv_ptype == pinfo->ptype) && (ssl->srv_port == pinfo->srcport) && ADDRESSES_EQUAL(&ssl->srv_addr, &pinfo->src); + } else { + ret = ssl_association_find(associations, pinfo->srcport, pinfo->ptype == PT_TCP) != 0; + } - ssl_debug_printf("packet_from_server: is from server - %s\n", (ret)?"TRUE":"FALSE"); - return ret; + ssl_debug_printf("packet_from_server: is from server - %s\n", (ret)?"TRUE":"FALSE"); + return ret; } /* add to packet data a newly allocated tvb with the specified real data*/ void ssl_add_record_info(gint proto, packet_info *pinfo, guchar* data, gint data_len, gint record_id) { - guchar* real_data; - SslRecordInfo* rec; - SslPacketInfo* pi; - real_data = se_alloc(data_len); - rec = se_alloc(sizeof(SslRecordInfo)); - pi = p_get_proto_data(pinfo->fd, proto); + guchar* real_data; + SslRecordInfo* rec; + SslPacketInfo* pi; + real_data = se_alloc(data_len); + rec = se_alloc(sizeof(SslRecordInfo)); + pi = p_get_proto_data(pinfo->fd, proto); - if (!pi) + if (!pi) { - pi = se_alloc0(sizeof(SslPacketInfo)); - p_add_proto_data(pinfo->fd, proto,pi); + pi = se_alloc0(sizeof(SslPacketInfo)); + p_add_proto_data(pinfo->fd, proto,pi); } - rec->id = record_id; - rec->tvb = tvb_new_real_data(real_data, data_len, data_len); - memcpy(real_data, data, data_len); + rec->id = record_id; + rec->tvb = tvb_new_real_data(real_data, data_len, data_len); + memcpy(real_data, data, data_len); - /* head insertion */ - rec->next= pi->handshake_data; - pi->handshake_data = rec; + /* head insertion */ + rec->next= pi->handshake_data; + pi->handshake_data = rec; } @@ -2896,276 +2899,276 @@ ssl_add_record_info(gint proto, packet_info *pinfo, guchar* data, gint data_len, tvbuff_t* ssl_get_record_info(int proto, packet_info *pinfo, gint record_id) { - SslRecordInfo* rec; - SslPacketInfo* pi; - pi = p_get_proto_data(pinfo->fd, proto); + SslRecordInfo* rec; + SslPacketInfo* pi; + pi = p_get_proto_data(pinfo->fd, proto); - if (!pi) - return NULL; + if (!pi) + return NULL; - for (rec = pi->handshake_data; rec; rec = rec->next) - if (rec->id == record_id) - return rec->tvb; + for (rec = pi->handshake_data; rec; rec = rec->next) + if (rec->id == record_id) + return rec->tvb; - return NULL; + return NULL; } void ssl_add_data_info(gint proto, packet_info *pinfo, guchar* data, gint data_len, gint key, SslFlow *flow) { - SslDataInfo *rec, **prec; - SslPacketInfo *pi; + SslDataInfo *rec, **prec; + SslPacketInfo *pi; - pi = p_get_proto_data(pinfo->fd, proto); - if (!pi) + pi = p_get_proto_data(pinfo->fd, proto); + if (!pi) { - pi = se_alloc0(sizeof(SslPacketInfo)); - p_add_proto_data(pinfo->fd, proto,pi); + pi = se_alloc0(sizeof(SslPacketInfo)); + p_add_proto_data(pinfo->fd, proto,pi); } - rec = se_alloc(sizeof(SslDataInfo)+data_len); - rec->key = key; - rec->plain_data.data = (guchar*)(rec + 1); - memcpy(rec->plain_data.data, data, data_len); - rec->plain_data.data_len = data_len; - rec->seq = flow->byte_seq; - rec->nxtseq = flow->byte_seq + data_len; - rec->flow = flow; - rec->next = NULL; + rec = se_alloc(sizeof(SslDataInfo)+data_len); + rec->key = key; + rec->plain_data.data = (guchar*)(rec + 1); + memcpy(rec->plain_data.data, data, data_len); + rec->plain_data.data_len = data_len; + rec->seq = flow->byte_seq; + rec->nxtseq = flow->byte_seq + data_len; + rec->flow = flow; + rec->next = NULL; - flow->byte_seq += data_len; + flow->byte_seq += data_len; - /* insertion */ - prec = &pi->appl_data; - while (*prec) prec = &(*prec)->next; - *prec = rec; + /* insertion */ + prec = &pi->appl_data; + while (*prec) prec = &(*prec)->next; + *prec = rec; - ssl_debug_printf("ssl_add_data_info: new data inserted data_len = %d, seq = %u, nxtseq = %u\n", - rec->plain_data.data_len, rec->seq, rec->nxtseq); + ssl_debug_printf("ssl_add_data_info: new data inserted data_len = %d, seq = %u, nxtseq = %u\n", + rec->plain_data.data_len, rec->seq, rec->nxtseq); } SslDataInfo* ssl_get_data_info(int proto, packet_info *pinfo, gint key) { - SslDataInfo* rec; - SslPacketInfo* pi; - pi = p_get_proto_data(pinfo->fd, proto); + SslDataInfo* rec; + SslPacketInfo* pi; + pi = p_get_proto_data(pinfo->fd, proto); - if (!pi) return NULL; + if (!pi) return NULL; - rec = pi->appl_data; - while (rec) { - if (rec->key == key) return rec; - rec = rec->next; - } + rec = pi->appl_data; + while (rec) { + if (rec->key == key) return rec; + rec = rec->next; + } - return NULL; + return NULL; } /* initialize/reset per capture state data (ssl sessions cache) */ void ssl_common_init(GHashTable **session_hash, StringInfo *decrypted_data, StringInfo *compressed_data) { - if (*session_hash) - g_hash_table_destroy(*session_hash); - *session_hash = g_hash_table_new(ssl_hash, ssl_equal); + if (*session_hash) + g_hash_table_destroy(*session_hash); + *session_hash = g_hash_table_new(ssl_hash, ssl_equal); - g_free(decrypted_data->data); - ssl_data_alloc(decrypted_data, 32); + g_free(decrypted_data->data); + ssl_data_alloc(decrypted_data, 32); - g_free(compressed_data->data); - ssl_data_alloc(compressed_data, 32); + g_free(compressed_data->data); + ssl_data_alloc(compressed_data, 32); } /* parse ssl related preferences (private keys and ports association strings) */ void ssl_parse_key_list(const gchar * keys_list, GHashTable *key_hash, GTree* associations, dissector_handle_t handle, gboolean tcp) { - gchar* end; - gchar* start; - gchar* tmp; - guchar* ip; - SslService* service; - Ssl_private_key_t * private_key, *tmp_private_key; - FILE* fp; - - start = g_strdup(keys_list); - tmp = start; - ssl_debug_printf("ssl_init keys string:\n%s\n", start); - do { - int read_index, write_index; - gchar* addr, *port, *protocol, *filename, *cert_passwd; - - addr = start; - /* split ip/file couple with ';' separator*/ - end = strpbrk(start, ";\n\r"); - if (end) { - *end = 0; - start = end+1; - } - - /* skip comments (in file) */ - if (addr[0] == '#') continue; - - /* for each entry split ip, port, protocol, filename with ',' separator */ - ssl_debug_printf("ssl_init found host entry %s\n", addr); - port = strchr(addr, ','); - if (!port) - { - ssl_debug_printf("ssl_init entry malformed can't find port in '%s'\n", addr); - continue; - } - *port = 0; - port++; - - protocol = strchr(port,','); - if (!protocol) - { - ssl_debug_printf("ssl_init entry malformed can't find protocol in %s\n", port); - continue; - } - *protocol=0; - protocol++; - - filename = strchr(protocol,','); - if (!filename) - { - ssl_debug_printf("ssl_init entry malformed can't find filename in %s\n", protocol); - continue; - } - *filename=0; - filename++; - - cert_passwd = strchr(filename,','); - if (cert_passwd) - { - *cert_passwd=0; - cert_passwd++; - } + gchar* end; + gchar* start; + gchar* tmp; + guchar* ip; + SslService* service; + Ssl_private_key_t * private_key, *tmp_private_key; + FILE* fp; + + start = g_strdup(keys_list); + tmp = start; + ssl_debug_printf("ssl_init keys string:\n%s\n", start); + do { + int read_index, write_index; + gchar* addr, *port, *protocol, *filename, *cert_passwd; + + addr = start; + /* split ip/file couple with ';' separator*/ + end = strpbrk(start, ";\n\r"); + if (end) { + *end = 0; + start = end+1; + } - /* convert ip and port string to network rappresentation*/ - service = g_malloc(sizeof(SslService) + 4); - service->addr.type = AT_IPv4; - service->addr.len = 4; - service->addr.data = ip = ((guchar*)service) + sizeof(SslService); + /* skip comments (in file) */ + if (addr[0] == '#') continue; - /* remove all spaces in addr */ - read_index = 0; - write_index = 0; + /* for each entry split ip, port, protocol, filename with ',' separator */ + ssl_debug_printf("ssl_init found host entry %s\n", addr); + port = strchr(addr, ','); + if (!port) + { + ssl_debug_printf("ssl_init entry malformed can't find port in '%s'\n", addr); + continue; + } + *port = 0; + port++; + + protocol = strchr(port,','); + if (!protocol) + { + ssl_debug_printf("ssl_init entry malformed can't find protocol in %s\n", port); + continue; + } + *protocol=0; + protocol++; + + filename = strchr(protocol,','); + if (!filename) + { + ssl_debug_printf("ssl_init entry malformed can't find filename in %s\n", protocol); + continue; + } + *filename=0; + filename++; + + cert_passwd = strchr(filename,','); + if (cert_passwd) + { + *cert_passwd=0; + cert_passwd++; + } - while(addr[read_index]) { - if (addr[read_index] != ' ') { - addr[write_index] = addr[read_index]; - write_index++; - } - read_index++; - } - addr[write_index] = 0; + /* convert ip and port string to network rappresentation*/ + service = g_malloc(sizeof(SslService) + 4); + service->addr.type = AT_IPv4; + service->addr.len = 4; + service->addr.data = ip = ((guchar*)service) + sizeof(SslService); - if ( !strcmp("any", addr) || !strcmp("ANY", addr) ) { - ip[0] = 0; - ip[1] = 0; - ip[2] = 0; - ip[3] = 0; - } else { - sscanf(addr, "%hhu.%hhu.%hhu.%hhu", &ip[0], &ip[1], &ip[2], &ip[3]); - } + /* remove all spaces in addr */ + read_index = 0; + write_index = 0; - if(!strcmp("start_tls", port)) { - service->port = 0; - } else { - service->port = atoi(port); - } - ssl_debug_printf("ssl_init addr '%hhu.%hhu.%hhu.%hhu' port '%d' filename '%s' password(only for p12 file) '%s'\n", - ip[0], ip[1], ip[2], ip[3], service->port, filename, cert_passwd); + while(addr[read_index]) { + if (addr[read_index] != ' ') { + addr[write_index] = addr[read_index]; + write_index++; + } + read_index++; + } + addr[write_index] = 0; + + if ( !strcmp("any", addr) || !strcmp("ANY", addr) ) { + ip[0] = 0; + ip[1] = 0; + ip[2] = 0; + ip[3] = 0; + } else { + sscanf(addr, "%hhu.%hhu.%hhu.%hhu", &ip[0], &ip[1], &ip[2], &ip[3]); + } - /* try to load pen or p12 file*/ - fp = ws_fopen(filename, "rb"); - if (!fp) { - fprintf(stderr, "can't open file %s \n",filename); - continue; - } + if(!strcmp("start_tls", port)) { + service->port = 0; + } else { + service->port = atoi(port); + } + ssl_debug_printf("ssl_init addr '%hhu.%hhu.%hhu.%hhu' port '%d' filename '%s' password(only for p12 file) '%s'\n", + ip[0], ip[1], ip[2], ip[3], service->port, filename, cert_passwd); + + /* try to load pen or p12 file*/ + fp = ws_fopen(filename, "rb"); + if (!fp) { + fprintf(stderr, "can't open file %s \n",filename); + continue; + } - if (!cert_passwd) { - private_key = ssl_load_key(fp); - } - else - { - private_key = ssl_load_pkcs12(fp,cert_passwd); - } - /* !!! */ - if (!private_key) { - fprintf(stderr,"can't load private key from %s\n", - filename); - continue; - } + if (!cert_passwd) { + private_key = ssl_load_key(fp); + } + else + { + private_key = ssl_load_pkcs12(fp,cert_passwd); + } + /* !!! */ + if (!private_key) { + fprintf(stderr,"can't load private key from %s\n", + filename); + continue; + } - fclose(fp); + fclose(fp); - ssl_debug_printf("ssl_init private key file %s successfully loaded\n",filename); + ssl_debug_printf("ssl_init private key file %s successfully loaded\n",filename); - /* if item exists, remove first */ - tmp_private_key = g_hash_table_lookup(key_hash, service); - if (tmp_private_key) { - g_hash_table_remove(key_hash, service); - ssl_free_key(tmp_private_key); - } - g_hash_table_insert(key_hash, service, private_key); + /* if item exists, remove first */ + tmp_private_key = g_hash_table_lookup(key_hash, service); + if (tmp_private_key) { + g_hash_table_remove(key_hash, service); + ssl_free_key(tmp_private_key); + } + g_hash_table_insert(key_hash, service, private_key); - ssl_association_add(associations, handle, service->port, protocol, tcp, TRUE); + ssl_association_add(associations, handle, service->port, protocol, tcp, TRUE); - } while (end != NULL); - g_free(tmp); + } while (end != NULL); + g_free(tmp); } /* store master secret into session data cache */ void ssl_save_session(SslDecryptSession* ssl, GHashTable *session_hash) { - /* allocate stringinfo chunks for session id and master secret data*/ - StringInfo* session_id; - StringInfo* master_secret; - session_id = se_alloc0(sizeof(StringInfo) + ssl->session_id.data_len); - master_secret = se_alloc0(48 + sizeof(StringInfo)); + /* allocate stringinfo chunks for session id and master secret data*/ + StringInfo* session_id; + StringInfo* master_secret; + session_id = se_alloc0(sizeof(StringInfo) + ssl->session_id.data_len); + master_secret = se_alloc0(48 + sizeof(StringInfo)); - master_secret->data = ((guchar*)master_secret+sizeof(StringInfo)); + master_secret->data = ((guchar*)master_secret+sizeof(StringInfo)); - /* ssl_hash() depends on session_id->data being aligned for guint access - * so be careful in changing how it is allocated. - */ - session_id->data = ((guchar*)session_id+sizeof(StringInfo)); + /* ssl_hash() depends on session_id->data being aligned for guint access + * so be careful in changing how it is allocated. + */ + session_id->data = ((guchar*)session_id+sizeof(StringInfo)); - ssl_data_set(session_id, ssl->session_id.data, ssl->session_id.data_len); - ssl_data_set(master_secret, ssl->master_secret.data, ssl->master_secret.data_len); - g_hash_table_insert(session_hash, session_id, master_secret); - ssl_print_string("ssl_save_session stored session id", session_id); - ssl_print_string("ssl_save_session stored master secret", master_secret); + ssl_data_set(session_id, ssl->session_id.data, ssl->session_id.data_len); + ssl_data_set(master_secret, ssl->master_secret.data, ssl->master_secret.data_len); + g_hash_table_insert(session_hash, session_id, master_secret); + ssl_print_string("ssl_save_session stored session id", session_id); + ssl_print_string("ssl_save_session stored master secret", master_secret); } void ssl_restore_session(SslDecryptSession* ssl, GHashTable *session_hash) { - StringInfo* ms; - ms = g_hash_table_lookup(session_hash, &ssl->session_id); + StringInfo* ms; + ms = g_hash_table_lookup(session_hash, &ssl->session_id); - if (!ms) { - ssl_debug_printf("ssl_restore_session can't find stored session\n"); - return; - } - ssl_data_set(&ssl->master_secret, ms->data, ms->data_len); - ssl->state |= SSL_MASTER_SECRET; - ssl_debug_printf("ssl_restore_session master key retrieved\n"); + if (!ms) { + ssl_debug_printf("ssl_restore_session can't find stored session\n"); + return; + } + ssl_data_set(&ssl->master_secret, ms->data, ms->data_len); + ssl->state |= SSL_MASTER_SECRET; + ssl_debug_printf("ssl_restore_session master key retrieved\n"); } int ssl_is_valid_content_type(guint8 type) { - if (type >= 0x14 && type <= 0x17) + if (type >= 0x14 && type <= 0x17) { - return 1; + return 1; } - return 0; + return 0; } #ifdef SSL_DECRYPT_DEBUG @@ -3195,8 +3198,8 @@ ssl_set_debug(char* name) void ssl_debug_flush(void) { - if (ssl_debug_file) - fflush(ssl_debug_file); + if (ssl_debug_file) + fflush(ssl_debug_file); } void diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index a2d36a07d0..0b5b7392ac 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -2412,48 +2412,47 @@ dissect_tcpopt_scps(const ip_tcp_opt *optp, tvbuff_t *tvb, */ while (optlen > local_offset) { - proto_item *hidden_item; - /* 1st octet is Extended Capability Binding Space */ - binding_space = tvb_get_guint8(tvb, (offset + local_offset)); + /* 1st octet is Extended Capability Binding Space */ + binding_space = tvb_get_guint8(tvb, (offset + local_offset)); - /* 2nd octet (upper 4-bits) has binding space length in 16-bit words. - * As defined by the specification, this length is exclusive of the - * octets containing the extended capability type and length - */ + /* 2nd octet (upper 4-bits) has binding space length in 16-bit words. + * As defined by the specification, this length is exclusive of the + * octets containing the extended capability type and length + */ - extended_cap_length = - (tvb_get_guint8(tvb, (offset + local_offset + 1)) >> 4); + extended_cap_length = + (tvb_get_guint8(tvb, (offset + local_offset + 1)) >> 4); - /* Convert the extended capabilities length into bytes for display */ - extended_cap_length = (extended_cap_length << 1); + /* Convert the extended capabilities length into bytes for display */ + extended_cap_length = (extended_cap_length << 1); - proto_tree_add_text(field_tree, tvb, offset + local_offset, 2, - "\tBinding Space %u", - binding_space); - hidden_item = proto_tree_add_uint(field_tree, hf_tcp_option_scps_binding, - tvb, (offset + local_offset), 1, - binding_space); + proto_tree_add_text(field_tree, tvb, offset + local_offset, 2, + "\tBinding Space %u", + binding_space); + hidden_item = proto_tree_add_uint(field_tree, hf_tcp_option_scps_binding, + tvb, (offset + local_offset), 1, + binding_space); - PROTO_ITEM_SET_HIDDEN(hidden_item); + PROTO_ITEM_SET_HIDDEN(hidden_item); - /* Step past the binding space and length octets */ - local_offset += 2; + /* Step past the binding space and length octets */ + local_offset += 2; - proto_tree_add_text(field_tree, tvb, offset + local_offset, - extended_cap_length, - "\tBinding Space Data (%u bytes)", - extended_cap_length); + proto_tree_add_text(field_tree, tvb, offset + local_offset, + extended_cap_length, + "\tBinding Space Data (%u bytes)", + extended_cap_length); - tcp_info_append_uint(pinfo, "EXCAP", binding_space); + tcp_info_append_uint(pinfo, "EXCAP", binding_space); - /* Step past the Extended capability data - * Treat the extended capability data area as opaque; - * If one desires to parse the extended capability data - * (say, in a vendor aware build of wireshark), it would - * be trigged here. - */ - local_offset += extended_cap_length; + /* Step past the Extended capability data + * Treat the extended capability data area as opaque; + * If one desires to parse the extended capability data + * (say, in a vendor aware build of wireshark), it would + * be trigged here. + */ + local_offset += extended_cap_length; } } } @@ -2540,7 +2539,6 @@ dissect_tcpopt_snack(const ip_tcp_opt *optp, tvbuff_t *tvb, base_mss = tcpd->fwd->maxsizeacked; if (base_mss) { - proto_item *hidden_item; /* Scale the reported offset and hole size by the largest segment acked */ hole_start = ack + (base_mss * relative_hole_offset); hole_end = hole_start + (base_mss * relative_hole_size); diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index 5c6518f0f0..27339363b1 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -413,7 +413,7 @@ const enum_val_t tds_protocol_type_options[] = { /* TODO: consider storing endian type with each conversation */ /* (using pref as the default) */ -static gint tds_little_endian = TRUE; +static gboolean tds_little_endian = TRUE; const enum_val_t tds_endian_type_options[] = { {"little_endian", "Little Endian", TRUE}, @@ -595,16 +595,16 @@ dissect_tds_nt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* */ static guint16 -tds_tvb_get_xxtohs(tvbuff_t *tvb, gint offset, gint tds_little_endian) { - if (tds_little_endian) +tds_tvb_get_xxtohs(tvbuff_t *tvb, gint offset, gboolean tds_little_endian_flag) { + if (tds_little_endian_flag) return tvb_get_letohs(tvb, offset); else return tvb_get_ntohs(tvb, offset); } static guint32 -tds_tvb_get_xxtohl(tvbuff_t *tvb, gint offset, gint tds_little_endian) { - if (tds_little_endian) +tds_tvb_get_xxtohl(tvbuff_t *tvb, gint offset, gboolean tds_little_endian_flag) { + if (tds_little_endian_flag) return tvb_get_letohl(tvb, offset); else return tvb_get_ntohl(tvb, offset); diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index a1200dfdf3..9c2e67c5df 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -440,7 +440,7 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, gint enum_val, data_id, current_data_id = -1, tpncp_data_field_sign, tpncp_data_field_size, tpncp_data_field_array_dim, tpncp_data_field_is_ip_addr; - guint index; + guint idx; tpncp_data_field_info *current_tpncp_data_field_info = NULL; hf_register_info hf_entr; @@ -575,8 +575,8 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, hf_allocated = hf_size+array_length(hf_tpncp)-1; if ((hf = (hf_register_info *)g_realloc(hf, hf_allocated * sizeof(hf_register_info))) == NULL) return (-1); - for (index = 0; index < array_length(hf_tpncp); index++) { - memcpy(hf + (hf_size - 1), hf_tpncp + index, sizeof(hf_register_info)); + for (idx = 0; idx < array_length(hf_tpncp); idx++) { + memcpy(hf + (hf_size - 1), hf_tpncp + idx, sizeof(hf_register_info)); hf_size++; } was_registered = TRUE; @@ -741,7 +741,7 @@ void proto_reg_handoff_tpncp(void) { /*-------------------------------------------------------------------------------------------------------------------------------------------*/ void proto_register_tpncp(void) { - gint index; + gint idx; module_t *tpncp_module; static gint *ett[] = { &ett_tpncp, @@ -758,8 +758,8 @@ void proto_register_tpncp(void) { * The function proto_register_field_array can not work with dynamic arrays, * so passing dynamic array elements one-by-one in the loop. */ - for(index = 0; index < hf_size; index++) { - proto_register_field_array(proto_tpncp, &hf[index], 1); + for(idx = 0; idx < hf_size; idx++) { + proto_register_field_array(proto_tpncp, &hf[idx], 1); } proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-turbocell.c b/epan/dissectors/packet-turbocell.c index 7c5f3f955e..2e3823fa95 100644 --- a/epan/dissectors/packet-turbocell.c +++ b/epan/dissectors/packet-turbocell.c @@ -201,7 +201,7 @@ static void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } else { - tvbuff_t *volatile msdu_tvb = NULL,*next_tvb; + tvbuff_t *volatile msdu_tvb = NULL; guint32 msdu_offset = 0x04; guint16 j = 1; guint16 msdu_length; diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index 81b6e9d2d9..1d27dfab96 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -2993,8 +2993,7 @@ void dissect_fp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Can't dissect anything without it... */ if (p_fp_info == NULL) { - proto_item *ti = - proto_tree_add_text(fp_tree, tvb, offset, -1, + ti = proto_tree_add_text(fp_tree, tvb, offset, -1, "Can't dissect FP frame because no per-frame info was attached!"); PROTO_ITEM_SET_GENERATED(ti); return; diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 290689049d..e35b32fa31 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -1826,7 +1826,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, usb_setup_dissector dissector; proto_item *ti = NULL; proto_tree *setup_tree = NULL; - int type; + int type_2; ti=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 0, usb_conv_info->interfaceClass); PROTO_ITEM_SET_GENERATED(ti); @@ -1842,7 +1842,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, sizeof(struct usb_device_setup_hdr), "URB setup"); setup_tree = proto_item_add_subtree(ti, usb_setup_hdr); usb_trans_info->requesttype=tvb_get_guint8(tvb, offset); - offset=dissect_usb_bmrequesttype(setup_tree, tvb, offset, &type); + offset=dissect_usb_bmrequesttype(setup_tree, tvb, offset, &type_2); /* read the request code and spawn off to a class specific @@ -1850,7 +1850,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, */ usb_trans_info->request=tvb_get_guint8(tvb, offset); - switch (type) { + switch (type_2) { case RQT_SETUP_TYPE_STANDARD: /* @@ -1977,8 +1977,8 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, return; } - type = (usb_trans_info->requesttype & USB_TYPE_MASK) >>5; - switch (type) { + type_2 = (usb_trans_info->requesttype & USB_TYPE_MASK) >>5; + switch (type_2) { case RQT_SETUP_TYPE_STANDARD: /* @@ -2030,7 +2030,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, proto_item *ti = NULL; proto_tree *setup_tree = NULL; guint8 requesttype, request; - int type; + int type_2; /* Dissect the setup header - it's present */ @@ -2039,7 +2039,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, requesttype=tvb_get_guint8(tvb, offset); - offset=dissect_usb_bmrequesttype(setup_tree, tvb, offset, &type); + offset=dissect_usb_bmrequesttype(setup_tree, tvb, offset, &type_2); request=tvb_get_guint8(tvb, offset); proto_tree_add_item(setup_tree, hf_usb_request, tvb, offset, 1, TRUE); diff --git a/epan/dissectors/packet-v52.c b/epan/dissectors/packet-v52.c index 5e90e50c5f..c132335ba7 100644 --- a/epan/dissectors/packet-v52.c +++ b/epan/dissectors/packet-v52.c @@ -34,11 +34,11 @@ # include "config.h" #endif -#include <stdio.h> +//#include <stdio.h> #include <glib.h> -#include <string.h> +//#include <string.h> #include <epan/packet.h> -#include <epan/strutil.h> +//#include <epan/strutil.h> #include <epan/expert.h> static int proto_v52 = -1; @@ -2131,7 +2131,7 @@ dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int offset = 0; proto_tree *v52_tree = NULL; proto_item *ti; - guint8 address = 0; + gboolean addr = FALSE; guint8 bcc_all_address_tmp_up = -1; guint16 pstn_all_address_tmp, isdn_all_address_tmp, bcc_all_address_tmp, prot_all_address_tmp, link_all_address_tmp; @@ -2151,7 +2151,7 @@ dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) message_type_tmp = tvb_get_guint8(tvb, MSG_TYPE_OFFSET); if ((message_type_tmp >= 0x00) && (message_type_tmp <= 0x0e)) { - address = 1; + addr = TRUE; proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE); proto_tree_add_item(v52_tree, hf_v52_pstn_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE); @@ -2162,7 +2162,7 @@ dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if ((message_type_tmp >= 0x10) && (message_type_tmp <= 0x13)) { - address = 1; + addr = TRUE; if ((tvb_get_guint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) { pstn_all_address_tmp = (((tvb_get_guint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET))); proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE); @@ -2180,7 +2180,7 @@ dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if ((message_type_tmp == 0x30) || (message_type_tmp == 0x31)) { - address = 1; + addr = TRUE; link_all_address_tmp = tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET); proto_tree_add_item(v52_tree, hf_v52_link_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE); proto_tree_add_item(v52_tree, hf_v52_link_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE); @@ -2189,7 +2189,7 @@ dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if ((message_type_tmp >= 0x20) && (message_type_tmp <= 0x2a)) { - address = 1; + addr = TRUE; proto_tree_add_item(v52_tree, hf_v52_bcc_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE); proto_tree_add_item(v52_tree, hf_v52_bcc_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE); @@ -2203,7 +2203,7 @@ dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if ((message_type_tmp >= 0x18) && (message_type_tmp <= 0x1f)) { - address = 1; + addr = TRUE; prot_all_address_tmp = (tvb_get_guint8(tvb, ADDRESS_OFFSET)<<8) + (tvb_get_guint8(tvb,LOW_ADDRESS_OFFSET)); proto_tree_add_item(v52_tree, hf_v52_prot_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE); proto_tree_add_item(v52_tree, hf_v52_prot_low_address, tvb, LOW_ADDRESS_OFFSET, LOW_ADDRESS_LENGTH, FALSE); @@ -2214,10 +2214,7 @@ dissect_v52_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - if (address) { - - } - else { + if (addr == FALSE) { if ((tvb_get_guint8(tvb, ADDRESS_OFFSET)&0x01) == 0x1) { pstn_all_address_tmp = (((tvb_get_guint8(tvb, ADDRESS_OFFSET)>>1)<<8)+(tvb_get_guint8(tvb, LOW_ADDRESS_OFFSET))); proto_tree_add_item(v52_tree, hf_v52_pstn_address, tvb, ADDRESS_OFFSET, ADDRESS_LENGTH, FALSE); diff --git a/epan/dissectors/packet-v5ua.c b/epan/dissectors/packet-v5ua.c index 38cf347841..c3dcf23cfe 100644 --- a/epan/dissectors/packet-v5ua.c +++ b/epan/dissectors/packet-v5ua.c @@ -976,13 +976,13 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *v5ua_ if(msg_class==1) dissect_draft_tei_status_parameter(parameter_tvb, parameter_tree, parameter_item); if(msg_class==9){ if(msg_type==1||msg_type==2||msg_type==3||msg_type==4){ - guint16 length, offset; + guint16 length_2, offset; tvbuff_t *layer3_data_tvb; offset = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) + 8; - length = msg_length - offset; - if(length > 0){ + length_2 = msg_length - offset; + if(length_2 > 0){ if(tvb_get_guint8(parameter_tvb, offset) == 0x48){ - layer3_data_tvb = tvb_new_subset(parameter_tvb, offset, length, length); + layer3_data_tvb = tvb_new_subset(parameter_tvb, offset, length_2, length_2); dissect_layer3_message(layer3_data_tvb, v5ua_tree, parameter_item, pinfo); } } |