
Hi!
Pamela> I am back to this issue. In the libsmi library for v0.3.1 file Pamela> parser-smi.c, the following code is included: [...]
Pamela> case 184: Pamela> #line 3374 "parser-smi.y" Pamela> { Pamela> /* Pamela> * SMIv1 allows something like { 0 0 } ! Pamela> * SMIv2 does not! Pamela> */ Pamela> /* TODO: make it work correctly for SMIv1 */ Pamela> smiPrintError(thisParserPtr, Pamela> ERR_OID_DEFVAL_TOO_LONG); Pamela> yyval.valuePtr = smiMalloc(sizeof(SmiValue)); yyval.valuePtr-> basetype = SMI_BASETYPE_OBJECTIDENTIFIER; yyval.valuePtr-> len = 2; yyval.valuePtr-> value.oid = smiMalloc(2 * sizeof(SmiSubid)); yyval.valuePtr-> value.oid[0] = 0; yyval.valuePtr-> value.oid[1] = 0; Pamela> break;}
Pamela> I believe this code sets the default oid value to 0.0. If you Pamela> have a default value in the MIB that is valid for example:
Pamela> myObjectID OBJECT-TYPE Pamela> SYNTAX OBJECT IDENTIFIER Pamela> MAX-ACCESS read-write Pamela> STATUS current Pamela> DESCRIPTION Pamela> "An object." Pamela> DEFVAL { { 1 3 6 1 4 1 9547 1 1 1 14 0 } } Pamela> ::= { fooTest 14 }
This is *NOT* valid. :-) See RFC 2578, Section 7.9.:
If the value is an OBJECT IDENTIFIER, then it must be expressed as a single ASN.1 identifier, and not as a collection of sub-identifiers.
It would be better to accept even illegal OID notation and just spit out an error message, but I did not put too much work on these invalid cases. Please just fix your MIB.
Pamela> The default value returned from smidump.exe is: Pamela> scalar myObjectID { Pamela> oid fooTest.14; Pamela> type ObjectIdentifier; Pamela> access readwrite; Pamela> default zeroDotZero; Pamela> description Pamela> "An object."; Pamela> };
Pamela> Are you able use smidump to print out a default for an Object Pamela> Identifier type other than zeroDotZero?
Yes, if the DEFVAL clause contains an identifier, you will retrieve the corresponding OID.
-frank