Skip to content

Honor RemotePort for SNMP sessions - #16

Merged
bluecmd merged 1 commit into
bluecmd:masterfrom
SoundGoof:fix/issue-4-remote-port
Jul 23, 2026
Merged

Honor RemotePort for SNMP sessions#16
bluecmd merged 1 commit into
bluecmd:masterfrom
SoundGoof:fix/issue-4-remote-port

Conversation

@SoundGoof

Copy link
Copy Markdown
Collaborator

Summary

Fixes #4 by making the RemotePort session parameter control the destination UDP port used for SNMP requests.

Root Cause

RemotePort was parsed and stored on the Python Session object, but it was never passed to the native session constructors. As a result, requests continued to use the default SNMP port 161.

Net-SNMP no longer uses its native remote_port session field. The supported method is to include the destination port in the peer name.

Changes

  • Append a non-default RemotePort to the native UDP peer name.
  • Apply the peer name to SNMP v1, v2c, and v3 UDP sessions.
  • Leave tunneled TLS, DTLS, and SSH transports unchanged.
  • Preserve support for the existing DestHost="host:port" syntax.
  • Add packet-level regression tests using an ephemeral UDP listener.

Testing

  • Built the native extension on Fedora 43 with Python 3.14 and Net-SNMP 5.9.4.
  • Verified that RemotePort sends the SNMP request to the selected port.
  • Verified that the existing DestHost="host:port" syntax continues to work.
  • Confirmed both regression tests pass.

@SoundGoof
SoundGoof force-pushed the fix/issue-4-remote-port branch from 33275d5 to ed75143 Compare July 23, 2026 22:04
@SoundGoof
SoundGoof requested a review from bluecmd July 23, 2026 22:06
@bluecmd
bluecmd merged commit a44febc into bluecmd:master Jul 23, 2026
4 checks passed
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.

RemotePort parameter not used

2 participants