/* Do not modify this file. */
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
/* packet-snmp.c */
-/* ../../tools/asn2wrs.py -b -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . snmp.asn */
+/* ../../tools/asn2wrs.py -b -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . -O ../../epan/dissectors snmp.asn */
/* Input file: packet-snmp-template.c */
-#line 1 "packet-snmp-template.c"
+#line 1 "../../asn1/snmp/packet-snmp-template.c"
/* packet-snmp.c
* Routines for SNMP (simple network management protocol)
* Copyright (C) 1998 Didier Jorand
# include "config.h"
#endif
+#include <string.h>
#include <ctype.h>
#include <glib.h>
/*--- Included file: packet-snmp-hf.c ---*/
-#line 1 "packet-snmp-hf.c"
+#line 1 "../../asn1/snmp/packet-snmp-hf.c"
static int hf_snmp_SMUX_PDUs_PDU = -1; /* SMUX_PDUs */
static int hf_snmp_version = -1; /* Version */
static int hf_snmp_community = -1; /* Community */
static int hf_snmp_trap = -1; /* Trap_PDU */
static int hf_snmp_getBulkRequest = -1; /* GetBulkRequest_PDU */
static int hf_snmp_informRequest = -1; /* InformRequest_PDU */
-static int hf_snmp_sNMPv2_Trap = -1; /* SNMPv2_Trap_PDU */
+static int hf_snmp_snmpV2_trap = -1; /* SNMPv2_Trap_PDU */
static int hf_snmp_report = -1; /* Report_PDU */
static int hf_snmp_request_id = -1; /* INTEGER */
static int hf_snmp_error_status = -1; /* T_error_status */
static int hf_snmp_operation = -1; /* T_operation */
/*--- End of included file: packet-snmp-hf.c ---*/
-#line 220 "packet-snmp-template.c"
+#line 221 "../../asn1/snmp/packet-snmp-template.c"
static int hf_smux_version = -1;
static int hf_smux_pdutype = -1;
/*--- Included file: packet-snmp-ett.c ---*/
-#line 1 "packet-snmp-ett.c"
+#line 1 "../../asn1/snmp/packet-snmp-ett.c"
static gint ett_snmp_Message = -1;
static gint ett_snmp_Messagev2u = -1;
static gint ett_snmp_T_datav2u = -1;
static gint ett_snmp_RReqPDU_U = -1;
/*--- End of included file: packet-snmp-ett.c ---*/
-#line 239 "packet-snmp-template.c"
+#line 240 "../../asn1/snmp/packet-snmp-template.c"
static const true_false_string auth_flags = {
"OK",
*/
-extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
- tvbuff_t *tvb,
- int offset,
- asn1_ctx_t *actx,
- proto_tree *tree,
- int hf_index _U_) {
+extern int
+dissect_snmp_VarBind(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
+ asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_)
+{
int seq_offset, name_offset, value_offset, value_start;
guint32 seq_len, name_len, value_len;
gint8 ber_class;
proto_item *pi_name, *pi_varbind, *pi_value = NULL;
proto_tree *pt, *pt_varbind, *pt_name, *pt_value;
char label[ITEM_LABEL_LENGTH];
- char* repr = NULL;
+ const char* repr = NULL;
const char* info_oid = NULL;
char* valstr;
int hfid = -1;
return dissect_unknown_ber(actx->pinfo, tvb, seq_offset, pt);
}
- if (ind){
+ if (ind) {
proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"Indicator must be clear in VarBind");
pt = proto_item_add_subtree(pi,ett_decoding_error);
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "VarBind has indicator set");
return dissect_unknown_ber(actx->pinfo, tvb, seq_offset, pt);
}
- if (ind){
+ if (ind) {
proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"Indicator must be clear in ObjectName");
pt = proto_item_add_subtree(pi,ett_decoding_error);
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "ObjectName has indicator set");
/* then we have the value's header */
offset = get_ber_identifier(tvb, offset, &ber_class, &pc, &tag);
- value_offset = offset = get_ber_length(tvb, offset, &value_len, &ind);
+ value_offset = get_ber_length(tvb, offset, &value_len, &ind);
if (! (!pc) ) {
proto_item* pi = proto_tree_add_text(tree, tvb, seq_offset, seq_len,"the value must be in primitive encoding");
pt_varbind = proto_item_add_subtree(pi_varbind,ett_varbind);
*label = '\0';
- pi_name = proto_tree_add_item(pt_varbind,hf_snmp_objectname,tvb,name_offset,name_len,FALSE);
+ pi_name = proto_tree_add_item(pt_varbind,hf_snmp_objectname,tvb,name_offset,name_len,ENC_NA);
pt_name = proto_item_add_subtree(pi_name,ett_name);
/* fetch ObjectName and its relative oid_info */
add_oid_debug_subtree(oid_info,pt_name);
if (!subids) {
- proto_item* pi = proto_tree_add_text(pt_name,tvb, 0, 0, "invalid oid: %s", oid_bytes);
+ proto_item* pi;
+
+ repr = oid_encoded2string(oid_bytes, name_len);
+ pi = proto_tree_add_text(pt_name,tvb, 0, 0, "invalid oid: %s", repr);
pt = proto_item_add_subtree(pi, ett_decoding_error);
- expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "invalid oid: %s", oid_bytes);
+ expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "invalid oid: %s", repr);
return dissect_unknown_ber(actx->pinfo, tvb, name_offset, pt);
}
}
}
- pi = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE);
+ pi = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN);
expert_add_info_format(actx->pinfo, pi, PI_RESPONSE_CODE, PI_NOTE, "%s",note);
g_strlcpy (label, note, ITEM_LABEL_LENGTH);
goto set_label;
} else if (oid_left == 0) {
if (ber_class == BER_CLASS_UNI && tag == BER_UNI_TAG_NULL) {
/* unSpecified does not require an instance sub-id add the new value and get off the way! */
- pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,FALSE);
+ pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,ENC_NA);
goto set_label;
} else {
proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"A scalar should have one instance sub-id this one has none");
if ( key_len == 0 && ber_class == BER_CLASS_UNI && tag == BER_UNI_TAG_NULL) {
/* unSpecified does not require an instance sub-id add the new value and get off the way! */
- pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,FALSE);
+ pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,ENC_NA);
goto set_label;
}
if (IS_FT_INT(k->ft_type)) {
proto_tree_add_int(pt_name,k->hfid,tvb,name_offset,name_len,(guint)subids[key_start]);
} else { /* if it's not an unsigned int let proto_tree_add_uint throw a warning */
- proto_tree_add_uint(pt_name,k->hfid,tvb,name_offset,name_len,(guint)subids[key_start]);
+ proto_tree_add_uint64(pt_name,k->hfid,tvb,name_offset,name_len,(guint)subids[key_start]);
}
key_start++;
key_len--;
case OID_KEY_TYPE_IPADDR: {
guint32* ipv4_p = (void*)buf;
proto_tree_add_ipv4(pt_name,k->hfid,tvb,name_offset,buf_len, *ipv4_p);
+ }
break;
default:
DISSECTOR_ASSERT_NOT_REACHED();
break;
- }
}
key_start += buf_len;
if (oid_info_is_ok && oid_info->value_type) {
if (ber_class == BER_CLASS_UNI && tag == BER_UNI_TAG_NULL) {
- pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,FALSE);
- } else {
+ pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,ENC_NA);
+ } else {
+ /* Provide a tree_item to attach errors to, if needed. */
+ pi_value = pi_name;
+
if ((oid_info->value_type->ber_class != BER_CLASS_ANY) &&
(ber_class != oid_info->value_type->ber_class))
format_error = BER_WRONG_TAG;
-
- if ((oid_info->value_type->ber_tag != BER_TAG_ANY) &&
+ else if ((oid_info->value_type->ber_tag != BER_TAG_ANY) &&
(tag != oid_info->value_type->ber_tag))
format_error = BER_WRONG_TAG;
+ else {
+ max_len = oid_info->value_type->max_len == -1 ? 0xffffff : oid_info->value_type->max_len;
+ min_len = oid_info->value_type->min_len;
- max_len = oid_info->value_type->max_len == -1 ? 0xffffff : oid_info->value_type->max_len;
- min_len = oid_info->value_type->min_len;
-
- if ((int)value_len < min_len || (int)value_len > max_len) {
- format_error = BER_WRONG_LENGTH;
- } else {
- pi_value = proto_tree_add_item(pt_varbind,oid_info->value_hfid,tvb,value_offset,value_len,FALSE);
+ if ((int)value_len < min_len || (int)value_len > max_len)
+ format_error = BER_WRONG_LENGTH;
}
+
+ if (format_error == BER_NO_ERROR)
+ pi_value = proto_tree_add_item(pt_varbind,oid_info->value_hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN);
}
} else {
switch(ber_class|(tag<<4)) {
case BER_CLASS_UNI|(BER_UNI_TAG_INTEGER<<4):
{
gint64 val=0;
- unsigned offset = value_offset;
+ unsigned int_val_offset = value_offset;
unsigned i;
-
+
max_len = 5; min_len = 1;
if (value_len > (guint)max_len && value_len < (guint)min_len) {
format_error = BER_WRONG_LENGTH;
break;
}
-
+
if(value_len > 0) {
/* extend sign bit */
- if(tvb_get_guint8(tvb, offset)&0x80){
+ if(tvb_get_guint8(tvb, int_val_offset)&0x80) {
val=-1;
}
- for(i=0;i<value_len;i++){
- val=(val<<8)|tvb_get_guint8(tvb, offset);
- offset++;
+ for(i=0;i<value_len;i++) {
+ val=(val<<8)|tvb_get_guint8(tvb, int_val_offset);
+ int_val_offset++;
}
}
proto_tree_add_int64(pt_varbind, hf_snmp_integer32_value, tvb,value_offset,value_len, val);
break;
}
+ pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,ENC_BIG_ENDIAN);
if (format_error != BER_NO_ERROR) {
- pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE);
expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB");
}
-
+
already_added:
oid_info_is_ok = FALSE;
}
if (oid_info && oid_info->name) {
if (oid_left >= 1) {
- repr = ep_strdup_printf("%s.%s (%s)",
- oid_info->name,
- oid_subid2string(&(subids[oid_matched]),oid_left),
- oid_subid2string(subids,oid_matched+oid_left));
+ repr = ep_strdup_printf("%s.%s (%s)", oid_info->name,
+ oid_subid2string(&(subids[oid_matched]),oid_left),
+ oid_subid2string(subids,oid_matched+oid_left));
info_oid = ep_strdup_printf("%s.%s", oid_info->name,
oid_subid2string(&(subids[oid_matched]),oid_left));
} else {
- repr = ep_strdup_printf("%s (%s)",
- oid_info->name,
- oid_subid2string(subids,oid_matched));
+ repr = ep_strdup_printf("%s (%s)", oid_info->name,
+ oid_subid2string(subids,oid_matched));
info_oid = oid_info->name;
}
} else if (oid_string) {
case BER_WRONG_LENGTH: {
proto_tree* pt = proto_item_add_subtree(pi_value,ett_decoding_error);
proto_item* pi = proto_tree_add_text(pt,tvb,0,0,"Wrong value length: %u expecting: %u <= len <= %u",
- value_len,
- min_len,
- max_len == -1 ? 0xFFFFFF : max_len);
+ value_len, min_len, max_len == -1 ? 0xFFFFFF : max_len);
pt = proto_item_add_subtree(pi,ett_decoding_error);
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "Wrong length for SNMP VarBind/value");
return dissect_unknown_ber(actx->pinfo, tvb, value_start, pt);
case BER_WRONG_TAG: {
proto_tree* pt = proto_item_add_subtree(pi_value,ett_decoding_error);
proto_item* pi = proto_tree_add_text(pt,tvb,0,0,"Wrong class/tag for Value expected: %d,%d got: %d,%d",
- oid_info->value_type->ber_class,
- oid_info->value_type->ber_tag,
- ber_class,
- tag);
+ oid_info->value_type->ber_class, oid_info->value_type->ber_tag,
+ ber_class, tag);
pt = proto_item_add_subtree(pi,ett_decoding_error);
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "Wrong class/tag for SNMP VarBind/value");
return dissect_unknown_ber(actx->pinfo, tvb, value_start, pt);
* 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) {
+int
+dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
+{
proto_item *item = NULL;
guint8 conformance, format;
guint32 enterpriseid, seconds;
/* 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);
+ proto_tree_add_item(tree, hf_snmp_engineid_conform, tvb, offset, 1, ENC_BIG_ENDIAN);
/* 4-byte enterprise number/name */
if (len_remain<4) return offset;
if (len_remain<1) return offset;
format = tvb_get_guint8(tvb, offset);
item = proto_tree_add_uint_format(tree, hf_snmp_engineid_format, tvb, offset, 1, format, "Engine ID Format: %s (%d)",
- val_to_str(format, snmp_engineid_format_vals, "Reserved/Enterprise-specific"), format);
+ val_to_str(format, snmp_engineid_format_vals, "Reserved/Enterprise-specific"), format);
offset+=1;
len_remain-=1;
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);
+ proto_tree_add_item(tree, hf_snmp_engineid_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
len_remain=0;
}
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);
+ proto_tree_add_item(tree, hf_snmp_engineid_ipv6, tvb, offset, 16, ENC_NA);
offset+=16;
len_remain=0;
}
case SNMP_ENGINEID_FORMAT_MACADDRESS:
/* See: https://supportforums.cisco.com/message/3010617#3010617 for details. */
if ((enterpriseid==9)&&(len_remain==7)) {
- proto_tree_add_item(tree, hf_snmp_engineid_cisco_type, tvb, offset, 1, FALSE);
+ proto_tree_add_item(tree, hf_snmp_engineid_cisco_type, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
len_remain--;
}
/* 6-byte MAC address */
if (len_remain==6) {
- proto_tree_add_item(tree, hf_snmp_engineid_mac, tvb, offset, 6, FALSE);
+ proto_tree_add_item(tree, hf_snmp_engineid_mac, tvb, offset, 6, ENC_BIG_ENDIAN);
offset+=6;
len_remain=0;
}
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);
+ proto_tree_add_item(tree, hf_snmp_engineid_text, tvb, offset, len_remain, ENC_ASCII|ENC_NA);
offset+=len_remain;
len_remain=0;
}
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);
+ proto_tree_add_item(tree, hf_snmp_engineid_data, tvb, offset, 4, ENC_NA);
seconds = tvb_get_letohl(tvb, offset+4);
ts.secs = seconds;
ts.nsecs = 0;
proto_tree_add_time_format_value(tree, hf_snmp_engineid_time, tvb, offset+4, 4,
- &ts, "%s",
- abs_time_secs_to_str(seconds, ABSOLUTE_TIME_LOCAL, TRUE));
+ &ts, "%s",
+ abs_time_secs_to_str(seconds, ABSOLUTE_TIME_LOCAL, TRUE));
offset+=8;
len_remain=0;
}
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);
+ proto_tree_add_item(tree, hf_snmp_engineid_data, tvb, offset, len_remain, ENC_NA);
offset+=len_remain;
len_remain=0;
}
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.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);
+ 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) {
+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;
#define CACHE_INSERT(c,a) if (c) { snmp_ue_assoc_t* t = c; c = a; c->next = t; } else { c = a; a->next = NULL; }
-static void renew_ue_cache(void) {
+static void
+renew_ue_cache(void)
+{
localized_ues = NULL;
unlocalized_ues = NULL;
}
-static snmp_ue_assoc_t* localize_ue( snmp_ue_assoc_t* o, const guint8* engine, guint engine_len ) {
+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));
n->engine.data = se_memdup(engine,engine_len);
#define unlocalized_match(a,u,l) \
( a->user.userName.len == l && memcmp( a->user.userName.data, u, l) == 0 )
-static snmp_ue_assoc_t* get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb) {
+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;
if (! ( user_tvb && engine_tvb ) ) return NULL;
- given_username_len = tvb_length_remaining(user_tvb,0);
+ given_username_len = tvb_ensure_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_len = tvb_ensure_length_remaining(engine_tvb,0);
given_engine = ep_tvb_memdup(engine_tvb,0,-1);
for (a = localized_ues; a; a = a->next) {
return NULL;
}
-static gboolean snmp_usm_auth_md5(snmp_usm_params_t* p, guint8** calc_auth_p, guint* calc_auth_len_p, gchar const** error) {
+static gboolean
+snmp_usm_auth_md5(snmp_usm_params_t* p, guint8** calc_auth_p, guint* calc_auth_len_p, gchar const** error)
+{
guint msg_len;
guint8* msg;
guint auth_len;
}
-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_) {
+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_)
+{
guint msg_len;
guint8* msg;
guint auth_len;
return ( memcmp(auth,calc_auth,12) != 0 ) ? FALSE : TRUE;
}
-static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData , gchar const** error _U_) {
+static tvbuff_t*
+snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_)
+{
#ifdef HAVE_LIBGCRYPT
gcry_error_t err;
gcry_cipher_hd_t hd = NULL;
err = gcry_cipher_open(&hd, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CBC, 0);
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
- err = gcry_cipher_setiv(hd, iv, 8);
+ err = gcry_cipher_setiv(hd, iv, 8);
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
err = gcry_cipher_setkey(hd,des_key,8);
#endif
}
-static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData , gchar const** error _U_) {
+static tvbuff_t*
+snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encryptedData _U_, gchar const** error _U_)
+{
#ifdef HAVE_LIBGCRYPT
- gcry_error_t err;
- gcry_cipher_hd_t hd = NULL;
+ gcry_error_t err;
+ gcry_cipher_hd_t hd = NULL;
guint8* cleartext;
guint8* aes_key = p->user_assoc->user.privKey.data; /* first 16 bytes */
err = gcry_cipher_open(&hd, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CFB, 0);
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
- err = gcry_cipher_setiv(hd, iv, 16);
+ err = gcry_cipher_setiv(hd, iv, 16);
if (err != GPG_ERR_NO_ERROR) goto on_gcry_error;
err = gcry_cipher_setkey(hd,aes_key,16);
}
-gboolean check_ScopedPdu(tvbuff_t* tvb) {
+gboolean
+check_ScopedPdu(tvbuff_t* tvb)
+{
int offset;
gint8 class;
gboolean pc;
/*--- Included file: packet-snmp-fn.c ---*/
-#line 1 "packet-snmp-fn.c"
+#line 1 "../../asn1/snmp/packet-snmp-fn.c"
static int
dissect_snmp_EnterpriseOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 64 "snmp.cnf"
+#line 64 "../../asn1/snmp/snmp.cnf"
const gchar* name;
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &enterprise_oid);
static int
dissect_snmp_SpecificTrap(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 48 "snmp.cnf"
+#line 48 "../../asn1/snmp/snmp.cnf"
guint specific_trap;
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
static int
dissect_snmp_Trap_PDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 40 "snmp.cnf"
+#line 40 "../../asn1/snmp/snmp.cnf"
generic_trap = 0;
enterprise_oid = NULL;
{ 4, "trap" },
{ 5, "getBulkRequest" },
{ 6, "informRequest" },
- { 7, "sNMPv2-Trap" },
+ { 7, "snmpV2-trap" },
{ 8, "report" },
{ 0, NULL }
};
{ 4, &hf_snmp_trap , BER_CLASS_CON, 4, BER_FLAGS_NOOWNTAG, dissect_snmp_Trap_PDU },
{ 5, &hf_snmp_getBulkRequest , BER_CLASS_CON, 5, BER_FLAGS_NOOWNTAG, dissect_snmp_GetBulkRequest_PDU },
{ 6, &hf_snmp_informRequest , BER_CLASS_CON, 6, BER_FLAGS_NOOWNTAG, dissect_snmp_InformRequest_PDU },
- { 7, &hf_snmp_sNMPv2_Trap , BER_CLASS_CON, 7, BER_FLAGS_NOOWNTAG, dissect_snmp_SNMPv2_Trap_PDU },
+ { 7, &hf_snmp_snmpV2_trap , BER_CLASS_CON, 7, BER_FLAGS_NOOWNTAG, dissect_snmp_SNMPv2_Trap_PDU },
{ 8, &hf_snmp_report , BER_CLASS_CON, 8, BER_FLAGS_NOOWNTAG, dissect_snmp_Report_PDU },
{ 0, NULL, 0, 0, 0, NULL }
};
static int
dissect_snmp_PDUs(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 28 "snmp.cnf"
+#line 28 "../../asn1/snmp/snmp.cnf"
gint pdu_type=-1;
col_clear(actx->pinfo->cinfo, COL_INFO);
static int
dissect_snmp_SnmpEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 99 "snmp.cnf"
+#line 99 "../../asn1/snmp/snmp.cnf"
tvbuff_t* param_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
static int
dissect_snmp_T_msgAuthoritativeEngineID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 90 "snmp.cnf"
+#line 90 "../../asn1/snmp/snmp.cnf"
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
&usm_p.engine_tvb);
static int
dissect_snmp_T_msgAuthenticationParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 112 "snmp.cnf"
+#line 112 "../../asn1/snmp/snmp.cnf"
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &usm_p.auth_tvb);
if (usm_p.auth_tvb) {
usm_p.auth_item = actx->created_item;
static int
dissect_snmp_T_msgFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 227 "snmp.cnf"
+#line 227 "../../asn1/snmp/snmp.cnf"
tvbuff_t *parameter_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
static int
dissect_snmp_T_msgSecurityParameters(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 170 "snmp.cnf"
+#line 170 "../../asn1/snmp/snmp.cnf"
switch(MsgSecurityModel){
case SNMP_SEC_USM: /* 3 */
static int
dissect_snmp_T_encryptedPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 121 "snmp.cnf"
+#line 121 "../../asn1/snmp/snmp.cnf"
tvbuff_t* crypt_tvb;
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_snmp_encryptedPDU, &crypt_tvb);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
SNMPv3Message_sequence, hf_index, ett_snmp_SNMPv3Message);
-#line 185 "snmp.cnf"
+#line 185 "../../asn1/snmp/snmp.cnf"
if( usm_p.authenticated
&& usm_p.user_assoc
/*--- End of included file: packet-snmp-fn.c ---*/
-#line 1477 "packet-snmp-template.c"
+#line 1496 "../../asn1/snmp/packet-snmp-template.c"
guint
dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
- proto_tree *tree, int proto, gint ett, gboolean is_tcp)
+ proto_tree *tree, int proto, gint ett, gboolean is_tcp)
{
guint length_remaining;
* 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
+ * boundaries? We require at least 6 bytes for the
* header, which allows for a 4-byte length (ASN.1
* BER).
*/
if (length_remaining < 6) {
+ /*
+ * Yes. Tell the TCP dissector where the data
+ * for this message starts in the data it handed
+ * us and that we need "some more data." Don't tell
+ * it exactly how many bytes we need because if/when
+ * we ask for even more (after the header) that will
+ * break reassembly.
+ */
pinfo->desegment_offset = offset;
- pinfo->desegment_len = 6 - length_remaining;
+ pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
/*
* Return 0, which means "I didn't dissect anything
if (tree) {
item = proto_tree_add_item(tree, proto, tvb, start_offset,
- message_length, FALSE);
+ message_length, ENC_BIG_ENDIAN);
snmp_tree = proto_item_add_subtree(item, ett);
}
- switch (version){
+ switch (version) {
case 0: /* v1 */
case 1: /* v2c */
offset = dissect_snmp_Message(FALSE , tvb, start_offset, &asn1_ctx, snmp_tree, -1);
if((!is_tcp) && (length_remaining > (guint)offset)) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle, next_tvb, pinfo, tree);
- }
- else{
+ } else {
next_tvb_call(&var_list, pinfo, tree, NULL, data_handle);
}
*/
/* 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)){
+ 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(tvb, offset, &tmp_length, &tmp_ind);
- /* if(tmp_length!=(guint32)tvb_reported_length_remaining(tvb, offset)){
+ /* if(tmp_length!=(guint32)tvb_reported_length_remaining(tvb, offset)) {
* Losen the heuristic a bit to handle the case where data has intentionally
* been added after the snmp PDU ( UDP case)
*/
- if ( pinfo->ptype == PT_UDP ){
- if(tmp_length>(guint32)tvb_reported_length_remaining(tvb, offset)){
+ if ( pinfo->ptype == PT_UDP ) {
+ if(tmp_length>(guint32)tvb_reported_length_remaining(tvb, offset)) {
return 0;
}
}else{
- if(tmp_length!=(guint32)tvb_reported_length_remaining(tvb, offset)){
+ 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)){
+ 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) ? */
if (pinfo->destport == UDP_PORT_SNMP) {
conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_UDP,
pinfo->srcport, 0, NO_PORT_B);
- if( (conversation == NULL) || (conversation->dissector_handle!=snmp_handle) ){
+ if( (conversation == NULL) || (conversation->dissector_handle!=snmp_handle) ) {
conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_UDP,
pinfo->srcport, 0, NO_PORT2);
conversation_set_dissector(conversation, snmp_handle);
return dissect_snmp_pdu(tvb, 0, pinfo, tree, proto_snmp, ett_snmp, FALSE);
}
+
static void
dissect_snmp_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
while (tvb_reported_length_remaining(tvb, offset) > 0) {
message_len = dissect_snmp_pdu(tvb, 0, pinfo, tree,
- proto_snmp, ett_snmp, TRUE);
+ proto_snmp, ett_snmp, TRUE);
if (message_len == 0) {
/*
* We don't have all the data for that message,
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMUX");
if (tree) {
- item = proto_tree_add_item(tree, proto_smux, tvb, 0, -1, FALSE);
+ item = proto_tree_add_item(tree, proto_smux, tvb, 0, -1, ENC_BIG_ENDIAN);
smux_tree = proto_item_add_subtree(item, ett_smux);
}
- dissect_SMUX_PDUs_PDU(tvb, pinfo, tree);
+ dissect_SMUX_PDUs_PDU(tvb, pinfo, smux_tree);
}
MD5 Password to Key Algorithm
from RFC 3414 A.2.1
*/
-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_md5(const guint8 *password, guint passwordlen,
+ const guint8 *engineID, guint engineLength,
+ guint8 *key)
+{
md5_state_t MD;
guint8 *cp, password_buf[64];
guint32 password_index = 0;
/*****************************************************/
/* 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 */
+ /* We ignore invalid engineLengths here. More strict */
+ /* checking is done in snmp_users_update_cb. */
/*****************************************************/
md5_init(&MD);
SHA1 Password to Key Algorithm COPIED from RFC 3414 A.2.2
*/
-static void snmp_usm_password_to_key_sha1(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)
+{
sha1_context SH;
- guint8 *cp, password_buf[72];
+ guint8 *cp, password_buf[64];
guint32 password_index = 0;
guint32 count = 0, i;
/*****************************************************/
/* 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 */
+ /* We ignore invalid engineLengths here. More strict */
+ /* checking is done in snmp_users_update_cb. */
/*****************************************************/
- memcpy(password_buf, key, 20);
- memcpy(password_buf+20, engineID, engineLength);
- memcpy(password_buf+20+engineLength, key, 20);
sha1_starts(&SH);
- sha1_update(&SH, password_buf, 40+engineLength);
+ sha1_update(&SH, key, 20);
+ sha1_update(&SH, engineID, engineLength);
+ sha1_update(&SH, key, 20);
sha1_finish(&SH, key);
return;
}
-static void process_prefs(void) {
+static void
+process_prefs(void)
+{
}
-static void* snmp_users_copy_cb(void* dest, const void* orig, unsigned len _U_) {
+static void*
+snmp_users_copy_cb(void* dest, const void* orig, size_t len _U_)
+{
const snmp_ue_assoc_t* o = orig;
snmp_ue_assoc_t* d = dest;
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) {
+static void
+snmp_users_free_cb(void* p)
+{
snmp_ue_assoc_t* ue = p;
g_free(ue->user.userName.data);
g_free(ue->user.authPassword.data);
g_free(ue->engine.data);
}
-static void snmp_users_update_cb(void* p _U_, const char** err) {
+static void
+snmp_users_update_cb(void* p _U_, const char** err)
+{
snmp_ue_assoc_t* ue = p;
GString* es = g_string_new("");
unsigned i;
-
+
*err = NULL;
if (num_ueas == 0)
for (i=0; i<num_ueas-1; i++) {
snmp_ue_assoc_t* u = &(ueas[i]);
-
-
+
+ /* RFC 3411 section 5 */
+ if ((u->engine.len > 0) && (u->engine.len < 5 || u->engine.len > 32)) {
+ g_string_append_printf(es, "Invalid engineId length (%u). Must be between 5 and 32 (10 and 64 hex digits)\n", u->engine.len);
+ }
+
+
if ( u->user.userName.len == ue->user.userName.len
&& u->engine.len == ue->engine.len ) {
-
+
if (u->engine.len > 0 && memcmp( u->engine.data, ue->engine.data, u->engine.len ) == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
/* XXX: make a string for the engineId */
- g_string_append_printf(es,"duplicate key (userName='%s')\n",ue->user.userName.data);
+ g_string_append_printf(es,"Duplicate key (userName='%s')\n",ue->user.userName.data);
}
}
-
+
if (u->engine.len == 0) {
if ( memcmp( u->user.userName.data, ue->user.userName.data, ue->user.userName.len ) == 0 ) {
- g_string_append_printf(es,"duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
+ g_string_append_printf(es,"Duplicate key (userName='%s' engineId=NONE)\n",ue->user.userName.data);
}
}
}
}
-
+
if (es->len) {
- g_string_truncate(es,es->len-2);
+ g_string_truncate(es,es->len-1);
*err = ep_strdup(es->str);
}
-
+
g_string_free(es,TRUE);
return;
UAT_VS_DEF(snmp_users,priv_proto,snmp_ue_assoc_t,0,"DES")
static void *
-snmp_specific_trap_copy_cb(void *dest, const void *orig, unsigned len _U_)
+snmp_specific_trap_copy_cb(void *dest, const void *orig, size_t len _U_)
{
snmp_st_assoc_t *u = dest;
const snmp_st_assoc_t *o = orig;
"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, NULL, HFILL }},
+ "Engine Enterprise ID", "snmp.engineid.enterprise", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
+ &sminmpec_values_ext, 0, NULL, HFILL }},
{ &hf_snmp_engineid_format, {
"Engine ID Format", "snmp.engineid.format", FT_UINT8, BASE_DEC,
VALS(snmp_engineid_format_vals), 0, NULL, HFILL }},
{ &hf_snmp_decryptedPDU, {
"Decrypted ScopedPDU", "snmp.decrypted_pdu", FT_BYTES, BASE_NONE,
NULL, 0, "Decrypted PDU", HFILL }},
- { &hf_snmp_noSuchObject, { "noSuchObject", "snmp.noSuchObject", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_noSuchInstance, { "noSuchInstance", "snmp.noSuchInstance", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_endOfMibView, { "endOfMibView", "snmp.endOfMibView", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_unSpecified, { "unSpecified", "snmp.unSpecified", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
-
- { &hf_snmp_integer32_value, { "Value (Integer32)", "snmp.value.int", FT_INT64, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_snmp_octetstring_value, { "Value (OctetString)", "snmp.value.octets", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_oid_value, { "Value (OID)", "snmp.value.oid", FT_OID, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_null_value, { "Value (Null)", "snmp.value.null", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_ipv4_value, { "Value (IpAddress)", "snmp.value.ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_ipv6_value, { "Value (IpAddress)", "snmp.value.ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_anyaddress_value, { "Value (IpAddress)", "snmp.value.addr", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_unsigned32_value, { "Value (Unsigned32)", "snmp.value.u32", FT_INT64, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_snmp_gauge32_value, { "Value (Gauge32)", "snmp.value.g32", FT_INT64, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_snmp_unknown_value, { "Value (Unknown)", "snmp.value.unk", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_counter_value, { "Value (Counter32)", "snmp.value.counter", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_snmp_big_counter_value, { "Value (Counter64)", "snmp.value.counter", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_snmp_nsap_value, { "Value (NSAP)", "snmp.value.nsap", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_snmp_timeticks_value, { "Value (Timeticks)", "snmp.value.timeticks", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
- { &hf_snmp_opaque_value, { "Value (Opaque)", "snmp.value.opaque", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_objectname, { "Object Name", "snmp.name", FT_OID, BASE_NONE, NULL, 0, NULL, HFILL }},
- { &hf_snmp_scalar_instance_index, { "Scalar Instance Index", "snmp.name.index", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
+ { &hf_snmp_noSuchObject, {
+ "noSuchObject", "snmp.noSuchObject", FT_NONE, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_noSuchInstance, {
+ "noSuchInstance", "snmp.noSuchInstance", FT_NONE, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_endOfMibView, {
+ "endOfMibView", "snmp.endOfMibView", FT_NONE, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_unSpecified, {
+ "unSpecified", "snmp.unSpecified", FT_NONE, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+
+ { &hf_snmp_integer32_value, {
+ "Value (Integer32)", "snmp.value.int", FT_INT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_octetstring_value, {
+ "Value (OctetString)", "snmp.value.octets", FT_BYTES, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_oid_value, {
+ "Value (OID)", "snmp.value.oid", FT_OID, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_null_value, {
+ "Value (Null)", "snmp.value.null", FT_NONE, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_ipv4_value, {
+ "Value (IpAddress)", "snmp.value.ipv4", FT_IPv4, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_ipv6_value, {
+ "Value (IpAddress)", "snmp.value.ipv6", FT_IPv6, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_anyaddress_value, {
+ "Value (IpAddress)", "snmp.value.addr", FT_BYTES, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_unsigned32_value, {
+ "Value (Unsigned32)", "snmp.value.u32", FT_INT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_gauge32_value, {
+ "Value (Gauge32)", "snmp.value.g32", FT_INT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_unknown_value, {
+ "Value (Unknown)", "snmp.value.unk", FT_BYTES, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_counter_value, {
+ "Value (Counter32)", "snmp.value.counter", FT_UINT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_big_counter_value, {
+ "Value (Counter64)", "snmp.value.counter", FT_UINT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_nsap_value, {
+ "Value (NSAP)", "snmp.value.nsap", FT_UINT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_timeticks_value, {
+ "Value (Timeticks)", "snmp.value.timeticks", FT_UINT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_opaque_value, {
+ "Value (Opaque)", "snmp.value.opaque", FT_BYTES, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_objectname, {
+ "Object Name", "snmp.name", FT_OID, BASE_NONE,
+ NULL, 0, NULL, HFILL }},
+ { &hf_snmp_scalar_instance_index, {
+ "Scalar Instance Index", "snmp.name.index", FT_UINT64, BASE_DEC,
+ NULL, 0, NULL, HFILL }},
/*--- Included file: packet-snmp-hfarr.c ---*/
-#line 1 "packet-snmp-hfarr.c"
+#line 1 "../../asn1/snmp/packet-snmp-hfarr.c"
{ &hf_snmp_SMUX_PDUs_PDU,
{ "SMUX-PDUs", "snmp.SMUX_PDUs",
FT_UINT32, BASE_DEC, VALS(snmp_SMUX_PDUs_vals), 0,
{ "informRequest", "snmp.informRequest",
FT_NONE, BASE_NONE, NULL, 0,
"InformRequest_PDU", HFILL }},
- { &hf_snmp_sNMPv2_Trap,
- { "sNMPv2-Trap", "snmp.sNMPv2_Trap",
+ { &hf_snmp_snmpV2_trap,
+ { "snmpV2-trap", "snmp.snmpV2_trap",
FT_NONE, BASE_NONE, NULL, 0,
"SNMPv2_Trap_PDU", HFILL }},
{ &hf_snmp_report,
NULL, HFILL }},
/*--- End of included file: packet-snmp-hfarr.c ---*/
-#line 2067 "packet-snmp-template.c"
+#line 2148 "../../asn1/snmp/packet-snmp-template.c"
};
/* List of subtrees */
&ett_decoding_error,
/*--- Included file: packet-snmp-ettarr.c ---*/
-#line 1 "packet-snmp-ettarr.c"
+#line 1 "../../asn1/snmp/packet-snmp-ettarr.c"
&ett_snmp_Message,
&ett_snmp_Messagev2u,
&ett_snmp_T_datav2u,
&ett_snmp_RReqPDU_U,
/*--- End of included file: packet-snmp-ettarr.c ---*/
-#line 2083 "packet-snmp-template.c"
+#line 2164 "../../asn1/snmp/packet-snmp-template.c"
};
module_t *snmp_module;
};
uat_t *assocs_uat = uat_new("SNMP Users",
- sizeof(snmp_ue_assoc_t),
- "snmp_users",
- TRUE,
- (void*)&ueas,
- &num_ueas,
- UAT_CAT_CRYPTO,
- "ChSNMPUsersSection",
- snmp_users_copy_cb,
- snmp_users_update_cb,
- snmp_users_free_cb,
- renew_ue_cache,
- users_fields);
+ sizeof(snmp_ue_assoc_t),
+ "snmp_users",
+ TRUE,
+ (void*)&ueas,
+ &num_ueas,
+ UAT_CAT_CRYPTO,
+ "ChSNMPUsersSection",
+ snmp_users_copy_cb,
+ snmp_users_update_cb,
+ snmp_users_free_cb,
+ renew_ue_cache,
+ users_fields);
static uat_field_t specific_traps_flds[] = {
UAT_FLD_CSTRING(specific_traps,enterprise,"Enterprise OID","Enterprise Object Identifier"),
proto_register_subtree_array(ett, array_length(ett));
- /* Register configuration preferences */
- snmp_module = prefs_register_protocol(proto_snmp, process_prefs);
- 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);
+ /* Register configuration preferences */
+ snmp_module = prefs_register_protocol(proto_snmp, process_prefs);
+ 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);
- prefs_register_obsolete_preference(snmp_module, "mib_modules");
- prefs_register_obsolete_preference(snmp_module, "users_file");
+ prefs_register_obsolete_preference(snmp_module, "mib_modules");
+ prefs_register_obsolete_preference(snmp_module, "users_file");
- prefs_register_bool_preference(snmp_module, "desegment",
- "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.",
- &snmp_desegment);
+ prefs_register_bool_preference(snmp_module, "desegment",
+ "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.",
+ &snmp_desegment);
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);
+ "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);
prefs_register_uat_preference(snmp_module, "users_table",
"Users Table",
#ifdef HAVE_LIBSMI
prefs_register_static_text_preference(snmp_module, "info_mibs",
- "MIB settings can be changed in the Name Resolution preferences",
- "MIB settings can be changed in the Name Resolution preferences");
+ "MIB settings can be changed in the Name Resolution preferences",
+ "MIB settings can be changed in the Name Resolution preferences");
#endif
- value_sub_dissectors_table = register_dissector_table("snmp.variable_oid","SNMP Variable OID", FT_STRING, BASE_NONE);
+ value_sub_dissectors_table = register_dissector_table("snmp.variable_oid","SNMP Variable OID", FT_STRING, BASE_NONE);
- register_init_routine(renew_ue_cache);
+ register_init_routine(renew_ue_cache);
+ register_ber_syntax_dissector("SNMP", proto_snmp, dissect_snmp_tcp);
}
snmp_handle = find_dissector("snmp");
- dissector_add("udp.port", UDP_PORT_SNMP, snmp_handle);
- dissector_add("udp.port", UDP_PORT_SNMP_TRAP, snmp_handle);
- dissector_add("udp.port", UDP_PORT_SNMP_PATROL, 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);
- dissector_add("hpext.dxsap", HPEXT_SNMP, snmp_handle);
+ dissector_add_uint("udp.port", UDP_PORT_SNMP, snmp_handle);
+ dissector_add_uint("udp.port", UDP_PORT_SNMP_TRAP, snmp_handle);
+ dissector_add_uint("udp.port", UDP_PORT_SNMP_PATROL, snmp_handle);
+ dissector_add_uint("ethertype", ETHERTYPE_SNMP, snmp_handle);
+ dissector_add_uint("ipx.socket", IPX_SOCKET_SNMP_AGENT, snmp_handle);
+ dissector_add_uint("ipx.socket", IPX_SOCKET_SNMP_SINK, snmp_handle);
+ dissector_add_uint("hpext.dxsap", HPEXT_SNMP, snmp_handle);
snmp_tcp_handle = create_dissector_handle(dissect_snmp_tcp, proto_snmp);
- dissector_add("tcp.port", TCP_PORT_SNMP, snmp_tcp_handle);
- dissector_add("tcp.port", TCP_PORT_SNMP_TRAP, snmp_tcp_handle);
+ dissector_add_uint("tcp.port", TCP_PORT_SNMP, snmp_tcp_handle);
+ dissector_add_uint("tcp.port", TCP_PORT_SNMP_TRAP, snmp_tcp_handle);
data_handle = find_dissector("data");
- register_ber_syntax_dissector("SNMP", proto_snmp, dissect_snmp_tcp);
-
/*
* Process preference settings.
*
dissector_handle_t smux_handle;
smux_handle = create_dissector_handle(dissect_smux, proto_smux);
- dissector_add("tcp.port", TCP_PORT_SMUX, smux_handle);
+ dissector_add_uint("tcp.port", TCP_PORT_SMUX, smux_handle);
}
-
-