Fix various typos and spelling errors.
[obnox/wireshark/wip.git] / epan / dissectors / packet-snmp.c
index 9522ead85f1cc8ad021bdd4edf785d3510666f0e..cd2549c9869f0d2edb30d8543e9bfa314d350d2b 100644 (file)
@@ -58,7 +58,6 @@
 # include "config.h"
 #endif
 
-#include <stdio.h>
 #include <string.h>
 #include <ctype.h>
 
@@ -193,6 +192,7 @@ static int hf_snmp_engineid_enterprise = -1;
 static int hf_snmp_engineid_format = -1;
 static int hf_snmp_engineid_ipv4 = -1;
 static int hf_snmp_engineid_ipv6 = -1;
+static int hf_snmp_engineid_cisco_type = -1;
 static int hf_snmp_engineid_mac = -1;
 static int hf_snmp_engineid_text = -1;
 static int hf_snmp_engineid_time = -1;
@@ -479,12 +479,10 @@ snmp_lookup_specific_trap (guint specific_trap)
 
  */
 
-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;
@@ -498,7 +496,7 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
        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;
@@ -522,7 +520,7 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
                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");
@@ -541,7 +539,7 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
                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");
@@ -581,9 +579,12 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
        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);
        }
 
@@ -852,10 +853,31 @@ indexing_done:
        } else {
                switch(ber_class|(tag<<4)) {
                        case BER_CLASS_UNI|(BER_UNI_TAG_INTEGER<<4):
-                               max_len = 4; min_len = 1;
-                               if (value_len > (guint)max_len && value_len < (guint)min_len) format_error = BER_WRONG_LENGTH;
-                               hfid = hf_snmp_integer32_value;
-                               break;
+                       {
+                               gint64 val=0;
+                               unsigned 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) {
+                                               val=-1;
+                                       }
+                                       for(i=0;i<value_len;i++) {
+                                               val=(val<<8)|tvb_get_guint8(tvb, offset);
+                                               offset++;
+                                       }
+                               }
+                               proto_tree_add_int64(pt_varbind, hf_snmp_integer32_value, tvb,value_offset,value_len, val);
+
+                               goto already_added;
+                       }
                        case BER_CLASS_UNI|(BER_UNI_TAG_OCTETSTRING<<4):
                                hfid = hf_snmp_octetstring_value;
                                break;
@@ -902,10 +924,12 @@ indexing_done:
                                break;
                }
 
+               pi_value = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE);
                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;
        }
 
@@ -923,16 +947,14 @@ set_label:
 
        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) {
@@ -955,9 +977,7 @@ set_label:
                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);
@@ -965,10 +985,8 @@ set_label:
                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);
@@ -1005,11 +1023,22 @@ static const value_string snmp_engineid_format_vals[] = {
        { 0,    NULL }
 };
 
+#define SNMP_ENGINEID_CISCO_AGENT 0x00
+#define SNMP_ENGINEID_CISCO_MANAGER 0x01
+
+static const value_string snmp_engineid_cisco_type_vals[] = {
+       { SNMP_ENGINEID_CISCO_AGENT,    "Agent" },
+       { SNMP_ENGINEID_CISCO_MANAGER,  "Manager" },
+       { 0,    NULL }
+};
+
 /*
  * 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;
@@ -1051,7 +1080,7 @@ int dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
       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;
 
@@ -1073,6 +1102,12 @@ int dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
        }
        break;
       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);
+         offset++;
+         len_remain--;
+       }
        /* 6-byte MAC address */
        if (len_remain==6) {
          proto_tree_add_item(tree, hf_snmp_engineid_mac, tvb, offset, 6, FALSE);
@@ -1099,8 +1134,8 @@ int dissect_snmp_engineid(proto_tree *tree, tvbuff_t *tvb, int offset, int len)
            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));
+                                            &ts, "%s",
+                                            abs_time_secs_to_str(seconds, ABSOLUTE_TIME_LOCAL, TRUE));
            offset+=8;
            len_remain=0;
          }
