Skip to content

Commit

Permalink
Fix PDU consistency check in notification originator
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof authored and lextm committed Aug 26, 2024
1 parent 72bf329 commit 2838892
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Revision 7.0.3, released on Aug 26, 2024
automation around building well-formed SNMP messages is and mediating
differences between SNMP versions is not present in this new `v1arch`
layer.

- The signature of the hlapi `.sendNotification()` call has changed
to accept `*varBinds` instead of a sequence of `varBinds`. The rationale
is to unify this method call with similar methods of CommandGenerator.
Expand Down
9 changes: 9 additions & 0 deletions pysnmp/hlapi/asyncio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, Ilya Etingof <[email protected]>
# License: http://snmplabs.com/pysnmp/license.html
#

# default is v3arch
from pysnmp.hlapi.v3arch.asyncio import *
4 changes: 2 additions & 2 deletions pysnmp/hlapi/v1arch/asyncio/ntforg.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _ensureVarBinds(varBinds):
for idx, varBind in enumerate(varBinds[1:]):
if varBind[0] == sysUpTime:
varBinds[0] = varBind
del varBinds[idx]
del varBinds[idx + 1]
break

if len(varBinds) < 2:
Expand All @@ -149,7 +149,7 @@ def _ensureVarBinds(varBinds):
# Search for and reposition snmpTrapOID if it's elsewhere
for idx, varBind in enumerate(varBinds[2:]):
if varBind[0] == snmpTrapOID:
del varBinds[idx]
del varBinds[idx + 2]
if varBinds[1][0] == snmpTrapOID:
varBinds[1] = varBind
else:
Expand Down

0 comments on commit 2838892

Please sign in to comment.