Skip to content

Fix missing SNMPv1 instance values - #24

Merged
SoundGoof merged 1 commit into
bluecmd:masterfrom
SoundGoof:fix/nonexistent-oid-none
Jul 23, 2026
Merged

Fix missing SNMPv1 instance values#24
SoundGoof merged 1 commit into
bluecmd:masterfrom
SoundGoof:fix/nonexistent-oid-none

Conversation

@SoundGoof

Copy link
Copy Markdown
Collaborator

Summary

Return None instead of an empty byte string when an SNMPv1 GET requests a non-existing instance.

This ports the upstream Net-SNMP fix for net-snmp/net-snmp#414, implemented upstream in commit b33d6bbe.

This PR supersedes #9 with a minimal patch based on the current master branch and adds coverage to the active system-test suite.

Root cause

For SNMPv1, a missing instance is reported through err_ind. The response still contains a varbind that was being processed as an OCTETSTR, producing b''.

This is indistinguishable from a valid empty string value.

Changes

  • Skip GET response varbind processing at and after the SNMPv1 error index.
  • Leave affected tuple entries and Varbind values as None.
  • Add an SNMPv1 regression test for a known OID with a non-existing IID.
  • Add corresponding SNMPv2c coverage.
  • Preserve the existing test for a completely unknown OID.

Behavior

Before:

  • SNMPv1 GET for sysDescr.123 returned (b'',).

After:

  • SNMPv1 GET for sysDescr.123 returns (None,).
  • The affected Varbind.val and Varbind.type remain None.

Testing

  • 41 system tests passed.
  • ASan/UBSan passed with no reported errors.
  • Valgrind passed with:
    • 0 bytes definitely lost
    • 0 bytes indirectly lost
    • 0 bytes possibly lost
    • 0 errors
  • git diff --check passed.

@SoundGoof
SoundGoof requested a review from bluecmd July 23, 2026 21:49
@SoundGoof
SoundGoof merged commit dc8ded6 into bluecmd:master Jul 23, 2026
4 checks passed
@SoundGoof
SoundGoof deleted the fix/nonexistent-oid-none branch July 23, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants