aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/snmp
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-03-09 13:58:58 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-03-09 13:58:58 +0000
commit9f412a5a8a1efc82cf91554ac80653be37ab6d9e (patch)
treebf7250e72b82eb0fe13c9f28a32312865b360d89 /asn1/snmp
parentdcc26d20dc3315f3769e1d43d02c2c7cf74100ad (diff)
downloadwireshark-9f412a5a8a1efc82cf91554ac80653be37ab6d9e.tar.gz
wireshark-9f412a5a8a1efc82cf91554ac80653be37ab6d9e.tar.bz2
wireshark-9f412a5a8a1efc82cf91554ac80653be37ab6d9e.zip
Show VarBind OIDs and trap enterprise OID in info column.
Initialize pdu_type in dissect_snmp_PDUs() and param_tvb in dissect_snmp_SnmpEngineID() to avoid potential crashes. svn path=/trunk/; revision=24591
Diffstat (limited to 'asn1/snmp')
-rw-r--r--asn1/snmp/packet-snmp-template.c9
-rw-r--r--asn1/snmp/snmp.asn3
-rw-r--r--asn1/snmp/snmp.cnf31
3 files changed, 32 insertions, 11 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c
index 09493575f5..7a3e7341a8 100644
--- a/asn1/snmp/packet-snmp-template.c
+++ b/asn1/snmp/packet-snmp-template.c
@@ -372,6 +372,7 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
proto_tree *pt, *pt_varbind, *pt_name, *pt_value;
char label[ITEM_LABEL_LENGTH];
char* repr = NULL;
+ char* info_oid = NULL;
char* valstr;
int hfid = -1;
int min_len = 0, max_len = 0;
@@ -785,13 +786,17 @@ set_label:
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));
+ info_oid = oid_info->name;
}
} else if (oid_string) {
repr = ep_strdup(oid_string);
+ info_oid = oid_string;
} else {
repr = ep_strdup("[Bad OID]");
}
@@ -801,6 +806,10 @@ set_label:
proto_item_set_text(pi_varbind,"%s: %s",repr,valstr);
+ if (display_oid && info_oid && check_col(actx->pinfo->cinfo, COL_INFO)) {
+ col_append_fstr (actx->pinfo->cinfo, COL_INFO, " %s", info_oid);
+ }
+
switch (format_error) {
case BER_WRONG_LENGTH: {
proto_tree* pt = proto_item_add_subtree(pi_value,ett_decoding_error);
diff --git a/asn1/snmp/snmp.asn b/asn1/snmp/snmp.asn
index 4465e96c51..3878993cca 100644
--- a/asn1/snmp/snmp.asn
+++ b/asn1/snmp/snmp.asn
@@ -58,6 +58,7 @@ RFC1157-SNMP DEFINITIONS ::= BEGIN
--IpAddress ::= [APPLICATION 0] IMPLICIT OCTET STRING (SIZE (4))
NotificationName ::= OBJECT IDENTIFIER
+EnterpriseOID ::= OBJECT IDENTIFIER
NetworkAddress ::= [APPLICATION 0] IMPLICIT OCTET STRING (SIZE (4))
TimeTicks ::= [APPLICATION 3] IMPLICIT INTEGER (0..4294967295)
Integer32 ::= INTEGER (-2147483648..2147483647)
@@ -229,7 +230,7 @@ BulkPDU ::= SEQUENCE { -- MUST be identical in structure to PDU
-- end v2
Trap-PDU ::= [4] IMPLICIT SEQUENCE {
- enterprise OBJECT IDENTIFIER, -- type of object generating trap, see sysObjectID in [5]
+ enterprise EnterpriseOID, -- type of object generating trap, see sysObjectID in [5]
agent-addr NetworkAddress, -- address of object generating trap
generic-trap INTEGER { -- generic trap type
coldStart(0),
diff --git a/asn1/snmp/snmp.cnf b/asn1/snmp/snmp.cnf
index 8ca77abbb4..b6772a4d1c 100644
--- a/asn1/snmp/snmp.cnf
+++ b/asn1/snmp/snmp.cnf
@@ -22,28 +22,39 @@ BulkPDU/request-id bulkPDU_request-id
VAL_PTR = &pdu_type
#.FN_BODY PDUs
-gint pdu_type;
+gint pdu_type=-1;
+
+ if (check_col(actx->pinfo->cinfo, COL_INFO))
+ col_clear(actx->pinfo->cinfo, COL_INFO);
%(DEFAULT_BODY)s
if( (pdu_type!=-1) && snmp_PDUs_vals[pdu_type].strptr ){
if (check_col(actx->pinfo->cinfo, COL_INFO))
- col_add_str(actx->pinfo->cinfo, COL_INFO, snmp_PDUs_vals[pdu_type].strptr);
+ col_prepend_fstr(actx->pinfo->cinfo, COL_INFO, "%%s", snmp_PDUs_vals[pdu_type].strptr);
}
#.END
+#.FN_PARS EnterpriseOID
+ VAL_PTR = &param_tvb
+#.FN_BODY EnterpriseOID
+ tvbuff_t* param_tvb = NULL;
+ const gchar* name;
+ gint len;
+%(DEFAULT_BODY)s
+ if (display_oid && param_tvb) {
+ len = tvb_length_remaining (param_tvb, 0);
+ name = oid_resolved_from_encoded(tvb_get_ptr(param_tvb, 0, len), len);
+ if (name && check_col(actx->pinfo->cinfo, COL_INFO)) {
+ col_append_fstr (actx->pinfo->cinfo, COL_INFO, " %%s", name);
+ }
+ }
-
-
-
-
-
-
-
+#.END
#.FN_PARS HeaderData/msgSecurityModel
@@ -67,7 +78,7 @@ gint pdu_type;
}
#.FN_BODY SnmpEngineID
- tvbuff_t* param_tvb;
+ tvbuff_t* param_tvb = NULL;
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
&param_tvb);