summaryrefslogtreecommitdiff
path: root/pysnmp/carrier/asyncore
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2019-01-10 23:27:07 +0100
committerIlya Etingof <etingof@gmail.com>2019-02-07 09:39:17 +0100
commit7be540c41fa096370a0799c6a76990aa15cbf608 (patch)
tree4fb5eb6551419e0d2ad2abe30b03896dc5954ee9 /pysnmp/carrier/asyncore
parent7e3c6b20ff3f976df63a8adefb0bab15ca25f253 (diff)
downloadpysnmp-git-7be540c41fa096370a0799c6a76990aa15cbf608.tar.gz
Add `IPV6_V6ONLY` IPV6 socket option
SO says this is required for proper UDP socket multi-homing.
Diffstat (limited to 'pysnmp/carrier/asyncore')
-rw-r--r--pysnmp/carrier/asyncore/dgram/base.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/pysnmp/carrier/asyncore/dgram/base.py b/pysnmp/carrier/asyncore/dgram/base.py
index 573e6f56..378974e6 100644
--- a/pysnmp/carrier/asyncore/dgram/base.py
+++ b/pysnmp/carrier/asyncore/dgram/base.py
@@ -78,6 +78,7 @@ class DgramSocketTransport(AbstractSocketTransport):
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, 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]))