Skip to content

Commit

Permalink
Fix undefined names in TRANSPORT-ADDRESS-MIB.py
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed Dec 29, 2018
1 parent 49af917 commit d1689d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Revision 4.4.7, released 2018-12-29
sending SNMPv3 TRAP with non-default `contextName` would fail.
- Fixed possible duplicate key occurrence in the `OrderedDict` following
a race condition
- Fixed undefined name references in `inet_pton`/`inet_ntop` substitute
routines for IPv6 in `TRANSPORT-ADDRESS-MIB.py`

Revision 4.4.6, released 2018-09-13
-----------------------------------
Expand Down
6 changes: 3 additions & 3 deletions pysnmp/smi/mibs/TRANSPORT-ADDRESS-MIB.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

def inet_pton(address_family, ip_string):
if address_family == socket.AF_INET:
return inet_aton(ip_string)
return socket.inet_aton(ip_string)
elif address_family != socket.AF_INET6:
raise socket.error(
'Unknown address family %s' % (address_family,)
Expand All @@ -46,7 +46,7 @@ def inet_pton(address_family, ip_string):
spaces = groups.count('')

if '.' in groups[-1]:
groups[-1:] = ["%x" % x for x in struct.unpack("!HH", inet_aton(groups[-1]))]
groups[-1:] = ["%x" % x for x in struct.unpack("!HH", socket.inet_aton(groups[-1]))]

if spaces == 1:
idx = groups.index('')
Expand Down Expand Up @@ -84,7 +84,7 @@ def inet_pton(address_family, ip_string):

def inet_ntop(address_family, packed_ip):
if address_family == socket.AF_INET:
return inet_ntop(packed_ip)
return socket.inet_ntop(packed_ip)
elif address_family != socket.AF_INET6:
raise socket.error(
'Unknown address family %s' % (address_family,)
Expand Down

0 comments on commit d1689d7

Please sign in to comment.