diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-01-12 00:03:50 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-02-07 09:39:45 +0100 |
commit | 41637896e2644030cd616f6fd55ff575f86a304a (patch) | |
tree | 2d275fdc5ec45565bb4489239c68b17ecec1ae5c /pysnmp | |
parent | aa67aeb56b9dac4904bef1b31db705f29ada2f05 (diff) | |
download | pysnmp-git-41637896e2644030cd616f6fd55ff575f86a304a.tar.gz |
Do not set IP_PKTINFO socket option on IPv6 socket
Trying to understand why sendmsg() fails on a transparent
IPv6 socket
Diffstat (limited to 'pysnmp')
-rw-r--r-- | pysnmp/carrier/asyncore/dgram/base.py | 3 | ||||
-rw-r--r-- | pysnmp/carrier/sockmsg.py | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/pysnmp/carrier/asyncore/dgram/base.py b/pysnmp/carrier/asyncore/dgram/base.py index 4dcc77a3..f6ebbbe9 100644 --- a/pysnmp/carrier/asyncore/dgram/base.py +++ b/pysnmp/carrier/asyncore/dgram/base.py @@ -73,12 +73,11 @@ class DgramSocketTransport(AbstractSocketTransport): raise error.CarrierError('sendmsg()/recvmsg() interface is not supported by this OS and/or Python version') try: - if self.socket.family in (socket.AF_INET, socket.AF_INET6): + if self.socket.family == socket.AF_INET: self.socket.setsockopt(socket.SOL_IP, socket.IP_PKTINFO, flag) if self.socket.family == socket.AF_INET6: self.socket.setsockopt(socket.SOL_IPV6, socket.IPV6_RECVPKTINFO, flag) - self.socket.setsockopt(socket.SOL_IPV6, socket.IPV6_V6ONLY, int(not flag)) except socket.error: raise error.CarrierError('setsockopt() for %s failed: %s' % (self.socket.family == socket.AF_INET6 and "IPV6_RECVPKTINFO" or "IP_PKTINFO", sys.exc_info()[1])) diff --git a/pysnmp/carrier/sockmsg.py b/pysnmp/carrier/sockmsg.py index 909407a9..4ff55a91 100644 --- a/pysnmp/carrier/sockmsg.py +++ b/pysnmp/carrier/sockmsg.py @@ -121,8 +121,8 @@ else: ancdata = [(socket.SOL_IPV6, socket.IPV6_PKTINFO, memoryview(_f).tobytes())] debug.logger & debug.flagIO and debug.logger( - 'sendto: sending %d octets to %s; ' - 'iov blob %r' % (len(data), _to, ancdata)) + 'sendto: sending %d octets to %s; address %r; ' + 'iov blob %r' % (len(_data), _to, addr, ancdata)) return s.sendmsg([_data], ancdata, 0, _to) |