Another iteration, the new code is almost there, We're missing just the implied octetstrings indexes.
svn path=/trunk/; revision=22618
This commit is contained in:
parent
bea90e8c33
commit
e7d5e2fc2d
|
@ -498,7 +498,7 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
|
|||
|
||||
pi = proto_tree_add_item(pt_varbind,hfid,tvb,value_offset,value_len,FALSE);
|
||||
expert_add_info_format(actx->pinfo, pi, PI_RESPONSE_CODE, PI_NOTE, "%s",note);
|
||||
return value_offset + value_len;
|
||||
goto set_label;
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
|
@ -512,8 +512,8 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
|
|||
} 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! */
|
||||
proto_tree_add_item(pt_varbind,hf_snmp_null_value,tvb,value_offset,value_len,FALSE);
|
||||
return value_offset + value_len;
|
||||
pi_value = proto_tree_add_item(pt_varbind,hf_snmp_unSpecified,tvb,value_offset,value_len,FALSE);
|
||||
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");
|
||||
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "No instance sub-id in scalar value");
|
||||
|
@ -534,9 +534,15 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
|
|||
guint key_len = oid_left;
|
||||
oid_info_is_ok = TRUE;
|
||||
|
||||
if (key_start = oid_matched+oid_left && 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);
|
||||
goto set_label;
|
||||
}
|
||||
|
||||
if (k) {
|
||||
for (;k;k = k->next) {
|
||||
if (key_start > oid_matched+oid_left) {
|
||||
if (key_start >= oid_matched+oid_left) {
|
||||
proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"index sub-oid shorter than expected");
|
||||
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "index sub-oid shorter than expected");
|
||||
oid_info_is_ok = FALSE;
|
||||
|
@ -627,14 +633,14 @@ extern int dissect_snmp_VarBind(gboolean implicit_tag _U_,
|
|||
}
|
||||
goto indexing_done;
|
||||
} else {
|
||||
proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"we do not know how to handle this OID, if you want this implemented please contact the wireshark developpers");
|
||||
proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"we do not know how to handle this OID, if you want this implemented please contact the wireshark developers");
|
||||
expert_add_info_format(actx->pinfo, pi, PI_UNDECODED, PI_WARN, "Unimplemented instance index");
|
||||
oid_info_is_ok = FALSE;
|
||||
goto indexing_done;
|
||||
}
|
||||
} else {
|
||||
proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"This is a BUG, the COLUMS's parent is not a ROW");
|
||||
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_WARN, "COLUMS's parent is not a ROW");
|
||||
proto_item* pi = proto_tree_add_text(pt_name,tvb,0,0,"The COLUMS's parent is not a ROW. This is a BUG! please contact the wireshark developers.");
|
||||
expert_add_info_format(actx->pinfo, pi, PI_MALFORMED, PI_ERROR, "COLUMS's parent is not a ROW");
|
||||
oid_info_is_ok = FALSE;
|
||||
goto indexing_done;
|
||||
}
|
||||
|
@ -722,9 +728,12 @@ indexing_done:
|
|||
}
|
||||
|
||||
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");
|
||||
oid_info_is_ok = FALSE;
|
||||
}
|
||||
|
||||
|
||||
set_label:
|
||||
proto_item_fill_label(pi_value->finfo, label);
|
||||
|
||||
if (oid_info->name) {
|
||||
|
@ -743,7 +752,7 @@ indexing_done:
|
|||
}
|
||||
|
||||
valstr = strstr(label,": ");
|
||||
valstr = valstr ? valstr+2 : "NULL";
|
||||
valstr = valstr ? valstr+2 : label;
|
||||
|
||||
proto_item_set_text(pi_varbind,"%s: %s",repr,valstr);
|
||||
|
||||
|
|
25
epan/oids.c
25
epan/oids.c
|
@ -240,6 +240,7 @@ static inline oid_kind_t smikind(SmiNode* sN, oid_key_t** key_p) {
|
|||
case SMI_NODEKIND_ROW: {
|
||||
SmiElement* sE;
|
||||
oid_key_t* kl = NULL;
|
||||
const oid_value_type_t* typedata = NULL;
|
||||
|
||||
switch (sN->indexkind) {
|
||||
case SMI_INDEX_INDEX:
|
||||
|
@ -252,11 +253,14 @@ static inline oid_kind_t smikind(SmiNode* sN, oid_key_t** key_p) {
|
|||
return OID_KIND_UNKNOWN;
|
||||
};
|
||||
|
||||
|
||||
|
||||
for (sE = smiGetFirstElement(sN); sE; sE = smiGetNextElement(sE)) {
|
||||
SmiNode* elNode = smiGetElementNode(sE) ;
|
||||
SmiType* elType = smiGetNodeType(elNode);
|
||||
oid_key_t* k;
|
||||
const oid_value_type_t* typedata = get_typedata(elType);
|
||||
|
||||
typedata = get_typedata(elType);
|
||||
|
||||
k = g_malloc(sizeof(oid_key_t));
|
||||
|
||||
|
@ -270,14 +274,15 @@ static inline oid_kind_t smikind(SmiNode* sN, oid_key_t** key_p) {
|
|||
|
||||
|
||||
if (typedata) {
|
||||
k->key_type = elNode->implied ? typedata->keytype_implicit : typedata->keytype;
|
||||
k->key_type = typedata->keytype;
|
||||
k->num_subids = typedata->keysize;
|
||||
} else {
|
||||
if (elType) {
|
||||
switch (elType->basetype) {
|
||||
case SMI_BASETYPE_BITS:
|
||||
case SMI_BASETYPE_OCTETSTRING:
|
||||
k->key_type = elNode->implied ? OID_KEY_TYPE_BYTES : OID_KEY_TYPE_WRONG;
|
||||
k->key_type = OID_KEY_TYPE_BYTES;
|
||||
/* XXX find out how to fetch k->num_subids */
|
||||
k->num_subids = 0;
|
||||
break;
|
||||
case SMI_BASETYPE_ENUM:
|
||||
|
@ -307,6 +312,15 @@ static inline oid_kind_t smikind(SmiNode* sN, oid_key_t** key_p) {
|
|||
kl = k;
|
||||
}
|
||||
|
||||
if (sN->implied) {
|
||||
if (typedata) {
|
||||
kl->key_type = typedata->keytype_implicit;
|
||||
} else {
|
||||
/* XXX: what should we do ? */
|
||||
kl->key_type = kl->key_type;
|
||||
}
|
||||
|
||||
}
|
||||
return OID_KIND_ROW;
|
||||
}
|
||||
case SMI_NODEKIND_NODE: return OID_KIND_NODE;
|
||||
|
@ -441,9 +455,8 @@ void register_mibs(void) {
|
|||
smiNode->oid);
|
||||
|
||||
|
||||
D(4,("\t\tNode: %s name=%s kind=%d",
|
||||
oid_subid2string(smiNode->oid, smiNode->oidlen), oid_data->name, oid_data->kind
|
||||
));
|
||||
D(4,("\t\tNode: kind=%d oid=%s name=%s ",
|
||||
oid_data->kind, oid_subid2string(smiNode->oid, smiNode->oidlen), oid_data->name ));
|
||||
|
||||
if ( typedata && oid_data->value_hfid == -2 ) {
|
||||
SmiNamedNumber* smiEnum;
|
||||
|
|
Loading…
Reference in New Issue