@@ -1132,21 +1167,23 @@ static void set_ue_keys(snmp_ue_assoc_t* n ) {
        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;
@@ -1176,13 +1213,15 @@ static snmp_ue_assoc_t* ue_se_dup(snmp_ue_assoc_t* o) {
 
 #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;
+
        if (num_ueas) {
                guint i;
 
-               localized_ues = NULL;
-               unlocalized_ues = NULL;
-
                for(i = 0; i < num_ueas; i++) {
                        snmp_ue_assoc_t* a = ue_se_dup(&(ueas[i]));
 
@@ -1194,14 +1233,13 @@ static void renew_ue_cache(void) {
                        }
 
                }
-       } else {
-               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);
@@ -1222,7 +1260,9 @@ static snmp_ue_assoc_t* localize_ue( snmp_ue_assoc_t* o, const guint8* engine, g
 #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;
@@ -1255,7 +1295,9 @@ static snmp_ue_assoc_t* get_user_assoc(tvbuff_t* engine_tvb, tvbuff_t* user_tvb)
        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;
@@ -1313,7 +1355,9 @@ static gboolean snmp_usm_auth_md5(snmp_usm_params_t* p, guint8** calc_auth_p, gu
 }
 
 
-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;
@@ -1370,7 +1414,9 @@ static gboolean snmp_usm_auth_sha1(snmp_usm_params_t* p _U_, guint8** calc_auth_
        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;
@@ -1417,7 +1463,7 @@ static tvbuff_t* snmp_usm_priv_des(snmp_usm_params_t* p _U_, tvbuff_t* encrypted
        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);
@@ -1442,10 +1488,12 @@ on_gcry_error:
 #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 */
@@ -1480,7 +1528,7 @@ static tvbuff_t* snmp_usm_priv_aes(snmp_usm_params_t* p _U_, tvbuff_t* encrypted
        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);
@@ -1506,7 +1554,9 @@ on_gcry_error:
 }
 
 
-gboolean check_ScopedPdu(tvbuff_t* tvb) {
+gboolean
+check_ScopedPdu(tvbuff_t* tvb)
+{
        int offset;
        gint8 class;
        gboolean pc;
@@ -2663,12 +2713,12 @@ static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro
 
 
 /*--- End of included file: packet-snmp-fn.c ---*/
-#line 1443 "packet-snmp-template.c"
+#line 1493 "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;
@@ -2727,7 +2777,7 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
                 * 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).
                 */
@@ -2793,11 +2843,11 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
 
        if (tree) {
                item = proto_tree_add_item(tree, proto, tvb, start_offset,
-                   message_length, FALSE);
+                                          message_length, FALSE);
                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);
@@ -2826,8 +2876,7 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
        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);
        }
 
@@ -2856,27 +2905,27 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         */
        /* 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)){
+       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) ? */
@@ -2903,7 +2952,7 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        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);
@@ -2912,6 +2961,7 @@ dissect_snmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
        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)
 {
@@ -2920,7 +2970,7 @@ 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,
@@ -2956,11 +3006,11 @@ dissect_smux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *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;
@@ -3008,11 +3058,11 @@ static void snmp_usm_password_to_key_md5(const guint8 *password,
    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];
        guint32      password_index = 0;
@@ -3054,10 +3104,14 @@ static void snmp_usm_password_to_key_sha1(const guint8 *password,
  }
 
 
-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;
 
@@ -3086,11 +3140,13 @@ static void* snmp_users_copy_cb(void* dest, const void* orig, unsigned len _U_)
 
        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);
@@ -3100,30 +3156,36 @@ static void snmp_users_free_cb(void* p) {
        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)
+               /* Nothing to update */
+               return;
+
        if (! ue->user.userName.len)
                g_string_append_printf(es,"no userName\n");
 
        for (i=0; i<num_ueas-1; i++) {
                snmp_ue_assoc_t* u = &(ueas[i]);
-               
-               
+
+
                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);
                                }
                        }
-                       
+
                        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);
@@ -3131,12 +3193,12 @@ static void snmp_users_update_cb(void* p _U_, const char** err) {
                        }
                }
        }
-       
+
        if (es->len) {
                g_string_truncate(es,es->len-2);
                *err = ep_strdup(es->str);
        }
-       
+
        g_string_free(es,TRUE);
 
        return;
@@ -3151,7 +3213,7 @@ 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")
 
 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;
@@ -3193,8 +3255,8 @@ void proto_register_snmp(void) {
                    "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 }},
@@ -3204,6 +3266,9 @@ void proto_register_snmp(void) {
                { &hf_snmp_engineid_ipv6, {
                    "Engine ID Data: IPv6 address", "snmp.engineid.ipv6", FT_IPv6, BASE_NONE,
                    NULL, 0, NULL, HFILL }},
+               { &hf_snmp_engineid_cisco_type, {
+                   "Engine ID Data: Cisco type", "snmp.engineid.cisco.type", FT_UINT8, BASE_NONE,
+                   VALS(snmp_engineid_cisco_type_vals), 0, NULL, HFILL }},
                { &hf_snmp_engineid_mac, {
                    "Engine ID Data: MAC address", "snmp.engineid.mac", FT_ETHER, BASE_NONE,
                    NULL, 0, NULL, HFILL }},
@@ -3222,28 +3287,70 @@ void proto_register_snmp(void) {
                { &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 }},
 
 
 
@@ -3252,266 +3359,266 @@ void proto_register_snmp(void) {
     { &hf_snmp_SMUX_PDUs_PDU,
       { "SMUX-PDUs", "snmp.SMUX_PDUs",
         FT_UINT32, BASE_DEC, VALS(snmp_SMUX_PDUs_vals), 0,
-        "snmp.SMUX_PDUs", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_version,
       { "version", "snmp.version",
         FT_INT32, BASE_DEC, VALS(snmp_Version_vals), 0,
-        "snmp.Version", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_community,
       { "community", "snmp.community",
         FT_STRING, BASE_NONE, NULL, 0,
-        "snmp.Community", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_data,
       { "data", "snmp.data",
         FT_UINT32, BASE_DEC, VALS(snmp_PDUs_vals), 0,
-        "snmp.PDUs", HFILL }},
+        "PDUs", HFILL }},
     { &hf_snmp_parameters,
       { "parameters", "snmp.parameters",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.OCTET_STRING", HFILL }},
+        "OCTET_STRING", HFILL }},
     { &hf_snmp_datav2u,
       { "datav2u", "snmp.datav2u",
         FT_UINT32, BASE_DEC, VALS(snmp_T_datav2u_vals), 0,
-        "snmp.T_datav2u", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_v2u_plaintext,
       { "plaintext", "snmp.plaintext",
         FT_UINT32, BASE_DEC, VALS(snmp_PDUs_vals), 0,
-        "snmp.PDUs", HFILL }},
+        "PDUs", HFILL }},
     { &hf_snmp_encrypted,
       { "encrypted", "snmp.encrypted",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.OCTET_STRING", HFILL }},
+        "OCTET_STRING", HFILL }},
     { &hf_snmp_msgAuthoritativeEngineID,
       { "msgAuthoritativeEngineID", "snmp.msgAuthoritativeEngineID",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.T_msgAuthoritativeEngineID", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgAuthoritativeEngineBoots,
       { "msgAuthoritativeEngineBoots", "snmp.msgAuthoritativeEngineBoots",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.T_msgAuthoritativeEngineBoots", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgAuthoritativeEngineTime,
       { "msgAuthoritativeEngineTime", "snmp.msgAuthoritativeEngineTime",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.T_msgAuthoritativeEngineTime", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgUserName,
       { "msgUserName", "snmp.msgUserName",
         FT_STRING, BASE_NONE, NULL, 0,
-        "snmp.T_msgUserName", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgAuthenticationParameters,
       { "msgAuthenticationParameters", "snmp.msgAuthenticationParameters",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.T_msgAuthenticationParameters", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgPrivacyParameters,
       { "msgPrivacyParameters", "snmp.msgPrivacyParameters",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.T_msgPrivacyParameters", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgVersion,
       { "msgVersion", "snmp.msgVersion",
         FT_INT32, BASE_DEC, VALS(snmp_Version_vals), 0,
-        "snmp.Version", HFILL }},
+        "Version", HFILL }},
     { &hf_snmp_msgGlobalData,
       { "msgGlobalData", "snmp.msgGlobalData",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.HeaderData", HFILL }},
+        "HeaderData", HFILL }},
     { &hf_snmp_msgSecurityParameters,
       { "msgSecurityParameters", "snmp.msgSecurityParameters",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.T_msgSecurityParameters", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgData,
       { "msgData", "snmp.msgData",
         FT_UINT32, BASE_DEC, VALS(snmp_ScopedPduData_vals), 0,
-        "snmp.ScopedPduData", HFILL }},
+        "ScopedPduData", HFILL }},
     { &hf_snmp_msgID,
       { "msgID", "snmp.msgID",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.INTEGER_0_2147483647", HFILL }},
+        "INTEGER_0_2147483647", HFILL }},
     { &hf_snmp_msgMaxSize,
       { "msgMaxSize", "snmp.msgMaxSize",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.INTEGER_484_2147483647", HFILL }},
+        "INTEGER_484_2147483647", HFILL }},
     { &hf_snmp_msgFlags,
       { "msgFlags", "snmp.msgFlags",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.T_msgFlags", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_msgSecurityModel,
       { "msgSecurityModel", "snmp.msgSecurityModel",
         FT_UINT32, BASE_DEC, VALS(sec_models), 0,
-        "snmp.T_msgSecurityModel", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_plaintext,
       { "plaintext", "snmp.plaintext",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.ScopedPDU", HFILL }},
+        "ScopedPDU", HFILL }},
     { &hf_snmp_encryptedPDU,
       { "encryptedPDU", "snmp.encryptedPDU",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.T_encryptedPDU", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_contextEngineID,
       { "contextEngineID", "snmp.contextEngineID",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.SnmpEngineID", HFILL }},
+        "SnmpEngineID", HFILL }},
     { &hf_snmp_contextName,
       { "contextName", "snmp.contextName",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.OCTET_STRING", HFILL }},
+        "OCTET_STRING", HFILL }},
     { &hf_snmp_get_request,
       { "get-request", "snmp.get_request",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.GetRequest_PDU", HFILL }},
+        "GetRequest_PDU", HFILL }},
     { &hf_snmp_get_next_request,
       { "get-next-request", "snmp.get_next_request",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.GetNextRequest_PDU", HFILL }},
+        "GetNextRequest_PDU", HFILL }},
     { &hf_snmp_get_response,
       { "get-response", "snmp.get_response",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.GetResponse_PDU", HFILL }},
+        "GetResponse_PDU", HFILL }},
     { &hf_snmp_set_request,
       { "set-request", "snmp.set_request",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.SetRequest_PDU", HFILL }},
+        "SetRequest_PDU", HFILL }},
     { &hf_snmp_trap,
       { "trap", "snmp.trap",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.Trap_PDU", HFILL }},
+        "Trap_PDU", HFILL }},
     { &hf_snmp_getBulkRequest,
       { "getBulkRequest", "snmp.getBulkRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.GetBulkRequest_PDU", HFILL }},
+        "GetBulkRequest_PDU", HFILL }},
     { &hf_snmp_informRequest,
       { "informRequest", "snmp.informRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.InformRequest_PDU", HFILL }},
+        "InformRequest_PDU", HFILL }},
     { &hf_snmp_sNMPv2_Trap,
       { "sNMPv2-Trap", "snmp.sNMPv2_Trap",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.SNMPv2_Trap_PDU", HFILL }},
+        "SNMPv2_Trap_PDU", HFILL }},
     { &hf_snmp_report,
       { "report", "snmp.report",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.Report_PDU", HFILL }},
+        "Report_PDU", HFILL }},
     { &hf_snmp_request_id,
       { "request-id", "snmp.request_id",
         FT_INT32, BASE_DEC, NULL, 0,
-        "snmp.INTEGER", HFILL }},
+        "INTEGER", HFILL }},
     { &hf_snmp_error_status,
       { "error-status", "snmp.error_status",
         FT_INT32, BASE_DEC, VALS(snmp_T_error_status_vals), 0,
-        "snmp.T_error_status", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_error_index,
       { "error-index", "snmp.error_index",
         FT_INT32, BASE_DEC, NULL, 0,
-        "snmp.INTEGER", HFILL }},
+        "INTEGER", HFILL }},
     { &hf_snmp_variable_bindings,
       { "variable-bindings", "snmp.variable_bindings",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.VarBindList", HFILL }},
+        "VarBindList", HFILL }},
     { &hf_snmp_bulkPDU_request_id,
       { "request-id", "snmp.request_id",
         FT_INT32, BASE_DEC, NULL, 0,
-        "snmp.Integer32", HFILL }},
+        "Integer32", HFILL }},
     { &hf_snmp_non_repeaters,
       { "non-repeaters", "snmp.non_repeaters",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.INTEGER_0_2147483647", HFILL }},
+        "INTEGER_0_2147483647", HFILL }},
     { &hf_snmp_max_repetitions,
       { "max-repetitions", "snmp.max_repetitions",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.INTEGER_0_2147483647", HFILL }},
+        "INTEGER_0_2147483647", HFILL }},
     { &hf_snmp_enterprise,
       { "enterprise", "snmp.enterprise",
         FT_OID, BASE_NONE, NULL, 0,
-        "snmp.EnterpriseOID", HFILL }},
+        "EnterpriseOID", HFILL }},
     { &hf_snmp_agent_addr,
       { "agent-addr", "snmp.agent_addr",
         FT_IPv4, BASE_NONE, NULL, 0,
-        "snmp.NetworkAddress", HFILL }},
+        "NetworkAddress", HFILL }},
     { &hf_snmp_generic_trap,
       { "generic-trap", "snmp.generic_trap",
         FT_INT32, BASE_DEC, VALS(snmp_GenericTrap_vals), 0,
-        "snmp.GenericTrap", HFILL }},
+        "GenericTrap", HFILL }},
     { &hf_snmp_specific_trap,
       { "specific-trap", "snmp.specific_trap",
         FT_INT32, BASE_DEC, NULL, 0,
-        "snmp.SpecificTrap", HFILL }},
+        "SpecificTrap", HFILL }},
     { &hf_snmp_time_stamp,
       { "time-stamp", "snmp.time_stamp",
         FT_UINT32, BASE_DEC, NULL, 0,
-        "snmp.TimeTicks", HFILL }},
+        "TimeTicks", HFILL }},
     { &hf_snmp_name,
       { "name", "snmp.name",
         FT_OID, BASE_NONE, NULL, 0,
-        "snmp.ObjectName", HFILL }},
+        "ObjectName", HFILL }},
     { &hf_snmp_valueType,
       { "valueType", "snmp.valueType",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.NULL", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_VarBindList_item,
       { "VarBind", "snmp.VarBind",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.VarBind", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_open,
       { "open", "snmp.open",
         FT_UINT32, BASE_DEC, VALS(snmp_OpenPDU_vals), 0,
-        "snmp.OpenPDU", HFILL }},
+        "OpenPDU", HFILL }},
     { &hf_snmp_close,
       { "close", "snmp.close",
         FT_INT32, BASE_DEC, VALS(snmp_ClosePDU_U_vals), 0,
-        "snmp.ClosePDU", HFILL }},
+        "ClosePDU", HFILL }},
     { &hf_snmp_registerRequest,
       { "registerRequest", "snmp.registerRequest",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.RReqPDU", HFILL }},
+        "RReqPDU", HFILL }},
     { &hf_snmp_registerResponse,
       { "registerResponse", "snmp.registerResponse",
         FT_UINT32, BASE_DEC, VALS(snmp_RegisterResponse_vals), 0,
-        "snmp.RegisterResponse", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_commitOrRollback,
       { "commitOrRollback", "snmp.commitOrRollback",
         FT_INT32, BASE_DEC, VALS(snmp_SOutPDU_U_vals), 0,
-        "snmp.SOutPDU", HFILL }},
+        "SOutPDU", HFILL }},
     { &hf_snmp_rRspPDU,
       { "rRspPDU", "snmp.rRspPDU",
         FT_INT32, BASE_DEC, VALS(snmp_RRspPDU_U_vals), 0,
-        "snmp.RRspPDU", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_pDUs,
       { "pDUs", "snmp.pDUs",
         FT_UINT32, BASE_DEC, VALS(snmp_PDUs_vals), 0,
-        "snmp.PDUs", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_smux_simple,
       { "smux-simple", "snmp.smux_simple",
         FT_NONE, BASE_NONE, NULL, 0,
-        "snmp.SimpleOpen", HFILL }},
+        "SimpleOpen", HFILL }},
     { &hf_snmp_smux_version,
       { "smux-version", "snmp.smux_version",
         FT_INT32, BASE_DEC, VALS(snmp_T_smux_version_vals), 0,
-        "snmp.T_smux_version", HFILL }},
+        NULL, HFILL }},
     { &hf_snmp_identity,
       { "identity", "snmp.identity",
         FT_OID, BASE_NONE, NULL, 0,
-        "snmp.OBJECT_IDENTIFIER", HFILL }},
+        "OBJECT_IDENTIFIER", HFILL }},
     { &hf_snmp_description,
       { "description", "snmp.description",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.DisplayString", HFILL }},
+        "DisplayString", HFILL }},
     { &hf_snmp_password,
       { "password", "snmp.password",
         FT_BYTES, BASE_NONE, NULL, 0,
-        "snmp.OCTET_STRING", HFILL }},
+        "OCTET_STRING", HFILL }},
     { &hf_snmp_subtree,
       { "subtree", "snmp.subtree",
         FT_OID, BASE_NONE, NULL, 0,
-        "snmp.ObjectName", HFILL }},
+        "ObjectName", HFILL }},
     { &hf_snmp_priority,
       { "priority", "snmp.priority",
         FT_INT32, BASE_DEC, NULL, 0,
-        "snmp.INTEGER_M1_2147483647", HFILL }},
+        "INTEGER_M1_2147483647", HFILL }},
     { &hf_snmp_operation,
       { "operation", "snmp.operation",
         FT_INT32, BASE_DEC, VALS(snmp_T_operation_vals), 0,
-        "snmp.T_operation", HFILL }},
+        NULL, HFILL }},
 
 /*--- End of included file: packet-snmp-hfarr.c ---*/
