SNMP: do not modify the ASN.1 source for request/response tracking

Follow-up of g14d398fe67

Change-Id: Ic6c4966d8a9a1a53c8d7daeeda7fd71779f9b07d
Reviewed-on: https://code.wireshark.org/review/35025
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
This commit is contained in:
Pascal Quantin 2019-11-07 16:15:03 +01:00
parent 04e400d7f7
commit e023908952
3 changed files with 46 additions and 28 deletions

View File

@ -1,5 +1,5 @@
RFC1157-SNMP DEFINITIONS ::= BEGIN
-- IMPORTS
-- ObjectName, ObjectSyntax, NetworkAddress, IpAddress, TimeTicks
-- FROM RFC1155-SMI;
@ -38,7 +38,7 @@ RFC1157-SNMP DEFINITIONS ::= BEGIN
--Empty ::= NULL
-- hundredths of seconds since an event, usualy the last restart
--TimeTicks ::= [APPLICATION 3] IMPLICIT INTEGER (0..4294967295)
--TimeTicks ::= [APPLICATION 3] IMPLICIT INTEGER (0..4294967295)
--Opaque ::= [APPLICATION 4] IMPLICIT OCTET STRING
@ -60,6 +60,7 @@ NotificationName ::= OBJECT IDENTIFIER
EnterpriseOID ::= OBJECT IDENTIFIER
NetworkAddress ::= [APPLICATION 0] IMPLICIT OCTET STRING (SIZE (4))
TimeTicks ::= [APPLICATION 3] IMPLICIT INTEGER (0..4294967295)
Integer32 ::= INTEGER (-2147483648..2147483647)
ObjectName ::= OBJECT IDENTIFIER
--Counter32 ::= [APPLICATION 1] IMPLICIT INTEGER (0..4294967295)
--Gauge32 ::= [APPLICATION 2] IMPLICIT INTEGER (0..4294967295)
@ -115,7 +116,7 @@ SNMPv3Message ::= SEQUENCE {
-- this element is in same position as in SNMPv1
-- and SNMPv2c, allowing recognition
-- the value 3 is used for snmpv3
msgVersion Version,
msgVersion Version,
-- INTEGER ( 0 .. 2147483647 ),
-- administrative parameters
msgGlobalData HeaderData,
@ -152,7 +153,7 @@ ScopedPDU ::= SEQUENCE {
contextEngineID SnmpEngineID,
contextName OCTET STRING,
data PDUs
-- ANY
-- ANY
-- e.g., PDUs as defined in RFC 1905
}
@ -168,7 +169,7 @@ PDUs ::= CHOICE {
getBulkRequest GetBulkRequest-PDU,
informRequest InformRequest-PDU,
snmpV2-trap SNMPv2-Trap-PDU,
report Report-PDU
report Report-PDU
}
-- PDUs
@ -192,7 +193,7 @@ Report-PDU ::= [8] IMPLICIT PDU
PDU ::= SEQUENCE {
request-id RequestID,
request-id INTEGER,
error-status INTEGER {
noError(0),
tooBig(1),
@ -218,11 +219,9 @@ PDU ::= SEQUENCE {
variable-bindings VarBindList
}
RequestID ::= INTEGER
-- v2
BulkPDU ::= SEQUENCE { -- MUST be identical in structure to PDU
request-id RequestID,
request-id Integer32,
non-repeaters INTEGER (0..2147483647),
max-repetitions INTEGER (0..2147483647),
variable-bindings VarBindList
@ -324,7 +323,7 @@ RReqPDU ::= [APPLICATION 2] IMPLICIT SEQUENCE {
subtree ObjectName,
priority INTEGER (-1..2147483647), -- the lower the better, "-1" means default
operation INTEGER {
operation INTEGER {
delete(0), -- remove registration
readOnly(1), -- add registration, objects are RO
readWrite(2) -- .., objects are RW

View File

@ -47,7 +47,11 @@ BulkPDU/request-id bulkPDU_request-id
#.END
#.FN_BODY RequestID VAL_PTR = &RequestID
#.FN_BODY PDU/request-id VAL_PTR = &RequestID
%(DEFAULT_BODY)s
#.FN_BODY Integer32 VAL_PTR = &RequestID
%(DEFAULT_BODY)s

View File

@ -280,11 +280,11 @@ static int hf_snmp_getBulkRequest = -1; /* GetBulkRequest_PDU */
static int hf_snmp_informRequest = -1; /* InformRequest_PDU */
static int hf_snmp_snmpV2_trap = -1; /* SNMPv2_Trap_PDU */
static int hf_snmp_report = -1; /* Report_PDU */
static int hf_snmp_request_id = -1; /* RequestID */
static int hf_snmp_request_id = -1; /* T_request_id */
static int hf_snmp_error_status = -1; /* T_error_status */
static int hf_snmp_error_index = -1; /* INTEGER */
static int hf_snmp_variable_bindings = -1; /* VarBindList */
static int hf_snmp_bulkPDU_request_id = -1; /* RequestID */
static int hf_snmp_bulkPDU_request_id = -1; /* Integer32 */
static int hf_snmp_non_repeaters = -1; /* INTEGER_0_2147483647 */
static int hf_snmp_max_repetitions = -1; /* INTEGER_0_2147483647 */
static int hf_snmp_enterprise = -1; /* EnterpriseOID */
@ -2029,7 +2029,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 83 "./asn1/snmp/snmp.cnf"
#line 87 "./asn1/snmp/snmp.cnf"
const gchar* name;
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &enterprise_oid);
@ -2089,6 +2089,21 @@ dissect_snmp_TimeTicks(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_snmp_Integer32(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 55 "./asn1/snmp/snmp.cnf"
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
&RequestID);
return offset;
}
static int
dissect_snmp_ObjectName(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_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
@ -2127,7 +2142,7 @@ dissect_snmp_Community(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_snmp_RequestID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
dissect_snmp_T_request_id(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 51 "./asn1/snmp/snmp.cnf"
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
@ -2198,7 +2213,7 @@ dissect_snmp_VarBindList(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static const ber_sequence_t PDU_sequence[] = {
{ &hf_snmp_request_id , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_RequestID },
{ &hf_snmp_request_id , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_T_request_id },
{ &hf_snmp_error_status , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_T_error_status },
{ &hf_snmp_error_index , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_INTEGER },
{ &hf_snmp_variable_bindings, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_snmp_VarBindList },
@ -2278,7 +2293,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 67 "./asn1/snmp/snmp.cnf"
#line 71 "./asn1/snmp/snmp.cnf"
guint specific_trap;
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
@ -2309,7 +2324,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 55 "./asn1/snmp/snmp.cnf"
#line 59 "./asn1/snmp/snmp.cnf"
generic_trap = 0;
enterprise_oid = NULL;
@ -2348,7 +2363,7 @@ dissect_snmp_INTEGER_0_2147483647(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static const ber_sequence_t BulkPDU_sequence[] = {
{ &hf_snmp_bulkPDU_request_id, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_RequestID },
{ &hf_snmp_bulkPDU_request_id, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_Integer32 },
{ &hf_snmp_non_repeaters , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_INTEGER_0_2147483647 },
{ &hf_snmp_max_repetitions, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_snmp_INTEGER_0_2147483647 },
{ &hf_snmp_variable_bindings, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_snmp_VarBindList },
@ -2529,7 +2544,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 117 "./asn1/snmp/snmp.cnf"
#line 121 "./asn1/snmp/snmp.cnf"
tvbuff_t* param_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &param_tvb);
@ -2547,7 +2562,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 109 "./asn1/snmp/snmp.cnf"
#line 113 "./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) {
@ -2594,7 +2609,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 129 "./asn1/snmp/snmp.cnf"
#line 133 "./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;
@ -2648,7 +2663,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 234 "./asn1/snmp/snmp.cnf"
#line 238 "./asn1/snmp/snmp.cnf"
tvbuff_t *parameter_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@ -2703,7 +2718,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 180 "./asn1/snmp/snmp.cnf"
#line 184 "./asn1/snmp/snmp.cnf"
switch(MsgSecurityModel){
case SNMP_SEC_USM: /* 3 */
@ -2747,7 +2762,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 138 "./asn1/snmp/snmp.cnf"
#line 142 "./asn1/snmp/snmp.cnf"
tvbuff_t* crypt_tvb;
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_snmp_encryptedPDU, &crypt_tvb);
@ -2830,7 +2845,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 197 "./asn1/snmp/snmp.cnf"
#line 201 "./asn1/snmp/snmp.cnf"
if( usm_p.authenticated
&& usm_p.user_assoc
@ -3819,7 +3834,7 @@ void proto_register_snmp(void) {
{ &hf_snmp_request_id,
{ "request-id", "snmp.request_id",
FT_INT32, BASE_DEC, NULL, 0,
"RequestID", HFILL }},
"T_request_id", HFILL }},
{ &hf_snmp_error_status,
{ "error-status", "snmp.error_status",
FT_INT32, BASE_DEC, VALS(snmp_T_error_status_vals), 0,
@ -3835,7 +3850,7 @@ void proto_register_snmp(void) {
{ &hf_snmp_bulkPDU_request_id,
{ "request-id", "snmp.request_id",
FT_INT32, BASE_DEC, NULL, 0,
"RequestID", HFILL }},
"Integer32", HFILL }},
{ &hf_snmp_non_repeaters,
{ "non-repeaters", "snmp.non_repeaters",
FT_UINT32, BASE_DEC, NULL, 0,