segfault during traversal of SMIv2 MIBs

Hello,
i´ve tried to traverse a SMIv2 MIB where one Module Identity is under an other one. See sketch below. I tried to perform a smiGetNextNode on Module Identity 1 to retrieve the Node (Module Identity Node of Module Identity 2 ) but if I do that libsmi produce a segfault because the OID of the Nodeptr is empty. If I do the same on Module Identity 2 I get OBJECT IDENTITY 1 and that's what I want. So my question is whether it is possible or not to traverse the MIB tree through Module Identitys without explicitly loading the next Module Identity because I don't really know if the next node is a ModuleIdentity or a ObjectIdentity. Or is there a other way to do this.
MODULE IDENTITY 1 | --- MODULE IDENTITY 2 | OBJECT IDENTITY 1 . . . OBJECT IDENTITY n
By the way its possible to stop libsmi from segfaulting inside smiGetNextNode if you add || (!nodePtr->oid) inside the part below.
/* did we move outside the common oid prefix of this module? */ for (i = 0; i < modulePtr->prefixNodePtr->oidlen; i++) if ((!nodePtr) || (!nodePtr->oid) || (nodePtr->oid[i] != modulePtr->prefixNodePtr->oid[i])) return NULL;
Regards, Henrik Puls

Henrik,
Aside from the fact, that libSMI should not cause a seg.fault, a SMIv2 MIB module must contain exactly one MODULE-IDENTITY construct. To have two, is not allowed by the SMI and that's probably why nobody has found the bug yet ;-)
Best regards, Frank Fock
Puls, Henrik wrote:
Hello,
i´ve tried to traverse a SMIv2 MIB where one Module Identity is under an other one. See sketch below. I tried to perform a smiGetNextNode on Module Identity 1 to retrieve the Node (Module Identity Node of Module Identity 2 ) but if I do that libsmi produce a segfault because the OID of the Nodeptr is empty. If I do the same on Module Identity 2 I get OBJECT IDENTITY 1 and that's what I want. So my question is whether it is possible or not to traverse the MIB tree through Module Identitys without explicitly loading the next Module Identity because I don't really know if the next node is a ModuleIdentity or a ObjectIdentity. Or is there a other way to do this.
MODULE IDENTITY 1 | --- MODULE IDENTITY 2 | OBJECT IDENTITY 1 . . . OBJECT IDENTITY n
By the way its possible to stop libsmi from segfaulting inside smiGetNextNode if you add || (!nodePtr->oid) inside the part below.
/* did we move outside the common oid prefix of this module? */ for (i = 0; i < modulePtr->prefixNodePtr->oidlen; i++) if ((!nodePtr) || (!nodePtr->oid) || (nodePtr->oid[i] != modulePtr->prefixNodePtr->oid[i])) return NULL;
Regards, Henrik Puls

On 01. Okt 2004, at 14:59, Puls, Henrik wrote:
i´ve tried to traverse a SMIv2 MIB where one Module Identity is under an other one. See sketch below. I tried to perform a smiGetNextNode on Module Identity 1 to retrieve the Node (Module Identity Node of Module Identity 2 ) but if I do that libsmi produce a segfault because the OID of the Nodeptr is empty.
A sequence of smiGetNextNode() calls retrieves nodes from just one module.
If I do the same on Module Identity 2 I get OBJECT IDENTITY 1 and that's what I want. So my question is whether it is possible or not to traverse the MIB tree through Module Identitys without explicitly loading the next Module Identity because I don't really know if the next node is a ModuleIdentity or a ObjectIdentity. Or is there a other way to do this.
Sorry, I don't see what you intend to do. Do you want to traverse a tree that is made up of nodes from several modules? In that case, you should come up with a recursive function that uses smiGetFirst/NextChild().
MODULE IDENTITY 1 | --- MODULE IDENTITY 2 | OBJECT IDENTITY 1 . . . OBJECT IDENTITY n
By the way its possible to stop libsmi from segfaulting inside smiGetNextNode if you add || (!nodePtr->oid) inside the part below.
/* did we move outside the common oid prefix of this module? */ for (i = 0; i < modulePtr->prefixNodePtr->oidlen; i++) if ((!nodePtr) || (!nodePtr->oid) || (nodePtr->oid[i] != modulePtr->prefixNodePtr->oid[i])) return NULL;
I do not yet understand under which circumstances you get a node without a valid oid. Usually, this should not happen. E.g., when I parse the modules you've sent to me in a private mail, I don't get to such a situation.
participants (3)
-
Frank Strauß
-
Frank.Fock@t-online.de
-
Puls, Henrik