2006-05-03 19:09:03 +00:00
|
|
|
/* Do not modify this file. */
|
2006-05-23 20:36:49 +00:00
|
|
|
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
|
2007-05-03 11:37:47 +00:00
|
|
|
/* .\packet-snmp.c */
|
2006-05-23 20:36:49 +00:00
|
|
|
/* ../../tools/asn2wrs.py -b -e -p snmp -c snmp.cnf -s packet-snmp-template snmp.asn */
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
/* Input file: packet-snmp-template.c */
|
|
|
|
|
|
|
|
#line 1 "packet-snmp-template.c"
|
1999-05-12 05:56:42 +00:00
|
|
|
/* packet-snmp.c
|
|
|
|
* Routines for SNMP (simple network management protocol)
|
2001-06-10 09:50:20 +00:00
|
|
|
* Copyright (C) 1998 Didier Jorand
|
1999-05-12 05:56:42 +00:00
|
|
|
*
|
2001-01-30 02:13:43 +00:00
|
|
|
* See RFC 1157 for SNMPv1.
|
|
|
|
*
|
|
|
|
* See RFCs 1901, 1905, and 1906 for SNMPv2c.
|
|
|
|
*
|
2002-10-22 20:06:15 +00:00
|
|
|
* See RFCs 1905, 1906, 1909, and 1910 for SNMPv2u [historic].
|
2001-01-30 02:13:43 +00:00
|
|
|
*
|
2002-10-22 20:06:15 +00:00
|
|
|
* See RFCs 2570-2576 for SNMPv3
|
2006-05-23 20:36:49 +00:00
|
|
|
* Updated to use the asn2wrs compiler made by Tomas Kukosa
|
2006-05-03 19:09:03 +00:00
|
|
|
* Copyright (C) 2005 - 2006 Anders Broman [AT] ericsson.com
|
|
|
|
*
|
2007-01-09 18:38:55 +00:00
|
|
|
* See RFC 3414 for User-based Security Model for SNMPv3
|
2007-01-11 00:29:50 +00:00
|
|
|
* See RFC 3826 for (AES) Cipher Algorithm in the SNMP USM
|
2007-01-09 18:38:55 +00:00
|
|
|
* Copyright (C) 2007 Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
|
2002-10-22 20:06:15 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-05-12 05:56:42 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-06-10 09:50:20 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
1999-05-12 05:56:42 +00:00
|
|
|
*
|
1999-12-10 09:49:29 +00:00
|
|
|
* Some stuff from:
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-10 09:49:29 +00:00
|
|
|
* GXSNMP -- An snmp mangament application
|
|
|
|
* Copyright (C) 1998 Gregory McLean & Jochen Friedrich
|
|
|
|
* Beholder RMON ethernet network monitor,Copyright (C) 1993 DNPAP group
|
|
|
|
*
|
1999-05-12 05:56:42 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-05-12 05:56:42 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-05-12 05:56:42 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2006-06-14 08:08:51 +00:00
|
|
|
#include <ctype.h>
|
1999-05-12 05:56:42 +00:00
|
|
|
|
1999-12-10 09:49:29 +00:00
|
|
|
#include <glib.h>
|
1999-12-12 01:51:47 +00:00
|
|
|
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/strutil.h>
|
|
|
|
#include <epan/conversation.h>
|
2006-05-03 19:09:03 +00:00
|
|
|
#include "etypes.h"
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2005-07-25 23:33:44 +00:00
|
|
|
#include <epan/sminmpec.h>
|
2005-08-19 22:26:10 +00:00
|
|
|
#include <epan/emem.h>
|
2006-06-13 13:21:12 +00:00
|
|
|
#include <epan/next_tvb.h>
|
2007-02-07 14:54:35 +00:00
|
|
|
#include <epan/uat.h>
|
2007-05-13 20:58:29 +00:00
|
|
|
#include <epan/asn1.h>
|
2000-05-30 03:35:55 +00:00
|
|
|
#include "packet-ipx.h"
|
2003-03-02 21:52:21 +00:00
|
|
|
#include "packet-hpext.h"
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
2005-05-10 08:49:27 +00:00
|
|
|
#include "packet-ber.h"
|
1999-12-12 01:51:47 +00:00
|
|
|
|
2002-10-22 20:06:15 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
|
|
|
# include <net-snmp/net-snmp-config.h>
|
2002-10-23 18:24:09 +00:00
|
|
|
# include <net-snmp/mib_api.h>
|
|
|
|
# include <net-snmp/library/default_store.h>
|
2002-10-24 07:08:26 +00:00
|
|
|
# include <net-snmp/config_api.h>
|
2002-10-23 18:24:09 +00:00
|
|
|
|
2004-09-11 23:03:36 +00:00
|
|
|
#ifdef _WIN32
|
2002-11-10 20:53:06 +00:00
|
|
|
# include <epan/filesystem.h>
|
2004-09-11 23:03:36 +00:00
|
|
|
#endif /* _WIN32 */
|
2002-11-10 20:53:06 +00:00
|
|
|
|
1999-12-14 05:59:16 +00:00
|
|
|
/*
|
2002-03-10 22:18:12 +00:00
|
|
|
* Define values "sprint_realloc_value()" expects.
|
1999-12-12 01:51:47 +00:00
|
|
|
*/
|
2002-03-10 22:18:12 +00:00
|
|
|
# define VALTYPE_INTEGER ASN_INTEGER
|
|
|
|
# define VALTYPE_COUNTER ASN_COUNTER
|
|
|
|
# define VALTYPE_GAUGE ASN_GAUGE
|
|
|
|
# define VALTYPE_TIMETICKS ASN_TIMETICKS
|
|
|
|
# define VALTYPE_STRING ASN_OCTET_STR
|
|
|
|
# define VALTYPE_IPADDR ASN_IPADDRESS
|
|
|
|
# define VALTYPE_OPAQUE ASN_OPAQUE
|
|
|
|
# define VALTYPE_NSAP ASN_NSAP
|
|
|
|
# define VALTYPE_OBJECTID ASN_OBJECT_ID
|
|
|
|
# define VALTYPE_BITSTR ASN_BIT_STR
|
|
|
|
# define VALTYPE_COUNTER64 ASN_COUNTER64
|
1999-12-12 01:51:47 +00:00
|
|
|
|
2006-12-08 15:05:41 +00:00
|
|
|
#endif /* HAVE_NET_SNMP */
|
1999-12-10 09:49:29 +00:00
|
|
|
#include "packet-snmp.h"
|
2006-05-03 19:09:03 +00:00
|
|
|
#include "format-oid.h"
|
1999-05-16 04:13:29 +00:00
|
|
|
|
2007-01-12 00:33:32 +00:00
|
|
|
#include <epan/crypt/crypt-sha1.h>
|
2007-01-09 20:22:48 +00:00
|
|
|
#include <epan/crypt/crypt-md5.h>
|
|
|
|
#include <epan/expert.h>
|
|
|
|
#include <epan/report_err.h>
|
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <winposixtype.h>
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
#ifdef HAVE_LIBGCRYPT
|
|
|
|
#include <gcrypt.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-07-02 07:10:16 +00:00
|
|
|
/* Take a pointer that may be null and return a pointer that's not null
|
2003-04-19 09:45:25 +00:00
|
|
|
by turning null pointers into pointers to the above null string,
|
|
|
|
and, if the argument pointer wasn't null, make sure we handle
|
|
|
|
non-printable characters in the string by escaping them. */
|
|
|
|
#define SAFE_STRING(s, l) (((s) != NULL) ? format_text((s), (l)) : "")
|
2000-07-02 07:10:16 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
#define PNAME "Simple Network Management Protocol"
|
|
|
|
#define PSNAME "SNMP"
|
|
|
|
#define PFNAME "snmp"
|
|
|
|
|
|
|
|
#define UDP_PORT_SNMP 161
|
|
|
|
#define UDP_PORT_SNMP_TRAP 162
|
|
|
|
#define TCP_PORT_SNMP 161
|
|
|
|
#define TCP_PORT_SNMP_TRAP 162
|
|
|
|
#define TCP_PORT_SMUX 199
|
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields */
|
1999-12-10 09:49:29 +00:00
|
|
|
static int proto_snmp = -1;
|
2006-05-03 19:09:03 +00:00
|
|
|
static int proto_smux = -1;
|
1999-05-12 05:56:42 +00:00
|
|
|
|
2003-09-08 20:45:50 +00:00
|
|
|
/* Default MIB modules to load */
|
2004-12-07 21:06:55 +00:00
|
|
|
/*
|
2005-08-17 22:27:15 +00:00
|
|
|
* XXX - According to Wes Hardaker, we shouldn't do this:
|
|
|
|
* http://www.ethereal.com/lists/ethereal-dev/200412/msg00222.html
|
2004-12-07 21:06:55 +00:00
|
|
|
*/
|
|
|
|
#ifdef _WIN32
|
|
|
|
# define DEF_MIB_MODULES "IP-MIB;IF-MIB;TCP-MIB;UDP-MIB;SNMPv2-MIB;RFC1213-MIB;UCD-SNMP-MIB"
|
2005-08-17 22:27:15 +00:00
|
|
|
# define IMPORT_SEPARATOR ":"
|
2004-12-07 21:06:55 +00:00
|
|
|
#else
|
|
|
|
# define DEF_MIB_MODULES "IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:UCD-SNMP-MIB"
|
2005-08-17 22:27:15 +00:00
|
|
|
# define IMPORT_SEPARATOR ";"
|
2004-12-07 21:06:55 +00:00
|
|
|
#endif /* _WIN32 */
|
2003-09-08 20:45:50 +00:00
|
|
|
|
2005-07-24 19:01:28 +00:00
|
|
|
static const gchar *mib_modules = DEF_MIB_MODULES;
|
2003-05-03 15:23:15 +00:00
|
|
|
static gboolean display_oid = TRUE;
|
2006-06-13 13:21:12 +00:00
|
|
|
static gboolean snmp_var_in_tree = TRUE;
|
2003-05-03 15:23:15 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
|
|
|
|
static gboolean snmp_usm_auth_md5(snmp_usm_params_t* p, guint8**, guint*, gchar const**);
|
|
|
|
static gboolean snmp_usm_auth_sha1(snmp_usm_params_t* p, guint8**, guint*, gchar const**);
|
|
|
|
|
|
|
|
static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t*, tvbuff_t*, gchar const**);
|
|
|
|
static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t*, tvbuff_t*, gchar const**);
|
|
|
|
|
|
|
|
|
|
|
|
static void snmp_usm_password_to_key_md5(const guint8 *password, guint passwordlen, const guint8 *engineID, guint engineLength, guint8 *key);
|
|
|
|
static void snmp_usm_password_to_key_sha1(const guint8 *password, guint passwordlen, const guint8 *engineID, guint engineLength, guint8 *key);
|
|
|
|
|
|
|
|
|
|
|
|
static snmp_usm_auth_model_t model_md5 = {snmp_usm_password_to_key_md5, snmp_usm_auth_md5, 16};
|
|
|
|
static snmp_usm_auth_model_t model_sha1 = {snmp_usm_password_to_key_sha1, snmp_usm_auth_sha1, 20};
|
|
|
|
|
|
|
|
static value_string auth_types[] = {
|
|
|
|
{0,"MD5"},
|
|
|
|
{1,"SHA1"},
|
|
|
|
{0,NULL}
|
|
|
|
};
|
|
|
|
static snmp_usm_auth_model_t* auth_models[] = {&model_md5,&model_sha1};
|
|
|
|
|
|
|
|
|
|
|
|
static value_string priv_types[] = {
|
|
|
|
{0,"DES"},
|
|
|
|
{1,"AES"},
|
|
|
|
{0,NULL}
|
|
|
|
};
|
|
|
|
static snmp_usm_decoder_t priv_protos[] = {snmp_usm_priv_des, snmp_usm_priv_aes};
|
|
|
|
|
|
|
|
static snmp_ue_assoc_t* ueas = NULL;
|
|
|
|
static guint num_ueas = 0;
|
|
|
|
static uat_t* assocs_uat = NULL;
|
2007-01-11 00:29:50 +00:00
|
|
|
static snmp_ue_assoc_t* localized_ues = NULL;
|
|
|
|
static snmp_ue_assoc_t* unlocalized_ues = NULL;
|
2007-02-07 14:54:35 +00:00
|
|
|
/****/
|
|
|
|
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
|
|
|
|
static snmp_usm_params_t usm_p = {FALSE,FALSE,0,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,FALSE};
|
2007-01-09 18:38:55 +00:00
|
|
|
|
2004-08-11 19:11:16 +00:00
|
|
|
/* Subdissector tables */
|
|
|
|
static dissector_table_t variable_oid_dissector_table;
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
#define TH_AUTH 0x01
|
|
|
|
#define TH_CRYPT 0x02
|
|
|
|
#define TH_REPORT 0x04
|
|
|
|
|
|
|
|
/* desegmentation of SNMP-over-TCP */
|
|
|
|
static gboolean snmp_desegment = TRUE;
|
|
|
|
|
|
|
|
/* Global variables */
|
|
|
|
|
|
|
|
guint32 MsgSecurityModel;
|
|
|
|
tvbuff_t *oid_tvb=NULL;
|
2006-06-13 13:21:12 +00:00
|
|
|
tvbuff_t *value_tvb=NULL;
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
static dissector_handle_t snmp_handle;
|
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
|
2006-06-13 13:21:12 +00:00
|
|
|
static next_tvb_list_t var_list;
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int hf_snmp_v3_flags_auth = -1;
|
|
|
|
static int hf_snmp_v3_flags_crypt = -1;
|
|
|
|
static int hf_snmp_v3_flags_report = -1;
|
2000-05-15 03:15:12 +00:00
|
|
|
|
2005-07-25 23:33:44 +00:00
|
|
|
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_mac = -1;
|
|
|
|
static int hf_snmp_engineid_text = -1;
|
|
|
|
static int hf_snmp_engineid_time = -1;
|
|
|
|
static int hf_snmp_engineid_data = -1;
|
2006-02-28 09:39:53 +00:00
|
|
|
static int hf_snmp_counter64 = -1;
|
2007-01-09 18:38:55 +00:00
|
|
|
static int hf_snmp_decryptedPDU = -1;
|
|
|
|
static int hf_snmp_msgAuthentication = -1;
|
2007-04-05 22:16:12 +00:00
|
|
|
static int hf_snmp_internet_ipv6 = -1;
|
|
|
|
static int hf_snmp_internet_other = -1;
|
2000-05-15 03:15:12 +00:00
|
|
|
|
2003-04-19 09:45:25 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/*--- Included file: packet-snmp-hf.c ---*/
|
|
|
|
#line 1 "packet-snmp-hf.c"
|
|
|
|
static int hf_snmp_SMUX_PDUs_PDU = -1; /* SMUX_PDUs */
|
|
|
|
static int hf_snmp_simple = -1; /* SimpleSyntax */
|
|
|
|
static int hf_snmp_application_wide = -1; /* ApplicationSyntax */
|
|
|
|
static int hf_snmp_integer_value = -1; /* Integer_value */
|
|
|
|
static int hf_snmp_string_value = -1; /* String_value */
|
|
|
|
static int hf_snmp_objectID_value = -1; /* ObjectID_value */
|
|
|
|
static int hf_snmp_empty = -1; /* Empty */
|
|
|
|
static int hf_snmp_ipAddress_value = -1; /* IpAddress */
|
|
|
|
static int hf_snmp_counter_value = -1; /* Counter32 */
|
|
|
|
static int hf_snmp_timeticks_value = -1; /* TimeTicks */
|
|
|
|
static int hf_snmp_arbitrary_value = -1; /* Opaque */
|
|
|
|
static int hf_snmp_big_counter_value = -1; /* Counter64 */
|
|
|
|
static int hf_snmp_unsigned_integer_value = -1; /* Unsigned32 */
|
2007-04-05 22:16:12 +00:00
|
|
|
static int hf_snmp_internet = -1; /* T_internet */
|
2006-05-03 19:09:03 +00:00
|
|
|
static int hf_snmp_version = -1; /* Version */
|
|
|
|
static int hf_snmp_community = -1; /* OCTET_STRING */
|
|
|
|
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 */
|
2007-01-09 18:38:55 +00:00
|
|
|
static int hf_snmp_msgAuthoritativeEngineID = -1; /* T_msgAuthoritativeEngineID */
|
2007-01-11 00:29:50 +00:00
|
|
|
static int hf_snmp_msgAuthoritativeEngineBoots = -1; /* T_msgAuthoritativeEngineBoots */
|
|
|
|
static int hf_snmp_msgAuthoritativeEngineTime = -1; /* T_msgAuthoritativeEngineTime */
|
2007-01-09 18:38:55 +00:00
|
|
|
static int hf_snmp_msgUserName = -1; /* T_msgUserName */
|
|
|
|
static int hf_snmp_msgAuthenticationParameters = -1; /* T_msgAuthenticationParameters */
|
|
|
|
static int hf_snmp_msgPrivacyParameters = -1; /* T_msgPrivacyParameters */
|
2006-05-03 19:09:03 +00:00
|
|
|
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 */
|
2007-01-09 18:38:55 +00:00
|
|
|
static int hf_snmp_encryptedPDU = -1; /* T_encryptedPDU */
|
2006-05-03 19:09:03 +00:00
|
|
|
static int hf_snmp_contextEngineID = -1; /* OCTET_STRING */
|
|
|
|
static int hf_snmp_contextName = -1; /* OCTET_STRING */
|
|
|
|
static int hf_snmp_get_request = -1; /* T_get_request */
|
|
|
|
static int hf_snmp_get_next_request = -1; /* T_get_next_request */
|
|
|
|
static int hf_snmp_get_response = -1; /* T_get_response */
|
|
|
|
static int hf_snmp_set_request = -1; /* T_set_request */
|
|
|
|
static int hf_snmp_trap = -1; /* T_trap */
|
|
|
|
static int hf_snmp_getBulkRequest = -1; /* T_getBulkRequest */
|
|
|
|
static int hf_snmp_informRequest = -1; /* T_informRequest */
|
|
|
|
static int hf_snmp_sNMPv2_Trap = -1; /* T_sNMPv2_Trap */
|
|
|
|
static int hf_snmp_report = -1; /* T_report */
|
|
|
|
static int hf_snmp_request_id = -1; /* INTEGER */
|
|
|
|
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; /* OBJECT_IDENTIFIER */
|
|
|
|
static int hf_snmp_agent_addr = -1; /* NetworkAddress */
|
|
|
|
static int hf_snmp_generic_trap = -1; /* T_generic_trap */
|
|
|
|
static int hf_snmp_specific_trap = -1; /* INTEGER */
|
|
|
|
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_value = -1; /* ObjectSyntax */
|
|
|
|
static int hf_snmp_unSpecified = -1; /* NULL */
|
|
|
|
static int hf_snmp_noSuchObject = -1; /* NULL */
|
|
|
|
static int hf_snmp_noSuchInstance = -1; /* NULL */
|
|
|
|
static int hf_snmp_endOfMibView = -1; /* NULL */
|
|
|
|
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 ---*/
|
2007-05-13 20:58:29 +00:00
|
|
|
#line 234 "packet-snmp-template.c"
|
2003-04-19 09:45:25 +00:00
|
|
|
|
|
|
|
static int hf_smux_version = -1;
|
|
|
|
static int hf_smux_pdutype = -1;
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_smux = -1;
|
|
|
|
static gint ett_snmp = -1;
|
|
|
|
static gint ett_engineid = -1;
|
|
|
|
static gint ett_msgFlags = -1;
|
2007-01-09 18:38:55 +00:00
|
|
|
static gint ett_encryptedPDU = -1;
|
|
|
|
static gint ett_decrypted = -1;
|
|
|
|
static gint ett_authParameters = -1;
|
2007-04-05 22:16:12 +00:00
|
|
|
static gint ett_internet = -1;
|
2000-05-15 03:15:12 +00:00
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/*--- Included file: packet-snmp-ett.c ---*/
|
|
|
|
#line 1 "packet-snmp-ett.c"
|
|
|
|
static gint ett_snmp_ObjectSyntax = -1;
|
|
|
|
static gint ett_snmp_SimpleSyntax = -1;
|
|
|
|
static gint ett_snmp_ApplicationSyntax = -1;
|
|
|
|
static gint ett_snmp_NetworkAddress = -1;
|
|
|
|
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 = -1;
|
|
|
|
static gint ett_snmp_VarBind = -1;
|
|
|
|
static gint ett_snmp_ValueType = -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 = -1;
|
|
|
|
static gint ett_snmp_RReqPDU = -1;
|
|
|
|
|
|
|
|
/*--- End of included file: packet-snmp-ett.c ---*/
|
2007-05-13 20:58:29 +00:00
|
|
|
#line 249 "packet-snmp-template.c"
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_snmp_IpAddressIpv6(gboolean, tvbuff_t* ,int , asn1_ctx_t* , proto_tree*, int);
|
|
|
|
static int dissect_snmp_IpAddressOther(gboolean, tvbuff_t* ,int , asn1_ctx_t* , proto_tree*, int);
|
2007-04-05 22:16:12 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
static const true_false_string auth_flags = {
|
|
|
|
"OK",
|
|
|
|
"Failed"
|
|
|
|
};
|
1999-06-12 04:17:19 +00:00
|
|
|
|
2003-11-02 23:12:35 +00:00
|
|
|
/* defined in net-SNMP; include/net-snmp/library/snmp.h */
|
|
|
|
#undef SNMP_MSG_GET
|
|
|
|
#undef SNMP_MSG_SET
|
|
|
|
#undef SNMP_MSG_GETNEXT
|
|
|
|
#undef SNMP_MSG_RESPONSE
|
|
|
|
#undef SNMP_MSG_TRAP
|
|
|
|
#undef SNMP_MSG_GETBULK
|
|
|
|
#undef SNMP_MSG_INFORM
|
|
|
|
#undef SNMP_MSG_TRAP2
|
|
|
|
#undef SNMP_MSG_REPORT
|
|
|
|
#undef SNMP_NOSUCHOBJECT
|
|
|
|
#undef SNMP_NOSUCHINSTANCE
|
|
|
|
#undef SNMP_ENDOFMIBVIEW
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/* Security Models */
|
|
|
|
|
|
|
|
#define SNMP_SEC_ANY 0
|
|
|
|
#define SNMP_SEC_V1 1
|
|
|
|
#define SNMP_SEC_V2C 2
|
|
|
|
#define SNMP_SEC_USM 3
|
|
|
|
|
|
|
|
static const value_string sec_models[] = {
|
|
|
|
{ SNMP_SEC_ANY, "Any" },
|
|
|
|
{ SNMP_SEC_V1, "V1" },
|
|
|
|
{ SNMP_SEC_V2C, "V2C" },
|
|
|
|
{ SNMP_SEC_USM, "USM" },
|
|
|
|
{ 0, NULL }
|
1999-06-12 04:17:19 +00:00
|
|
|
};
|
|
|
|
|
2000-05-15 03:15:12 +00:00
|
|
|
/* SMUX PDU types */
|
|
|
|
#define SMUX_MSG_OPEN 0
|
|
|
|
#define SMUX_MSG_CLOSE 1
|
|
|
|
#define SMUX_MSG_RREQ 2
|
|
|
|
#define SMUX_MSG_RRSP 3
|
|
|
|
#define SMUX_MSG_SOUT 4
|
|
|
|
|
|
|
|
static const value_string smux_types[] = {
|
|
|
|
{ SMUX_MSG_OPEN, "Open" },
|
|
|
|
{ SMUX_MSG_CLOSE, "Close" },
|
|
|
|
{ SMUX_MSG_RREQ, "Registration Request" },
|
|
|
|
{ SMUX_MSG_RRSP, "Registration Response" },
|
|
|
|
{ SMUX_MSG_SOUT, "Commit Or Rollback" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
1999-12-10 09:49:29 +00:00
|
|
|
/* SNMP Tags */
|
|
|
|
|
|
|
|
#define SNMP_IPA 0 /* IP Address */
|
|
|
|
#define SNMP_CNT 1 /* Counter (Counter32) */
|
|
|
|
#define SNMP_GGE 2 /* Gauge (Gauge32) */
|
|
|
|
#define SNMP_TIT 3 /* TimeTicks */
|
|
|
|
#define SNMP_OPQ 4 /* Opaque */
|
|
|
|
#define SNMP_NSP 5 /* NsapAddress */
|
|
|
|
#define SNMP_C64 6 /* Counter64 */
|
|
|
|
#define SNMP_U32 7 /* Uinteger32 */
|
|
|
|
|
|
|
|
#define SERR_NSO 0
|
|
|
|
#define SERR_NSI 1
|
|
|
|
#define SERR_EOM 2
|
|
|
|
|
|
|
|
/* SNMPv1 Types */
|
|
|
|
|
|
|
|
#define SNMP_NULL 0
|
|
|
|
#define SNMP_INTEGER 1 /* l */
|
|
|
|
#define SNMP_OCTETSTR 2 /* c */
|
|
|
|
#define SNMP_DISPLAYSTR 2 /* c */
|
|
|
|
#define SNMP_OBJECTID 3 /* ul */
|
|
|
|
#define SNMP_IPADDR 4 /* uc */
|
|
|
|
#define SNMP_COUNTER 5 /* ul */
|
|
|
|
#define SNMP_GAUGE 6 /* ul */
|
|
|
|
#define SNMP_TIMETICKS 7 /* ul */
|
|
|
|
#define SNMP_OPAQUE 8 /* c */
|
|
|
|
|
|
|
|
/* additional SNMPv2 Types */
|
|
|
|
|
|
|
|
#define SNMP_UINTEGER 5 /* ul */
|
|
|
|
#define SNMP_BITSTR 9 /* uc */
|
|
|
|
#define SNMP_NSAP 10 /* uc */
|
|
|
|
#define SNMP_COUNTER64 11 /* ul */
|
|
|
|
#define SNMP_NOSUCHOBJECT 12
|
|
|
|
#define SNMP_NOSUCHINSTANCE 13
|
|
|
|
#define SNMP_ENDOFMIBVIEW 14
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
1999-12-10 09:49:29 +00:00
|
|
|
typedef struct _SNMP_CNV SNMP_CNV;
|
|
|
|
|
|
|
|
struct _SNMP_CNV
|
|
|
|
{
|
|
|
|
guint class;
|
|
|
|
guint tag;
|
|
|
|
gint syntax;
|
2005-08-05 00:23:22 +00:00
|
|
|
const gchar *name;
|
1999-12-10 09:49:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static SNMP_CNV SnmpCnv [] =
|
|
|
|
{
|
2005-09-14 17:08:41 +00:00
|
|
|
{BER_CLASS_UNI, BER_UNI_TAG_NULL, SNMP_NULL, "NULL"},
|
|
|
|
{BER_CLASS_UNI, BER_UNI_TAG_INTEGER, SNMP_INTEGER, "INTEGER"},
|
|
|
|
{BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, SNMP_OCTETSTR, "OCTET STRING"},
|
|
|
|
{BER_CLASS_UNI, BER_UNI_TAG_OID, SNMP_OBJECTID, "OBJECTID"},
|
|
|
|
{BER_CLASS_APP, SNMP_IPA, SNMP_IPADDR, "IPADDR"},
|
|
|
|
{BER_CLASS_APP, SNMP_CNT, SNMP_COUNTER, "COUNTER"}, /* Counter32 */
|
|
|
|
{BER_CLASS_APP, SNMP_GGE, SNMP_GAUGE, "GAUGE"}, /* Gauge32 == Unsigned32 */
|
|
|
|
{BER_CLASS_APP, SNMP_TIT, SNMP_TIMETICKS, "TIMETICKS"},
|
|
|
|
{BER_CLASS_APP, SNMP_OPQ, SNMP_OPAQUE, "OPAQUE"},
|
1999-12-10 09:49:29 +00:00
|
|
|
|
|
|
|
/* SNMPv2 data types and errors */
|
|
|
|
|
2005-09-14 17:08:41 +00:00
|
|
|
{BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, SNMP_BITSTR, "BITSTR"},
|
|
|
|
{BER_CLASS_APP, SNMP_C64, SNMP_COUNTER64, "COUNTER64"},
|
|
|
|
{BER_CLASS_CON, SERR_NSO, SNMP_NOSUCHOBJECT, "NOSUCHOBJECT"},
|
|
|
|
{BER_CLASS_CON, SERR_NSI, SNMP_NOSUCHINSTANCE, "NOSUCHINSTANCE"},
|
|
|
|
{BER_CLASS_CON, SERR_EOM, SNMP_ENDOFMIBVIEW, "ENDOFMIBVIEW"},
|
|
|
|
{0, 0, -1, NULL}
|
1999-12-10 09:49:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NAME: g_snmp_tag_cls2syntax
|
|
|
|
* SYNOPSIS: gboolean g_snmp_tag_cls2syntax
|
|
|
|
* (
|
|
|
|
* guint tag,
|
|
|
|
* guint cls,
|
|
|
|
* gushort *syntax
|
|
|
|
* )
|
|
|
|
* DESCRIPTION: Converts ASN1 tag and class to Syntax tag and name.
|
|
|
|
* See SnmpCnv for conversion.
|
|
|
|
* RETURNS: name on success, NULL on failure
|
|
|
|
*/
|
|
|
|
|
2005-08-05 00:23:22 +00:00
|
|
|
static const gchar *
|
1999-12-10 09:49:29 +00:00
|
|
|
snmp_tag_cls2syntax ( guint tag, guint cls, gushort *syntax)
|
|
|
|
{
|
|
|
|
SNMP_CNV *cnv;
|
|
|
|
|
|
|
|
cnv = SnmpCnv;
|
|
|
|
while (cnv->syntax != -1)
|
|
|
|
{
|
|
|
|
if (cnv->tag == tag && cnv->class == cls)
|
|
|
|
{
|
|
|
|
*syntax = cnv->syntax;
|
|
|
|
return cnv->name;
|
|
|
|
}
|
|
|
|
cnv++;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
int oid_to_subid_buf(const guint8 *oid, gint oid_len, subid_t *buf, int buf_len) {
|
2006-05-15 17:58:39 +00:00
|
|
|
int i, out_len;
|
|
|
|
guint8 byte;
|
|
|
|
guint32 value;
|
|
|
|
gboolean is_first;
|
|
|
|
|
|
|
|
value=0; out_len = 0; byte =0; is_first = TRUE;
|
|
|
|
for (i=0; i<oid_len; i++){
|
2006-07-05 21:30:25 +00:00
|
|
|
if (out_len >= buf_len)
|
2006-05-15 17:58:39 +00:00
|
|
|
break;
|
|
|
|
byte = oid[i];
|
|
|
|
value = (value << 7) | (byte & 0x7F);
|
|
|
|
if (byte & 0x80) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (is_first) {
|
|
|
|
if ( value<40 ){
|
|
|
|
buf[0] = 0;
|
|
|
|
buf[1] = value;
|
|
|
|
}else if ( value < 80 ){
|
|
|
|
buf[0] = 1;
|
|
|
|
buf[1] = value - 40;
|
|
|
|
}else {
|
|
|
|
buf[0] = 2;
|
|
|
|
buf[1] = value - 80;
|
|
|
|
}
|
|
|
|
out_len= out_len+2;
|
|
|
|
is_first = FALSE;
|
|
|
|
}else{
|
|
|
|
buf[out_len++] = value;
|
|
|
|
}
|
|
|
|
value = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return out_len;
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2005-07-25 23:33:44 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
gchar *
|
|
|
|
format_oid(subid_t *oid, guint oid_length)
|
2005-07-25 23:33:44 +00:00
|
|
|
{
|
2006-05-03 19:09:03 +00:00
|
|
|
char *result;
|
|
|
|
int result_len;
|
|
|
|
int len;
|
|
|
|
unsigned int i;
|
|
|
|
char *buf;
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2006-05-03 19:09:03 +00:00
|
|
|
guchar *oid_string;
|
|
|
|
size_t oid_string_len;
|
|
|
|
size_t oid_out_len;
|
|
|
|
#endif
|
2005-07-25 23:33:44 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
result_len = oid_length * 22;
|
2005-07-25 23:33:44 +00:00
|
|
|
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2006-05-03 19:09:03 +00:00
|
|
|
/*
|
|
|
|
* Get the decoded form of the OID, and add its length to the
|
|
|
|
* length of the result string.
|
|
|
|
*
|
|
|
|
* XXX - check for "sprint_realloc_objid()" failure.
|
|
|
|
*/
|
2006-07-04 02:15:55 +00:00
|
|
|
oid_string_len = 1024;
|
|
|
|
oid_string = ep_alloc(oid_string_len);
|
2006-05-03 19:09:03 +00:00
|
|
|
*oid_string = '\0';
|
|
|
|
oid_out_len = 0;
|
2006-07-04 02:15:55 +00:00
|
|
|
/* We pass an ep allocated block here, NOT a malloced block
|
2006-07-05 21:30:25 +00:00
|
|
|
* so we MUST NOT allow reallocation, hence the fourth
|
2006-07-04 02:15:55 +00:00
|
|
|
* parameter MUST be 0/FALSE
|
|
|
|
*/
|
|
|
|
sprint_realloc_objid(&oid_string, &oid_string_len, &oid_out_len, FALSE,
|
2006-05-03 19:09:03 +00:00
|
|
|
oid, oid_length);
|
|
|
|
result_len += strlen(oid_string) + 3;
|
|
|
|
#endif
|
2005-07-25 23:33:44 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
result = ep_alloc(result_len + 1);
|
|
|
|
buf = result;
|
|
|
|
len = g_snprintf(buf, result_len + 1 - (buf-result), "%lu", (unsigned long)oid[0]);
|
|
|
|
buf += len;
|
|
|
|
for (i = 1; i < oid_length;i++) {
|
|
|
|
len = g_snprintf(buf, result_len + 1 - (buf-result), ".%lu", (unsigned long)oid[i]);
|
|
|
|
buf += len;
|
|
|
|
}
|
2005-07-25 23:33:44 +00:00
|
|
|
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2006-05-03 19:09:03 +00:00
|
|
|
/*
|
|
|
|
* Append the decoded form of the OID.
|
|
|
|
*/
|
|
|
|
g_snprintf(buf, result_len + 1 -(buf-result), " (%s)", oid_string);
|
|
|
|
#endif
|
2005-07-25 23:33:44 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return result;
|
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2006-07-04 02:36:18 +00:00
|
|
|
/* returns the decoded (can be NULL) and non_decoded OID strings */
|
2006-01-18 20:02:19 +00:00
|
|
|
void
|
|
|
|
new_format_oid(subid_t *oid, guint oid_length,
|
2003-05-03 15:23:15 +00:00
|
|
|
gchar **non_decoded, gchar **decoded)
|
|
|
|
{
|
2005-08-25 03:28:31 +00:00
|
|
|
int non_decoded_len;
|
2003-05-03 15:23:15 +00:00
|
|
|
int len;
|
|
|
|
unsigned int i;
|
|
|
|
char *buf;
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2006-07-10 01:05:24 +00:00
|
|
|
guchar *oid_string;
|
|
|
|
size_t oid_string_len;
|
|
|
|
size_t oid_out_len;
|
|
|
|
#endif
|
2003-05-03 15:23:15 +00:00
|
|
|
|
2006-07-10 01:05:24 +00:00
|
|
|
if (oid == NULL || oid_length < 1) {
|
2006-07-09 22:12:02 +00:00
|
|
|
*decoded = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2003-05-03 15:23:15 +00:00
|
|
|
/*
|
|
|
|
* Get the decoded form of the OID, and add its length to the
|
|
|
|
* length of the result string.
|
|
|
|
*/
|
|
|
|
|
2006-01-18 20:02:19 +00:00
|
|
|
/*
|
|
|
|
* XXX - if we convert this to ep_alloc(), make sure the fourth
|
|
|
|
* argument to sprint_realloc_objid() is FALSE.
|
|
|
|
*/
|
|
|
|
|
2006-07-04 02:36:18 +00:00
|
|
|
oid_string_len = 1024;
|
|
|
|
oid_string = ep_alloc(oid_string_len);
|
2005-08-25 03:28:31 +00:00
|
|
|
if (oid_string != NULL) {
|
|
|
|
*oid_string = '\0';
|
|
|
|
oid_out_len = 0;
|
2006-07-04 02:36:18 +00:00
|
|
|
/* We pass an ep allocated block here, NOT a malloced block
|
2006-07-05 21:30:25 +00:00
|
|
|
* so we MUST NOT allow reallocation, hence the fourth
|
2006-07-04 02:36:18 +00:00
|
|
|
* parameter MUST be 0/FALSE
|
|
|
|
*/
|
|
|
|
sprint_realloc_objid(&oid_string, &oid_string_len, &oid_out_len, FALSE,
|
2005-08-25 03:28:31 +00:00
|
|
|
oid, oid_length);
|
|
|
|
}
|
2003-05-03 15:23:15 +00:00
|
|
|
*decoded = oid_string;
|
|
|
|
#else
|
|
|
|
*decoded = NULL;
|
|
|
|
#endif
|
|
|
|
|
2005-08-25 03:28:31 +00:00
|
|
|
non_decoded_len = oid_length * 22 + 1;
|
|
|
|
*non_decoded = ep_alloc(non_decoded_len);
|
2003-05-03 15:23:15 +00:00
|
|
|
buf = *non_decoded;
|
2005-08-25 03:28:31 +00:00
|
|
|
len = g_snprintf(buf, non_decoded_len-(buf-*non_decoded), "%lu", (unsigned long)oid[0]);
|
2003-05-03 15:23:15 +00:00
|
|
|
buf += len;
|
|
|
|
for (i = 1; i < oid_length; i++) {
|
2005-08-25 03:28:31 +00:00
|
|
|
len = g_snprintf(buf, non_decoded_len-(buf-*non_decoded), ".%lu", (unsigned long)oid[i]);
|
2003-05-03 15:23:15 +00:00
|
|
|
buf += len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2005-09-06 17:43:22 +00:00
|
|
|
static gboolean
|
|
|
|
check_var_length(guint vb_length, guint required_length, guchar **errmsg)
|
2002-03-06 03:52:13 +00:00
|
|
|
{
|
2004-01-23 00:40:00 +00:00
|
|
|
gchar *buf;
|
2002-03-06 03:52:13 +00:00
|
|
|
static const char badlen_fmt[] = "Length is %u, should be %u";
|
|
|
|
|
|
|
|
if (vb_length != required_length) {
|
|
|
|
/* Enough room for the largest "Length is XXX,
|
|
|
|
should be XXX" message - 10 digits for each
|
|
|
|
XXX. */
|
2006-07-04 03:15:58 +00:00
|
|
|
buf = ep_alloc(sizeof badlen_fmt + 10 + 10);
|
2005-09-06 17:43:22 +00:00
|
|
|
if (buf != NULL) {
|
|
|
|
g_snprintf(buf, sizeof badlen_fmt + 10 + 10,
|
|
|
|
badlen_fmt, vb_length, required_length);
|
|
|
|
}
|
|
|
|
*errmsg = buf;
|
|
|
|
return FALSE;
|
2002-03-06 03:52:13 +00:00
|
|
|
}
|
2005-09-06 17:43:22 +00:00
|
|
|
return TRUE; /* length is OK */
|
2002-03-06 03:52:13 +00:00
|
|
|
}
|
|
|
|
|
2004-01-23 00:40:00 +00:00
|
|
|
static gchar *
|
2000-06-26 00:13:21 +00:00
|
|
|
format_var(struct variable_list *variable, subid_t *variable_oid,
|
2002-03-11 01:40:28 +00:00
|
|
|
guint variable_oid_length, gushort vb_type, guint val_len)
|
1999-12-12 01:51:47 +00:00
|
|
|
{
|
2004-01-23 10:25:08 +00:00
|
|
|
guchar *buf;
|
2002-03-10 22:18:12 +00:00
|
|
|
size_t buf_len;
|
|
|
|
size_t out_len;
|
2000-06-26 00:13:21 +00:00
|
|
|
|
2006-07-05 21:30:25 +00:00
|
|
|
if (variable_oid == NULL || variable_oid_length == 0)
|
|
|
|
return NULL;
|
|
|
|
|
2000-06-26 00:13:21 +00:00
|
|
|
switch (vb_type) {
|
|
|
|
|
|
|
|
case SNMP_IPADDR:
|
2002-03-06 03:52:13 +00:00
|
|
|
/* Length has to be 4 bytes. */
|
2005-09-06 17:43:22 +00:00
|
|
|
if (!check_var_length(val_len, 4, &buf))
|
2002-03-06 03:52:13 +00:00
|
|
|
return buf; /* it's not 4 bytes */
|
|
|
|
break;
|
|
|
|
|
2004-05-29 01:00:59 +00:00
|
|
|
#ifdef REMOVED
|
|
|
|
/* not all counters are encoded as a full 64bit integer */
|
2002-03-06 03:52:13 +00:00
|
|
|
case SNMP_COUNTER64:
|
|
|
|
/* Length has to be 8 bytes. */
|
2005-09-06 17:43:22 +00:00
|
|
|
if (!check_var_length(val_len, 8, &buf))
|
2002-03-06 03:52:13 +00:00
|
|
|
return buf; /* it's not 8 bytes */
|
2000-06-26 00:13:21 +00:00
|
|
|
break;
|
2004-05-29 01:00:59 +00:00
|
|
|
#endif
|
2000-06-26 00:13:21 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-12-12 01:51:47 +00:00
|
|
|
variable->next_variable = NULL;
|
|
|
|
variable->name = variable_oid;
|
|
|
|
variable->name_length = variable_oid_length;
|
|
|
|
switch (vb_type) {
|
|
|
|
|
|
|
|
case SNMP_INTEGER:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_INTEGER;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_COUNTER:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_COUNTER;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_GAUGE:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_GAUGE;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_TIMETICKS:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_TIMETICKS;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_OCTETSTR:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_STRING;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_IPADDR:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_IPADDR;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_OPAQUE:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_OPAQUE;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_NSAP:
|
1999-12-14 10:16:11 +00:00
|
|
|
variable->type = VALTYPE_NSAP;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_OBJECTID:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_OBJECTID;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_BITSTR:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_BITSTR;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_COUNTER64:
|
1999-12-14 05:59:16 +00:00
|
|
|
variable->type = VALTYPE_COUNTER64;
|
1999-12-12 01:51:47 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-03-11 01:40:28 +00:00
|
|
|
variable->val_len = val_len;
|
2000-06-26 00:13:21 +00:00
|
|
|
|
2002-03-10 22:18:12 +00:00
|
|
|
/*
|
2003-04-27 20:57:58 +00:00
|
|
|
* XXX - check for "sprint_realloc_objid()" failure.
|
2002-03-10 22:18:12 +00:00
|
|
|
*/
|
2006-01-18 20:02:19 +00:00
|
|
|
|
2006-07-04 01:56:52 +00:00
|
|
|
buf_len = 1024;
|
|
|
|
buf = ep_alloc(buf_len);
|
2005-08-25 03:28:31 +00:00
|
|
|
if (buf != NULL) {
|
|
|
|
*buf = '\0';
|
|
|
|
out_len = 0;
|
2006-07-04 01:56:52 +00:00
|
|
|
/* We pass an ep allocated block here, NOT a malloced block
|
2006-07-05 21:30:25 +00:00
|
|
|
* so we MUST NOT allow reallocation, hence the fourth
|
2006-07-04 01:56:52 +00:00
|
|
|
* parameter MUST be 0/FALSE
|
|
|
|
*/
|
|
|
|
sprint_realloc_value(&buf, &buf_len, &out_len, FALSE,
|
2005-08-25 03:28:31 +00:00
|
|
|
variable_oid, variable_oid_length, variable);
|
|
|
|
}
|
2000-06-26 00:13:21 +00:00
|
|
|
return buf;
|
1999-12-12 01:51:47 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-14 17:08:41 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
#define F_SNMP_ENGINEID_CONFORM 0x80
|
|
|
|
#define SNMP_ENGINEID_RFC1910 0x00
|
|
|
|
#define SNMP_ENGINEID_RFC3411 0x01
|
1999-12-12 01:51:47 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const true_false_string tfs_snmp_engineid_conform = {
|
|
|
|
"RFC3411 (SNMPv3)",
|
|
|
|
"RFC1910 (Non-SNMPv3)"
|
|
|
|
};
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
#define SNMP_ENGINEID_FORMAT_IPV4 0x01
|
|
|
|
#define SNMP_ENGINEID_FORMAT_IPV6 0x02
|
|
|
|
#define SNMP_ENGINEID_FORMAT_MACADDRESS 0x03
|
|
|
|
#define SNMP_ENGINEID_FORMAT_TEXT 0x04
|
|
|
|
#define SNMP_ENGINEID_FORMAT_OCTETS 0x05
|
2005-09-14 17:08:41 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const value_string snmp_engineid_format_vals[] = {
|
|
|
|
{ SNMP_ENGINEID_FORMAT_IPV4, "IPv4 address" },
|
|
|
|
{ SNMP_ENGINEID_FORMAT_IPV6, "IPv6 address" },
|
|
|
|
{ SNMP_ENGINEID_FORMAT_MACADDRESS, "MAC address" },
|
|
|
|
{ SNMP_ENGINEID_FORMAT_TEXT, "Text, administratively assigned" },
|
|
|
|
{ SNMP_ENGINEID_FORMAT_OCTETS, "Octets, administratively assigned" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/*
|
|
|
|
* SNMP Engine ID dissection according to RFC 3411 (SnmpEngineID TC)
|
|
|
|
* or historic RFC 1910 (AgentID)
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
|
|
|
|
{
|
|
|
|
proto_item *item = NULL;
|
|
|
|
guint8 conformance, format;
|
|
|
|
guint32 enterpriseid, seconds;
|
|
|
|
nstime_t ts;
|
|
|
|
int len_remain = len;
|
2005-09-14 17:08:41 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/* first bit: engine id conformance */
|
|
|
|
if (len_remain<4) return offset;
|
|
|
|
conformance = ((tvb_get_guint8(tvb, offset)>>7) && 0x01);
|
|
|
|
proto_tree_add_item(tree, hf_snmp_engineid_conform, tvb, offset, 1, FALSE);
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/* 4-byte enterprise number/name */
|
|
|
|
if (len_remain<4) return offset;
|
|
|
|
enterpriseid = tvb_get_ntohl(tvb, offset);
|
|
|
|
if (conformance)
|
|
|
|
enterpriseid -= 0x80000000; /* ignore first bit */
|
|
|
|
proto_tree_add_uint(tree, hf_snmp_engineid_enterprise, tvb, offset, 4, enterpriseid);
|
|
|
|
offset+=4;
|
|
|
|
len_remain-=4;
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
switch(conformance) {
|
|
|
|
|
|
|
|
case SNMP_ENGINEID_RFC1910:
|
|
|
|
/* 12-byte AgentID w/ 8-byte trailer */
|
|
|
|
if (len_remain==8) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 8, "AgentID Trailer: 0x%s",
|
|
|
|
tvb_bytes_to_str(tvb, offset, 8));
|
|
|
|
offset+=8;
|
|
|
|
len_remain-=8;
|
|
|
|
} else {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, len_remain, "<Data not conforming to RFC1910>");
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_ENGINEID_RFC3411: /* variable length: 5..32 */
|
|
|
|
|
|
|
|
/* 1-byte format specifier */
|
|
|
|
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);
|
|
|
|
offset+=1;
|
|
|
|
len_remain-=1;
|
|
|
|
|
|
|
|
switch(format) {
|
|
|
|
case SNMP_ENGINEID_FORMAT_IPV4:
|
|
|
|
/* 4-byte IPv4 address */
|
|
|
|
if (len_remain==4) {
|
|
|
|
proto_tree_add_item(tree, hf_snmp_engineid_ipv4, tvb, offset, 4, FALSE);
|
|
|
|
offset+=4;
|
|
|
|
len_remain=0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SNMP_ENGINEID_FORMAT_IPV6:
|
|
|
|
/* 16-byte IPv6 address */
|
|
|
|
if (len_remain==16) {
|
|
|
|
proto_tree_add_item(tree, hf_snmp_engineid_ipv6, tvb, offset, 16, FALSE);
|
|
|
|
offset+=16;
|
|
|
|
len_remain=0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SNMP_ENGINEID_FORMAT_MACADDRESS:
|
|
|
|
/* 6-byte MAC address */
|
|
|
|
if (len_remain==6) {
|
|
|
|
proto_tree_add_item(tree, hf_snmp_engineid_mac, tvb, offset, 6, FALSE);
|
|
|
|
offset+=6;
|
|
|
|
len_remain=0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
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, FALSE);
|
|
|
|
offset+=len_remain;
|
|
|
|
len_remain=0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 128:
|
|
|
|
/* most common enterprise-specific format: (ucd|net)-snmp random */
|
|
|
|
if ((enterpriseid==2021)||(enterpriseid==8072)) {
|
|
|
|
proto_item_append_text(item, (enterpriseid==2021) ? ": UCD-SNMP Random" : ": Net-SNMP Random");
|
|
|
|
/* demystify: 4B random, 4B epoch seconds */
|
|
|
|
if (len_remain==8) {
|
|
|
|
proto_tree_add_item(tree, hf_snmp_engineid_data, tvb, offset, 4, FALSE);
|
|
|
|
seconds = tvb_get_letohl(tvb, offset+4);
|
|
|
|
ts.secs = seconds;
|
|
|
|
proto_tree_add_time_format(tree, hf_snmp_engineid_time, tvb, offset+4, 4,
|
|
|
|
&ts, "Engine ID Data: Creation Time: %s",
|
|
|
|
abs_time_secs_to_str(seconds));
|
|
|
|
offset+=8;
|
|
|
|
len_remain=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SNMP_ENGINEID_FORMAT_OCTETS:
|
|
|
|
default:
|
|
|
|
/* max. 27 bytes, administratively assigned or unknown format */
|
|
|
|
if (len_remain<=27) {
|
|
|
|
proto_tree_add_item(tree, hf_snmp_engineid_data, tvb, offset, len_remain, FALSE);
|
|
|
|
offset+=len_remain;
|
|
|
|
len_remain=0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len_remain>0) {
|
|
|
|
proto_tree_add_text(tree, tvb, offset, len_remain, "<Data not conforming to RFC3411>");
|
|
|
|
offset+=len_remain;
|
|
|
|
}
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This code is copied from the original SNMP dissector with minor changes to adapt it to use packet-ber.c routines
|
2006-07-05 21:30:25 +00:00
|
|
|
* TODO:
|
2006-05-03 19:09:03 +00:00
|
|
|
* - Rewrite it completly as OID as subid_t could be returned from dissect_ber_objectidentifier
|
|
|
|
* - vb_type_name is known when calling this routine(?)
|
|
|
|
* - All branches not needed(?)
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
2007-05-15 05:49:43 +00:00
|
|
|
snmp_variable_decode(tvbuff_t *tvb, proto_tree *snmp_tree, asn1_ctx_t *actx,tvbuff_t *oid_tvb,
|
2006-05-03 19:09:03 +00:00
|
|
|
int offset, guint *lengthp, tvbuff_t **out_tvb)
|
|
|
|
{
|
|
|
|
int start, vb_value_start;
|
|
|
|
guint length;
|
|
|
|
guint vb_length;
|
|
|
|
gushort vb_type;
|
|
|
|
const gchar *vb_type_name;
|
|
|
|
gint32 vb_integer_value;
|
|
|
|
guint32 vb_uinteger_value;
|
|
|
|
guint8 *vb_octet_string;
|
|
|
|
const guint8 *oid_buf;
|
|
|
|
subid_t *vb_oid;
|
|
|
|
guint vb_oid_length;
|
2006-05-13 22:18:08 +00:00
|
|
|
gchar *vb_display_string = NULL;
|
2006-05-03 19:09:03 +00:00
|
|
|
subid_t *variable_oid = NULL;
|
|
|
|
gint oid_len;
|
|
|
|
guint variable_oid_length = 0;
|
|
|
|
const guint8 *var_oid_buf;
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2006-05-03 19:09:03 +00:00
|
|
|
struct variable_list variable;
|
|
|
|
long value;
|
|
|
|
#endif
|
|
|
|
unsigned int i;
|
|
|
|
gchar *buf;
|
|
|
|
int len;
|
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind = 0;
|
|
|
|
gint32 ber_tag;
|
|
|
|
|
|
|
|
start = offset;
|
|
|
|
/* parse the type of the object */
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_identifier(actx->pinfo, snmp_tree, tvb, start, &class, &pc, &ber_tag);
|
|
|
|
offset = dissect_ber_length(actx->pinfo, snmp_tree, tvb, offset, &vb_length, &ind);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2006-05-23 20:36:49 +00:00
|
|
|
if(vb_length == 0){
|
|
|
|
length = offset - start;
|
|
|
|
*lengthp = length;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
vb_value_start = offset;
|
|
|
|
|
|
|
|
/* Convert the class, constructed flag, and tag to a type. */
|
|
|
|
vb_type_name = snmp_tag_cls2syntax(ber_tag, class, &vb_type);
|
|
|
|
|
|
|
|
if (vb_type_name == NULL) {
|
|
|
|
/*
|
|
|
|
* Unsupported type.
|
|
|
|
* Dissect the value as an opaque string of octets.
|
|
|
|
*/
|
|
|
|
vb_type_name = "unsupported type";
|
|
|
|
vb_type = SNMP_OPAQUE;
|
|
|
|
}
|
|
|
|
/* construct subid_t variable_oid from oid_tvb */
|
|
|
|
if (oid_tvb){
|
|
|
|
oid_len = tvb_length_remaining(oid_tvb,0);
|
|
|
|
var_oid_buf = tvb_get_ptr(oid_tvb, 0, oid_len);
|
2006-07-04 03:27:14 +00:00
|
|
|
variable_oid = ep_alloc((oid_len+1) * sizeof(gulong));
|
2006-05-03 19:09:03 +00:00
|
|
|
variable_oid_length = oid_to_subid_buf(var_oid_buf, oid_len, variable_oid, ((oid_len+1) * sizeof(gulong)));
|
|
|
|
}
|
|
|
|
/* parse the value */
|
|
|
|
switch (vb_type) {
|
|
|
|
|
|
|
|
case SNMP_INTEGER:
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(FALSE, actx, NULL, tvb, start, -1, (void*)&(vb_integer_value));
|
2006-05-03 19:09:03 +00:00
|
|
|
length = offset - vb_value_start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2002-03-10 22:18:12 +00:00
|
|
|
value = vb_integer_value;
|
|
|
|
variable.val.integer = &value;
|
|
|
|
vb_display_string = format_var(&variable,
|
|
|
|
variable_oid, variable_oid_length, vb_type,
|
|
|
|
vb_length);
|
2005-08-25 03:28:31 +00:00
|
|
|
#else
|
|
|
|
vb_display_string = NULL;
|
|
|
|
#endif
|
|
|
|
if (vb_display_string != NULL) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-14 17:08:41 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s", vb_display_string);
|
|
|
|
} else {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree,tvb,
|
2005-09-14 17:08:41 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s: %d (%#x)", vb_type_name,
|
|
|
|
vb_integer_value, vb_integer_value);
|
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_COUNTER:
|
|
|
|
case SNMP_GAUGE:
|
|
|
|
case SNMP_TIMETICKS:
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(FALSE, actx, NULL, tvb, start, -1, &vb_uinteger_value);
|
2005-09-14 17:08:41 +00:00
|
|
|
length = offset - vb_value_start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2002-03-10 22:18:12 +00:00
|
|
|
value = vb_uinteger_value;
|
|
|
|
variable.val.integer = &value;
|
|
|
|
vb_display_string = format_var(&variable,
|
|
|
|
variable_oid, variable_oid_length, vb_type,
|
|
|
|
vb_length);
|
2005-08-25 03:28:31 +00:00
|
|
|
#else
|
|
|
|
vb_display_string = NULL;
|
|
|
|
#endif
|
|
|
|
if (vb_display_string != NULL) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-16 09:47:18 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s", vb_display_string);
|
|
|
|
} else {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-16 09:47:18 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s: %u (%#x)", vb_type_name,
|
|
|
|
vb_uinteger_value, vb_uinteger_value);
|
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-02-22 10:45:23 +00:00
|
|
|
case SNMP_COUNTER64:
|
2007-05-15 05:49:43 +00:00
|
|
|
offset=dissect_ber_integer64(TRUE, actx, snmp_tree, tvb, offset, hf_snmp_counter64, NULL);
|
2006-02-22 10:45:23 +00:00
|
|
|
break;
|
1999-12-10 09:49:29 +00:00
|
|
|
case SNMP_OCTETSTR:
|
|
|
|
case SNMP_IPADDR:
|
|
|
|
case SNMP_OPAQUE:
|
|
|
|
case SNMP_NSAP:
|
1999-12-12 01:51:47 +00:00
|
|
|
case SNMP_BITSTR:
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(FALSE, actx, NULL, tvb, start, -1, out_tvb);
|
2006-05-03 19:09:03 +00:00
|
|
|
vb_octet_string = ep_tvb_memdup(tvb, vb_value_start, vb_length);
|
2005-09-14 17:08:41 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
length = offset - vb_value_start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2002-03-10 22:18:12 +00:00
|
|
|
variable.val.string = vb_octet_string;
|
|
|
|
vb_display_string = format_var(&variable,
|
|
|
|
variable_oid, variable_oid_length, vb_type,
|
|
|
|
vb_length);
|
2005-08-25 03:28:31 +00:00
|
|
|
#else
|
|
|
|
vb_display_string = NULL;
|
|
|
|
#endif
|
|
|
|
if (vb_display_string != NULL) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-14 17:08:41 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s", vb_display_string);
|
|
|
|
} else {
|
1999-12-10 09:49:29 +00:00
|
|
|
/*
|
2005-08-25 03:28:31 +00:00
|
|
|
* If some characters are not printable,
|
|
|
|
* display the string as bytes.
|
1999-12-10 09:49:29 +00:00
|
|
|
*/
|
2005-08-25 03:28:31 +00:00
|
|
|
for (i = 0; i < vb_length; i++) {
|
|
|
|
if (!(isprint(vb_octet_string[i])
|
|
|
|
|| isspace(vb_octet_string[i])))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i < vb_length) {
|
|
|
|
/*
|
|
|
|
* We stopped, due to a non-printable
|
|
|
|
* character, before we got to the end
|
|
|
|
* of the string.
|
|
|
|
*/
|
|
|
|
vb_display_string = ep_alloc(4*vb_length);
|
|
|
|
buf = vb_display_string;
|
|
|
|
len = g_snprintf(buf, 4*vb_length, "%03u", vb_octet_string[0]);
|
1999-12-10 09:49:29 +00:00
|
|
|
buf += len;
|
2005-08-25 03:28:31 +00:00
|
|
|
for (i = 1; i < vb_length; i++) {
|
|
|
|
len = g_snprintf(buf, 4*vb_length-(buf-vb_display_string), ".%03u",
|
|
|
|
vb_octet_string[i]);
|
|
|
|
buf += len;
|
|
|
|
}
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb, vb_value_start,
|
2005-08-25 03:28:31 +00:00
|
|
|
length,
|
|
|
|
"Value: %s: %s", vb_type_name,
|
|
|
|
vb_display_string);
|
|
|
|
} else {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb, vb_value_start,
|
2005-08-25 03:28:31 +00:00
|
|
|
length,
|
|
|
|
"Value: %s: %s", vb_type_name,
|
|
|
|
SAFE_STRING(vb_octet_string, vb_length));
|
1999-12-10 09:49:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_NULL:
|
2007-05-15 05:49:43 +00:00
|
|
|
dissect_ber_null(FALSE, actx, NULL, tvb, start, -1);
|
2006-05-03 19:09:03 +00:00
|
|
|
length = offset - vb_value_start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb, vb_value_start, length,
|
1999-12-12 01:51:47 +00:00
|
|
|
"Value: %s", vb_type_name);
|
1999-12-10 09:49:29 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_OBJECTID:
|
2005-09-28 08:01:54 +00:00
|
|
|
/* XXX Redo this using dissect_ber_object_identifier when
|
2006-01-18 20:02:19 +00:00
|
|
|
it returns tvb or some other binary form of an OID */
|
2006-05-03 19:09:03 +00:00
|
|
|
oid_buf = tvb_get_ptr(tvb, vb_value_start, vb_length);
|
2006-07-04 03:27:14 +00:00
|
|
|
vb_oid = ep_alloc((vb_length+1) * sizeof(gulong));
|
2005-09-14 17:08:41 +00:00
|
|
|
vb_oid_length = oid_to_subid_buf(oid_buf, vb_length, vb_oid, ((vb_length+1) * sizeof(gulong)));
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
offset = offset + vb_length;
|
|
|
|
length = offset - vb_value_start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2002-03-10 22:18:12 +00:00
|
|
|
variable.val.objid = vb_oid;
|
|
|
|
vb_display_string = format_var(&variable,
|
|
|
|
variable_oid, variable_oid_length, vb_type,
|
2002-03-11 01:40:28 +00:00
|
|
|
vb_oid_length * sizeof (subid_t));
|
2005-08-25 03:28:31 +00:00
|
|
|
if (vb_display_string != NULL) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-16 09:47:18 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s", vb_display_string);
|
|
|
|
} else {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-16 09:47:18 +00:00
|
|
|
vb_value_start, length,
|
|
|
|
"Value: %s: [Out of memory]", vb_type_name);
|
2005-08-25 03:28:31 +00:00
|
|
|
}
|
2006-12-08 15:05:41 +00:00
|
|
|
#else /* HAVE_NET_SNMP */
|
2000-06-28 05:15:13 +00:00
|
|
|
vb_display_string = format_oid(vb_oid, vb_oid_length);
|
2005-08-25 03:28:31 +00:00
|
|
|
if (vb_display_string != NULL) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-16 09:47:18 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s: %s", vb_type_name,
|
|
|
|
vb_display_string);
|
|
|
|
} else {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb,
|
2005-09-16 09:47:18 +00:00
|
|
|
vb_value_start, length,
|
2005-08-25 03:28:31 +00:00
|
|
|
"Value: %s: [Out of memory]", vb_type_name);
|
|
|
|
}
|
2006-12-08 15:05:41 +00:00
|
|
|
#endif /* HAVE_NET_SNMP */
|
1999-12-10 09:49:29 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_NOSUCHOBJECT:
|
2006-05-03 19:09:03 +00:00
|
|
|
length = offset - start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb, offset, length,
|
1999-12-12 01:51:47 +00:00
|
|
|
"Value: %s: no such object", vb_type_name);
|
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_NOSUCHINSTANCE:
|
2006-05-03 19:09:03 +00:00
|
|
|
length = offset - start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb, offset, length,
|
1999-12-12 01:51:47 +00:00
|
|
|
"Value: %s: no such instance", vb_type_name);
|
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SNMP_ENDOFMIBVIEW:
|
2006-05-03 19:09:03 +00:00
|
|
|
length = offset - start;
|
1999-12-10 09:49:29 +00:00
|
|
|
if (snmp_tree) {
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree_add_text(snmp_tree, tvb, offset, length,
|
1999-12-12 01:51:47 +00:00
|
|
|
"Value: %s: end of mib view", vb_type_name);
|
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-06-10 18:28:22 +00:00
|
|
|
DISSECTOR_ASSERT_NOT_REACHED();
|
2006-05-03 19:09:03 +00:00
|
|
|
return;
|
1999-12-10 09:49:29 +00:00
|
|
|
}
|
2006-05-03 19:09:03 +00:00
|
|
|
length = offset - start;
|
1999-12-10 09:49:29 +00:00
|
|
|
*lengthp = length;
|
2006-05-03 19:09:03 +00:00
|
|
|
return;
|
1999-12-10 09:49:29 +00:00
|
|
|
}
|
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
|
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
static void set_ue_keys(snmp_ue_assoc_t* n ) {
|
|
|
|
guint key_size = n->user.authModel->key_size;
|
|
|
|
|
|
|
|
n->user.authKey.data = se_alloc(key_size);
|
|
|
|
n->user.authKey.len = key_size;
|
|
|
|
n->user.authModel->pass2key(n->user.authPassword.data,
|
|
|
|
n->user.authPassword.len,
|
|
|
|
n->engine.data,
|
|
|
|
n->engine.len,
|
|
|
|
n->user.authKey.data);
|
|
|
|
|
|
|
|
n->user.privKey.data = se_alloc(key_size);
|
|
|
|
n->user.privKey.len = key_size;
|
|
|
|
n->user.authModel->pass2key(n->user.privPassword.data,
|
|
|
|
n->user.privPassword.len,
|
|
|
|
n->engine.data,
|
|
|
|
n->engine.len,
|
|
|
|
n->user.privKey.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static snmp_ue_assoc_t* ue_se_dup(snmp_ue_assoc_t* o) {
|
|
|
|
snmp_ue_assoc_t* d = se_memdup(o,sizeof(snmp_ue_assoc_t));
|
|
|
|
|
|
|
|
d->user.authModel = o->user.authModel;
|
|
|
|
|
|
|
|
d->user.privProtocol = o->user.privProtocol;
|
|
|
|
|
|
|
|
d->user.userName.data = se_memdup(o->user.userName.data,o->user.userName.len);
|
|
|
|
d->user.userName.len = o->user.userName.len;
|
|
|
|
|
|
|
|
d->user.authPassword.data = o->user.authPassword.data ? se_memdup(o->user.authPassword.data,o->user.authPassword.len) : NULL;
|
|
|
|
d->user.authPassword.len = o->user.authPassword.len;
|
|
|
|
|
|
|
|
d->user.privPassword.data = o->user.privPassword.data ? se_memdup(o->user.privPassword.data,o->user.privPassword.len) : NULL;
|
|
|
|
d->user.privPassword.len = o->user.privPassword.len;
|
|
|
|
|
|
|
|
d->engine.len = o->engine.len;
|
|
|
|
|
|
|
|
if (d->engine.len) {
|
|
|
|
d->engine.data = se_memdup(o->engine.data,o->engine.len);
|
|
|
|
set_ue_keys(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
return d;
|
|
|
|
|
|
|
|
}
|
2007-01-10 01:16:22 +00:00
|
|
|
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
#define CACHE_INSERT(c,a) if (c) { snmp_ue_assoc_t* t = c; c = a; c->next = t; } else { c = a; a->next = NULL; }
|
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
static void renew_ue_cache(void) {
|
2007-02-07 14:54:35 +00:00
|
|
|
if (num_ueas) {
|
|
|
|
guint i;
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
localized_ues = NULL;
|
|
|
|
unlocalized_ues = NULL;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
for(i = 0; i < num_ueas; i++) {
|
|
|
|
snmp_ue_assoc_t* a = ue_se_dup(&(ueas[i]));
|
|
|
|
|
|
|
|
if (a->engine.len) {
|
2007-01-11 00:29:50 +00:00
|
|
|
CACHE_INSERT(localized_ues,a);
|
2007-02-07 14:54:35 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
} else {
|
|
|
|
CACHE_INSERT(unlocalized_ues,a);
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
}
|
2007-02-07 14:54:35 +00:00
|
|
|
} else {
|
|
|
|
localized_ues = NULL;
|
|
|
|
unlocalized_ues = NULL;
|
2007-01-11 00:29:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static snmp_ue_assoc_t* localize_ue( snmp_ue_assoc_t* o, const guint8* engine, guint engine_len ) {
|
|
|
|
snmp_ue_assoc_t* n = se_memdup(o,sizeof(snmp_ue_assoc_t));
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
n->engine.data = se_memdup(engine,engine_len);
|
|
|
|
n->engine.len = engine_len;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
set_ue_keys(n);
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define localized_match(a,u,ul,e,el) \
|
|
|
|
( a->user.userName.len == ul \
|
|
|
|
&& a->engine.len == el \
|
|
|
|
&& memcmp( a->user.userName.data, u, (a->user.userName.len < ul) ? a->user.userName.len : ul ) == 0 \
|
|
|
|
&& memcmp( a->engine.data, e, (a->engine.len < el) ? a->engine.len : el ) == 0 )
|
|
|
|
|
|
|
|
#define unlocalized_match(a,u,l) \
|
|
|
|
( a->user.userName.len == l && memcmp( a->user.userName.data, u, a->user.userName.len < l ? a->user.userName.len : l) == 0 )
|
2007-01-10 01:16:22 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
static snmp_ue_assoc_t* get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb) {
|
|
|
|
static snmp_ue_assoc_t* a;
|
|
|
|
guint given_username_len;
|
|
|
|
guint8* given_username;
|
|
|
|
guint given_engine_len;
|
|
|
|
guint8* given_engine;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
if ( ! (localized_ues || unlocalized_ues ) ) return NULL;
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
if (! ( user_tvb && engine_tvb ) ) return NULL;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
given_username_len = tvb_length_remaining(user_tvb,0);
|
|
|
|
given_username = ep_tvb_memdup(user_tvb,0,-1);
|
|
|
|
given_engine_len = tvb_length_remaining(engine_tvb,0);
|
|
|
|
given_engine = ep_tvb_memdup(engine_tvb,0,-1);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
for (a = localized_ues; a; a = a->next) {
|
|
|
|
if ( localized_match(a, given_username, given_username_len, given_engine, given_engine_len) ) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
for (a = unlocalized_ues; a; a = a->next) {
|
|
|
|
if ( unlocalized_match(a, given_username, given_username_len) ) {
|
|
|
|
snmp_ue_assoc_t* n = localize_ue( a, given_engine, given_engine_len );
|
|
|
|
CACHE_INSERT(localized_ues,n);
|
|
|
|
return n;
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
static gboolean snmp_usm_auth_md5(snmp_usm_params_t* p, guint8** calc_auth_p, guint* calc_auth_len_p, gchar const** error) {
|
2007-01-09 18:38:55 +00:00
|
|
|
guint msg_len;
|
|
|
|
guint8* msg;
|
|
|
|
guint auth_len;
|
|
|
|
guint8* auth;
|
|
|
|
guint8* key;
|
|
|
|
guint key_len;
|
|
|
|
guint8 calc_auth[16];
|
|
|
|
guint start;
|
|
|
|
guint end;
|
|
|
|
guint i;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
if (!p->auth_tvb) {
|
|
|
|
*error = "No Authenticator";
|
2007-01-12 00:33:32 +00:00
|
|
|
return FALSE;
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
key = p->user_assoc->user.authKey.data;
|
|
|
|
key_len = p->user_assoc->user.authKey.len;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
if (! key ) {
|
|
|
|
*error = "User has no authKey";
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
auth_len = tvb_length_remaining(p->auth_tvb,0);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
if (auth_len != 12) {
|
|
|
|
*error = "Authenticator length wrong";
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
msg_len = tvb_length_remaining(p->msg_tvb,0);
|
|
|
|
msg = ep_tvb_memdup(p->msg_tvb,0,msg_len);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
auth = ep_tvb_memdup(p->auth_tvb,0,auth_len);
|
|
|
|
|
|
|
|
start = p->auth_offset - p->start_offset;
|
|
|
|
end = start + auth_len;
|
|
|
|
|
|
|
|
/* fill the authenticator with zeros */
|
|
|
|
for ( i = start ; i < end ; i++ ) {
|
|
|
|
msg[i] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
md5_hmac(msg, msg_len, key, key_len, calc_auth);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
if (calc_auth_p) *calc_auth_p = calc_auth;
|
|
|
|
if (calc_auth_len_p) *calc_auth_len_p = 12;
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
return ( memcmp(auth,calc_auth,12) != 0 ) ? FALSE : TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
static gboolean snmp_usm_auth_sha1(snmp_usm_params_t* p _U_, guint8** calc_auth_p, guint* calc_auth_len_p, gchar const** error _U_) {
|
2007-01-10 01:16:22 +00:00
|
|
|
guint msg_len;
|
|
|
|
guint8* msg;
|
|
|
|
guint auth_len;
|
|
|
|
guint8* auth;
|
|
|
|
guint8* key;
|
|
|
|
guint key_len;
|
|
|
|
guint8 calc_auth[20];
|
|
|
|
guint start;
|
|
|
|
guint end;
|
|
|
|
guint i;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
if (!p->auth_tvb) {
|
|
|
|
*error = "No Authenticator";
|
2007-01-12 00:33:32 +00:00
|
|
|
return FALSE;
|
2007-01-10 01:16:22 +00:00
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
key = p->user_assoc->user.authKey.data;
|
|
|
|
key_len = p->user_assoc->user.authKey.len;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
if (! key ) {
|
|
|
|
*error = "User has no authKey";
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
auth_len = tvb_length_remaining(p->auth_tvb,0);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
if (auth_len != 12) {
|
|
|
|
*error = "Authenticator length wrong";
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
msg_len = tvb_length_remaining(p->msg_tvb,0);
|
|
|
|
msg = ep_tvb_memdup(p->msg_tvb,0,msg_len);
|
|
|
|
|
|
|
|
auth = ep_tvb_memdup(p->auth_tvb,0,auth_len);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
start = p->auth_offset - p->start_offset;
|
|
|
|
end = start + auth_len;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
/* fill the authenticator with zeros */
|
|
|
|
for ( i = start ; i < end ; i++ ) {
|
|
|
|
msg[i] = '\0';
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
sha1_hmac(key, key_len, msg, msg_len, calc_auth);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
if (calc_auth_p) *calc_auth_p = calc_auth;
|
|
|
|
if (calc_auth_len_p) *calc_auth_len_p = 12;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
return ( memcmp(auth,calc_auth,12) != 0 ) ? FALSE : TRUE;
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#ifdef HAVE_LIBGCRYPT
|
|
|
|
gcry_error_t err;
|
|
|
|
gcry_cipher_hd_t hd = NULL;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
guint8* cleartext;
|
|
|
|
guint8* des_key = p->user_assoc->user.privKey.data; /* first 8 bytes */
|
|
|
|
guint8* pre_iv = &(p->user_assoc->user.privKey.data[8]); /* last 8 bytes */
|
|
|
|
guint8* salt;
|
|
|
|
gint salt_len;
|
|
|
|
gint cryptgrm_len;
|
|
|
|
guint8* cryptgrm;
|
|
|
|
tvbuff_t* clear_tvb;
|
2007-01-10 01:16:22 +00:00
|
|
|
guint8 iv[8];
|
2007-01-09 18:38:55 +00:00
|
|
|
guint i;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
salt_len = tvb_length_remaining(p->priv_tvb,0);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
if (salt_len != 8) {
|
2007-01-11 00:29:50 +00:00
|
|
|
*error = "decryptionError: msgPrivacyParameters lenght != 8";
|
2007-01-09 18:38:55 +00:00
|
|
|
return NULL;
|
2007-01-12 00:33:32 +00:00
|
|
|
}
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
salt = ep_tvb_memdup(p->priv_tvb,0,salt_len);
|
|
|
|
|
|
|
|
/*
|
|
|
|
The resulting "salt" is XOR-ed with the pre-IV to obtain the IV.
|
|
|
|
*/
|
|
|
|
for (i=0; i<8; i++) {
|
|
|
|
iv[i] = pre_iv[i] ^ salt[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
cryptgrm_len = tvb_length_remaining(encryptedData,0);
|
|
|
|
|
|
|
|
if (cryptgrm_len % 8) {
|
2007-01-11 00:29:50 +00:00
|
|
|
*error = "decryptionError: the length of the encrypted data is not a mutiple of 8 octets";
|
2007-01-09 18:38:55 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
cryptgrm = ep_tvb_memdup(encryptedData,0,-1);
|
|
|
|
|
|
|
|
cleartext = ep_alloc(cryptgrm_len);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
err = gcry_cipher_open(&hd, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CBC, 0);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
err = gcry_cipher_setiv(hd, iv, 8);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
err = gcry_cipher_setkey(hd,des_key,8);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
err = gcry_cipher_decrypt(hd, cleartext, cryptgrm_len, cryptgrm, cryptgrm_len);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
gcry_cipher_close(hd);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
clear_tvb = tvb_new_real_data(cleartext, cryptgrm_len, cryptgrm_len);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
return clear_tvb;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
on_gcry_error:
|
|
|
|
*error = (void*)gpg_strerror(err);
|
|
|
|
if (hd) gcry_cipher_close(hd);
|
|
|
|
return NULL;
|
|
|
|
#else
|
|
|
|
*error = "libgcrypt not present, cannot decrypt";
|
|
|
|
return NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#ifdef HAVE_LIBGCRYPT
|
2007-01-11 00:29:50 +00:00
|
|
|
gcry_error_t err;
|
|
|
|
gcry_cipher_hd_t hd = NULL;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
guint8* cleartext;
|
|
|
|
guint8* aes_key = p->user_assoc->user.privKey.data; /* first 16 bytes */
|
2007-01-11 17:39:16 +00:00
|
|
|
guint8 iv[16];
|
|
|
|
gint priv_len;
|
2007-01-11 00:29:50 +00:00
|
|
|
gint cryptgrm_len;
|
|
|
|
guint8* cryptgrm;
|
|
|
|
tvbuff_t* clear_tvb;
|
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
priv_len = tvb_length_remaining(p->priv_tvb,0);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
if (priv_len != 8) {
|
2007-01-11 00:29:50 +00:00
|
|
|
*error = "decryptionError: msgPrivacyParameters lenght != 8";
|
|
|
|
return NULL;
|
2007-01-12 00:33:32 +00:00
|
|
|
}
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
iv[0] = (p->boots & 0xff000000) >> 24;
|
|
|
|
iv[1] = (p->boots & 0x00ff0000) >> 16;
|
|
|
|
iv[2] = (p->boots & 0x0000ff00) >> 8;
|
|
|
|
iv[3] = (p->boots & 0x000000ff);
|
|
|
|
iv[4] = (p->time & 0xff000000) >> 24;
|
|
|
|
iv[5] = (p->time & 0x00ff0000) >> 16;
|
|
|
|
iv[6] = (p->time & 0x0000ff00) >> 8;
|
|
|
|
iv[7] = (p->time & 0x000000ff);
|
|
|
|
tvb_memcpy(p->priv_tvb,&(iv[8]),0,8);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
cryptgrm_len = tvb_length_remaining(encryptedData,0);
|
|
|
|
cryptgrm = ep_tvb_memdup(encryptedData,0,-1);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
cleartext = ep_alloc(cryptgrm_len);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
err = gcry_cipher_open(&hd, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CFB, 0);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
err = gcry_cipher_setiv(hd, iv, 16);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
err = gcry_cipher_setkey(hd,aes_key,16);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
err = gcry_cipher_decrypt(hd, cleartext, cryptgrm_len, cryptgrm, cryptgrm_len);
|
|
|
|
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
gcry_cipher_close(hd);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
clear_tvb = tvb_new_real_data(cleartext, cryptgrm_len, cryptgrm_len);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
return clear_tvb;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
on_gcry_error:
|
2007-01-11 17:39:16 +00:00
|
|
|
*error = (void*)gpg_strerror(err);
|
2007-01-11 00:29:50 +00:00
|
|
|
if (hd) gcry_cipher_close(hd);
|
2007-01-09 18:38:55 +00:00
|
|
|
return NULL;
|
|
|
|
#else
|
|
|
|
*error = "libgcrypt not present, cannot decrypt";
|
|
|
|
return NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
gboolean check_ScopedPdu(tvbuff_t* tvb) {
|
|
|
|
int offset;
|
|
|
|
gint8 class;
|
|
|
|
gboolean pc;
|
|
|
|
gint32 tag;
|
|
|
|
int hoffset, eoffset;
|
|
|
|
guint32 len;
|
2007-01-10 01:16:22 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
offset = get_ber_identifier(tvb, 0, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(NULL, tvb, offset, NULL, NULL);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
if ( ! (((class!=BER_CLASS_APP) && (class!=BER_CLASS_PRI) )
|
|
|
|
&& ( (!pc) || (class!=BER_CLASS_UNI) || (tag!=BER_UNI_TAG_ENUMERATED) )
|
|
|
|
)) return FALSE;
|
|
|
|
|
|
|
|
if((tvb_get_guint8(tvb, offset)==0)&&(tvb_get_guint8(tvb, offset+1)==0))
|
|
|
|
return TRUE;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
hoffset = offset;
|
|
|
|
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(NULL, tvb, offset, &len, NULL);
|
|
|
|
eoffset = offset + len;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
if (eoffset <= hoffset) return FALSE;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
if ((class!=BER_CLASS_APP)&&(class!=BER_CLASS_PRI))
|
|
|
|
if( (class!=BER_CLASS_UNI)
|
|
|
|
||((tag<BER_UNI_TAG_NumericString)&&(tag!=BER_UNI_TAG_OCTETSTRING)&&(tag!=BER_UNI_TAG_UTF8String)) )
|
|
|
|
return FALSE;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
return TRUE;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
}
|
2007-01-10 01:16:22 +00:00
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/*--- Included file: packet-snmp-fn.c ---*/
|
|
|
|
#line 1 "packet-snmp-fn.c"
|
|
|
|
/*--- Fields for imported types ---*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, &oid_tvb);
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_name(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ObjectName(FALSE, tvb, offset, actx, tree, hf_snmp_name);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_subtree(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ObjectName(FALSE, tvb, offset, actx, tree, hf_snmp_subtree);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2006-03-08 18:56:13 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_Integer_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 343 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
guint length;
|
|
|
|
|
2007-05-15 05:49:43 +00:00
|
|
|
snmp_variable_decode(tvb, tree, actx, oid_tvb, offset, &length, NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
offset = offset + length;
|
|
|
|
|
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_integer_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Integer_value(FALSE, tvb, offset, actx, tree, hf_snmp_integer_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_String_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 337 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
guint length;
|
|
|
|
|
2007-05-15 05:49:43 +00:00
|
|
|
snmp_variable_decode(tvb, tree, actx, oid_tvb, offset, &length, &value_tvb);
|
2006-05-03 19:09:03 +00:00
|
|
|
offset = offset + length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
2006-03-08 18:56:13 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_string_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_String_value(FALSE, tvb, offset, actx, tree, hf_snmp_string_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_ObjectID_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 349 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
guint length;
|
|
|
|
|
2007-05-15 05:49:43 +00:00
|
|
|
snmp_variable_decode(tvb, tree, actx, oid_tvb, offset, &length, NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
offset = offset + length;
|
|
|
|
|
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_objectID_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ObjectID_value(FALSE, tvb, offset, actx, tree, hf_snmp_objectID_value);
|
2006-03-08 18:56:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_Empty(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 355 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
guint length;
|
|
|
|
|
2007-05-15 05:49:43 +00:00
|
|
|
snmp_variable_decode(tvb, tree, actx, oid_tvb, offset, &length, NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
offset = offset + length;
|
|
|
|
|
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_empty(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Empty(FALSE, tvb, offset, actx, tree, hf_snmp_empty);
|
2006-03-08 18:56:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const value_string snmp_SimpleSyntax_vals[] = {
|
|
|
|
{ 0, "integer-value" },
|
|
|
|
{ 1, "string-value" },
|
|
|
|
{ 2, "objectID-value" },
|
|
|
|
{ 3, "empty" },
|
2006-03-08 18:56:13 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t SimpleSyntax_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_integer_value },
|
|
|
|
{ 1, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_string_value },
|
|
|
|
{ 2, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_objectID_value },
|
|
|
|
{ 3, BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_empty },
|
2006-03-08 18:56:13 +00:00
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_SimpleSyntax(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
SimpleSyntax_choice, hf_index, ett_snmp_SimpleSyntax,
|
|
|
|
NULL);
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_simple(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_SimpleSyntax(FALSE, tvb, offset, actx, tree, hf_snmp_simple);
|
2006-03-08 18:56:13 +00:00
|
|
|
}
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
2006-03-08 18:56:13 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_IpAddress(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
2006-03-08 18:56:13 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_ipAddress_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_IpAddress(FALSE, tvb, offset, actx, tree, hf_snmp_ipAddress_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2006-03-08 18:56:13 +00:00
|
|
|
|
1999-06-12 04:17:19 +00:00
|
|
|
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_Counter32(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_counter_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Counter32(FALSE, tvb, offset, actx, tree, hf_snmp_counter_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2000-05-15 03:15:12 +00:00
|
|
|
|
2004-08-11 19:11:16 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-13 22:18:08 +00:00
|
|
|
NULL);
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_timeticks_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_TimeTicks(FALSE, tvb, offset, actx, tree, hf_snmp_timeticks_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_time_stamp(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_TimeTicks(FALSE, tvb, offset, actx, tree, hf_snmp_time_stamp);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
1999-05-12 05:56:42 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_Opaque(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_arbitrary_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Opaque(FALSE, tvb, offset, actx, tree, hf_snmp_arbitrary_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_Counter64(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_big_counter_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Counter64(FALSE, tvb, offset, actx, tree, hf_snmp_big_counter_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_Unsigned32(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_unsigned_integer_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Unsigned32(FALSE, tvb, offset, actx, tree, hf_snmp_unsigned_integer_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_ApplicationSyntax_vals[] = {
|
|
|
|
{ 0, "ipAddress-value" },
|
|
|
|
{ 1, "counter-value" },
|
|
|
|
{ 3, "timeticks-value" },
|
|
|
|
{ 4, "arbitrary-value" },
|
|
|
|
{ 6, "big-counter-value" },
|
|
|
|
{ 2, "unsigned-integer-value" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t ApplicationSyntax_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_ipAddress_value },
|
|
|
|
{ 1, BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_counter_value },
|
|
|
|
{ 3, BER_CLASS_APP, 3, BER_FLAGS_NOOWNTAG, dissect_timeticks_value },
|
|
|
|
{ 4, BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_arbitrary_value },
|
|
|
|
{ 6, BER_CLASS_APP, 6, BER_FLAGS_NOOWNTAG, dissect_big_counter_value },
|
|
|
|
{ 2, BER_CLASS_APP, 2, BER_FLAGS_NOOWNTAG, dissect_unsigned_integer_value },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_ApplicationSyntax(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
ApplicationSyntax_choice, hf_index, ett_snmp_ApplicationSyntax,
|
|
|
|
NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_application_wide(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ApplicationSyntax(FALSE, tvb, offset, actx, tree, hf_snmp_application_wide);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_ObjectSyntax_vals[] = {
|
|
|
|
{ -1/*choice*/, "simple" },
|
|
|
|
{ -1/*choice*/, "application-wide" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t ObjectSyntax_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ -1/*choice*/, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_simple },
|
|
|
|
{ -1/*choice*/, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_application_wide },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_ObjectSyntax(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
ObjectSyntax_choice, hf_index, ett_snmp_ObjectSyntax,
|
|
|
|
NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_value(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ObjectSyntax(FALSE, tvb, offset, actx, tree, hf_snmp_value);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_bulkPDU_request_id(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Integer32(FALSE, tvb, offset, actx, tree, hf_snmp_bulkPDU_request_id);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-05 22:16:12 +00:00
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_internet(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-04-05 22:16:12 +00:00
|
|
|
#line 361 "snmp.cnf"
|
|
|
|
/* see http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1125 */
|
|
|
|
guint32 len;
|
|
|
|
int cur_offset;
|
|
|
|
|
|
|
|
cur_offset = get_ber_identifier(tvb, offset, NULL, NULL, NULL);
|
|
|
|
get_ber_length(NULL, tvb, cur_offset, &len, NULL);
|
|
|
|
|
|
|
|
switch (len) {
|
2007-05-13 20:58:29 +00:00
|
|
|
case 4: offset = dissect_snmp_IpAddress(FALSE, tvb, offset, actx, tree, hf_snmp_internet); break;
|
|
|
|
case 16: offset = dissect_snmp_IpAddressIpv6(FALSE, tvb, offset, actx, tree, hf_snmp_internet_ipv6); break;
|
|
|
|
default: offset = dissect_snmp_IpAddressOther(FALSE, tvb, offset, actx, tree, hf_snmp_internet_other); break;
|
2007-04-05 22:16:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (len != 4) {
|
|
|
|
proto_item* pi = get_ber_last_created_item();
|
|
|
|
proto_tree* pt = proto_item_add_subtree(pi,ett_internet);
|
|
|
|
/*
|
|
|
|
* It might be possible to do so, although the dissector should probably still put
|
|
|
|
* a complaint into the protocol tree ("not irritating Cisco by pointing out where
|
|
|
|
* they're violating the standard" is not a project goal for Wireshark :-)).
|
|
|
|
* -- Guy Harris
|
|
|
|
*/
|
|
|
|
pi = proto_tree_add_text(pt,tvb,cur_offset,len,
|
|
|
|
"The host that generated this packet is violating"
|
|
|
|
"the SNMP protocol definition and sends corrupt and invalid packets");
|
|
|
|
PROTO_ITEM_SET_GENERATED(pi);
|
2007-05-13 20:58:29 +00:00
|
|
|
expert_add_info_format( actx->pinfo, pi, PI_MALFORMED, PI_ERROR,
|
2007-04-05 22:16:12 +00:00
|
|
|
"Corrupt and Invalid packet" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_internet(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_internet(FALSE, tvb, offset, actx, tree, hf_snmp_internet);
|
2007-04-05 22:16:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const value_string snmp_NetworkAddress_vals[] = {
|
|
|
|
{ 0, "internet" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t NetworkAddress_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_internet },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
NetworkAddress_choice, hf_index, ett_snmp_NetworkAddress,
|
|
|
|
NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_agent_addr(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_NetworkAddress(FALSE, tvb, offset, actx, tree, hf_snmp_agent_addr);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-04-05 22:16:12 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_IpAddressIpv6(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2007-04-05 22:16:12 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_IpAddressOther(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2007-04-05 22:16:12 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const value_string snmp_Version_vals[] = {
|
|
|
|
{ 0, "version-1" },
|
|
|
|
{ 1, "v2c" },
|
|
|
|
{ 2, "v2u" },
|
|
|
|
{ 3, "snmpv3" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_version(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Version(FALSE, tvb, offset, actx, tree, hf_snmp_version);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgVersion(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_Version(FALSE, tvb, offset, actx, tree, hf_snmp_msgVersion);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_community(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_snmp_community);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_parameters(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_snmp_parameters);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_encrypted(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_snmp_encrypted);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_contextEngineID(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_snmp_contextEngineID);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_contextName(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_snmp_contextName);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_password(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OCTET_STRING(FALSE, tvb, offset, actx, tree, hf_snmp_password);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_request_id(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER(FALSE, tvb, offset, actx, tree, hf_snmp_request_id);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_error_index(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER(FALSE, tvb, offset, actx, tree, hf_snmp_error_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_specific_trap(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER(FALSE, tvb, offset, actx, tree, hf_snmp_specific_trap);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_T_error_status_vals[] = {
|
|
|
|
{ 0, "noError" },
|
|
|
|
{ 1, "tooBig" },
|
|
|
|
{ 2, "noSuchName" },
|
|
|
|
{ 3, "badValue" },
|
|
|
|
{ 4, "readOnly" },
|
|
|
|
{ 5, "genErr" },
|
|
|
|
{ 6, "noAccess" },
|
|
|
|
{ 7, "wrongType" },
|
|
|
|
{ 8, "wrongLength" },
|
|
|
|
{ 9, "wrongEncoding" },
|
|
|
|
{ 10, "wrongValue" },
|
|
|
|
{ 11, "noCreation" },
|
|
|
|
{ 12, "inconsistentValue" },
|
|
|
|
{ 13, "resourceUnavailable" },
|
|
|
|
{ 14, "commitFailed" },
|
|
|
|
{ 15, "undoFailed" },
|
|
|
|
{ 16, "authorizationError" },
|
|
|
|
{ 17, "notWritable" },
|
|
|
|
{ 18, "inconsistentName" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_error_status(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_error_status(FALSE, tvb, offset, actx, tree, hf_snmp_error_status);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_unSpecified(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_NULL(FALSE, tvb, offset, actx, tree, hf_snmp_unSpecified);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_noSuchObject_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_NULL(TRUE, tvb, offset, actx, tree, hf_snmp_noSuchObject);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_noSuchInstance_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_NULL(TRUE, tvb, offset, actx, tree, hf_snmp_noSuchInstance);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_endOfMibView_impl(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_NULL(TRUE, tvb, offset, actx, tree, hf_snmp_endOfMibView);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_ValueType_vals[] = {
|
|
|
|
{ 0, "value" },
|
|
|
|
{ 1, "unSpecified" },
|
|
|
|
{ 2, "noSuchObject" },
|
|
|
|
{ 3, "noSuchInstance" },
|
|
|
|
{ 4, "endOfMibView" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t ValueType_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_value },
|
|
|
|
{ 1, BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_unSpecified },
|
|
|
|
{ 2, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_noSuchObject_impl },
|
|
|
|
{ 3, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_noSuchInstance_impl },
|
|
|
|
{ 4, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_endOfMibView_impl },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_ValueType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
ValueType_choice, hf_index, ett_snmp_ValueType,
|
|
|
|
NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_valueType(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ValueType(FALSE, tvb, offset, actx, tree, hf_snmp_valueType);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t VarBind_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_name },
|
|
|
|
{ BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_valueType },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 323 "snmp.cnf"
|
2006-06-13 13:21:12 +00:00
|
|
|
oid_tvb = NULL;
|
|
|
|
value_tvb = NULL;
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
VarBind_sequence, hf_index, ett_snmp_VarBind);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2006-06-13 13:21:12 +00:00
|
|
|
if (oid_tvb && value_tvb) {
|
|
|
|
next_tvb_add_string(&var_list, value_tvb, (snmp_var_in_tree) ? tree : NULL,
|
|
|
|
variable_oid_dissector_table,
|
|
|
|
oid_to_str(tvb_get_ptr(oid_tvb, 0, tvb_length(oid_tvb)), tvb_length(oid_tvb)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_VarBindList_item(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_VarBind(FALSE, tvb, offset, actx, tree, hf_snmp_VarBindList_item);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t VarBindList_sequence_of[1] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_VarBindList_item },
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence_of(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
VarBindList_sequence_of, hf_index, ett_snmp_VarBindList);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_variable_bindings(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_VarBindList(FALSE, tvb, offset, actx, tree, hf_snmp_variable_bindings);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t PDU_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_request_id },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_error_status },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_error_index },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_variable_bindings },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
PDU_sequence, hf_index, ett_snmp_PDU);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_get_request(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 37 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_get_request(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_get_request(FALSE, tvb, offset, actx, tree, hf_snmp_get_request);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_get_next_request(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 52 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_get_next_request(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_get_next_request(FALSE, tvb, offset, actx, tree, hf_snmp_get_next_request);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_get_response(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 67 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_get_response(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_get_response(FALSE, tvb, offset, actx, tree, hf_snmp_get_response);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_set_request(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 82 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_set_request(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_set_request(FALSE, tvb, offset, actx, tree, hf_snmp_set_request);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_enterprise(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OBJECT_IDENTIFIER(FALSE, tvb, offset, actx, tree, hf_snmp_enterprise);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_identity(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OBJECT_IDENTIFIER(FALSE, tvb, offset, actx, tree, hf_snmp_identity);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_T_generic_trap_vals[] = {
|
|
|
|
{ 0, "coldStart" },
|
|
|
|
{ 1, "warmStart" },
|
|
|
|
{ 2, "linkDown" },
|
|
|
|
{ 3, "linkUp" },
|
|
|
|
{ 4, "authenticationFailure" },
|
|
|
|
{ 5, "egpNeighborLoss" },
|
|
|
|
{ 6, "enterpriseSpecific" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_generic_trap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_generic_trap(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_generic_trap(FALSE, tvb, offset, actx, tree, hf_snmp_generic_trap);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t Trap_PDU_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_enterprise },
|
|
|
|
{ BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_agent_addr },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_generic_trap },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_specific_trap },
|
|
|
|
{ BER_CLASS_APP, 3, BER_FLAGS_NOOWNTAG, dissect_time_stamp },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_variable_bindings },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
Trap_PDU_sequence, hf_index, ett_snmp_Trap_PDU);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_trap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 98 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_Trap_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_trap(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_trap(FALSE, tvb, offset, actx, tree, hf_snmp_trap);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgID(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER_0_2147483647(FALSE, tvb, offset, actx, tree, hf_snmp_msgID);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_non_repeaters(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER_0_2147483647(FALSE, tvb, offset, actx, tree, hf_snmp_non_repeaters);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_max_repetitions(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER_0_2147483647(FALSE, tvb, offset, actx, tree, hf_snmp_max_repetitions);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t BulkPDU_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_bulkPDU_request_id },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_non_repeaters },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_max_repetitions },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_variable_bindings },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
BulkPDU_sequence, hf_index, ett_snmp_BulkPDU);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
|
|
|
offset = dissect_snmp_BulkPDU(implicit_tag, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_getBulkRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 113 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_GetBulkRequest_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_getBulkRequest(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_getBulkRequest(FALSE, tvb, offset, actx, tree, hf_snmp_getBulkRequest);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
|
|
|
offset = dissect_snmp_PDU(implicit_tag, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_informRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 128 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_InformRequest_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_informRequest(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_informRequest(FALSE, tvb, offset, actx, tree, hf_snmp_informRequest);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
|
|
|
offset = dissect_snmp_PDU(implicit_tag, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_sNMPv2_Trap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 143 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_SNMPv2_Trap_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_sNMPv2_Trap(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_sNMPv2_Trap(FALSE, tvb, offset, actx, tree, hf_snmp_sNMPv2_Trap);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
|
|
|
offset = dissect_snmp_PDU(implicit_tag, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_T_report(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 158 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind_field;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len1;
|
|
|
|
|
|
|
|
if(!implicit_tag){
|
2006-05-23 20:36:49 +00:00
|
|
|
/* XXX asn2wrs can not yet handle tagged assignment yes so this
|
2006-05-03 19:09:03 +00:00
|
|
|
* XXX is some conformance file magic to work around that bug
|
|
|
|
*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = get_ber_length(tree, tvb, offset, &len1, &ind_field);
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_Report_PDU(TRUE, tvb, offset, actx, tree, hf_index);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_report(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_report(FALSE, tvb, offset, actx, tree, hf_snmp_report);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_PDUs_vals[] = {
|
|
|
|
{ 0, "get-request" },
|
|
|
|
{ 1, "get-next-request" },
|
|
|
|
{ 2, "get-response" },
|
|
|
|
{ 3, "set-request" },
|
|
|
|
{ 4, "trap" },
|
|
|
|
{ 5, "getBulkRequest" },
|
|
|
|
{ 6, "informRequest" },
|
|
|
|
{ 7, "sNMPv2-Trap" },
|
|
|
|
{ 8, "report" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t PDUs_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_CON, 0, BER_FLAGS_NOOWNTAG, dissect_get_request },
|
|
|
|
{ 1, BER_CLASS_CON, 1, BER_FLAGS_NOOWNTAG, dissect_get_next_request },
|
|
|
|
{ 2, BER_CLASS_CON, 2, BER_FLAGS_NOOWNTAG, dissect_get_response },
|
|
|
|
{ 3, BER_CLASS_CON, 3, BER_FLAGS_NOOWNTAG, dissect_set_request },
|
|
|
|
{ 4, BER_CLASS_CON, 4, BER_FLAGS_NOOWNTAG, dissect_trap },
|
|
|
|
{ 5, BER_CLASS_CON, 5, BER_FLAGS_NOOWNTAG, dissect_getBulkRequest },
|
|
|
|
{ 6, BER_CLASS_CON, 6, BER_FLAGS_NOOWNTAG, dissect_informRequest },
|
|
|
|
{ 7, BER_CLASS_CON, 7, BER_FLAGS_NOOWNTAG, dissect_sNMPv2_Trap },
|
|
|
|
{ 8, BER_CLASS_CON, 8, BER_FLAGS_NOOWNTAG, dissect_report },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-01-09 18:38:55 +00:00
|
|
|
#line 30 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
gint pdu_type;
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
PDUs_choice, hf_index, ett_snmp_PDUs,
|
|
|
|
&pdu_type);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2007-05-13 20:58:29 +00:00
|
|
|
if (check_col(actx->pinfo->cinfo, COL_INFO))
|
|
|
|
col_add_str(actx->pinfo->cinfo, COL_INFO, val_to_str(pdu_type, snmp_PDUs_vals,"Unknown PDU type (%u)"));
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_data(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_PDUs(FALSE, tvb, offset, actx, tree, hf_snmp_data);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_v2u_plaintext(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_PDUs(FALSE, tvb, offset, actx, tree, hf_snmp_v2u_plaintext);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_pDUs(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_PDUs(FALSE, tvb, offset, actx, tree, hf_snmp_pDUs);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t Message_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_community },
|
|
|
|
{ BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_data },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
Message_sequence, hf_index, ett_snmp_Message);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_T_datav2u_vals[] = {
|
|
|
|
{ 0, "plaintext" },
|
|
|
|
{ 1, "encrypted" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t T_datav2u_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_v2u_plaintext },
|
|
|
|
{ 1, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encrypted },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
T_datav2u_choice, hf_index, ett_snmp_T_datav2u,
|
|
|
|
NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_datav2u(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_datav2u(FALSE, tvb, offset, actx, tree, hf_snmp_datav2u);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t Messagev2u_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_parameters },
|
|
|
|
{ BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_datav2u },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
Messagev2u_sequence, hf_index, ett_snmp_Messagev2u);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-01-11 00:29:50 +00:00
|
|
|
#line 185 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
tvbuff_t *parameter_tvb = NULL;
|
|
|
|
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2007-01-09 18:38:55 +00:00
|
|
|
&usm_p.engine_tvb);
|
|
|
|
if (parameter_tvb) {
|
|
|
|
proto_tree* engine_tree = proto_item_add_subtree(get_ber_last_created_item(),ett_engineid);
|
|
|
|
dissect_snmp_engineid(engine_tree, usm_p.engine_tvb, 0, tvb_length_remaining(usm_p.engine_tvb,0));
|
|
|
|
}
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgAuthoritativeEngineID(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgAuthoritativeEngineID(FALSE, tvb, offset, actx, tree, hf_snmp_msgAuthoritativeEngineID);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2007-01-11 00:29:50 +00:00
|
|
|
&usm_p.boots);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgAuthoritativeEngineBoots(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgAuthoritativeEngineBoots(FALSE, tvb, offset, actx, tree, hf_snmp_msgAuthoritativeEngineBoots);
|
2007-01-11 00:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2007-01-11 00:29:50 +00:00
|
|
|
&usm_p.time);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgAuthoritativeEngineTime(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgAuthoritativeEngineTime(FALSE, tvb, offset, actx, tree, hf_snmp_msgAuthoritativeEngineTime);
|
2007-01-11 00:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2007-01-09 18:38:55 +00:00
|
|
|
&usm_p.user_tvb);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgUserName(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgUserName(FALSE, tvb, offset, actx, tree, hf_snmp_msgUserName);
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-01-11 00:29:50 +00:00
|
|
|
#line 198 "snmp.cnf"
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &usm_p.auth_tvb);
|
2007-01-09 18:38:55 +00:00
|
|
|
if (usm_p.auth_tvb) {
|
|
|
|
usm_p.auth_item = get_ber_last_created_item();
|
|
|
|
usm_p.auth_offset = offset_from_real_beginning(usm_p.auth_tvb,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgAuthenticationParameters(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgAuthenticationParameters(FALSE, tvb, offset, actx, tree, hf_snmp_msgAuthenticationParameters);
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2007-01-09 18:38:55 +00:00
|
|
|
&usm_p.priv_tvb);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgPrivacyParameters(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgPrivacyParameters(FALSE, tvb, offset, actx, tree, hf_snmp_msgPrivacyParameters);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t UsmSecurityParameters_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_msgAuthoritativeEngineID },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_msgAuthoritativeEngineBoots },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_msgAuthoritativeEngineTime },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_msgUserName },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_msgAuthenticationParameters },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_msgPrivacyParameters },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
UsmSecurityParameters_sequence, hf_index, ett_snmp_UsmSecurityParameters);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgMaxSize(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER_484_2147483647(FALSE, tvb, offset, actx, tree, hf_snmp_msgMaxSize);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 307 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
tvbuff_t *parameter_tvb = NULL;
|
|
|
|
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
¶meter_tvb);
|
|
|
|
|
|
|
|
if (parameter_tvb){
|
2007-01-09 18:38:55 +00:00
|
|
|
guint8 v3_flags = tvb_get_guint8(parameter_tvb, 0);
|
2007-01-11 00:29:50 +00:00
|
|
|
proto_tree* flags_tree = proto_item_add_subtree(get_ber_last_created_item(),ett_msgFlags);
|
2007-01-09 18:38:55 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
proto_tree_add_item(flags_tree, hf_snmp_v3_flags_report, parameter_tvb, 0, 1, FALSE);
|
|
|
|
proto_tree_add_item(flags_tree, hf_snmp_v3_flags_crypt, parameter_tvb, 0, 1, FALSE);
|
|
|
|
proto_tree_add_item(flags_tree, hf_snmp_v3_flags_auth, parameter_tvb, 0, 1, FALSE);
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
usm_p.encrypted = v3_flags & TH_CRYPT ? TRUE : FALSE;
|
|
|
|
usm_p.authenticated = v3_flags & TH_AUTH ? TRUE : FALSE;
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgFlags(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgFlags(FALSE, tvb, offset, actx, tree, hf_snmp_msgFlags);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
&MsgSecurityModel);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgSecurityModel(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgSecurityModel(FALSE, tvb, offset, actx, tree, hf_snmp_msgSecurityModel);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t HeaderData_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_msgID },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_msgMaxSize },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_msgFlags },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_msgSecurityModel },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
HeaderData_sequence, hf_index, ett_snmp_HeaderData);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgGlobalData(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_HeaderData(FALSE, tvb, offset, actx, tree, hf_snmp_msgGlobalData);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 250 "snmp.cnf"
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
switch(MsgSecurityModel){
|
2007-01-09 18:38:55 +00:00
|
|
|
case SNMP_SEC_USM: /* 3 */
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_UsmSecurityParameters(FALSE, tvb, offset+2, actx, tree, -1);
|
2007-01-09 18:38:55 +00:00
|
|
|
usm_p.user_assoc = get_user_assoc(usm_p.engine_tvb, usm_p.user_tvb);
|
|
|
|
break;
|
|
|
|
case SNMP_SEC_ANY: /* 0 */
|
|
|
|
case SNMP_SEC_V1: /* 1 */
|
|
|
|
case SNMP_SEC_V2C: /* 2 */
|
|
|
|
default:
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
break;
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgSecurityParameters(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_msgSecurityParameters(FALSE, tvb, offset, actx, tree, hf_snmp_msgSecurityParameters);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t ScopedPDU_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_contextEngineID },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_contextName },
|
|
|
|
{ BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_data },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
ScopedPDU_sequence, hf_index, ett_snmp_ScopedPDU);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_plaintext(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ScopedPDU(FALSE, tvb, offset, actx, tree, hf_snmp_plaintext);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-01-11 00:29:50 +00:00
|
|
|
#line 207 "snmp.cnf"
|
2007-01-09 18:38:55 +00:00
|
|
|
tvbuff_t* crypt_tvb;
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_snmp_encryptedPDU, &crypt_tvb);
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
if( usm_p.encrypted && crypt_tvb
|
|
|
|
&& usm_p.user_assoc
|
|
|
|
&& usm_p.user_assoc->user.privProtocol ) {
|
2007-01-11 17:39:16 +00:00
|
|
|
|
|
|
|
const gchar* error = NULL;
|
|
|
|
proto_tree* encryptedpdu_tree = proto_item_add_subtree(get_ber_last_created_item(),ett_encryptedPDU);
|
|
|
|
tvbuff_t* cleartext_tvb = usm_p.user_assoc->user.privProtocol(&usm_p, crypt_tvb, &error );
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
if (! cleartext_tvb) {
|
2007-01-11 17:39:16 +00:00
|
|
|
proto_item* cause = proto_tree_add_text(encryptedpdu_tree, cleartext_tvb, 0, -1,
|
|
|
|
"Failed to decrypt encryptedPDU: %s", error);
|
|
|
|
|
2007-05-13 20:58:29 +00:00
|
|
|
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN,
|
2007-01-11 17:39:16 +00:00
|
|
|
"Failed to decrypt encryptedPDU: %s", error);
|
|
|
|
|
|
|
|
return offset;
|
2007-01-09 18:38:55 +00:00
|
|
|
} else {
|
2007-01-10 01:16:22 +00:00
|
|
|
proto_item* decrypted_item;
|
|
|
|
proto_tree* decrypted_tree;
|
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
if (! check_ScopedPdu(cleartext_tvb)) {
|
|
|
|
proto_item* cause = proto_tree_add_text(encryptedpdu_tree, cleartext_tvb, 0, -1,
|
|
|
|
"Decrypted data not formated as expected, wrong key?");
|
|
|
|
|
2007-05-13 20:58:29 +00:00
|
|
|
expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN,
|
2007-01-11 17:39:16 +00:00
|
|
|
"Decrypted data not formated as expected");
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2007-05-13 20:58:29 +00:00
|
|
|
add_new_data_source(actx->pinfo, cleartext_tvb, "Decrypted ScopedPDU");
|
2007-01-09 18:38:55 +00:00
|
|
|
tvb_set_child_real_data_tvbuff(tvb, cleartext_tvb);
|
2007-01-10 01:16:22 +00:00
|
|
|
|
|
|
|
decrypted_item = proto_tree_add_item(encryptedpdu_tree, hf_snmp_decryptedPDU,cleartext_tvb,0,-1,FALSE);
|
|
|
|
decrypted_tree = proto_item_add_subtree(decrypted_item,ett_decrypted);
|
2007-05-13 20:58:29 +00:00
|
|
|
dissect_snmp_ScopedPDU(FALSE, cleartext_tvb, 0, actx, decrypted_tree, -1);
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_encryptedPDU(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_encryptedPDU(FALSE, tvb, offset, actx, tree, hf_snmp_encryptedPDU);
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const value_string snmp_ScopedPduData_vals[] = {
|
|
|
|
{ 0, "plaintext" },
|
|
|
|
{ 1, "encryptedPDU" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t ScopedPduData_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_plaintext },
|
|
|
|
{ 1, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_encryptedPDU },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
ScopedPduData_choice, hf_index, ett_snmp_ScopedPduData,
|
|
|
|
NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_msgData(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ScopedPduData(FALSE, tvb, offset, actx, tree, hf_snmp_msgData);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t SNMPv3Message_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_msgVersion },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_msgGlobalData },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_msgSecurityParameters },
|
|
|
|
{ BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_msgData },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
SNMPv3Message_sequence, hf_index, ett_snmp_SNMPv3Message);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
#line 265 "snmp.cnf"
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
if( usm_p.authenticated
|
|
|
|
&& usm_p.user_assoc
|
|
|
|
&& usm_p.user_assoc->user.authModel ) {
|
2007-01-10 01:16:22 +00:00
|
|
|
const gchar* error = NULL;
|
2007-01-09 18:38:55 +00:00
|
|
|
proto_item* authen_item;
|
|
|
|
proto_tree* authen_tree = proto_item_add_subtree(usm_p.auth_item,ett_authParameters);
|
2007-01-11 17:39:16 +00:00
|
|
|
guint8* calc_auth;
|
|
|
|
guint calc_auth_len;
|
2007-01-09 18:38:55 +00:00
|
|
|
|
2007-01-11 17:39:16 +00:00
|
|
|
usm_p.authOK = usm_p.user_assoc->user.authModel->authenticate( &usm_p, &calc_auth, &calc_auth_len, &error );
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
if (error) {
|
|
|
|
authen_item = proto_tree_add_text(authen_tree,tvb,0,0,"Error while verifying Messsage authenticity: %s", error);
|
|
|
|
PROTO_ITEM_SET_GENERATED(authen_item);
|
2007-05-13 20:58:29 +00:00
|
|
|
expert_add_info_format( actx->pinfo, authen_item, PI_MALFORMED, PI_ERROR, "Error while verifying Messsage authenticity: %s", error );
|
2007-01-09 18:38:55 +00:00
|
|
|
} else {
|
|
|
|
int severity;
|
|
|
|
gchar* fmt;
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
authen_item = proto_tree_add_boolean(authen_tree, hf_snmp_msgAuthentication, tvb, 0, 0, usm_p.authOK);
|
2007-01-09 18:38:55 +00:00
|
|
|
PROTO_ITEM_SET_GENERATED(authen_item);
|
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
if (usm_p.authOK) {
|
2007-01-09 18:38:55 +00:00
|
|
|
fmt = "SNMP Authentication OK";
|
|
|
|
severity = PI_CHAT;
|
|
|
|
} else {
|
2007-01-11 17:39:16 +00:00
|
|
|
gchar* calc_auth_str = bytestring_to_str(calc_auth,calc_auth_len,' ');
|
|
|
|
proto_item_append_text(authen_item, " calcuated = %s", calc_auth_str);
|
2007-01-09 18:38:55 +00:00
|
|
|
fmt = "SNMP Authentication Error";
|
|
|
|
severity = PI_WARN;
|
|
|
|
}
|
|
|
|
|
2007-05-13 20:58:29 +00:00
|
|
|
expert_add_info_format( actx->pinfo, authen_item, PI_CHECKSUM, severity, fmt );
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_T_smux_version_vals[] = {
|
|
|
|
{ 0, "version-1" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_smux_version(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_smux_version(FALSE, tvb, offset, actx, tree, hf_snmp_smux_version);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_description(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_DisplayString(FALSE, tvb, offset, actx, tree, hf_snmp_description);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t SimpleOpen_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_smux_version },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_identity },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_description },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_password },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
SimpleOpen_sequence, hf_index, ett_snmp_SimpleOpen);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_smux_simple(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_SimpleOpen(FALSE, tvb, offset, actx, tree, hf_snmp_smux_simple);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_OpenPDU_vals[] = {
|
|
|
|
{ 0, "smux-simple" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t OpenPDU_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_smux_simple },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
OpenPDU_choice, hf_index, ett_snmp_OpenPDU,
|
|
|
|
NULL);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_open(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_OpenPDU(FALSE, tvb, offset, actx, tree, hf_snmp_open);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_ClosePDU_vals[] = {
|
|
|
|
{ 0, "goingDown" },
|
|
|
|
{ 1, "unsupportedVersion" },
|
|
|
|
{ 2, "packetFormat" },
|
|
|
|
{ 3, "protocolError" },
|
|
|
|
{ 4, "internalError" },
|
|
|
|
{ 5, "authenticationFailure" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_close(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_ClosePDU(FALSE, tvb, offset, actx, tree, hf_snmp_close);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_priority(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_INTEGER_M1_2147483647(FALSE, tvb, offset, actx, tree, hf_snmp_priority);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_T_operation_vals[] = {
|
|
|
|
{ 0, "delete" },
|
|
|
|
{ 1, "readOnly" },
|
|
|
|
{ 2, "readWrite" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_operation(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_T_operation(FALSE, tvb, offset, actx, tree, hf_snmp_operation);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_sequence_t RReqPDU_sequence[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_subtree },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_priority },
|
|
|
|
{ BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_operation },
|
|
|
|
{ 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_sequence(implicit_tag, actx, tree, tvb, offset,
|
|
|
|
RReqPDU_sequence, hf_index, ett_snmp_RReqPDU);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_registerRequest(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_RReqPDU(FALSE, tvb, offset, actx, tree, hf_snmp_registerRequest);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string snmp_RRspPDU_vals[] = {
|
|
|
|
{ -1, "failure" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
2002-08-28 21:04:11 +00:00
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
2006-03-08 18:56:13 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_rRspPDU(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_RRspPDU(FALSE, tvb, offset, actx, tree, hf_snmp_rRspPDU);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
1999-12-10 09:49:29 +00:00
|
|
|
|
2003-05-03 15:23:15 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const value_string snmp_RegisterResponse_vals[] = {
|
|
|
|
{ 0, "rRspPDU" },
|
|
|
|
{ 1, "pDUs" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t RegisterResponse_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_APP, 3, BER_FLAGS_NOOWNTAG, dissect_rRspPDU },
|
|
|
|
{ 1, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_pDUs },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
2003-10-29 22:11:08 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
RegisterResponse_choice, hf_index, ett_snmp_RegisterResponse,
|
|
|
|
NULL);
|
2003-10-29 22:11:08 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_registerResponse(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_RegisterResponse(FALSE, tvb, offset, actx, tree, hf_snmp_registerResponse);
|
1999-05-12 05:56:42 +00:00
|
|
|
}
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
static const value_string snmp_SOutPDU_vals[] = {
|
|
|
|
{ 0, "commit" },
|
|
|
|
{ 1, "rollback" },
|
|
|
|
{ 0, NULL }
|
2001-01-30 02:13:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
|
2006-05-03 19:09:03 +00:00
|
|
|
NULL);
|
2001-01-30 02:13:43 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
2007-05-13 20:58:29 +00:00
|
|
|
static int dissect_commitOrRollback(proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_) {
|
|
|
|
return dissect_snmp_SOutPDU(FALSE, tvb, offset, actx, tree, hf_snmp_commitOrRollback);
|
2006-05-03 19:09:03 +00:00
|
|
|
}
|
2001-01-30 02:13:43 +00:00
|
|
|
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static const value_string snmp_SMUX_PDUs_vals[] = {
|
|
|
|
{ 0, "open" },
|
|
|
|
{ 1, "close" },
|
|
|
|
{ 2, "registerRequest" },
|
|
|
|
{ 3, "registerResponse" },
|
|
|
|
{ 4, "commitOrRollback" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
2001-01-30 02:13:43 +00:00
|
|
|
|
2007-05-22 16:17:54 +00:00
|
|
|
static const ber_old_choice_t SMUX_PDUs_choice[] = {
|
2006-05-03 19:09:03 +00:00
|
|
|
{ 0, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_open },
|
|
|
|
{ 1, BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_close },
|
|
|
|
{ 2, BER_CLASS_APP, 2, BER_FLAGS_NOOWNTAG, dissect_registerRequest },
|
|
|
|
{ 3, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_registerResponse },
|
|
|
|
{ 4, BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_commitOrRollback },
|
|
|
|
{ 0, 0, 0, 0, NULL }
|
|
|
|
};
|
2001-01-30 02:13:43 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
static int
|
2007-05-13 20:58:29 +00:00
|
|
|
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_) {
|
2007-05-22 16:17:54 +00:00
|
|
|
offset = dissect_ber_old_choice(actx, tree, tvb, offset,
|
|
|
|
SMUX_PDUs_choice, hf_index, ett_snmp_SMUX_PDUs,
|
|
|
|
NULL);
|
2001-01-30 02:13:43 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--- PDUs ---*/
|
|
|
|
|
2007-03-21 10:22:22 +00:00
|
|
|
static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
|
2007-05-13 20:58:29 +00:00
|
|
|
asn1_ctx_t asn1_ctx;
|
|
|
|
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
|
|
|
|
dissect_snmp_SMUX_PDUs(FALSE, tvb, 0, &asn1_ctx, tree, hf_snmp_SMUX_PDUs_PDU);
|
2001-01-30 02:13:43 +00:00
|
|
|
}
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
/*--- End of included file: packet-snmp-fn.c ---*/
|
2007-05-13 20:58:29 +00:00
|
|
|
#line 1513 "packet-snmp-template.c"
|
2007-01-09 18:38:55 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2003-09-06 01:21:00 +00:00
|
|
|
guint
|
2001-04-15 07:30:03 +00:00
|
|
|
dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
2003-09-06 01:21:00 +00:00
|
|
|
proto_tree *tree, int proto, gint ett, gboolean is_tcp)
|
2000-05-15 03:15:12 +00:00
|
|
|
{
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2003-09-06 01:21:00 +00:00
|
|
|
guint length_remaining;
|
2006-05-03 19:09:03 +00:00
|
|
|
gint8 class;
|
|
|
|
gboolean pc, ind = 0;
|
|
|
|
gint32 tag;
|
|
|
|
guint32 len;
|
2000-05-15 03:15:12 +00:00
|
|
|
guint message_length;
|
2006-05-03 19:09:03 +00:00
|
|
|
int start_offset = offset;
|
|
|
|
guint32 version = 0;
|
2000-05-15 03:15:12 +00:00
|
|
|
|
|
|
|
proto_tree *snmp_tree = NULL;
|
|
|
|
proto_item *item = NULL;
|
2007-05-13 20:58:29 +00:00
|
|
|
asn1_ctx_t asn1_ctx;
|
|
|
|
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
|
|
|
|
|
2000-05-15 03:15:12 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
usm_p.msg_tvb = tvb;
|
|
|
|
usm_p.start_offset = offset_from_real_beginning(tvb,0) ;
|
|
|
|
usm_p.engine_tvb = NULL;
|
|
|
|
usm_p.user_tvb = NULL;
|
|
|
|
usm_p.auth_item = NULL;
|
|
|
|
usm_p.auth_tvb = NULL;
|
|
|
|
usm_p.auth_offset = 0;
|
|
|
|
usm_p.priv_tvb = NULL;
|
|
|
|
usm_p.user_assoc = NULL;
|
|
|
|
usm_p.authenticated = FALSE;
|
|
|
|
usm_p.encrypted = FALSE;
|
2007-01-11 00:29:50 +00:00
|
|
|
usm_p.boots = 0;
|
|
|
|
usm_p.time = 0;
|
|
|
|
usm_p.authOK = FALSE;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2003-09-06 01:21:00 +00:00
|
|
|
/*
|
|
|
|
* This will throw an exception if we don't have any data left.
|
|
|
|
* That's what we want. (See "tcp_dissect_pdus()", which is
|
|
|
|
* similar, but doesn't have to deal with ASN.1.
|
|
|
|
* XXX - can we make "tcp_dissect_pdus()" provide enough
|
|
|
|
* information to the "get_pdu_len" routine so that we could
|
|
|
|
* have that routine deal with ASN.1, and just use
|
|
|
|
* "tcp_dissect_pdus()"?)
|
|
|
|
*/
|
|
|
|
length_remaining = tvb_ensure_length_remaining(tvb, offset);
|
2000-05-15 03:15:12 +00:00
|
|
|
|
|
|
|
/* NOTE: we have to parse the message piece by piece, since the
|
|
|
|
* capture length may be less than the message length: a 'global'
|
|
|
|
* parsing is likely to fail.
|
|
|
|
*/
|
2003-09-06 01:21:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If this is SNMP-over-TCP, we might have to do reassembly
|
|
|
|
* in order to read the "Sequence Of" header.
|
|
|
|
*/
|
|
|
|
if (is_tcp && snmp_desegment && pinfo->can_desegment) {
|
|
|
|
/*
|
|
|
|
* This is TCP, and we should, and can, do reassembly.
|
|
|
|
*
|
|
|
|
* Is the "Sequence Of" header split across segment
|
|
|
|
* boundaries? We requre at least 6 bytes for the
|
|
|
|
* header, which allows for a 4-byte length (ASN.1
|
|
|
|
* BER).
|
|
|
|
*/
|
|
|
|
if (length_remaining < 6) {
|
|
|
|
pinfo->desegment_offset = offset;
|
|
|
|
pinfo->desegment_len = 6 - length_remaining;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return 0, which means "I didn't dissect anything
|
|
|
|
* because I don't have enough data - we need
|
|
|
|
* to desegment".
|
|
|
|
*/
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OK, try to read the "Sequence Of" header; this gets the total
|
|
|
|
* length of the SNMP message.
|
|
|
|
*/
|
2006-05-03 19:09:03 +00:00
|
|
|
/* Set tree to 0 to not display internakl BER fields if option used.*/
|
|
|
|
offset = dissect_ber_identifier(pinfo, 0, tvb, offset, &class, &pc, &tag);
|
|
|
|
offset = dissect_ber_length(pinfo, 0, tvb, offset, &len, &ind);
|
2003-09-06 01:21:00 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
message_length = len + 2;
|
2007-05-15 05:49:43 +00:00
|
|
|
offset = dissect_ber_integer(FALSE, &asn1_ctx, 0, tvb, offset, -1, &version);
|
2003-09-06 01:21:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If this is SNMP-over-TCP, we might have to do reassembly
|
|
|
|
* to get all of this message.
|
|
|
|
*/
|
|
|
|
if (is_tcp && snmp_desegment && pinfo->can_desegment) {
|
|
|
|
/*
|
|
|
|
* Yes - is the message split across segment boundaries?
|
|
|
|
*/
|
|
|
|
if (length_remaining < message_length) {
|
|
|
|
/*
|
|
|
|
* Yes. Tell the TCP dissector where the data
|
|
|
|
* for this message starts in the data it handed
|
|
|
|
* us, and how many more bytes we need, and
|
|
|
|
* return.
|
|
|
|
*/
|
2006-05-03 19:09:03 +00:00
|
|
|
pinfo->desegment_offset = start_offset;
|
2003-09-06 01:21:00 +00:00
|
|
|
pinfo->desegment_len =
|
|
|
|
message_length - length_remaining;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return 0, which means "I didn't dissect anything
|
|
|
|
* because I don't have enough data - we need
|
|
|
|
* to desegment".
|
|
|
|
*/
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-13 13:21:12 +00:00
|
|
|
next_tvb_init(&var_list);
|
|
|
|
|
2003-09-06 01:21:00 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL,
|
2003-11-16 23:17:27 +00:00
|
|
|
proto_get_protocol_short_name(find_protocol_by_id(proto)));
|
2003-09-06 01:21:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
item = proto_tree_add_item(tree, proto, tvb, offset,
|
|
|
|
message_length, FALSE);
|
|
|
|
snmp_tree = proto_item_add_subtree(item, ett);
|
2000-05-15 03:15:12 +00:00
|
|
|
}
|
2003-04-18 21:05:52 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
switch (version){
|
|
|
|
case 0: /* v1 */
|
|
|
|
case 1: /* v2c */
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_Message(FALSE , tvb, start_offset, &asn1_ctx, snmp_tree, -1);
|
2000-05-15 03:15:12 +00:00
|
|
|
break;
|
2006-05-03 19:09:03 +00:00
|
|
|
case 2: /* v2u */
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_Messagev2u(FALSE , tvb, start_offset, &asn1_ctx, snmp_tree, -1);
|
2000-05-15 03:15:12 +00:00
|
|
|
break;
|
2006-05-03 19:09:03 +00:00
|
|
|
/* v3 */
|
|
|
|
case 3:
|
2007-05-13 20:58:29 +00:00
|
|
|
offset = dissect_snmp_SNMPv3Message(FALSE , tvb, start_offset, &asn1_ctx, snmp_tree, -1);
|
2000-05-15 03:15:12 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-05-03 19:09:03 +00:00
|
|
|
/*
|
|
|
|
* Return the length remaining in the tvbuff, so
|
|
|
|
* if this is SNMP-over-TCP, our caller thinks there's
|
|
|
|
* nothing left to dissect.
|
|
|
|
*/
|
|
|
|
proto_tree_add_text(snmp_tree, tvb, offset, -1,"Unknown version");
|
|
|
|
return length_remaining;
|
|
|
|
break;
|
2000-05-15 03:15:12 +00:00
|
|
|
}
|
|
|
|
|
2006-06-13 13:21:12 +00:00
|
|
|
next_tvb_call(&var_list, pinfo, tree, NULL, data_handle);
|
2000-05-15 03:15:12 +00:00
|
|
|
|
2006-06-13 13:21:12 +00:00
|
|
|
return offset;
|
2000-05-15 03:15:12 +00:00
|
|
|
}
|
|
|
|
|
2005-05-10 08:49:27 +00:00
|
|
|
static gint
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-12-05 02:33:52 +00:00
|
|
|
{
|
2000-10-21 18:52:17 +00:00
|
|
|
conversation_t *conversation;
|
2005-05-10 08:49:27 +00:00
|
|
|
int offset;
|
|
|
|
gint8 tmp_class;
|
|
|
|
gboolean tmp_pc;
|
|
|
|
gint32 tmp_tag;
|
|
|
|
guint32 tmp_length;
|
|
|
|
gboolean tmp_ind;
|
|
|
|
|
2006-01-18 20:02:19 +00:00
|
|
|
/*
|
|
|
|
* See if this looks like SNMP or not. if not, return 0 so
|
2006-05-21 04:49:01 +00:00
|
|
|
* wireshark can try som other dissector instead.
|
2005-05-10 08:49:27 +00:00
|
|
|
*/
|
|
|
|
/* All SNMP packets are BER encoded and consist of a SEQUENCE
|
|
|
|
* that spans the entire PDU. The first item is an INTEGER that
|
|
|
|
* has the values 0-2 (version 1-3).
|
|
|
|
* if not it is not snmp.
|
|
|
|
*/
|
|
|
|
/* SNMP starts with a SEQUENCE */
|
|
|
|
offset = get_ber_identifier(tvb, 0, &tmp_class, &tmp_pc, &tmp_tag);
|
|
|
|
if((tmp_class!=BER_CLASS_UNI)||(tmp_tag!=BER_UNI_TAG_SEQUENCE)){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* then comes a length which spans the rest of the tvb */
|
|
|
|
offset = get_ber_length(NULL, tvb, offset, &tmp_length, &tmp_ind);
|
|
|
|
if(tmp_length!=(guint32)tvb_reported_length_remaining(tvb, offset)){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* then comes an INTEGER (version)*/
|
|
|
|
offset = get_ber_identifier(tvb, offset, &tmp_class, &tmp_pc, &tmp_tag);
|
|
|
|
if((tmp_class!=BER_CLASS_UNI)||(tmp_tag!=BER_UNI_TAG_INTEGER)){
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* do we need to test that version is 0 - 2 (version1-3) ? */
|
|
|
|
|
2000-10-21 18:52:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* If this packet went to the SNMP port, we check to see if
|
2001-06-10 09:50:20 +00:00
|
|
|
* there's already a conversation with one address/port pair
|
|
|
|
* matching the source IP address and port of this packet,
|
|
|
|
* the other address matching the destination IP address of this
|
|
|
|
* packet, and any destination port.
|
|
|
|
*
|
|
|
|
* If not, we create one, with its address 1/port 1 pair being
|
|
|
|
* the source address/port of this packet, its address 2 being
|
|
|
|
* the destination address of this packet, and its port 2 being
|
|
|
|
* wildcarded, and give it the SNMP dissector as a dissector.
|
2000-10-21 18:52:17 +00:00
|
|
|
*/
|
2001-04-15 07:30:03 +00:00
|
|
|
if (pinfo->destport == UDP_PORT_SNMP) {
|
2005-02-02 20:07:03 +00:00
|
|
|
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_UDP,
|
2001-06-10 09:50:20 +00:00
|
|
|
pinfo->srcport, 0, NO_PORT_B);
|
2005-05-11 10:40:53 +00:00
|
|
|
if( (conversation == NULL) || (conversation->dissector_handle!=snmp_handle) ){
|
2005-02-02 20:07:03 +00:00
|
|
|
conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_UDP,
|
2001-09-03 10:33:12 +00:00
|
|
|
pinfo->srcport, 0, NO_PORT2);
|
2001-11-27 07:13:32 +00:00
|
|
|
conversation_set_dissector(conversation, snmp_handle);
|
2000-10-21 18:52:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-10 08:49:27 +00:00
|
|
|
return dissect_snmp_pdu(tvb, 0, pinfo, tree, proto_snmp, ett_snmp, FALSE);
|
2003-09-06 01:21:00 +00:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
dissect_snmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
guint message_len;
|
|
|
|
|
|
|
|
while (tvb_reported_length_remaining(tvb, offset) > 0) {
|
2006-05-03 19:09:03 +00:00
|
|
|
message_len = dissect_snmp_pdu(tvb, 0, pinfo, tree,
|
2003-09-06 01:21:00 +00:00
|
|
|
proto_snmp, ett_snmp, TRUE);
|
|
|
|
if (message_len == 0) {
|
|
|
|
/*
|
|
|
|
* We don't have all the data for that message,
|
|
|
|
* so we need to do desegmentation;
|
|
|
|
* "dissect_snmp_pdu()" has set that up.
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
offset += message_len;
|
|
|
|
}
|
1999-12-05 02:33:52 +00:00
|
|
|
}
|
|
|
|
|
2000-05-15 03:15:12 +00:00
|
|
|
static void
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_smux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
2000-05-15 03:15:12 +00:00
|
|
|
{
|
2006-05-03 19:09:03 +00:00
|
|
|
proto_tree *smux_tree = NULL;
|
|
|
|
proto_item *item = NULL;
|
|
|
|
|
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMUX");
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
item = proto_tree_add_item(tree, proto_smux, tvb, 0, -1, FALSE);
|
|
|
|
smux_tree = proto_item_add_subtree(item, ett_smux);
|
|
|
|
}
|
|
|
|
|
|
|
|
dissect_SMUX_PDUs_PDU(tvb, pinfo, tree);
|
2000-05-15 03:15:12 +00:00
|
|
|
}
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
MD5 Password to Key Algorithm
|
2007-01-12 00:33:32 +00:00
|
|
|
from RFC 3414 A.2.1
|
2007-01-09 18:38:55 +00:00
|
|
|
*/
|
2007-02-07 14:54:35 +00:00
|
|
|
static void snmp_usm_password_to_key_md5(const guint8 *password,
|
2007-01-11 00:29:50 +00:00
|
|
|
guint passwordlen,
|
|
|
|
const guint8 *engineID,
|
|
|
|
guint engineLength,
|
|
|
|
guint8 *key) {
|
2007-01-09 18:38:55 +00:00
|
|
|
md5_state_t MD;
|
|
|
|
guint8 *cp, password_buf[64];
|
|
|
|
guint32 password_index = 0;
|
|
|
|
guint32 count = 0, i;
|
|
|
|
guint8 key1[16];
|
|
|
|
md5_init(&MD); /* initialize MD5 */
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
/**********************************************/
|
|
|
|
/* Use while loop until we've done 1 Megabyte */
|
|
|
|
/**********************************************/
|
|
|
|
while (count < 1048576) {
|
|
|
|
cp = password_buf;
|
|
|
|
for (i = 0; i < 64; i++) {
|
|
|
|
/*************************************************/
|
|
|
|
/* Take the next octet of the password, wrapping */
|
|
|
|
/* to the beginning of the password as necessary.*/
|
|
|
|
/*************************************************/
|
|
|
|
*cp++ = password[password_index++ % passwordlen];
|
|
|
|
}
|
|
|
|
md5_append(&MD, password_buf, 64);
|
|
|
|
count += 64;
|
|
|
|
}
|
|
|
|
md5_finish(&MD, key1); /* tell MD5 we're done */
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
/*****************************************************/
|
|
|
|
/* Now localize the key with the engineID and pass */
|
|
|
|
/* through MD5 to produce final key */
|
|
|
|
/* May want to ensure that engineLength <= 32, */
|
|
|
|
/* otherwise need to use a buffer larger than 64 */
|
|
|
|
/*****************************************************/
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
md5_init(&MD);
|
|
|
|
md5_append(&MD, key1, 16);
|
|
|
|
md5_append(&MD, engineID, engineLength);
|
|
|
|
md5_append(&MD, key1, 16);
|
|
|
|
md5_finish(&MD, key);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-12 00:33:32 +00:00
|
|
|
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
/*
|
|
|
|
SHA1 Password to Key Algorithm COPIED from RFC 3414 A.2.2
|
|
|
|
*/
|
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
static void snmp_usm_password_to_key_sha1(const guint8 *password,
|
2007-01-11 00:29:50 +00:00
|
|
|
guint passwordlen,
|
|
|
|
const guint8 *engineID,
|
|
|
|
guint engineLength,
|
|
|
|
guint8 *key ) {
|
2007-01-10 01:16:22 +00:00
|
|
|
sha1_context SH;
|
2007-01-09 18:38:55 +00:00
|
|
|
guint8 *cp, password_buf[72];
|
|
|
|
guint32 password_index = 0;
|
|
|
|
guint32 count = 0, i;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
sha1_starts(&SH); /* initialize SHA */
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
/**********************************************/
|
|
|
|
/* Use while loop until we've done 1 Megabyte */
|
|
|
|
/**********************************************/
|
|
|
|
while (count < 1048576) {
|
|
|
|
cp = password_buf;
|
|
|
|
for (i = 0; i < 64; i++) {
|
|
|
|
/*************************************************/
|
|
|
|
/* Take the next octet of the password, wrapping */
|
|
|
|
/* to the beginning of the password as necessary.*/
|
|
|
|
/*************************************************/
|
|
|
|
*cp++ = password[password_index++ % passwordlen];
|
|
|
|
}
|
2007-01-10 01:16:22 +00:00
|
|
|
sha1_update (&SH, password_buf, 64);
|
2007-01-09 18:38:55 +00:00
|
|
|
count += 64;
|
|
|
|
}
|
2007-01-10 01:16:22 +00:00
|
|
|
sha1_finish(&SH, key);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
/*****************************************************/
|
|
|
|
/* Now localize the key with the engineID and pass */
|
|
|
|
/* through SHA to produce final key */
|
|
|
|
/* May want to ensure that engineLength <= 32, */
|
|
|
|
/* otherwise need to use a buffer larger than 72 */
|
|
|
|
/*****************************************************/
|
|
|
|
memcpy(password_buf, key, 20);
|
|
|
|
memcpy(password_buf+20, engineID, engineLength);
|
|
|
|
memcpy(password_buf+20+engineLength, key, 20);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-10 01:16:22 +00:00
|
|
|
sha1_starts(&SH);
|
|
|
|
sha1_update(&SH, password_buf, 40+engineLength);
|
|
|
|
sha1_finish(&SH, key);
|
2007-01-09 18:38:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2003-09-08 20:16:47 +00:00
|
|
|
static void
|
|
|
|
process_prefs(void)
|
|
|
|
{
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2003-09-08 20:16:47 +00:00
|
|
|
gchar *tmp_mib_modules;
|
2003-09-08 20:21:04 +00:00
|
|
|
static gboolean mibs_loaded = FALSE;
|
2003-09-08 20:16:47 +00:00
|
|
|
|
2003-09-08 20:21:04 +00:00
|
|
|
if (mibs_loaded) {
|
|
|
|
/*
|
|
|
|
* Unload the MIBs, as we'll be reloading them based on
|
|
|
|
* the current preference setting.
|
|
|
|
*/
|
|
|
|
shutdown_mib(); /* unload MIBs */
|
|
|
|
}
|
2003-09-08 20:16:47 +00:00
|
|
|
|
|
|
|
/*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Cannot check if MIBS is already set, as it could be set by Wireshark.
|
2003-09-08 20:16:47 +00:00
|
|
|
*
|
|
|
|
* If we have a list of modules to load, put that list in MIBS,
|
|
|
|
* otherwise clear MIBS.
|
|
|
|
*/
|
|
|
|
if (mib_modules != NULL) {
|
|
|
|
tmp_mib_modules = g_strconcat("MIBS=", mib_modules, NULL);
|
2005-08-17 22:27:15 +00:00
|
|
|
/*
|
|
|
|
* Try to be clever and replace colons for semicolons under
|
|
|
|
* Windows. Do the converse on non-Windows systems. This
|
|
|
|
* handles cases where we've copied a preferences file
|
|
|
|
* between a non-Windows box and a Windows box or upgraded
|
2006-05-21 04:49:01 +00:00
|
|
|
* from an older version of Wireshark under Windows.
|
2005-08-17 22:27:15 +00:00
|
|
|
*/
|
|
|
|
g_strdelimit(tmp_mib_modules, IMPORT_SEPARATOR, ENV_SEPARATOR_CHAR);
|
2003-09-08 20:16:47 +00:00
|
|
|
|
2004-09-11 23:03:36 +00:00
|
|
|
#ifdef _WIN32
|
2003-09-08 20:16:47 +00:00
|
|
|
_putenv(tmp_mib_modules);
|
|
|
|
#else
|
|
|
|
putenv(tmp_mib_modules);
|
2004-09-11 23:03:36 +00:00
|
|
|
#endif /*_WIN32*/
|
2003-09-08 20:16:47 +00:00
|
|
|
} else {
|
2004-09-11 23:03:36 +00:00
|
|
|
#ifdef _WIN32
|
2003-09-08 20:16:47 +00:00
|
|
|
_putenv("MIBS");
|
|
|
|
#else
|
|
|
|
putenv("MIBS");
|
2004-09-11 23:03:36 +00:00
|
|
|
#endif /* _WIN32 */
|
2003-09-08 20:16:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Load the MIBs.
|
|
|
|
*/
|
|
|
|
register_mib_handlers();
|
|
|
|
read_premib_configs();
|
|
|
|
init_mib();
|
|
|
|
read_configs();
|
2003-09-08 20:21:04 +00:00
|
|
|
mibs_loaded = TRUE;
|
2006-12-08 15:05:41 +00:00
|
|
|
#endif /* HAVE_NET_SNMP */
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
static void* snmp_users_copy_cb(void* dest, const void* orig, unsigned len _U_) {
|
|
|
|
const snmp_ue_assoc_t* o = orig;
|
|
|
|
snmp_ue_assoc_t* d = dest;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
d->auth_model = o->auth_model;
|
|
|
|
d->user.authModel = auth_models[o->auth_model];
|
|
|
|
|
|
|
|
d->priv_proto = o->priv_proto;
|
|
|
|
d->user.privProtocol = priv_protos[o->priv_proto];
|
|
|
|
|
|
|
|
d->user.userName.data = g_memdup(o->user.userName.data,o->user.userName.len);
|
|
|
|
d->user.userName.len = o->user.userName.len;
|
|
|
|
|
|
|
|
d->user.authPassword.data = o->user.authPassword.data ? g_memdup(o->user.authPassword.data,o->user.authPassword.len) : NULL;
|
|
|
|
d->user.authPassword.len = o->user.authPassword.len;
|
|
|
|
|
|
|
|
d->user.privPassword.data = o->user.privPassword.data ? g_memdup(o->user.privPassword.data,o->user.privPassword.len) : NULL;
|
|
|
|
d->user.privPassword.len = o->user.privPassword.len;
|
|
|
|
|
|
|
|
d->engine.len = o->engine.len;
|
|
|
|
if (o->engine.data) {
|
|
|
|
d->engine.data = g_memdup(o->engine.data,o->engine.len);
|
|
|
|
}
|
|
|
|
|
|
|
|
d->user.authKey.data = o->user.authKey.data ? g_memdup(o->user.authKey.data,o->user.authKey.len) : NULL;
|
|
|
|
d->user.authKey.len = o->user.authKey.len;
|
|
|
|
|
|
|
|
d->user.privKey.data = o->user.privKey.data ? g_memdup(o->user.privKey.data,o->user.privKey.len) : NULL;
|
|
|
|
d->user.privKey.len = o->user.privKey.len;
|
|
|
|
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void snmp_users_free_cb(void* p) {
|
|
|
|
snmp_ue_assoc_t* ue = p;
|
|
|
|
if (ue->user.userName.data) g_free(ue->user.userName.data);
|
|
|
|
if (ue->user.authPassword.data) g_free(ue->user.authPassword.data);
|
|
|
|
if (ue->user.privPassword.data) g_free(ue->user.privPassword.data);
|
|
|
|
if (ue->user.authKey.data) g_free(ue->user.authKey.data);
|
|
|
|
if (ue->user.privKey.data) g_free(ue->user.privKey.data);
|
|
|
|
if (ue->engine.data) g_free(ue->engine.data);
|
|
|
|
}
|
|
|
|
|
2007-04-23 10:59:26 +00:00
|
|
|
static void snmp_users_update_cb(void* p _U_, const char** err) {
|
2007-02-07 14:54:35 +00:00
|
|
|
snmp_ue_assoc_t* ue = p;
|
2007-02-07 18:51:44 +00:00
|
|
|
GString* es = g_string_new("");
|
2007-02-08 10:15:04 +00:00
|
|
|
|
|
|
|
*err = NULL;
|
|
|
|
|
2007-02-07 18:51:44 +00:00
|
|
|
if (! ue->user.userName.len) g_string_append(es,"no userName, ");
|
|
|
|
if (ue->user.authPassword.len < 8) g_string_sprintfa(es,"short authPassword (%d), ", ue->user.authPassword.len);
|
|
|
|
if (ue->user.privPassword.len < 8) g_string_sprintfa(es,"short privPassword (%d), ", ue->user.privPassword.len);
|
2007-02-07 14:54:35 +00:00
|
|
|
|
2007-02-07 18:51:44 +00:00
|
|
|
if (es->len) {
|
|
|
|
g_string_truncate(es,es->len-2);
|
|
|
|
*err = ep_strdup(es->str);
|
2007-01-09 18:38:55 +00:00
|
|
|
}
|
2007-02-07 14:54:35 +00:00
|
|
|
|
2007-02-07 18:51:44 +00:00
|
|
|
g_string_free(es,TRUE);
|
2007-02-07 14:54:35 +00:00
|
|
|
|
|
|
|
return;
|
2003-09-08 20:16:47 +00:00
|
|
|
}
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
UAT_LSTRING_CB_DEF(snmp_users,userName,snmp_ue_assoc_t,user.userName.data,user.userName.len)
|
|
|
|
UAT_LSTRING_CB_DEF(snmp_users,authPassword,snmp_ue_assoc_t,user.authPassword.data,user.authPassword.len)
|
|
|
|
UAT_LSTRING_CB_DEF(snmp_users,privPassword,snmp_ue_assoc_t,user.privPassword.data,user.privPassword.len)
|
|
|
|
UAT_BUFFER_CB_DEF(snmp_users,engine_id,snmp_ue_assoc_t,engine.data,engine.len)
|
|
|
|
UAT_VS_DEF(snmp_users,auth_model,snmp_ue_assoc_t,0,"MD5")
|
|
|
|
UAT_VS_DEF(snmp_users,priv_proto,snmp_ue_assoc_t,0,"DES")
|
2007-01-12 00:33:32 +00:00
|
|
|
|
|
|
|
|
2007-01-09 18:38:55 +00:00
|
|
|
/*--- proto_register_snmp -------------------------------------------*/
|
2007-01-12 00:33:32 +00:00
|
|
|
void proto_register_snmp(void) {
|
2006-12-08 15:05:41 +00:00
|
|
|
#if defined(_WIN32) && defined(HAVE_NET_SNMP)
|
2002-11-10 20:53:06 +00:00
|
|
|
char *mib_path;
|
2005-08-19 22:44:56 +00:00
|
|
|
int mib_path_len;
|
2002-11-10 20:53:06 +00:00
|
|
|
#define MIB_PATH_APPEND "snmp\\mibs"
|
|
|
|
#endif
|
2003-09-08 20:45:50 +00:00
|
|
|
gchar *tmp_mib_modules;
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
/* List of fields */
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_snmp_v3_flags_auth,
|
|
|
|
{ "Authenticated", "snmp.v3.flags.auth", FT_BOOLEAN, 8,
|
2001-06-18 02:18:27 +00:00
|
|
|
TFS(&flags_set_truth), TH_AUTH, "", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_v3_flags_crypt,
|
|
|
|
{ "Encrypted", "snmp.v3.flags.crypt", FT_BOOLEAN, 8,
|
2001-06-18 02:18:27 +00:00
|
|
|
TFS(&flags_set_truth), TH_CRYPT, "", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_v3_flags_report,
|
|
|
|
{ "Reportable", "snmp.v3.flags.report", FT_BOOLEAN, 8,
|
2001-06-18 02:18:27 +00:00
|
|
|
TFS(&flags_set_truth), TH_REPORT, "", HFILL }},
|
2005-07-25 23:33:44 +00:00
|
|
|
{ &hf_snmp_engineid_conform, {
|
|
|
|
"Engine ID Conformance", "snmp.engineid.conform", FT_BOOLEAN, 8,
|
|
|
|
TFS(&tfs_snmp_engineid_conform), F_SNMP_ENGINEID_CONFORM, "Engine ID RFC3411 Conformance", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_enterprise, {
|
|
|
|
"Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(sminmpec_values), 0, "Engine Enterprise ID", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_format, {
|
|
|
|
"Engine ID Format", "snmp.engineid.format", FT_UINT8, BASE_DEC,
|
|
|
|
VALS(snmp_engineid_format_vals), 0, "Engine ID Format", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_ipv4, {
|
|
|
|
"Engine ID Data: IPv4 address", "snmp.engineid.ipv4", FT_IPv4, BASE_NONE,
|
|
|
|
NULL, 0, "Engine ID Data: IPv4 address", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_ipv6, {
|
|
|
|
"Engine ID Data: IPv6 address", "snmp.engineid.ipv6", FT_IPv6, BASE_NONE,
|
|
|
|
NULL, 0, "Engine ID Data: IPv6 address", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_mac, {
|
|
|
|
"Engine ID Data: MAC address", "snmp.engineid.mac", FT_ETHER, BASE_NONE,
|
|
|
|
NULL, 0, "Engine ID Data: MAC address", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_text, {
|
|
|
|
"Engine ID Data: Text", "snmp.engineid.text", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0, "Engine ID Data: Text", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_time, {
|
|
|
|
"Engine ID Data: Time", "snmp.engineid.time", FT_ABSOLUTE_TIME, BASE_NONE,
|
|
|
|
NULL, 0, "Engine ID Data: Time", HFILL }},
|
|
|
|
{ &hf_snmp_engineid_data, {
|
|
|
|
"Engine ID Data", "snmp.engineid.data", FT_BYTES, BASE_HEX,
|
|
|
|
NULL, 0, "Engine ID Data", HFILL }},
|
2006-02-28 09:39:53 +00:00
|
|
|
{ &hf_snmp_counter64, {
|
|
|
|
"Value", "snmp.counter64", FT_INT64, BASE_DEC,
|
|
|
|
NULL, 0, "A counter64 value", HFILL }},
|
2007-01-09 18:38:55 +00:00
|
|
|
{ &hf_snmp_msgAuthentication,
|
2007-01-11 17:39:16 +00:00
|
|
|
{ "Authentication", "snmp.v3.auth", FT_BOOLEAN, 8,
|
2007-01-09 18:38:55 +00:00
|
|
|
TFS(&auth_flags), 0, "", HFILL }},
|
|
|
|
{ &hf_snmp_decryptedPDU, {
|
2007-01-10 01:16:22 +00:00
|
|
|
"Decrypted ScopedPDU", "snmp.decrypted_pdu", FT_BYTES, BASE_HEX,
|
2007-01-09 18:38:55 +00:00
|
|
|
NULL, 0, "Decrypted PDU", HFILL }},
|
2007-04-05 22:16:12 +00:00
|
|
|
{ &hf_snmp_internet_ipv6, {
|
|
|
|
"internet", "snmp.internet", FT_IPv6, BASE_NONE,
|
|
|
|
NULL, 0, "", HFILL }},
|
|
|
|
{ &hf_snmp_internet_other, {
|
|
|
|
"internet", "snmp.internet", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0, "", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
/*--- Included file: packet-snmp-hfarr.c ---*/
|
|
|
|
#line 1 "packet-snmp-hfarr.c"
|
|
|
|
{ &hf_snmp_SMUX_PDUs_PDU,
|
|
|
|
{ "SMUX-PDUs", "snmp.SMUX_PDUs",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_SMUX_PDUs_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.SMUX_PDUs", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_simple,
|
|
|
|
{ "simple", "snmp.simple",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_SimpleSyntax_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.SimpleSyntax", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_application_wide,
|
|
|
|
{ "application-wide", "snmp.application_wide",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_ApplicationSyntax_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ApplicationSyntax", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_integer_value,
|
|
|
|
{ "integer-value", "snmp.integer_value",
|
|
|
|
FT_INT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Integer_value", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_string_value,
|
|
|
|
{ "string-value", "snmp.string_value",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.String_value", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_objectID_value,
|
|
|
|
{ "objectID-value", "snmp.objectID_value",
|
|
|
|
FT_OID, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ObjectID_value", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_empty,
|
|
|
|
{ "empty", "snmp.empty",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Empty", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_ipAddress_value,
|
|
|
|
{ "ipAddress-value", "snmp.ipAddress_value",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.IpAddress", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_counter_value,
|
|
|
|
{ "counter-value", "snmp.counter_value",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Counter32", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_timeticks_value,
|
|
|
|
{ "timeticks-value", "snmp.timeticks_value",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.TimeTicks", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_arbitrary_value,
|
|
|
|
{ "arbitrary-value", "snmp.arbitrary_value",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Opaque", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_big_counter_value,
|
|
|
|
{ "big-counter-value", "snmp.big_counter_value",
|
2006-08-23 08:05:28 +00:00
|
|
|
FT_UINT64, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Counter64", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_unsigned_integer_value,
|
|
|
|
{ "unsigned-integer-value", "snmp.unsigned_integer_value",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Unsigned32", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_internet,
|
|
|
|
{ "internet", "snmp.internet",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0,
|
2007-04-05 22:16:12 +00:00
|
|
|
"snmp.T_internet", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_version,
|
|
|
|
{ "version", "snmp.version",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_Version_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Version", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_community,
|
|
|
|
{ "community", "snmp.community",
|
|
|
|
FT_STRING, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OCTET_STRING", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_data,
|
|
|
|
{ "data", "snmp.data",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_PDUs_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.PDUs", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_parameters,
|
|
|
|
{ "parameters", "snmp.parameters",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OCTET_STRING", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_datav2u,
|
|
|
|
{ "datav2u", "snmp.datav2u",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_T_datav2u_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_datav2u", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_v2u_plaintext,
|
|
|
|
{ "plaintext", "snmp.plaintext",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_PDUs_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.PDUs", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_encrypted,
|
|
|
|
{ "encrypted", "snmp.encrypted",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OCTET_STRING", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgAuthoritativeEngineID,
|
|
|
|
{ "msgAuthoritativeEngineID", "snmp.msgAuthoritativeEngineID",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2007-01-09 18:38:55 +00:00
|
|
|
"snmp.T_msgAuthoritativeEngineID", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgAuthoritativeEngineBoots,
|
|
|
|
{ "msgAuthoritativeEngineBoots", "snmp.msgAuthoritativeEngineBoots",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2007-01-11 00:29:50 +00:00
|
|
|
"snmp.T_msgAuthoritativeEngineBoots", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgAuthoritativeEngineTime,
|
|
|
|
{ "msgAuthoritativeEngineTime", "snmp.msgAuthoritativeEngineTime",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2007-01-11 00:29:50 +00:00
|
|
|
"snmp.T_msgAuthoritativeEngineTime", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgUserName,
|
|
|
|
{ "msgUserName", "snmp.msgUserName",
|
|
|
|
FT_STRING, BASE_HEX, NULL, 0,
|
2007-01-09 18:38:55 +00:00
|
|
|
"snmp.T_msgUserName", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgAuthenticationParameters,
|
|
|
|
{ "msgAuthenticationParameters", "snmp.msgAuthenticationParameters",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2007-01-09 18:38:55 +00:00
|
|
|
"snmp.T_msgAuthenticationParameters", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgPrivacyParameters,
|
|
|
|
{ "msgPrivacyParameters", "snmp.msgPrivacyParameters",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2007-01-09 18:38:55 +00:00
|
|
|
"snmp.T_msgPrivacyParameters", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgVersion,
|
|
|
|
{ "msgVersion", "snmp.msgVersion",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_Version_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Version", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgGlobalData,
|
|
|
|
{ "msgGlobalData", "snmp.msgGlobalData",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.HeaderData", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgSecurityParameters,
|
|
|
|
{ "msgSecurityParameters", "snmp.msgSecurityParameters",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_msgSecurityParameters", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgData,
|
|
|
|
{ "msgData", "snmp.msgData",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_ScopedPduData_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ScopedPduData", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgID,
|
|
|
|
{ "msgID", "snmp.msgID",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER_0_2147483647", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgMaxSize,
|
|
|
|
{ "msgMaxSize", "snmp.msgMaxSize",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER_484_2147483647", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgFlags,
|
|
|
|
{ "msgFlags", "snmp.msgFlags",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_msgFlags", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_msgSecurityModel,
|
|
|
|
{ "msgSecurityModel", "snmp.msgSecurityModel",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(sec_models), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_msgSecurityModel", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_plaintext,
|
|
|
|
{ "plaintext", "snmp.plaintext",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ScopedPDU", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_encryptedPDU,
|
|
|
|
{ "encryptedPDU", "snmp.encryptedPDU",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2007-01-09 18:38:55 +00:00
|
|
|
"snmp.T_encryptedPDU", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_contextEngineID,
|
|
|
|
{ "contextEngineID", "snmp.contextEngineID",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OCTET_STRING", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_contextName,
|
|
|
|
{ "contextName", "snmp.contextName",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OCTET_STRING", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_get_request,
|
|
|
|
{ "get-request", "snmp.get_request",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_get_request", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_get_next_request,
|
|
|
|
{ "get-next-request", "snmp.get_next_request",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_get_next_request", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_get_response,
|
|
|
|
{ "get-response", "snmp.get_response",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_get_response", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_set_request,
|
|
|
|
{ "set-request", "snmp.set_request",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_set_request", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_trap,
|
|
|
|
{ "trap", "snmp.trap",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_trap", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_getBulkRequest,
|
|
|
|
{ "getBulkRequest", "snmp.getBulkRequest",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_getBulkRequest", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_informRequest,
|
|
|
|
{ "informRequest", "snmp.informRequest",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_informRequest", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_sNMPv2_Trap,
|
|
|
|
{ "sNMPv2-Trap", "snmp.sNMPv2_Trap",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_sNMPv2_Trap", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_report,
|
|
|
|
{ "report", "snmp.report",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_report", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_request_id,
|
|
|
|
{ "request-id", "snmp.request_id",
|
|
|
|
FT_INT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_error_status,
|
|
|
|
{ "error-status", "snmp.error_status",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_T_error_status_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_error_status", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_error_index,
|
|
|
|
{ "error-index", "snmp.error_index",
|
|
|
|
FT_INT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_variable_bindings,
|
|
|
|
{ "variable-bindings", "snmp.variable_bindings",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.VarBindList", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_bulkPDU_request_id,
|
|
|
|
{ "request-id", "snmp.request_id",
|
|
|
|
FT_INT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.Integer32", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_non_repeaters,
|
|
|
|
{ "non-repeaters", "snmp.non_repeaters",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER_0_2147483647", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_max_repetitions,
|
|
|
|
{ "max-repetitions", "snmp.max_repetitions",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER_0_2147483647", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_enterprise,
|
|
|
|
{ "enterprise", "snmp.enterprise",
|
|
|
|
FT_OID, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OBJECT_IDENTIFIER", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_agent_addr,
|
|
|
|
{ "agent-addr", "snmp.agent_addr",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_NetworkAddress_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.NetworkAddress", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_generic_trap,
|
|
|
|
{ "generic-trap", "snmp.generic_trap",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_T_generic_trap_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_generic_trap", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_specific_trap,
|
|
|
|
{ "specific-trap", "snmp.specific_trap",
|
|
|
|
FT_INT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_time_stamp,
|
|
|
|
{ "time-stamp", "snmp.time_stamp",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.TimeTicks", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_name,
|
|
|
|
{ "name", "snmp.name",
|
|
|
|
FT_OID, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ObjectName", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_valueType,
|
|
|
|
{ "valueType", "snmp.valueType",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_ValueType_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ValueType", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_value,
|
|
|
|
{ "value", "snmp.value",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_ObjectSyntax_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ObjectSyntax", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_unSpecified,
|
|
|
|
{ "unSpecified", "snmp.unSpecified",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.NULL", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_noSuchObject,
|
|
|
|
{ "noSuchObject", "snmp.noSuchObject",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.NULL", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_noSuchInstance,
|
|
|
|
{ "noSuchInstance", "snmp.noSuchInstance",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.NULL", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_endOfMibView,
|
|
|
|
{ "endOfMibView", "snmp.endOfMibView",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.NULL", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_VarBindList_item,
|
|
|
|
{ "Item", "snmp.VarBindList_item",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.VarBind", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_open,
|
|
|
|
{ "open", "snmp.open",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_OpenPDU_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OpenPDU", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_close,
|
|
|
|
{ "close", "snmp.close",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_ClosePDU_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ClosePDU", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_registerRequest,
|
|
|
|
{ "registerRequest", "snmp.registerRequest",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.RReqPDU", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_registerResponse,
|
|
|
|
{ "registerResponse", "snmp.registerResponse",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_RegisterResponse_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.RegisterResponse", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_commitOrRollback,
|
|
|
|
{ "commitOrRollback", "snmp.commitOrRollback",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_SOutPDU_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.SOutPDU", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_rRspPDU,
|
|
|
|
{ "rRspPDU", "snmp.rRspPDU",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_RRspPDU_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.RRspPDU", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_pDUs,
|
|
|
|
{ "pDUs", "snmp.pDUs",
|
|
|
|
FT_UINT32, BASE_DEC, VALS(snmp_PDUs_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.PDUs", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_smux_simple,
|
|
|
|
{ "smux-simple", "snmp.smux_simple",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.SimpleOpen", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_smux_version,
|
|
|
|
{ "smux-version", "snmp.smux_version",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_T_smux_version_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_smux_version", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_identity,
|
|
|
|
{ "identity", "snmp.identity",
|
|
|
|
FT_OID, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OBJECT_IDENTIFIER", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_description,
|
|
|
|
{ "description", "snmp.description",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.DisplayString", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_password,
|
|
|
|
{ "password", "snmp.password",
|
|
|
|
FT_BYTES, BASE_HEX, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.OCTET_STRING", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_subtree,
|
|
|
|
{ "subtree", "snmp.subtree",
|
|
|
|
FT_OID, BASE_NONE, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.ObjectName", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_priority,
|
|
|
|
{ "priority", "snmp.priority",
|
|
|
|
FT_INT32, BASE_DEC, NULL, 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.INTEGER_M1_2147483647", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
{ &hf_snmp_operation,
|
|
|
|
{ "operation", "snmp.operation",
|
|
|
|
FT_INT32, BASE_DEC, VALS(snmp_T_operation_vals), 0,
|
2006-08-16 05:58:39 +00:00
|
|
|
"snmp.T_operation", HFILL }},
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
/*--- End of included file: packet-snmp-hfarr.c ---*/
|
2007-05-13 20:58:29 +00:00
|
|
|
#line 2073 "packet-snmp-template.c"
|
2006-05-03 19:09:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* List of subtrees */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_snmp,
|
|
|
|
&ett_engineid,
|
|
|
|
&ett_msgFlags,
|
2007-01-09 18:38:55 +00:00
|
|
|
&ett_encryptedPDU,
|
|
|
|
&ett_decrypted,
|
|
|
|
&ett_authParameters,
|
2007-04-05 22:16:12 +00:00
|
|
|
&ett_internet,
|
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
/*--- Included file: packet-snmp-ettarr.c ---*/
|
|
|
|
#line 1 "packet-snmp-ettarr.c"
|
|
|
|
&ett_snmp_ObjectSyntax,
|
|
|
|
&ett_snmp_SimpleSyntax,
|
|
|
|
&ett_snmp_ApplicationSyntax,
|
|
|
|
&ett_snmp_NetworkAddress,
|
|
|
|
&ett_snmp_Message,
|
|
|
|
&ett_snmp_Messagev2u,
|
|
|
|
&ett_snmp_T_datav2u,
|
|
|
|
&ett_snmp_UsmSecurityParameters,
|
|
|
|
&ett_snmp_SNMPv3Message,
|
|
|
|
&ett_snmp_HeaderData,
|
|
|
|
&ett_snmp_ScopedPduData,
|
|
|
|
&ett_snmp_ScopedPDU,
|
|
|
|
&ett_snmp_PDUs,
|
|
|
|
&ett_snmp_PDU,
|
|
|
|
&ett_snmp_BulkPDU,
|
|
|
|
&ett_snmp_Trap_PDU,
|
|
|
|
&ett_snmp_VarBind,
|
|
|
|
&ett_snmp_ValueType,
|
|
|
|
&ett_snmp_VarBindList,
|
|
|
|
&ett_snmp_SMUX_PDUs,
|
|
|
|
&ett_snmp_RegisterResponse,
|
|
|
|
&ett_snmp_OpenPDU,
|
|
|
|
&ett_snmp_SimpleOpen,
|
|
|
|
&ett_snmp_RReqPDU,
|
|
|
|
|
|
|
|
/*--- End of included file: packet-snmp-ettarr.c ---*/
|
2007-05-13 20:58:29 +00:00
|
|
|
#line 2086 "packet-snmp-template.c"
|
2006-05-03 19:09:03 +00:00
|
|
|
};
|
2007-02-07 14:54:35 +00:00
|
|
|
module_t *snmp_module;
|
|
|
|
static uat_field_t fields[] = {
|
2007-02-12 19:57:41 +00:00
|
|
|
UAT_FLD_BUFFER(snmp_users,engine_id,"Engine-id for this entry (empty = any)"),
|
|
|
|
UAT_FLD_LSTRING(snmp_users,userName,"The username"),
|
|
|
|
UAT_FLD_VS(snmp_users,auth_model,auth_types,"Algorithm to be used for authentication."),
|
|
|
|
UAT_FLD_LSTRING(snmp_users,authPassword,"The password used for authenticating packets for this entry"),
|
|
|
|
UAT_FLD_VS(snmp_users,priv_proto,priv_types,"Algorithm to be used for privacy."),
|
|
|
|
UAT_FLD_LSTRING(snmp_users,privPassword,"The password used for encrypting packets for this entry"),
|
2007-02-07 14:54:35 +00:00
|
|
|
UAT_END_FIELDS
|
|
|
|
};
|
|
|
|
|
|
|
|
assocs_uat = uat_new("SNMP Users",
|
|
|
|
sizeof(snmp_ue_assoc_t),
|
|
|
|
"snmp_users",
|
|
|
|
(void**)&ueas,
|
|
|
|
&num_ueas,
|
|
|
|
UAT_CAT_CRYPTO,
|
|
|
|
"ChSNMPUsersSection",
|
|
|
|
snmp_users_copy_cb,
|
|
|
|
snmp_users_update_cb,
|
|
|
|
snmp_users_free_cb,
|
|
|
|
fields);
|
|
|
|
|
2006-12-08 15:05:41 +00:00
|
|
|
#ifdef HAVE_NET_SNMP
|
2002-11-10 20:53:06 +00:00
|
|
|
|
2004-09-11 23:03:36 +00:00
|
|
|
#ifdef _WIN32
|
2002-11-10 20:53:06 +00:00
|
|
|
/* Set MIBDIRS so that the SNMP library can find its mibs. */
|
|
|
|
/* XXX - Should we set MIBS or MIBFILES as well? */
|
2005-08-19 22:44:56 +00:00
|
|
|
mib_path_len=strlen(get_datafile_dir()) + strlen(MIB_PATH_APPEND) + 20;
|
|
|
|
mib_path = ep_alloc (mib_path_len);
|
|
|
|
g_snprintf (mib_path, mib_path_len, "MIBDIRS=%s\\%s", get_datafile_dir(), MIB_PATH_APPEND);
|
2002-11-10 20:53:06 +00:00
|
|
|
/* Amazingly enough, Windows does not provide setenv(). */
|
|
|
|
if (getenv("MIBDIRS") == NULL)
|
|
|
|
_putenv(mib_path);
|
|
|
|
|
2004-09-11 23:03:36 +00:00
|
|
|
#endif /* _WIN32 */
|
2002-11-10 20:53:06 +00:00
|
|
|
|
2002-03-26 06:35:03 +00:00
|
|
|
/*
|
|
|
|
* Suppress warnings about unknown tokens - we aren't initializing
|
2006-12-08 15:05:41 +00:00
|
|
|
* Net-SNMP in its entirety, we're just initializing the
|
2002-03-26 06:35:03 +00:00
|
|
|
* MIB-handling part because that's all we're using, which
|
|
|
|
* means that entries in the configuration file for other
|
|
|
|
* pars of the library will not be handled, and we don't want
|
|
|
|
* the config file reading code to whine about that.
|
|
|
|
*/
|
2002-10-22 20:06:15 +00:00
|
|
|
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
|
|
|
|
NETSNMP_DS_LIB_NO_TOKEN_WARNINGS, TRUE);
|
|
|
|
netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID,
|
|
|
|
NETSNMP_DS_LIB_PRINT_SUFFIX_ONLY, 2);
|
2006-12-08 15:05:41 +00:00
|
|
|
#endif /* HAVE_NET_SNMP */
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Register protocol */
|
|
|
|
proto_snmp = proto_register_protocol(PNAME, PSNAME, PFNAME);
|
|
|
|
new_register_dissector("snmp", dissect_snmp, proto_snmp);
|
|
|
|
|
|
|
|
/* Register fields and subtrees */
|
|
|
|
proto_register_field_array(proto_snmp, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
2003-05-03 15:23:15 +00:00
|
|
|
|
|
|
|
/* Register configuration preferences */
|
2003-09-08 20:16:47 +00:00
|
|
|
snmp_module = prefs_register_protocol(proto_snmp, process_prefs);
|
2003-05-03 15:23:15 +00:00
|
|
|
prefs_register_bool_preference(snmp_module, "display_oid",
|
|
|
|
"Show SNMP OID in info column",
|
|
|
|
"Whether the SNMP OID should be shown in the info column",
|
|
|
|
&display_oid);
|
2003-09-08 20:16:47 +00:00
|
|
|
|
2003-09-08 20:45:50 +00:00
|
|
|
/*
|
|
|
|
* Set the default value of "mib_modules".
|
|
|
|
*
|
|
|
|
* If the MIBS environment variable is set, make its value
|
|
|
|
* the value of "mib_modules", otherwise, set "mib_modules"
|
|
|
|
* to DEF_MIB_MODULES.
|
|
|
|
*/
|
|
|
|
tmp_mib_modules = getenv("MIBS");
|
|
|
|
if (tmp_mib_modules != NULL)
|
|
|
|
mib_modules = tmp_mib_modules;
|
2003-09-08 20:16:47 +00:00
|
|
|
prefs_register_string_preference(snmp_module, "mib_modules",
|
|
|
|
"MIB modules to load",
|
2004-12-07 21:06:55 +00:00
|
|
|
"List of MIB modules to load (the list is set to environment variable MIBS if the variable is not already set)"
|
|
|
|
"The list must be separated by colons (:) on non-Windows systems and semicolons (;) on Windows systems",
|
2003-09-08 20:16:47 +00:00
|
|
|
&mib_modules);
|
2003-09-06 01:21:00 +00:00
|
|
|
prefs_register_bool_preference(snmp_module, "desegment",
|
2004-08-21 09:02:52 +00:00
|
|
|
"Reassemble SNMP-over-TCP messages\nspanning multiple TCP segments",
|
|
|
|
"Whether the SNMP dissector should reassemble messages spanning multiple TCP segments."
|
|
|
|
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
|
2003-09-06 01:21:00 +00:00
|
|
|
&snmp_desegment);
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2006-06-13 13:21:12 +00:00
|
|
|
prefs_register_bool_preference(snmp_module, "var_in_tree",
|
|
|
|
"Display dissected variables inside SNMP tree",
|
|
|
|
"ON - display dissected variables inside SNMP tree, OFF - display dissected variables in root tree after SNMP",
|
|
|
|
&snmp_var_in_tree);
|
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
prefs_register_obsolete_preference(snmp_module, "users_file");
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-02-07 14:54:35 +00:00
|
|
|
prefs_register_uat_preference(snmp_module, "users_table",
|
|
|
|
"Users Table",
|
|
|
|
"Table of engine-user associations used for authentication and decryption",
|
|
|
|
assocs_uat);
|
|
|
|
|
2006-06-13 13:21:12 +00:00
|
|
|
variable_oid_dissector_table =
|
|
|
|
register_dissector_table("snmp.variable_oid",
|
|
|
|
"SNMP Variable OID", FT_STRING, BASE_NONE);
|
2007-01-12 00:33:32 +00:00
|
|
|
|
2007-01-11 00:29:50 +00:00
|
|
|
register_init_routine(renew_ue_cache);
|
1999-10-27 02:05:09 +00:00
|
|
|
}
|
2000-04-08 07:07:42 +00:00
|
|
|
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
/*--- proto_reg_handoff_snmp ---------------------------------------*/
|
|
|
|
void proto_reg_handoff_snmp(void) {
|
2003-09-06 01:21:00 +00:00
|
|
|
dissector_handle_t snmp_tcp_handle;
|
|
|
|
|
2004-09-25 07:41:58 +00:00
|
|
|
snmp_handle = find_dissector("snmp");
|
|
|
|
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_add("udp.port", UDP_PORT_SNMP, snmp_handle);
|
|
|
|
dissector_add("udp.port", UDP_PORT_SNMP_TRAP, snmp_handle);
|
|
|
|
dissector_add("ethertype", ETHERTYPE_SNMP, snmp_handle);
|
|
|
|
dissector_add("ipx.socket", IPX_SOCKET_SNMP_AGENT, snmp_handle);
|
|
|
|
dissector_add("ipx.socket", IPX_SOCKET_SNMP_SINK, snmp_handle);
|
2003-03-02 21:52:21 +00:00
|
|
|
dissector_add("hpext.dxsap", HPEXT_SNMP, snmp_handle);
|
2003-09-06 01:21:00 +00:00
|
|
|
|
|
|
|
snmp_tcp_handle = create_dissector_handle(dissect_snmp_tcp, proto_snmp);
|
|
|
|
dissector_add("tcp.port", TCP_PORT_SNMP, snmp_tcp_handle);
|
|
|
|
dissector_add("tcp.port", TCP_PORT_SNMP_TRAP, snmp_tcp_handle);
|
|
|
|
|
2001-11-26 04:52:51 +00:00
|
|
|
data_handle = find_dissector("data");
|
2003-09-08 20:16:47 +00:00
|
|
|
|
|
|
|
/*
|
2003-09-08 20:45:50 +00:00
|
|
|
* Process preference settings.
|
2003-09-08 20:16:47 +00:00
|
|
|
*
|
2003-09-08 20:45:50 +00:00
|
|
|
* We can't do this in the register routine, as preferences aren't
|
|
|
|
* read until all dissector register routines have been called (so
|
|
|
|
* that all dissector preferences have been registered).
|
2003-09-08 20:16:47 +00:00
|
|
|
*/
|
|
|
|
process_prefs();
|
2006-05-03 19:09:03 +00:00
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
}
|
2003-04-19 09:45:25 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_smux(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_smux_version,
|
|
|
|
{ "Version", "smux.version", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, "", HFILL }},
|
|
|
|
{ &hf_smux_pdutype,
|
|
|
|
{ "PDU type", "smux.pdutype", FT_UINT8, BASE_DEC, VALS(smux_types),
|
|
|
|
0x0, "", HFILL }},
|
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_smux,
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_smux = proto_register_protocol("SNMP Multiplex Protocol",
|
|
|
|
"SMUX", "smux");
|
|
|
|
proto_register_field_array(proto_smux, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2004-08-11 19:11:16 +00:00
|
|
|
|
2003-04-19 09:45:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_smux(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t smux_handle;
|
|
|
|
|
|
|
|
smux_handle = create_dissector_handle(dissect_smux, proto_smux);
|
|
|
|
dissector_add("tcp.port", TCP_PORT_SMUX, smux_handle);
|
|
|
|
}
|
2006-05-03 19:09:03 +00:00
|
|
|
|
|
|
|
|