[erlang-bugs] snmp bug?

Martin Bjorklund <>
Mon Feb 8 09:14:30 CET 2010


Caleb Tennis <> wrote:
> I've been communicating with snmp devices on the network with erlang, but I'm
> having issues getting MIBs into erlang, but I'm running into errors with the
> compiler.
> One of the mibs I've focused on uses the TEXTUAL-CONVENTION macro, but I get
> these errors when trying to compile it:
> :~# erlc AP-SERIES-300-UPS-MODULE-MIB.mib 
> imported.
> imported.
> Now, I recognize this may be an issue with the MIB file itself

It is.  The MIB must IMPORT the TEXTUAL-CONVENTION macro.

> In digging some more, it seems like those MIBs don't compile.  For example,
> SNMPv2-TC.mib, which I believe is needed for understanding
> TEXTUAL-CONVENTIONS, gives this error:
> :~# erlc SNMPv2-TC.mib 
> SNMPv2-TC.mib: 8: Error: syntax error before: 'TEXTUAL-CONVENTION'

SNMPv2-TC isn't really a MIB; it defines the ASN.1 macro
TEXTUAL-CONVENTION, but unfortunately it also uses the macro and
defines some common TEXTUAL-CONVENTIONs.

> In fact, there are a number of mib files that ship with erlang that give
> errors like this, all on line with MACRO statements.
> The erlang code leads me to believe that these *should* work and compile, but
> it looks like they don't.  So, while I'm not positive this is a bug, it
> smells a bit like one, hence why I'm posting.

The erlang MIB compiler simply cannot handle the MACRO statement.  It
should be straightforward to do what libsmi does - check that the
module that contains the MACRO is one of the known modules, and simply
skip the MACRO invocation.

In any case, the real bug here is that your MIB does not IMPORT
TEXTUAL-CONVENTION.  Even if the erlang MIB compiler could compile
SNMPv2-TC, your MIB needs to be fixed.


More information about the erlang-bugs mailing list