-#line 2026 "packet-snmp-template.c"
+#line 2133 "packet-snmp-template.c"
   };
 
   /* List of subtrees */
@@ -3551,7 +3658,7 @@ void proto_register_snmp(void) {
     &ett_snmp_RReqPDU_U,
 
 /*--- End of included file: packet-snmp-ettarr.c ---*/
-#line 2042 "packet-snmp-template.c"
+#line 2149 "packet-snmp-template.c"
   };
   module_t *snmp_module;
 
@@ -3566,18 +3673,18 @@ void proto_register_snmp(void) {
   };
 
   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"),
@@ -3590,7 +3697,7 @@ void proto_register_snmp(void) {
                                       sizeof(snmp_st_assoc_t),
                                       "snmp_specific_traps",
                                       TRUE,
-                                      (void**) &specific_traps,
+                                      (void*) &specific_traps,
                                       &num_specific_traps,
                                       UAT_CAT_GENERAL,
                                       "ChSNMPEnterpriseSpecificTrapTypes",
@@ -3609,26 +3716,26 @@ void proto_register_snmp(void) {
   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",
@@ -3642,14 +3749,15 @@ void proto_register_snmp(void) {
 
 #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);
 }
 
 
@@ -3673,8 +3781,6 @@ void proto_reg_handoff_snmp(void) {
 
        data_handle = find_dissector("data");
 
-       register_ber_syntax_dissector("SNMP", proto_snmp, dissect_snmp_tcp);
-
        /*
         * Process preference settings.
         *
@@ -3716,5 +3822,3 @@ proto_reg_handoff_smux(void)
        smux_handle = create_dissector_handle(dissect_smux, proto_smux);
        dissector_add("tcp.port", TCP_PORT_SMUX, smux_handle);
 }
-
-