aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-snmp.c
diff options
context:
space:
mode:
authorlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2007-08-28 15:18:32 +0000
committerlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>2007-08-28 15:18:32 +0000
commit4164fda05fbf03c28844108f3c9fa83715674553 (patch)
treea234af0150b064f34c3a6229e1754c32f6d1ddba /epan/dissectors/packet-snmp.c
parent15942a9944124b6b8fd79300c28add7260731f39 (diff)
SNMP:
- As noted by Thomas Anders values are not added to the tree anymore. Move the calling of subdissectors to the end of the function, so that the value is added to the tree. - add port 8161 to be decoded as SNMP (hey, it's on IANA's services file!) UAT: - do not have the uat reloaded. OIDS: - do not complain if renaming an OID to an identical name git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22704 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-snmp.c')
-rw-r--r--epan/dissectors/packet-snmp.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c
index 260fcb9280..98d05fd213 100644
--- a/epan/dissectors/packet-snmp.c
+++ b/epan/dissectors/packet-snmp.c
@@ -111,6 +111,7 @@
#define TCP_PORT_SNMP 161
#define TCP_PORT_SNMP_TRAP 162
#define TCP_PORT_SMUX 199
+#define UDP_PORT_SNMP_PATROL 8161
/* Initialize the protocol and registered fields */
static int proto_snmp = -1;
@@ -288,7 +289,7 @@ static int hf_snmp_priority = -1; /* INTEGER_M1_2147483647 */
static int hf_snmp_operation = -1; /* T_operation */
/*--- End of included file: packet-snmp-hf.c ---*/
-#line 214 "packet-snmp-template.c"
+#line 215 "packet-snmp-template.c"
static int hf_smux_version = -1;
static int hf_smux_pdutype = -1;
@@ -304,6 +305,7 @@ static gint ett_authParameters = -1;
static gint ett_internet = -1;
static gint ett_varbind = -1;
static gint ett_name = -1;
+static gint ett_value = -1;
static gint ett_decoding_error = -1;
@@ -330,7 +332,7 @@ static gint ett_snmp_SimpleOpen = -1;
static gint ett_snmp_RReqPDU = -1;
/*--- End of included file: packet-snmp-ett.c ---*/
-#line 232 "packet-snmp-template.c"
+#line 234 "packet-snmp-template.c"
static const true_false_string auth_flags = {
"OK",
@@ -483,14 +485,14 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
oid_info_t* oid_info;
guint oid_matched, oid_left;
proto_item *pi_name, *pi_varbind, *pi_value = NULL;
- proto_tree *pt, *pt_varbind, *pt_name;
+ proto_tree *pt, *pt_varbind, *pt_name, *pt_value;
char label[ITEM_LABEL_LENGTH];
char* repr = NULL;
char* valstr;
int hfid = -1;
int min_len = 0, max_len = 0;
gboolean oid_info_is_ok;
- const char* oid_string;
+ const char* oid_string = NULL;
seq_offset = offset;
/* first have the VarBind's sequence header */
@@ -600,15 +602,10 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
add_oid_debug_subtree(oid_info,pt_name);
- if (oid_matched+oid_left) {
+ if (subids && oid_matched+oid_left) {
oid_string = oid_subid2string(subids,oid_matched+oid_left);
- } else {
- oid_string = ".";
- }
+ }
-
-
-
/* now we'll try to figure out which are the indexing sub-oids and whether the oid we know about is the one oid we have to use */
switch (oid_info->kind) {
case OID_KIND_SCALAR:
@@ -761,14 +758,6 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
}
indexing_done:
- if (value_len > 0 && oid_string) {
- tvbuff_t* sub_tvb = tvb_new_subset(tvb, value_offset, value_len, value_len);
-
- next_tvb_add_string(&var_list, sub_tvb, (snmp_var_in_tree) ? pt_varbind : NULL, value_sub_dissectors_table, oid_string);
-
- return seq_offset + seq_len;
- }
-
if (oid_info_is_ok) {
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);
@@ -847,8 +836,16 @@ indexing_done:
expert_add_info_format(actx->pinfo, pi_value, PI_UNDECODED, PI_NOTE, "Unresolved value, Missing MIB");
oid_info_is_ok = FALSE;
}
+
+ pt_value = proto_item_add_subtree(pi_value,ett_value);
+
+ if (value_len > 0 && oid_string) {
+ tvbuff_t* sub_tvb = tvb_new_subset(tvb, value_offset, value_len, value_len);
-
+ next_tvb_add_string(&var_list, sub_tvb, (snmp_var_in_tree) ? pt_value : NULL, value_sub_dissectors_table, oid_string);
+ }
+
+
set_label:
if (pi_value) proto_item_fill_label(pi_value->finfo, label);
@@ -2792,7 +2789,7 @@ static void dissect_SMUX_PDUs_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro
/*--- End of included file: packet-snmp-fn.c ---*/
-#line 1357 "packet-snmp-template.c"
+#line 1354 "packet-snmp-template.c"
guint
@@ -3568,7 +3565,7 @@ void proto_register_snmp(void) {
"snmp.T_operation", HFILL }},
/*--- End of included file: packet-snmp-hfarr.c ---*/
-#line 1868 "packet-snmp-template.c"
+#line 1865 "packet-snmp-template.c"
};
/* List of subtrees */
@@ -3582,6 +3579,7 @@ void proto_register_snmp(void) {
&ett_internet,
&ett_varbind,
&ett_name,
+ &ett_value,
&ett_decoding_error,
/*--- Included file: packet-snmp-ettarr.c ---*/
@@ -3607,7 +3605,7 @@ void proto_register_snmp(void) {
&ett_snmp_RReqPDU,
/*--- End of included file: packet-snmp-ettarr.c ---*/
-#line 1883 "packet-snmp-template.c"
+#line 1881 "packet-snmp-template.c"
};
module_t *snmp_module;
static uat_field_t users_fields[] = {
@@ -3682,6 +3680,7 @@ void proto_reg_handoff_snmp(void) {
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);