Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmpwalk doesn't show properly SNMP boolean values which equal false #400

Closed
vvsosed opened this issue Jan 12, 2023 · 3 comments
Closed

Comments

@vvsosed
Copy link
Contributor

vvsosed commented Jan 12, 2023

We use definition like
leaf ifConnectorPresent { type boolean; description "This object has the value 'true(1)' if the interface sublayer has a physical connector and the value 'false(2)' otherwise."; smiv2:max-access "read-only"; smiv2:oid "1.3.6.1.2.1.31.1.1.1.17"; }

but unfortunately, we are able to see snmpwalk output like
IF-MIB::ifConnectorPresent.5 = INTEGER: true(1)
IF-MIB::ifConnectorPresent.7 = INTEGER: 0
According to RFC-1212 we should see
IF-MIB::ifConnectorPresent.5 = BOOLEAN: true(1)
IF-MIB::ifConnectorPresent.7 = BOOLEAN: false(2)
I suspect that problem happens because the CLIXON SNMP module uses integer type to support SNMP boolean value.

@vvsosed vvsosed changed the title snmpwalk doesn't show SNMP boolean values which equals to false snmpwalk doesn't show properly SNMP boolean values which equal false Jan 12, 2023
@olofhagsand
Copy link
Member

There seems to be two problems,

  • First that "false" is translated to INTEGER: 0, and should be INTEGERE: false(0)
  • Second, that the type itself is not BOOLEAN.

This is a comment in the code regarding netsnmp support:

Athough smidump translates TruthValue to boolean
    * and there is an ASN_BOOLEAN constant:
    * 1) there is no code for ASN_BOOLEAN and
    * 2) Truthvalue actually translates to enum true(1)/false(0)

Would it be OK to fix the first false problem, since the second seems to be absent from the libnetsmp code available.
But I need to revisit that to be sure.

@shmuelhazan
Copy link
Contributor

@olofhagsand I tested now with a some network equipment (Netgear swtich), and looks like they are representing it as an INTEGER too:

...
IF-MIB::ifConnectorPresent.939 = INTEGER: false(2)
...

So probably the main bug is that false is 0 instead of 2.

@vvsosed
Copy link
Contributor Author

vvsosed commented Jan 16, 2023

Successfully fixed, thanks!

@vvsosed vvsosed closed this as completed Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants