Hi again! I fixed all problems indicated by smilint, up to level 6, but unfortunately the problem remains: My enumeration now is: --- IotwSchedPolicyEnum ::= TEXTUAL-CONVENTION STATUS current DESCRIPTION "The scheduling policy expressed as integer." SYNTAX INTEGER { -- RFC 1155 (STD 16) says in -- "3.2.1.1. Guidelines for Enumerated INTEGERs": -- "a named number having the value 0 shall -- not be present in the list of enumerations. -- Use of this value is prohibited." schedPolicyNice (1), schedPolicyBatch (2), schedPolicyFIFO (3), schedPolicyIdle (4), schedPolicyOther (5), schedPolicyRR (6) } ---
My sequence now looks like this: --- IotwObjectEntry ::= SEQUENCE { --... iotwTimingPriority PercentTC, -- basically Integer32 iotwTimingSchedPolicy IotwSchedPolicyEnum, --... --- When using "mib2c -c mib2c.array-user.conf" the code generated still has the problem it had before: In iotwObjectTable_set_reserve1() there is this code fragment: --- case COLUMN_IOTWTIMINGPRIORITY: /** PercentTC = ASN_INTEGER */ /* * or possibly 'netsnmp_check_vb_int_range' */ rc = netsnmp_check_vb_int(var); break; case COLUMN_IOTWTIMINGSCHEDPOLICY: /** = */ /* * or possibly 'netsnmp_check_vb_int_range' */ rc = netsnmp_check_vb_int(var); break; --- And in iotwObjectTable_set_reserve2() there is a similar one: --- case COLUMN_IOTWTIMINGSCHEDPOLICY: /** = */ /* * TODO: routine to check valid values * * EXAMPLE: * * if ( *var->val.integer != XXX ) { * rc = SNMP_ERR_INCONSISTENTVALUE; * rc = SNMP_ERR_BADVALUE; * } */ break; --- In other routines the type is also handled as integer, but in iotwObjectTable_get_value() a syntax error is created: --- case COLUMN_IOTWTIMINGPRIORITY: /** PercentTC = ASN_INTEGER */ snmp_set_var_typed_value(var, ASN_INTEGER, (char *) &context->iotwTimingPriority, sizeof(context->iotwTimingPriority)); break; case COLUMN_IOTWTIMINGSCHEDPOLICY: /** = */ snmp_set_var_typed_value(var,, (char *) &context-> iotwTimingSchedPolicy, sizeof(context-> iotwTimingSchedPolicy)); break; --- So the code did not recognize the type for iotwTimingSchedPolicy. The corresponding code in /usr/share/snmp/mib2c.array-user.conf looks like this: --- @if $c.readable@ @eval $have_type = 0@ case COLUMN_$c.uc: /** $c.syntax = $c.type */ @if "$c.type" eq "ASN_OBJECT_ID"@ @eval $have_type = 1@ snmp_set_var_typed_value(var, $c.type, (char*)&context->$c, context->${c}_len ); @end@ @if "$c.type" eq "ASN_OCTET_STR"@ @eval $have_type = 1@ snmp_set_var_typed_value(var, $c.type, (char*)&context->$c, context->${c}_len ); @end@ @if $have_type == 0@ snmp_set_var_typed_value(var, $c.type, (char*)&context->$c, sizeof(context->$c) ); @end@ break; @end@ --- As said earlier, I'm not using the latest version (I'm using net-snmp-5.4.2.1-8.12.22.1.8750.1.PTF.935863 of SLES11 SP3); maybe someone knows whether this bug has been fixed meanwhile. Regards, Ulrich >>> Olivier Miakinen <om+net-s...@miakinen.net> schrieb am 02.09.2015 um 11:52 in Nachricht <55e6c6f3.70...@miakinen.net>: > Hallo Ulrich, > > I'm not a NET-SNMP expert, but I have remarks about the mib itself. > > Le 02/09/2015 11:07, Ulrich Windl a écrit : >> >> I'm working with an older version of Net-SNMP. I have a question: >> >> My MIB uses an enum "iotwTimingSchedPolicy" that is defined as >> iotwSchedPolicyEnum ::= Integer32 { > > A syntax must begin with an upper case letter : IotwSchedPolicyEnum > >> schedPolicy-nice (0), >> schedPolicy-batch (1), >> schedPolicy-FIFO (2), >> schedPolicy-idle (3), >> schedPolicy-other (4), >> schedPolicy-RR (5), > > I'm not sure that the last comma (,) is allowed. > >> } >> >> And it us used as >> iotwObjectEntrySyntax ::= SEQUENCE { > > Upper case initial is mandatory for IotwObjectEntrySyntax > >> (...) >> iotwTimingSchedPolicy iotwSchedPolicyEnum, > > Lower case initial for the object (iotwTimingSchedPolicy) but upper case > for the syntax (IotwSchedPolicyEnum). > >> (..) >> } >> >> (...) >> iotwTimingSchedPolicy OBJECT-TYPE >> SYNTAX iotwSchedPolicyEnum > > IotwSchedPolicyEnum > >> MAX-ACCESS read-write >> STATUS optional > > Since you have a MAX-ACCESS, your mib is defined in SMIv2, then a STATUS > can't be 'optional' (possible values are 'current', 'deprecated' and > 'obsolete'). > >> (...) >> >> I realized that mib2c and snmptranslate both cannot find out the type of the > variable. > > Probably because the type is not valid (missing upper case initial) > >> I'm new in MIB-writing, so maybe I mad mistakes, but the tools don't complain > about errors. Ideas? > > I found this in NET-SNMP FAQ : > > http://www.net-snmp.org/docs/FAQ.html#How_can_I_get_more_information_about_pr > oblems_with_MIB_files_ > > <cit.> > For a more rigourous validation, use a tool such as 'smilint', or the > on-line interface at http://wwwsnmp.cs.utwente.nl/ietf/mibs/validate/ > </cit.> > > > Regards, > -- > Olivier Miakinen ------------------------------------------------------------------------------ Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140 _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders