summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Wyllie <jwyllie83@gmail.com>2012-10-22 21:24:00 -0400
committerBrian May <brian@microcomaustralia.com.au>2014-09-15 14:14:51 +1000
commit6107abf10f1a942e12611f45121912c818ccbc0d (patch)
tree03db7416cdaa38e0defeec82189439401622b977
parent5e8ad544ee25bbfc6e34d7826b9ef461b2336794 (diff)
Fixed a bug where lack of IPv6 destination = fatal
There was a problem where trying to bind .v4 and .v6 listeners would set them to None if there was nothing to bind (if, say, you weren't binding an IPv6 listener). Later, the code then would try to call a member function of the listener. The member function would not do anything if there was no listener, but trying to dereference None yielded the broken behavior.
-rw-r--r--client.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/client.py b/client.py
index bd8e82b..ef4920a 100644
--- a/client.py
+++ b/client.py
@@ -681,12 +681,16 @@ def main(listenip_v6, listenip_v4,
tcp_listener.setsockopt(socket.SOL_IP, IP_TRANSPARENT, 1)
if udp_listener:
udp_listener.setsockopt(socket.SOL_IP, IP_TRANSPARENT, 1)
- udp_listener.v4.setsockopt(socket.SOL_IP, IP_RECVORIGDSTADDR, 1)
- udp_listener.v6.setsockopt(SOL_IPV6, IPV6_RECVORIGDSTADDR, 1)
+ if udp_listener.v4 is not None:
+ udp_listener.v4.setsockopt(socket.SOL_IP, IP_RECVORIGDSTADDR, 1)
+ if udp_listener.v6 is not None:
+ udp_listener.v6.setsockopt(SOL_IPV6, IPV6_RECVORIGDSTADDR, 1)
if dns_listener:
dns_listener.setsockopt(socket.SOL_IP, IP_TRANSPARENT, 1)
- dns_listener.v4.setsockopt(socket.SOL_IP, IP_RECVORIGDSTADDR, 1)
- dns_listener.v6.setsockopt(SOL_IPV6, IPV6_RECVORIGDSTADDR, 1)
+ if dns_listener.v4 is not None:
+ dns_listener.v4.setsockopt(socket.SOL_IP, IP_RECVORIGDSTADDR, 1)
+ if dns_listener.v6 is not None:
+ dns_listener.v6.setsockopt(SOL_IPV6, IPV6_RECVORIGDSTADDR, 1)
try:
return _main(tcp_listener, udp_listener, fw, ssh_cmd, remotename,