diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2014-08-29 19:36:59 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-30 09:54:05 +0000 |
commit | 437b448095a6c2135a1c90c259ac3334445c348d (patch) | |
tree | a23e1f48d64e074345707fcb8467eee4f4262c22 /epan | |
parent | 26ab2e40e38b7dc38e13955267e7375b59f9bfc0 (diff) |
Mark Trap-PDU as obsolete for SNMP versions > 1
Change-Id: I967a1547eb97619042b620bb3d803a29cce9ebe1
Reviewed-on: https://code.wireshark.org/review/3920
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-snmp.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index 3f3ee193dd..10aae10a5a 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -173,7 +173,7 @@ static guint num_specific_traps = 0; static snmp_st_assoc_t *specific_traps = NULL; static const char *enterprise_oid = NULL; static guint generic_trap = 0; - +static guint32 snmp_version = 0; static snmp_usm_params_t usm_p = {FALSE,FALSE,0,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE}; @@ -381,6 +381,7 @@ static expert_field ei_snmp_varbind_wrong_class_tag = EI_INIT; static expert_field ei_snmp_rfc1910_non_conformant = EI_INIT; static expert_field ei_snmp_rfc3411_non_conformant = EI_INIT; static expert_field ei_snmp_version_unknown = EI_INIT; +static expert_field ei_snmp_trap_pdu_obsolete = EI_INIT; static const true_false_string auth_flags = { "OK", @@ -1977,7 +1978,7 @@ check_ScopedPdu(tvbuff_t* tvb) static int dissect_snmp_EnterpriseOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 62 "../../asn1/snmp/snmp.cnf" +#line 68 "../../asn1/snmp/snmp.cnf" const gchar* name; offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &enterprise_oid); @@ -2067,7 +2068,7 @@ static const value_string snmp_Version_vals[] = { static int dissect_snmp_Version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, - NULL); + &snmp_version); return offset; } @@ -2230,7 +2231,7 @@ dissect_snmp_GenericTrap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_snmp_SpecificTrap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 46 "../../asn1/snmp/snmp.cnf" +#line 52 "../../asn1/snmp/snmp.cnf" guint specific_trap; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -2261,7 +2262,7 @@ static const ber_sequence_t Trap_PDU_U_sequence[] = { static int dissect_snmp_Trap_PDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 38 "../../asn1/snmp/snmp.cnf" +#line 40 "../../asn1/snmp/snmp.cnf" generic_trap = 0; enterprise_oid = NULL; @@ -2269,6 +2270,10 @@ dissect_snmp_Trap_PDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset Trap_PDU_U_sequence, hf_index, ett_snmp_Trap_PDU_U); + if (snmp_version != 0) { + expert_add_info(actx->pinfo, tree, &ei_snmp_trap_pdu_obsolete); + } + return offset; @@ -2380,7 +2385,7 @@ static const ber_choice_t PDUs_choice[] = { static int dissect_snmp_PDUs(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 26 "../../asn1/snmp/snmp.cnf" +#line 28 "../../asn1/snmp/snmp.cnf" gint pdu_type=-1; col_clear(actx->pinfo->cinfo, COL_INFO); @@ -2466,7 +2471,7 @@ dissect_snmp_Messagev2u(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_snmp_SnmpEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 96 "../../asn1/snmp/snmp.cnf" +#line 102 "../../asn1/snmp/snmp.cnf" tvbuff_t* param_tvb = NULL; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, ¶m_tvb); @@ -2484,7 +2489,7 @@ dissect_snmp_SnmpEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_snmp_T_msgAuthoritativeEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 88 "../../asn1/snmp/snmp.cnf" +#line 94 "../../asn1/snmp/snmp.cnf" offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &usm_p.engine_tvb); if (usm_p.engine_tvb) { @@ -2531,7 +2536,7 @@ dissect_snmp_T_msgUserName(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off static int dissect_snmp_T_msgAuthenticationParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 108 "../../asn1/snmp/snmp.cnf" +#line 114 "../../asn1/snmp/snmp.cnf" offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &usm_p.auth_tvb); if (usm_p.auth_tvb) { usm_p.auth_item = actx->created_item; @@ -2585,7 +2590,7 @@ dissect_snmp_INTEGER_484_2147483647(gboolean implicit_tag _U_, tvbuff_t *tvb _U_ static int dissect_snmp_T_msgFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 211 "../../asn1/snmp/snmp.cnf" +#line 217 "../../asn1/snmp/snmp.cnf" tvbuff_t *parameter_tvb = NULL; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -2640,7 +2645,7 @@ dissect_snmp_HeaderData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_snmp_T_msgSecurityParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 159 "../../asn1/snmp/snmp.cnf" +#line 165 "../../asn1/snmp/snmp.cnf" switch(MsgSecurityModel){ case SNMP_SEC_USM: /* 3 */ @@ -2682,7 +2687,7 @@ dissect_snmp_ScopedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_snmp_T_encryptedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 117 "../../asn1/snmp/snmp.cnf" +#line 123 "../../asn1/snmp/snmp.cnf" tvbuff_t* crypt_tvb; offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_snmp_encryptedPDU, &crypt_tvb); @@ -2765,7 +2770,7 @@ dissect_snmp_SNMPv3Message(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, SNMPv3Message_sequence, hf_index, ett_snmp_SNMPv3Message); -#line 174 "../../asn1/snmp/snmp.cnf" +#line 180 "../../asn1/snmp/snmp.cnf" if( usm_p.authenticated && usm_p.user_assoc @@ -3077,7 +3082,7 @@ static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro /*--- End of included file: packet-snmp-fn.c ---*/ -#line 1871 "../../asn1/snmp/packet-snmp-template.c" +#line 1872 "../../asn1/snmp/packet-snmp-template.c" guint @@ -3902,7 +3907,7 @@ void proto_register_snmp(void) { NULL, HFILL }}, /*--- End of included file: packet-snmp-hfarr.c ---*/ -#line 2431 "../../asn1/snmp/packet-snmp-template.c" +#line 2432 "../../asn1/snmp/packet-snmp-template.c" }; /* List of subtrees */ @@ -3942,7 +3947,7 @@ void proto_register_snmp(void) { &ett_snmp_RReqPDU_U, /*--- End of included file: packet-snmp-ettarr.c ---*/ -#line 2447 "../../asn1/snmp/packet-snmp-template.c" +#line 2448 "../../asn1/snmp/packet-snmp-template.c" }; static ei_register_info ei[] = { { &ei_snmp_failed_decrypted_data_pdu, { "snmp.failed_decrypted_data_pdu", PI_MALFORMED, PI_WARN, "Failed to decrypt encryptedPDU", EXPFILL }}, @@ -3975,6 +3980,7 @@ void proto_register_snmp(void) { { &ei_snmp_rfc1910_non_conformant, { "snmp.rfc1910_non_conformant", PI_PROTOCOL, PI_WARN, "Data not conforming to RFC1910", EXPFILL }}, { &ei_snmp_rfc3411_non_conformant, { "snmp.rfc3411_non_conformant", PI_PROTOCOL, PI_WARN, "Data not conforming to RFC3411", EXPFILL }}, { &ei_snmp_version_unknown, { "snmp.version.unknown", PI_PROTOCOL, PI_WARN, "Unknown version", EXPFILL }}, + { &ei_snmp_trap_pdu_obsolete, { "snmp.trap_pdu_obsolete", PI_PROTOCOL, PI_WARN, "Trap-PDU is obsolete in this SNMP version", EXPFILL }}, }; |