From 3962a11575ec6118cff8ba10ec81b9679e68faa2 Mon Sep 17 00:00:00 2001 From: "smill@cuckoo.sh" Date: Thu, 22 Sep 2016 08:15:34 +0000 Subject: Commented on IP_TRANSPARENT and changed an exception type. --- netlib/tcp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netlib/tcp.py b/netlib/tcp.py index 4e988ee3..47200bed 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -738,10 +738,11 @@ class TCPClient(_Connection): if self.spoof_source_address: try: + # 19 is `IP_TRANSPARENT`, which is only available on Python 3.3+ on some OSes if not connection.getsockopt(socket.SOL_IP, 19): connection.setsockopt(socket.SOL_IP, 19, 1) except socket.error as e: - raise exceptions.ProtocolException( + raise exceptions.TcpException( "Failed to spoof the source address: " + e.strerror) if self.source_address: connection.bind(self.source_address()) -- cgit v1.2.3