aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-snmp.c')
-rw-r--r--epan/dissectors/packet-snmp.c716
1 files changed, 355 insertions, 361 deletions
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c
index 2f0bc657c9..7e3ffb7588 100644
--- a/epan/dissectors/packet-snmp.c
+++ b/epan/dissectors/packet-snmp.c
@@ -1,11 +1,8 @@
/* Do not modify this file. Changes will be overwritten. */
/* Generated automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-snmp.c */
-/* asn2wrs.py -b -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . -O ../.. snmp.asn */
+/* asn2wrs.py -b -L -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . -O ../.. snmp.asn */
-/* Input file: packet-snmp-template.c */
-
-#line 1 "./asn1/snmp/packet-snmp-template.c"
/* packet-snmp.c
* Routines for SNMP (simple network management protocol)
* Copyright (C) 1998 Didier Jorand
@@ -77,9 +74,9 @@
#define SNMP_NUM_PROCEDURES 8
/* Initialize the protocol and registered fields */
-static int snmp_tap = -1;
-static int proto_snmp = -1;
-static int proto_smux = -1;
+static int snmp_tap;
+static int proto_snmp;
+static int proto_smux;
static gboolean display_oid = TRUE;
static gboolean snmp_var_in_tree = TRUE;
@@ -97,7 +94,7 @@ static tvbuff_t* snmp_usm_priv_aes128(snmp_usm_params_t*, tvbuff_t*, packet_info
static tvbuff_t* snmp_usm_priv_aes192(snmp_usm_params_t*, tvbuff_t*, packet_info *pinfo, gchar const**);
static tvbuff_t* snmp_usm_priv_aes256(snmp_usm_params_t*, tvbuff_t*, packet_info *pinfo, gchar const**);
-static gboolean snmp_usm_auth(const packet_info *pinfo, const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8**, guint*, gchar const**);
+static bool snmp_usm_auth(const packet_info *pinfo, const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8**, guint*, gchar const**);
static const value_string auth_types[] = {
{SNMP_USM_AUTH_MD5,"MD5"},
@@ -190,201 +187,191 @@ tvbuff_t *oid_tvb=NULL;
tvbuff_t *value_tvb=NULL;
static dissector_handle_t snmp_handle;
+static dissector_handle_t snmp_tcp_handle;
static dissector_handle_t data_handle;
+static dissector_handle_t smux_handle;
static next_tvb_list_t *var_list;
-static int hf_snmp_response_in = -1;
-static int hf_snmp_response_to = -1;
-static int hf_snmp_time = -1;
-
-static int hf_snmp_v3_flags_auth = -1;
-static int hf_snmp_v3_flags_crypt = -1;
-static int hf_snmp_v3_flags_report = -1;
-
-static int hf_snmp_engineid_conform = -1;
-static int hf_snmp_engineid_enterprise = -1;
-static int hf_snmp_engineid_format = -1;
-static int hf_snmp_engineid_ipv4 = -1;
-static int hf_snmp_engineid_ipv6 = -1;
-static int hf_snmp_engineid_cisco_type = -1;
-static int hf_snmp_engineid_mac = -1;
-static int hf_snmp_engineid_text = -1;
-static int hf_snmp_engineid_time = -1;
-static int hf_snmp_engineid_data = -1;
-static int hf_snmp_decryptedPDU = -1;
-static int hf_snmp_msgAuthentication = -1;
-
-static int hf_snmp_noSuchObject = -1;
-static int hf_snmp_noSuchInstance = -1;
-static int hf_snmp_endOfMibView = -1;
-static int hf_snmp_unSpecified = -1;
-
-static int hf_snmp_integer32_value = -1;
-static int hf_snmp_octetstring_value = -1;
-static int hf_snmp_oid_value = -1;
-static int hf_snmp_null_value = -1;
-static int hf_snmp_ipv4_value = -1;
-static int hf_snmp_ipv6_value = -1;
-static int hf_snmp_anyaddress_value = -1;
-static int hf_snmp_unsigned32_value = -1;
-static int hf_snmp_unknown_value = -1;
-static int hf_snmp_opaque_value = -1;
-static int hf_snmp_nsap_value = -1;
-static int hf_snmp_counter_value = -1;
-static int hf_snmp_timeticks_value = -1;
-static int hf_snmp_big_counter_value = -1;
-static int hf_snmp_gauge32_value = -1;
-
-static int hf_snmp_objectname = -1;
-static int hf_snmp_scalar_instance_index = -1;
-
-static int hf_snmp_var_bind_str = -1;
-static int hf_snmp_agentid_trailer = -1;
-
-
-/*--- Included file: packet-snmp-hf.c ---*/
-#line 1 "./asn1/snmp/packet-snmp-hf.c"
-static int hf_snmp_SMUX_PDUs_PDU = -1; /* SMUX_PDUs */
-static int hf_snmp_version = -1; /* Version */
-static int hf_snmp_community = -1; /* Community */
-static int hf_snmp_data = -1; /* PDUs */
-static int hf_snmp_parameters = -1; /* OCTET_STRING */
-static int hf_snmp_datav2u = -1; /* T_datav2u */
-static int hf_snmp_v2u_plaintext = -1; /* PDUs */
-static int hf_snmp_encrypted = -1; /* OCTET_STRING */
-static int hf_snmp_msgAuthoritativeEngineID = -1; /* T_msgAuthoritativeEngineID */
-static int hf_snmp_msgAuthoritativeEngineBoots = -1; /* T_msgAuthoritativeEngineBoots */
-static int hf_snmp_msgAuthoritativeEngineTime = -1; /* T_msgAuthoritativeEngineTime */
-static int hf_snmp_msgUserName = -1; /* T_msgUserName */
-static int hf_snmp_msgAuthenticationParameters = -1; /* T_msgAuthenticationParameters */
-static int hf_snmp_msgPrivacyParameters = -1; /* T_msgPrivacyParameters */
-static int hf_snmp_msgVersion = -1; /* Version */
-static int hf_snmp_msgGlobalData = -1; /* HeaderData */
-static int hf_snmp_msgSecurityParameters = -1; /* T_msgSecurityParameters */
-static int hf_snmp_msgData = -1; /* ScopedPduData */
-static int hf_snmp_msgID = -1; /* INTEGER_0_2147483647 */
-static int hf_snmp_msgMaxSize = -1; /* INTEGER_484_2147483647 */
-static int hf_snmp_msgFlags = -1; /* T_msgFlags */
-static int hf_snmp_msgSecurityModel = -1; /* T_msgSecurityModel */
-static int hf_snmp_plaintext = -1; /* ScopedPDU */
-static int hf_snmp_encryptedPDU = -1; /* T_encryptedPDU */
-static int hf_snmp_contextEngineID = -1; /* SnmpEngineID */
-static int hf_snmp_contextName = -1; /* OCTET_STRING */
-static int hf_snmp_get_request = -1; /* GetRequest_PDU */
-static int hf_snmp_get_next_request = -1; /* GetNextRequest_PDU */
-static int hf_snmp_get_response = -1; /* GetResponse_PDU */
-static int hf_snmp_set_request = -1; /* SetRequest_PDU */
-static int hf_snmp_trap = -1; /* Trap_PDU */
-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; /* 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; /* 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 */
-static int hf_snmp_agent_addr = -1; /* NetworkAddress */
-static int hf_snmp_generic_trap = -1; /* GenericTrap */
-static int hf_snmp_specific_trap = -1; /* SpecificTrap */
-static int hf_snmp_time_stamp = -1; /* TimeTicks */
-static int hf_snmp_name = -1; /* ObjectName */
-static int hf_snmp_valueType = -1; /* ValueType */
-static int hf_snmp_VarBindList_item = -1; /* VarBind */
-static int hf_snmp_open = -1; /* OpenPDU */
-static int hf_snmp_close = -1; /* ClosePDU */
-static int hf_snmp_registerRequest = -1; /* RReqPDU */
-static int hf_snmp_registerResponse = -1; /* RegisterResponse */
-static int hf_snmp_commitOrRollback = -1; /* SOutPDU */
-static int hf_snmp_rRspPDU = -1; /* RRspPDU */
-static int hf_snmp_pDUs = -1; /* PDUs */
-static int hf_snmp_smux_simple = -1; /* SimpleOpen */
-static int hf_snmp_smux_version = -1; /* T_smux_version */
-static int hf_snmp_identity = -1; /* OBJECT_IDENTIFIER */
-static int hf_snmp_description = -1; /* DisplayString */
-static int hf_snmp_password = -1; /* OCTET_STRING */
-static int hf_snmp_subtree = -1; /* ObjectName */
-static int hf_snmp_priority = -1; /* INTEGER_M1_2147483647 */
-static int hf_snmp_operation = -1; /* T_operation */
-
-/*--- End of included file: packet-snmp-hf.c ---*/
-#line 238 "./asn1/snmp/packet-snmp-template.c"
+static int hf_snmp_response_in;
+static int hf_snmp_response_to;
+static int hf_snmp_time;
+
+static int hf_snmp_v3_flags_auth;
+static int hf_snmp_v3_flags_crypt;
+static int hf_snmp_v3_flags_report;
+
+static int hf_snmp_engineid_conform;
+static int hf_snmp_engineid_enterprise;
+static int hf_snmp_engineid_format;
+static int hf_snmp_engineid_ipv4;
+static int hf_snmp_engineid_ipv6;
+static int hf_snmp_engineid_cisco_type;
+static int hf_snmp_engineid_mac;
+static int hf_snmp_engineid_text;
+static int hf_snmp_engineid_time;
+static int hf_snmp_engineid_data;
+static int hf_snmp_decryptedPDU;
+static int hf_snmp_msgAuthentication;
+
+static int hf_snmp_noSuchObject;
+static int hf_snmp_noSuchInstance;
+static int hf_snmp_endOfMibView;
+static int hf_snmp_unSpecified;
+
+static int hf_snmp_integer32_value;
+static int hf_snmp_octetstring_value;
+static int hf_snmp_oid_value;
+static int hf_snmp_null_value;
+static int hf_snmp_ipv4_value;
+static int hf_snmp_ipv6_value;
+static int hf_snmp_anyaddress_value;
+static int hf_snmp_unsigned32_value;
+static int hf_snmp_unknown_value;
+static int hf_snmp_opaque_value;
+static int hf_snmp_nsap_value;
+static int hf_snmp_counter_value;
+static int hf_snmp_timeticks_value;
+static int hf_snmp_big_counter_value;
+static int hf_snmp_gauge32_value;
+
+static int hf_snmp_objectname;
+static int hf_snmp_scalar_instance_index;
+
+static int hf_snmp_var_bind_str;
+static int hf_snmp_agentid_trailer;
+
+static int hf_snmp_SMUX_PDUs_PDU; /* SMUX_PDUs */
+static int hf_snmp_version; /* Version */
+static int hf_snmp_community; /* Community */
+static int hf_snmp_data; /* PDUs */
+static int hf_snmp_parameters; /* OCTET_STRING */
+static int hf_snmp_datav2u; /* T_datav2u */
+static int hf_snmp_v2u_plaintext; /* PDUs */
+static int hf_snmp_encrypted; /* OCTET_STRING */
+static int hf_snmp_msgAuthoritativeEngineID; /* T_msgAuthoritativeEngineID */
+static int hf_snmp_msgAuthoritativeEngineBoots; /* T_msgAuthoritativeEngineBoots */
+static int hf_snmp_msgAuthoritativeEngineTime; /* T_msgAuthoritativeEngineTime */
+static int hf_snmp_msgUserName; /* T_msgUserName */
+static int hf_snmp_msgAuthenticationParameters; /* T_msgAuthenticationParameters */
+static int hf_snmp_msgPrivacyParameters; /* T_msgPrivacyParameters */
+static int hf_snmp_msgVersion; /* Version */
+static int hf_snmp_msgGlobalData; /* HeaderData */
+static int hf_snmp_msgSecurityParameters; /* T_msgSecurityParameters */
+static int hf_snmp_msgData; /* ScopedPduData */
+static int hf_snmp_msgID; /* INTEGER_0_2147483647 */
+static int hf_snmp_msgMaxSize; /* INTEGER_484_2147483647 */
+static int hf_snmp_msgFlags; /* T_msgFlags */
+static int hf_snmp_msgSecurityModel; /* T_msgSecurityModel */
+static int hf_snmp_plaintext; /* ScopedPDU */
+static int hf_snmp_encryptedPDU; /* T_encryptedPDU */
+static int hf_snmp_contextEngineID; /* SnmpEngineID */
+static int hf_snmp_contextName; /* OCTET_STRING */
+static int hf_snmp_get_request; /* GetRequest_PDU */
+static int hf_snmp_get_next_request; /* GetNextRequest_PDU */
+static int hf_snmp_get_response; /* GetResponse_PDU */
+static int hf_snmp_set_request; /* SetRequest_PDU */
+static int hf_snmp_trap; /* Trap_PDU */
+static int hf_snmp_getBulkRequest; /* GetBulkRequest_PDU */
+static int hf_snmp_informRequest; /* InformRequest_PDU */
+static int hf_snmp_snmpV2_trap; /* SNMPv2_Trap_PDU */
+static int hf_snmp_report; /* Report_PDU */
+static int hf_snmp_request_id; /* T_request_id */
+static int hf_snmp_error_status; /* T_error_status */
+static int hf_snmp_error_index; /* INTEGER */
+static int hf_snmp_variable_bindings; /* VarBindList */
+static int hf_snmp_bulkPDU_request_id; /* Integer32 */
+static int hf_snmp_non_repeaters; /* INTEGER_0_2147483647 */
+static int hf_snmp_max_repetitions; /* INTEGER_0_2147483647 */
+static int hf_snmp_enterprise; /* EnterpriseOID */
+static int hf_snmp_agent_addr; /* NetworkAddress */
+static int hf_snmp_generic_trap; /* GenericTrap */
+static int hf_snmp_specific_trap; /* SpecificTrap */
+static int hf_snmp_time_stamp; /* TimeTicks */
+static int hf_snmp_name; /* ObjectName */
+static int hf_snmp_valueType; /* ValueType */
+static int hf_snmp_VarBindList_item; /* VarBind */
+static int hf_snmp_open; /* OpenPDU */
+static int hf_snmp_close; /* ClosePDU */
+static int hf_snmp_registerRequest; /* RReqPDU */
+static int hf_snmp_registerResponse; /* RegisterResponse */
+static int hf_snmp_commitOrRollback; /* SOutPDU */
+static int hf_snmp_rRspPDU; /* RRspPDU */
+static int hf_snmp_pDUs; /* PDUs */
+static int hf_snmp_smux_simple; /* SimpleOpen */
+static int hf_snmp_smux_version; /* T_smux_version */
+static int hf_snmp_identity; /* OBJECT_IDENTIFIER */
+static int hf_snmp_description; /* DisplayString */
+static int hf_snmp_password; /* OCTET_STRING */
+static int hf_snmp_subtree; /* ObjectName */
+static int hf_snmp_priority; /* INTEGER_M1_2147483647 */
+static int hf_snmp_operation; /* T_operation */
/* Initialize the subtree pointers */
-static gint ett_smux = -1;
-static gint ett_snmp = -1;
-static gint ett_engineid = -1;
-static gint ett_msgFlags = -1;
-static gint ett_encryptedPDU = -1;
-static gint ett_decrypted = -1;
-static gint ett_authParameters = -1;
-static gint ett_internet = -1;
-static gint ett_varbind = -1;
-static gint ett_name = -1;
-static gint ett_value = -1;
-static gint ett_decoding_error = -1;
-
-
-/*--- Included file: packet-snmp-ett.c ---*/
-#line 1 "./asn1/snmp/packet-snmp-ett.c"
-static gint ett_snmp_Message = -1;
-static gint ett_snmp_Messagev2u = -1;
-static gint ett_snmp_T_datav2u = -1;
-static gint ett_snmp_UsmSecurityParameters = -1;
-static gint ett_snmp_SNMPv3Message = -1;
-static gint ett_snmp_HeaderData = -1;
-static gint ett_snmp_ScopedPduData = -1;
-static gint ett_snmp_ScopedPDU = -1;
-static gint ett_snmp_PDUs = -1;
-static gint ett_snmp_PDU = -1;
-static gint ett_snmp_BulkPDU = -1;
-static gint ett_snmp_Trap_PDU_U = -1;
-static gint ett_snmp_VarBind = -1;
-static gint ett_snmp_VarBindList = -1;
-static gint ett_snmp_SMUX_PDUs = -1;
-static gint ett_snmp_RegisterResponse = -1;
-static gint ett_snmp_OpenPDU = -1;
-static gint ett_snmp_SimpleOpen_U = -1;
-static gint ett_snmp_RReqPDU_U = -1;
-
-/*--- End of included file: packet-snmp-ett.c ---*/
-#line 254 "./asn1/snmp/packet-snmp-template.c"
-
-static expert_field ei_snmp_failed_decrypted_data_pdu = EI_INIT;
-static expert_field ei_snmp_decrypted_data_bad_formatted = EI_INIT;
-static expert_field ei_snmp_verify_authentication_error = EI_INIT;
-static expert_field ei_snmp_authentication_ok = EI_INIT;
-static expert_field ei_snmp_authentication_error = EI_INIT;
-static expert_field ei_snmp_varbind_not_uni_class_seq = EI_INIT;
-static expert_field ei_snmp_varbind_has_indicator = EI_INIT;
-static expert_field ei_snmp_objectname_not_oid = EI_INIT;
-static expert_field ei_snmp_objectname_has_indicator = EI_INIT;
-static expert_field ei_snmp_value_not_primitive_encoding = EI_INIT;
-static expert_field ei_snmp_invalid_oid = EI_INIT;
-static expert_field ei_snmp_varbind_wrong_tag = EI_INIT;
-static expert_field ei_snmp_varbind_response = EI_INIT;
-static expert_field ei_snmp_no_instance_subid = EI_INIT;
-static expert_field ei_snmp_wrong_num_of_subids = EI_INIT;
-static expert_field ei_snmp_index_suboid_too_short = EI_INIT;
-static expert_field ei_snmp_unimplemented_instance_index = EI_INIT;
-static expert_field ei_snmp_index_suboid_len0 = EI_INIT;
-static expert_field ei_snmp_index_suboid_too_long = EI_INIT;
-static expert_field ei_snmp_index_string_too_long = EI_INIT;
-static expert_field ei_snmp_column_parent_not_row = EI_INIT;
-static expert_field ei_snmp_uint_too_large = EI_INIT;
-static expert_field ei_snmp_int_too_large = EI_INIT;
-static expert_field ei_snmp_integral_value0 = EI_INIT;
-static expert_field ei_snmp_missing_mib = EI_INIT;
-static expert_field ei_snmp_varbind_wrong_length_value = EI_INIT;
-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 gint ett_smux;
+static gint ett_snmp;
+static gint ett_engineid;
+static gint ett_msgFlags;
+static gint ett_encryptedPDU;
+static gint ett_decrypted;
+static gint ett_authParameters;
+static gint ett_internet;
+static gint ett_varbind;
+static gint ett_name;
+static gint ett_value;
+static gint ett_decoding_error;
+
+static gint ett_snmp_Message;
+static gint ett_snmp_Messagev2u;
+static gint ett_snmp_T_datav2u;
+static gint ett_snmp_UsmSecurityParameters;
+static gint ett_snmp_SNMPv3Message;
+static gint ett_snmp_HeaderData;
+static gint ett_snmp_ScopedPduData;
+static gint ett_snmp_ScopedPDU;
+static gint ett_snmp_PDUs;
+static gint ett_snmp_PDU;
+static gint ett_snmp_BulkPDU;
+static gint ett_snmp_Trap_PDU_U;
+static gint ett_snmp_VarBind;
+static gint ett_snmp_VarBindList;
+static gint ett_snmp_SMUX_PDUs;
+static gint ett_snmp_RegisterResponse;
+static gint ett_snmp_OpenPDU;
+static gint ett_snmp_SimpleOpen_U;
+static gint ett_snmp_RReqPDU_U;
+
+static expert_field ei_snmp_failed_decrypted_data_pdu;
+static expert_field ei_snmp_decrypted_data_bad_formatted;
+static expert_field ei_snmp_verify_authentication_error;
+static expert_field ei_snmp_authentication_ok;
+static expert_field ei_snmp_authentication_error;
+static expert_field ei_snmp_varbind_not_uni_class_seq;
+static expert_field ei_snmp_varbind_has_indicator;
+static expert_field ei_snmp_objectname_not_oid;
+static expert_field ei_snmp_objectname_has_indicator;
+static expert_field ei_snmp_value_not_primitive_encoding;
+static expert_field ei_snmp_invalid_oid;
+static expert_field ei_snmp_varbind_wrong_tag;
+static expert_field ei_snmp_varbind_response;
+static expert_field ei_snmp_no_instance_subid;
+static expert_field ei_snmp_wrong_num_of_subids;
+static expert_field ei_snmp_index_suboid_too_short;
+static expert_field ei_snmp_unimplemented_instance_index;
+static expert_field ei_snmp_index_suboid_len0;
+static expert_field ei_snmp_index_suboid_too_long;
+static expert_field ei_snmp_index_string_too_long;
+static expert_field ei_snmp_column_parent_not_row;
+static expert_field ei_snmp_uint_too_large;
+static expert_field ei_snmp_int_too_large;
+static expert_field ei_snmp_integral_value0;
+static expert_field ei_snmp_missing_mib;
+static expert_field ei_snmp_varbind_wrong_length_value;
+static expert_field ei_snmp_varbind_wrong_class_tag;
+static expert_field ei_snmp_rfc1910_non_conformant;
+static expert_field ei_snmp_rfc3411_non_conformant;
+static expert_field ei_snmp_version_unknown;
+static expert_field ei_snmp_trap_pdu_obsolete;
static const true_false_string auth_flags = {
"OK",
@@ -425,7 +412,7 @@ static const value_string smux_types[] = {
#endif
/* Procedure names (used in Service Response Time) */
-const value_string snmp_procedure_names[] = {
+static const value_string snmp_procedure_names[] = {
{ 0, "Get" },
{ 1, "GetNext" },
{ 3, "Set" },
@@ -458,6 +445,9 @@ typedef struct snmp_conv_info_t {
wmem_map_t *request_response;
} snmp_conv_info_t;
+static snmp_conv_info_t*
+snmp_find_conversation_and_get_conv_data(packet_info *pinfo);
+
static snmp_request_response_t *
snmp_get_request_response_pointer(wmem_map_t *map, guint32 requestId)
{
@@ -543,7 +533,7 @@ snmpstat_init(struct register_srt* srt _U_, GArray* srt_array)
/* This is called only if request and response was matched -> no need to return anything than TAP_PACKET_REDRAW */
static tap_packet_status
-snmpstat_packet(void *psnmp, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
+snmpstat_packet(void *psnmp, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi, tap_flags_t flags _U_)
{
guint i = 0;
srt_stat_table *snmp_srt_table;
@@ -578,7 +568,7 @@ static int
dissect_snmp_variable_string(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
- proto_tree_add_item(tree, hf_snmp_var_bind_str, tvb, 0, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(tree, hf_snmp_var_bind_str, tvb, 0, -1, ENC_ASCII);
return tvb_captured_length(tvb);
}
@@ -738,15 +728,15 @@ dissect_snmp_variable_date_and_time(proto_tree *tree, packet_info *pinfo, int hf
*/
static int
-dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
+dissect_snmp_VarBind(bool implicit_tag _U_, tvbuff_t *tvb, int offset,
asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_)
{
int seq_offset, name_offset, value_offset, value_start;
guint32 seq_len, name_len, value_len;
gint8 ber_class;
- gboolean pc;
+ bool pc;
gint32 tag;
- gboolean ind;
+ bool ind;
guint32* subids;
guint8* oid_bytes;
oid_info_t* oid_info = NULL;
@@ -759,7 +749,7 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
char* valstr;
int hfid = -1;
int min_len = 0, max_len = 0;
- gboolean oid_info_is_ok;
+ bool oid_info_is_ok;
const char* oid_string = NULL;
enum {BER_NO_ERROR, BER_WRONG_LENGTH, BER_WRONG_TAG} format_error = BER_NO_ERROR;
@@ -941,7 +931,7 @@ dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
goto indexing_done;
}
case OID_KEY_TYPE_INTEGER: {
- if (IS_FT_INT(k->ft_type)) {
+ if (FT_IS_INT(k->ft_type)) {
proto_tree_add_int(pt_name,k->hfid,tvb,name_offset,name_len,(guint)subids[key_start]);
} else { /* if it's not an unsigned int let proto_tree_add_uint throw a warning */
proto_tree_add_uint64(pt_name,k->hfid,tvb,name_offset,name_len,(guint)subids[key_start]);
@@ -1098,8 +1088,14 @@ indexing_done:
format_error = BER_WRONG_LENGTH;
}
- if (format_error == BER_NO_ERROR)
- pi_value = proto_tree_add_item(pt_varbind,oid_info->value_hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN);
+ if (format_error == BER_NO_ERROR) {
+ /* Special case DATE AND TIME */
+ if((oid_info->value_type)&&(oid_info->value_type->keytype == OID_KEY_TYPE_DATE_AND_TIME)&&(value_len > 7)){
+ pi_value = dissect_snmp_variable_date_and_time(pt_varbind, actx->pinfo, oid_info->value_hfid, tvb, value_offset, value_len);
+ } else {
+ pi_value = proto_tree_add_item(pt_varbind,oid_info->value_hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN);
+ }
+ }
}
} else {
switch(ber_class|(tag<<4)) {
@@ -1313,6 +1309,7 @@ static const true_false_string tfs_snmp_engineid_conform = {
#define SNMP_ENGINEID_FORMAT_MACADDRESS 0x03
#define SNMP_ENGINEID_FORMAT_TEXT 0x04
#define SNMP_ENGINEID_FORMAT_OCTETS 0x05
+#define SNMP_ENGINEID_FORMAT_LOCAL 0x06
static const value_string snmp_engineid_format_vals[] = {
{ SNMP_ENGINEID_FORMAT_IPV4, "IPv4 address" },
@@ -1320,6 +1317,7 @@ static const value_string snmp_engineid_format_vals[] = {
{ SNMP_ENGINEID_FORMAT_MACADDRESS, "MAC address" },
{ SNMP_ENGINEID_FORMAT_TEXT, "Text, administratively assigned" },
{ SNMP_ENGINEID_FORMAT_OCTETS, "Octets, administratively assigned" },
+ { SNMP_ENGINEID_FORMAT_LOCAL, "Local engine" },
{ 0, NULL }
};
@@ -1380,7 +1378,8 @@ dissect_snmp_engineid(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int o
if (len_remain<1) return offset;
format = tvb_get_guint8(tvb, offset);
item = proto_tree_add_uint_format(tree, hf_snmp_engineid_format, tvb, offset, 1, format, "Engine ID Format: %s (%d)",
- val_to_str(format, snmp_engineid_format_vals, "Reserved/Enterprise-specific"), format);
+ val_to_str_const(format, snmp_engineid_format_vals, "Reserved/Enterprise-specific"),
+ format);
offset+=1;
len_remain-=1;
@@ -1418,11 +1417,13 @@ dissect_snmp_engineid(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int o
case SNMP_ENGINEID_FORMAT_TEXT:
/* max. 27-byte string, administratively assigned */
if (len_remain<=27) {
- proto_tree_add_item(tree, hf_snmp_engineid_text, tvb, offset, len_remain, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(tree, hf_snmp_engineid_text, tvb, offset, len_remain, ENC_ASCII);
offset+=len_remain;
len_remain=0;
}
break;
+ case SNMP_ENGINEID_FORMAT_LOCAL:
+ break;
case 128:
/* most common enterprise-specific format: (ucd|net)-snmp random */
if ((enterpriseid==2021)||(enterpriseid==8072)) {
@@ -1449,7 +1450,7 @@ dissect_snmp_engineid(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int o
case SNMP_ENGINEID_FORMAT_OCTETS:
default:
/* max. 27 bytes, administratively assigned or unknown format */
- if (len_remain<=27) {
+ if (len_remain>0 && len_remain<=27) {
proto_tree_add_item(tree, hf_snmp_engineid_data, tvb, offset, len_remain, ENC_NA);
offset+=len_remain;
len_remain=0;
@@ -1602,7 +1603,7 @@ snmp_users_free_cb(void* p)
g_free(ue->engine.data);
}
-static gboolean
+static bool
snmp_users_update_cb(void* p _U_, char** err)
{
snmp_ue_assoc_t* ue = (snmp_ue_assoc_t*)p;
@@ -1768,7 +1769,7 @@ get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb, packet_info *pinfo)
return NULL;
}
-static gboolean
+static bool
snmp_usm_auth(const packet_info *pinfo, const snmp_usm_auth_model_t model, snmp_usm_params_t* p, guint8** calc_auth_p,
guint* calc_auth_len_p, gchar const** error)
{
@@ -1989,7 +1990,7 @@ check_ScopedPdu(tvbuff_t* tvb)
{
int offset;
gint8 ber_class;
- gboolean pc;
+ bool pc;
gint32 tag;
int hoffset, eoffset;
guint32 len;
@@ -2022,14 +2023,10 @@ check_ScopedPdu(tvbuff_t* tvb)
}
-/*--- Included file: packet-snmp-fn.c ---*/
-#line 1 "./asn1/snmp/packet-snmp-fn.c"
-
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 88 "./asn1/snmp/snmp.cnf"
+dissect_snmp_EnterpriseOID(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
const gchar* name;
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &enterprise_oid);
@@ -2043,14 +2040,13 @@ dissect_snmp_EnterpriseOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
}
-
return offset;
}
static int
-dissect_snmp_OCTET_STRING_SIZE_4(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_OCTET_STRING_SIZE_4(bool 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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
@@ -2060,7 +2056,7 @@ dissect_snmp_OCTET_STRING_SIZE_4(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i
static int
-dissect_snmp_NetworkAddress(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_NetworkAddress(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 0, TRUE, dissect_snmp_OCTET_STRING_SIZE_4);
@@ -2070,7 +2066,7 @@ dissect_snmp_NetworkAddress(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
-dissect_snmp_INTEGER_0_4294967295(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_INTEGER_0_4294967295(bool 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);
@@ -2080,7 +2076,7 @@ dissect_snmp_INTEGER_0_4294967295(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static int
-dissect_snmp_TimeTicks(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_TimeTicks(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 3, TRUE, dissect_snmp_INTEGER_0_4294967295);
@@ -2090,22 +2086,20 @@ 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 56 "./asn1/snmp/snmp.cnf"
+dissect_snmp_Integer32(bool 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,
&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_) {
+dissect_snmp_ObjectName(bool 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);
return offset;
@@ -2122,7 +2116,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_) {
+dissect_snmp_Version(bool 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,
&snmp_version);
@@ -2132,7 +2126,7 @@ dissect_snmp_Version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
-dissect_snmp_Community(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_Community(bool 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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
@@ -2142,15 +2136,13 @@ dissect_snmp_Community(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
-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 52 "./asn1/snmp/snmp.cnf"
+dissect_snmp_T_request_id(bool 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,
&RequestID);
-
return offset;
}
@@ -2180,7 +2172,7 @@ static const value_string snmp_T_error_status_vals[] = {
static int
-dissect_snmp_T_error_status(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_error_status(bool 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);
@@ -2190,7 +2182,7 @@ dissect_snmp_T_error_status(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
-dissect_snmp_INTEGER(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_INTEGER(bool 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);
@@ -2204,7 +2196,7 @@ static const ber_sequence_t VarBindList_sequence_of[1] = {
};
static int
-dissect_snmp_VarBindList(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_VarBindList(bool 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_sequence_of(implicit_tag, actx, tree, tvb, offset,
VarBindList_sequence_of, hf_index, ett_snmp_VarBindList);
@@ -2221,7 +2213,7 @@ static const ber_sequence_t PDU_sequence[] = {
};
static int
-dissect_snmp_PDU(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_PDU(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
PDU_sequence, hf_index, ett_snmp_PDU);
@@ -2231,7 +2223,7 @@ dissect_snmp_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a
static int
-dissect_snmp_GetRequest_PDU(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_GetRequest_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 0, TRUE, dissect_snmp_PDU);
@@ -2241,7 +2233,7 @@ dissect_snmp_GetRequest_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
-dissect_snmp_GetNextRequest_PDU(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_GetNextRequest_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 1, TRUE, dissect_snmp_PDU);
@@ -2251,7 +2243,7 @@ dissect_snmp_GetNextRequest_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
-dissect_snmp_GetResponse_PDU(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_GetResponse_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 2, TRUE, dissect_snmp_PDU);
@@ -2261,7 +2253,7 @@ dissect_snmp_GetResponse_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
static int
-dissect_snmp_SetRequest_PDU(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_SetRequest_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 3, TRUE, dissect_snmp_PDU);
@@ -2282,7 +2274,7 @@ static const value_string snmp_GenericTrap_vals[] = {
static int
-dissect_snmp_GenericTrap(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_GenericTrap(bool 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,
&generic_trap);
@@ -2292,8 +2284,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 72 "./asn1/snmp/snmp.cnf"
+dissect_snmp_SpecificTrap(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
guint specific_trap;
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -2307,7 +2298,6 @@ dissect_snmp_SpecificTrap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
}
}
-
return offset;
}
@@ -2323,8 +2313,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 60 "./asn1/snmp/snmp.cnf"
+dissect_snmp_Trap_PDU_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
generic_trap = 0;
enterprise_oid = NULL;
@@ -2337,14 +2326,13 @@ dissect_snmp_Trap_PDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
}
-
return offset;
}
static int
-dissect_snmp_Trap_PDU(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_Trap_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 4, TRUE, dissect_snmp_Trap_PDU_U);
@@ -2354,7 +2342,7 @@ dissect_snmp_Trap_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
static int
-dissect_snmp_INTEGER_0_2147483647(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_INTEGER_0_2147483647(bool 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);
@@ -2371,7 +2359,7 @@ static const ber_sequence_t BulkPDU_sequence[] = {
};
static int
-dissect_snmp_BulkPDU(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_BulkPDU(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
BulkPDU_sequence, hf_index, ett_snmp_BulkPDU);
@@ -2381,7 +2369,7 @@ dissect_snmp_BulkPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
-dissect_snmp_GetBulkRequest_PDU(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_GetBulkRequest_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 5, TRUE, dissect_snmp_BulkPDU);
@@ -2391,7 +2379,7 @@ dissect_snmp_GetBulkRequest_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
-dissect_snmp_InformRequest_PDU(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_InformRequest_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 6, TRUE, dissect_snmp_PDU);
@@ -2401,7 +2389,7 @@ dissect_snmp_InformRequest_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
static int
-dissect_snmp_SNMPv2_Trap_PDU(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_SNMPv2_Trap_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 7, TRUE, dissect_snmp_PDU);
@@ -2411,7 +2399,7 @@ dissect_snmp_SNMPv2_Trap_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
static int
-dissect_snmp_Report_PDU(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_Report_PDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_CON, 8, TRUE, dissect_snmp_PDU);
@@ -2446,8 +2434,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 28 "./asn1/snmp/snmp.cnf"
+dissect_snmp_PDUs(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
gint pdu_type=-1;
snmp_request_response_t *srrp;
@@ -2473,7 +2460,6 @@ dissect_snmp_PDUs(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_,
-
return offset;
}
@@ -2486,7 +2472,7 @@ static const ber_sequence_t Message_sequence[] = {
};
static int
-dissect_snmp_Message(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_Message(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
Message_sequence, hf_index, ett_snmp_Message);
@@ -2496,7 +2482,7 @@ dissect_snmp_Message(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
-dissect_snmp_OCTET_STRING(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_OCTET_STRING(bool 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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
@@ -2517,7 +2503,7 @@ static const ber_choice_t T_datav2u_choice[] = {
};
static int
-dissect_snmp_T_datav2u(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_datav2u(bool 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_choice(actx, tree, tvb, offset,
T_datav2u_choice, hf_index, ett_snmp_T_datav2u,
NULL);
@@ -2534,7 +2520,7 @@ static const ber_sequence_t Messagev2u_sequence[] = {
};
static int
-dissect_snmp_Messagev2u(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_Messagev2u(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
Messagev2u_sequence, hf_index, ett_snmp_Messagev2u);
@@ -2544,8 +2530,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 122 "./asn1/snmp/snmp.cnf"
+dissect_snmp_SnmpEngineID(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
tvbuff_t* param_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &param_tvb);
@@ -2555,15 +2540,13 @@ dissect_snmp_SnmpEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
}
-
return offset;
}
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 114 "./asn1/snmp/snmp.cnf"
+dissect_snmp_T_msgAuthoritativeEngineID(bool 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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &usm_p.engine_tvb);
if (usm_p.engine_tvb) {
@@ -2572,14 +2555,13 @@ dissect_snmp_T_msgAuthoritativeEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb
}
-
return offset;
}
static int
-dissect_snmp_T_msgAuthoritativeEngineBoots(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_msgAuthoritativeEngineBoots(bool 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,
&usm_p.boots);
@@ -2589,7 +2571,7 @@ dissect_snmp_T_msgAuthoritativeEngineBoots(gboolean implicit_tag _U_, tvbuff_t *
static int
-dissect_snmp_T_msgAuthoritativeEngineTime(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_msgAuthoritativeEngineTime(bool 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,
&usm_p.snmp_time);
@@ -2599,7 +2581,7 @@ dissect_snmp_T_msgAuthoritativeEngineTime(gboolean implicit_tag _U_, tvbuff_t *t
static int
-dissect_snmp_T_msgUserName(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_msgUserName(bool 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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
&usm_p.user_tvb);
@@ -2609,22 +2591,20 @@ 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 134 "./asn1/snmp/snmp.cnf"
+dissect_snmp_T_msgAuthenticationParameters(bool 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_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;
usm_p.auth_offset = tvb_offset_from_real_beginning(usm_p.auth_tvb);
}
-
return offset;
}
static int
-dissect_snmp_T_msgPrivacyParameters(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_msgPrivacyParameters(bool 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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
&usm_p.priv_tvb);
@@ -2643,7 +2623,7 @@ static const ber_sequence_t UsmSecurityParameters_sequence[] = {
};
static int
-dissect_snmp_UsmSecurityParameters(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_UsmSecurityParameters(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
UsmSecurityParameters_sequence, hf_index, ett_snmp_UsmSecurityParameters);
@@ -2653,7 +2633,7 @@ dissect_snmp_UsmSecurityParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static int
-dissect_snmp_INTEGER_484_2147483647(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_INTEGER_484_2147483647(bool 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);
@@ -2663,8 +2643,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 238 "./asn1/snmp/snmp.cnf"
+dissect_snmp_T_msgFlags(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
tvbuff_t *parameter_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
@@ -2684,14 +2663,13 @@ dissect_snmp_T_msgFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
-
return offset;
}
static int
-dissect_snmp_T_msgSecurityModel(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_msgSecurityModel(bool 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,
&MsgSecurityModel);
@@ -2708,7 +2686,7 @@ static const ber_sequence_t HeaderData_sequence[] = {
};
static int
-dissect_snmp_HeaderData(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_HeaderData(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
HeaderData_sequence, hf_index, ett_snmp_HeaderData);
@@ -2718,8 +2696,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 185 "./asn1/snmp/snmp.cnf"
+dissect_snmp_T_msgSecurityParameters(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
switch(MsgSecurityModel){
case SNMP_SEC_USM: /* 3 */
@@ -2739,7 +2716,6 @@ dissect_snmp_T_msgSecurityParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U
}
-
return offset;
}
@@ -2752,7 +2728,7 @@ static const ber_sequence_t ScopedPDU_sequence[] = {
};
static int
-dissect_snmp_ScopedPDU(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_ScopedPDU(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
ScopedPDU_sequence, hf_index, ett_snmp_ScopedPDU);
@@ -2762,8 +2738,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 143 "./asn1/snmp/snmp.cnf"
+dissect_snmp_T_encryptedPDU(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
tvbuff_t* crypt_tvb;
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_snmp_encryptedPDU, &crypt_tvb);
@@ -2806,7 +2781,6 @@ dissect_snmp_T_encryptedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
}
-
return offset;
}
@@ -2824,7 +2798,7 @@ static const ber_choice_t ScopedPduData_choice[] = {
};
static int
-dissect_snmp_ScopedPduData(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_ScopedPduData(bool 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_choice(actx, tree, tvb, offset,
ScopedPduData_choice, hf_index, ett_snmp_ScopedPduData,
NULL);
@@ -2842,11 +2816,10 @@ static const ber_sequence_t SNMPv3Message_sequence[] = {
};
static int
-dissect_snmp_SNMPv3Message(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_SNMPv3Message(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
SNMPv3Message_sequence, hf_index, ett_snmp_SNMPv3Message);
-#line 202 "./asn1/snmp/snmp.cnf"
if( usm_p.authenticated
&& usm_p.user_assoc ) {
@@ -2878,7 +2851,6 @@ dissect_snmp_SNMPv3Message(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
}
}
-
return offset;
}
@@ -2890,7 +2862,7 @@ static const value_string snmp_T_smux_version_vals[] = {
static int
-dissect_snmp_T_smux_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_) {
+dissect_snmp_T_smux_version(bool 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);
@@ -2900,7 +2872,7 @@ dissect_snmp_T_smux_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
-dissect_snmp_OBJECT_IDENTIFIER(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_OBJECT_IDENTIFIER(bool 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);
return offset;
@@ -2909,7 +2881,7 @@ dissect_snmp_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
static int
-dissect_snmp_DisplayString(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_DisplayString(bool 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_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
@@ -2926,7 +2898,7 @@ static const ber_sequence_t SimpleOpen_U_sequence[] = {
};
static int
-dissect_snmp_SimpleOpen_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_) {
+dissect_snmp_SimpleOpen_U(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
SimpleOpen_U_sequence, hf_index, ett_snmp_SimpleOpen_U);
@@ -2936,7 +2908,7 @@ dissect_snmp_SimpleOpen_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
-dissect_snmp_SimpleOpen(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_SimpleOpen(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 0, TRUE, dissect_snmp_SimpleOpen_U);
@@ -2955,7 +2927,7 @@ static const ber_choice_t OpenPDU_choice[] = {
};
static int
-dissect_snmp_OpenPDU(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_OpenPDU(bool 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_choice(actx, tree, tvb, offset,
OpenPDU_choice, hf_index, ett_snmp_OpenPDU,
NULL);
@@ -2976,7 +2948,7 @@ static const value_string snmp_ClosePDU_U_vals[] = {
static int
-dissect_snmp_ClosePDU_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_) {
+dissect_snmp_ClosePDU_U(bool 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);
@@ -2986,7 +2958,7 @@ dissect_snmp_ClosePDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
-dissect_snmp_ClosePDU(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_ClosePDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 1, TRUE, dissect_snmp_ClosePDU_U);
@@ -2996,7 +2968,7 @@ dissect_snmp_ClosePDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _
static int
-dissect_snmp_INTEGER_M1_2147483647(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_INTEGER_M1_2147483647(bool 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);
@@ -3013,7 +2985,7 @@ static const value_string snmp_T_operation_vals[] = {
static int
-dissect_snmp_T_operation(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_operation(bool 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);
@@ -3029,7 +3001,7 @@ static const ber_sequence_t RReqPDU_U_sequence[] = {
};
static int
-dissect_snmp_RReqPDU_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_) {
+dissect_snmp_RReqPDU_U(bool 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_sequence(implicit_tag, actx, tree, tvb, offset,
RReqPDU_U_sequence, hf_index, ett_snmp_RReqPDU_U);
@@ -3039,7 +3011,7 @@ dissect_snmp_RReqPDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
-dissect_snmp_RReqPDU(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_RReqPDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 2, TRUE, dissect_snmp_RReqPDU_U);
@@ -3054,7 +3026,7 @@ static const value_string snmp_RRspPDU_U_vals[] = {
static int
-dissect_snmp_RRspPDU_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_) {
+dissect_snmp_RRspPDU_U(bool 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);
@@ -3064,7 +3036,7 @@ dissect_snmp_RRspPDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
-dissect_snmp_RRspPDU(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_RRspPDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 3, TRUE, dissect_snmp_RRspPDU_U);
@@ -3085,7 +3057,7 @@ static const ber_choice_t RegisterResponse_choice[] = {
};
static int
-dissect_snmp_RegisterResponse(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_RegisterResponse(bool 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_choice(actx, tree, tvb, offset,
RegisterResponse_choice, hf_index, ett_snmp_RegisterResponse,
NULL);
@@ -3102,7 +3074,7 @@ static const value_string snmp_SOutPDU_U_vals[] = {
static int
-dissect_snmp_SOutPDU_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_) {
+dissect_snmp_SOutPDU_U(bool 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);
@@ -3112,7 +3084,7 @@ dissect_snmp_SOutPDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
-dissect_snmp_SOutPDU(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_SOutPDU(bool 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_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 4, TRUE, dissect_snmp_SOutPDU_U);
@@ -3139,7 +3111,12 @@ static const ber_choice_t SMUX_PDUs_choice[] = {
};
static int
-dissect_snmp_SMUX_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_) {
+dissect_snmp_SMUX_PDUs(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+
+ snmp_conv_info_t *snmp_info = snmp_find_conversation_and_get_conv_data(actx->pinfo);
+
+ actx->private_data = snmp_info;
+
offset = dissect_ber_choice(actx, tree, tvb, offset,
SMUX_PDUs_choice, hf_index, ett_snmp_SMUX_PDUs,
NULL);
@@ -3158,22 +3135,30 @@ static int dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, prot
}
-/*--- End of included file: packet-snmp-fn.c ---*/
-#line 1923 "./asn1/snmp/packet-snmp-template.c"
-
static snmp_conv_info_t*
snmp_find_conversation_and_get_conv_data(packet_info *pinfo) {
- conversation_t *conversation;
+ conversation_t *conversation = NULL;
snmp_conv_info_t *snmp_info = NULL;
- conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, conversation_pt_to_endpoint_type(pinfo->ptype),
- pinfo->srcport, pinfo->destport, 0);
-
- if( (conversation == NULL) || (conversation_get_dissector(conversation, pinfo->num)!=snmp_handle) ) {
- conversation = conversation_new(pinfo->num, &pinfo->src, &pinfo->dst, conversation_pt_to_endpoint_type(pinfo->ptype),
- pinfo->srcport, pinfo->destport, 0);
- conversation_set_dissector(conversation, snmp_handle);
+ /* Get the conversation with the wildcarded port, if it exists
+ * and is associated with SNMP, so that requests and responses
+ * can be matched even if the response comes from a different,
+ * ephemeral, source port, as originally done in OS/400.
+ * On UDP, we do not automatically call conversation_set_port2()
+ * and we do not want to do so. Possibly this should eventually
+ * use find_conversation_full and separate the "SNMP conversation"
+ * from "the transport layer conversation that carries SNMP."
+ */
+ if (pinfo->destport == UDP_PORT_SNMP) {
+ conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, conversation_pt_to_conversation_type(pinfo->ptype),
+ pinfo->srcport, 0, NO_PORT_B);
+ } else if (pinfo->srcport == UDP_PORT_SNMP) {
+ conversation = find_conversation(pinfo->fd->num, &pinfo->dst, &pinfo->src, conversation_pt_to_conversation_type(pinfo->ptype),
+ pinfo->destport, 0, NO_PORT_B);
+ }
+ if ((conversation == NULL) || (conversation_get_dissector(conversation, pinfo->num) != snmp_handle)) {
+ conversation = find_or_create_conversation(pinfo);
}
snmp_info = (snmp_conv_info_t *)conversation_get_proto_data(conversation, proto_snmp);
@@ -3193,7 +3178,7 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
guint length_remaining;
gint8 ber_class;
- gboolean pc, ind = 0;
+ bool pc, ind = 0;
gint32 tag;
guint32 len;
guint message_length;
@@ -3266,7 +3251,7 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
*/
pinfo->desegment_offset = offset;
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
- return -1;
+ return 0;
}
}
@@ -3359,10 +3344,10 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
{
int offset;
gint8 tmp_class;
- gboolean tmp_pc;
+ bool tmp_pc;
gint32 tmp_tag;
guint32 tmp_length;
- gboolean tmp_ind;
+ bool tmp_ind;
/*
* See if this looks like SNMP or not. if not, return 0 so
@@ -3380,18 +3365,21 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
}
/* then comes a length which spans the rest of the tvb */
offset = get_ber_length(tvb, offset, &tmp_length, &tmp_ind);
- /* if(tmp_length!=(guint32)tvb_reported_length_remaining(tvb, offset)) {
- * Loosen the heuristic a bit to handle the case where data has intentionally
- * been added after the snmp PDU ( UDP case)
+ /* Loosen the heuristic a bit to handle the case where data has intentionally
+ * been added after the snmp PDU ( UDP case) (#3684)
+ * If this is fragmented or carried in ICMP, we don't expect the tvb to
+ * have the full legnth, so don't check.
*/
- if ( pinfo->ptype == PT_UDP ) {
- if(tmp_length>(guint32)tvb_reported_length_remaining(tvb, offset)) {
- return 0;
- }
- }else{
- if(tmp_length!=(guint32)tvb_reported_length_remaining(tvb, offset)) {
- return 0;
- }
+ if (!pinfo->fragmented && !pinfo->flags.in_error_pkt) {
+ if ( pinfo->ptype == PT_UDP ) {
+ if(tmp_length>(guint32)tvb_reported_length_remaining(tvb, offset)) {
+ return 0;
+ }
+ }else{
+ if(tmp_length!=(guint32)tvb_reported_length_remaining(tvb, offset)) {
+ return 0;
+ }
+ }
}
/* then comes an INTEGER (version)*/
get_ber_identifier(tvb, offset, &tmp_class, &tmp_pc, &tmp_tag);
@@ -3402,11 +3390,20 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
/*
- * The first SNMP packet goes to the SNMP port; the second one
- * may come from some *other* port, but goes back to the same
- * IP address and port as the ones from which the first packet
- * came; all subsequent packets presumably go between those two
- * IP addresses and ports.
+ * The IBM i (OS/400) SNMP agent, at least originally, would
+ * send responses back from some *other* UDP port, an ephemeral
+ * port above 5000, going back to the same IP address and port
+ * from which the request came, similar to TFTP. This only happens
+ * with the agent port, 161, not with the trap port, etc. As of
+ * 2015 with the latest fixes applied, it no longer does this:
+ * https://www.ibm.com/support/pages/ptf/SI55487
+ * https://www.ibm.com/support/pages/ptf/SI55537
+ *
+ * The SNMP RFCs are silent on this (cf. L2TP RFC 2661, which
+ * supports using either the well-known port or an ephemeral
+ * port as the source port for responses, while noting that
+ * the latter can cause issues with firewalls and NATs.) so
+ * possibly some other implementations could do this.
*
* If this packet went to the SNMP port, we check to see if
* there's already a conversation with one address/port pair
@@ -3420,6 +3417,17 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
* wildcarded, and give it the SNMP dissector as a dissector.
*/
+ if (pinfo->destport == UDP_PORT_SNMP) {
+ conversation_t *conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, conversation_pt_to_conversation_type(pinfo->ptype),
+ pinfo->srcport, 0, NO_PORT_B);
+
+ if( (conversation == NULL) || (conversation_get_dissector(conversation, pinfo->num)!=snmp_handle) ) {
+ conversation = conversation_new(pinfo->num, &pinfo->src, &pinfo->dst, conversation_pt_to_conversation_type(pinfo->ptype),
+ pinfo->srcport, 0, NO_PORT2);
+ conversation_set_dissector(conversation, snmp_handle);
+ }
+ }
+
return dissect_snmp_pdu(tvb, 0, pinfo, tree, proto_snmp, ett_snmp, FALSE);
}
@@ -3430,7 +3438,7 @@ dissect_snmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
guint message_len;
while (tvb_reported_length_remaining(tvb, offset) > 0) {
- message_len = dissect_snmp_pdu(tvb, 0, pinfo, tree, proto_snmp, ett_snmp, TRUE);
+ message_len = dissect_snmp_pdu(tvb, offset, pinfo, tree, proto_snmp, ett_snmp, TRUE);
if (message_len == 0) {
/*
* We don't have all the data for that message,
@@ -3688,9 +3696,6 @@ void proto_register_snmp(void) {
NULL, 0, NULL, HFILL }},
-
-/*--- Included file: packet-snmp-hfarr.c ---*/
-#line 1 "./asn1/snmp/packet-snmp-hfarr.c"
{ &hf_snmp_SMUX_PDUs_PDU,
{ "SMUX-PDUs", "snmp.SMUX_PDUs",
FT_UINT32, BASE_DEC, VALS(snmp_SMUX_PDUs_vals), 0,
@@ -3951,9 +3956,6 @@ void proto_register_snmp(void) {
{ "operation", "snmp.operation",
FT_INT32, BASE_DEC, VALS(snmp_T_operation_vals), 0,
NULL, HFILL }},
-
-/*--- End of included file: packet-snmp-hfarr.c ---*/
-#line 2452 "./asn1/snmp/packet-snmp-template.c"
};
/* List of subtrees */
@@ -3969,9 +3971,6 @@ void proto_register_snmp(void) {
&ett_name,
&ett_value,
&ett_decoding_error,
-
-/*--- Included file: packet-snmp-ettarr.c ---*/
-#line 1 "./asn1/snmp/packet-snmp-ettarr.c"
&ett_snmp_Message,
&ett_snmp_Messagev2u,
&ett_snmp_T_datav2u,
@@ -3991,9 +3990,6 @@ void proto_register_snmp(void) {
&ett_snmp_OpenPDU,
&ett_snmp_SimpleOpen_U,
&ett_snmp_RReqPDU_U,
-
-/*--- End of included file: packet-snmp-ettarr.c ---*/
-#line 2468 "./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 }},
@@ -4012,7 +4008,7 @@ void proto_register_snmp(void) {
{ &ei_snmp_no_instance_subid, { "snmp.no_instance_subid", PI_MALFORMED, PI_WARN, "No instance sub-id in scalar value", EXPFILL }},
{ &ei_snmp_wrong_num_of_subids, { "snmp.wrong_num_of_subids", PI_MALFORMED, PI_WARN, "Wrong number of instance sub-ids in scalar value", EXPFILL }},
{ &ei_snmp_index_suboid_too_short, { "snmp.index_suboid_too_short", PI_MALFORMED, PI_WARN, "index sub-oid shorter than expected", EXPFILL }},
- { &ei_snmp_unimplemented_instance_index, { "snmp.unimplemented_instance_index", PI_UNDECODED, PI_WARN, "OID instaces not handled, if you want this implemented please contact the wireshark developers", EXPFILL }},
+ { &ei_snmp_unimplemented_instance_index, { "snmp.unimplemented_instance_index", PI_UNDECODED, PI_WARN, "OID instances not handled, if you want this implemented please contact the wireshark developers", EXPFILL }},
{ &ei_snmp_index_suboid_len0, { "snmp.ndex_suboid_len0", PI_MALFORMED, PI_WARN, "an index sub-oid OID cannot be 0 bytes long!", EXPFILL }},
{ &ei_snmp_index_suboid_too_long, { "snmp.index_suboid_too_long", PI_MALFORMED, PI_WARN, "index sub-oid should not be longer than remaining oid size", EXPFILL }},
{ &ei_snmp_index_string_too_long, { "snmp.index_string_too_long", PI_MALFORMED, PI_WARN, "index string should not be longer than remaining oid size", EXPFILL }},
@@ -4090,6 +4086,8 @@ void proto_register_snmp(void) {
expert_snmp = expert_register_protocol(proto_snmp);
expert_register_field_array(expert_snmp, ei, array_length(ei));
+ /* Register dissector */
+ snmp_tcp_handle = register_dissector("snmp.tcp", dissect_snmp_tcp, proto_snmp);
/* Register configuration preferences */
snmp_module = prefs_register_protocol(proto_snmp, process_prefs);
@@ -4128,7 +4126,7 @@ void proto_register_snmp(void) {
"MIB settings can be changed in the Name Resolution preferences");
#endif
- value_sub_dissectors_table = register_dissector_table("snmp.variable_oid","SNMP Variable OID", proto_snmp, FT_STRING, BASE_NONE);
+ value_sub_dissectors_table = register_dissector_table("snmp.variable_oid","SNMP Variable OID", proto_snmp, FT_STRING, STRING_CASE_SENSITIVE);
register_init_routine(init_ue_cache);
register_cleanup_routine(cleanup_ue_cache);
@@ -4143,7 +4141,6 @@ void proto_register_snmp(void) {
/*--- proto_reg_handoff_snmp ---------------------------------------*/
void proto_reg_handoff_snmp(void) {
- dissector_handle_t snmp_tcp_handle;
dissector_add_uint_with_preference("udp.port", UDP_PORT_SNMP, snmp_handle);
dissector_add_uint("ethertype", ETHERTYPE_SNMP, snmp_handle);
@@ -4151,7 +4148,6 @@ void proto_reg_handoff_snmp(void) {
dissector_add_uint("ipx.socket", IPX_SOCKET_SNMP_SINK, snmp_handle);
dissector_add_uint("hpext.dxsap", HPEXT_SNMP, snmp_handle);
- snmp_tcp_handle = create_dissector_handle(dissect_snmp_tcp, proto_snmp);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_SNMP, snmp_tcp_handle);
/* Since "regular" SNMP port and "trap" SNMP port use the same handler,
the "trap" port doesn't really need a separate preference. Just register
@@ -4192,14 +4188,12 @@ proto_register_smux(void)
proto_register_subtree_array(ett, array_length(ett));
+ smux_handle = register_dissector("smux", dissect_smux, proto_smux);
}
void
proto_reg_handoff_smux(void)
{
- dissector_handle_t smux_handle;
-
- smux_handle = create_dissector_handle(dissect_smux, proto_smux);
dissector_add_uint_with_preference("tcp.port", TCP_PORT_SMUX, smux_handle);
}