mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-04-20 09:19:23 +02:00
Fix UDP and DNS support on Python 2.7 with tproxy method
There was runtime failure on UDP or DNS processing, because "socket" was redefined to PyXAPI's socket_ext in tproxy.py, but still was plain Python's socket in client.py Fixed https://github.com/sshuttle/sshuttle/issues/134 for me
This commit is contained in:
parent
9a9015a75e
commit
af9ebd0f4b
@ -1,4 +1,3 @@
|
|||||||
import socket
|
|
||||||
import errno
|
import errno
|
||||||
import re
|
import re
|
||||||
import signal
|
import signal
|
||||||
@ -17,6 +16,20 @@ from sshuttle.helpers import log, debug1, debug2, debug3, Fatal, islocal, \
|
|||||||
resolvconf_nameservers
|
resolvconf_nameservers
|
||||||
from sshuttle.methods import get_method, Features
|
from sshuttle.methods import get_method, Features
|
||||||
|
|
||||||
|
try:
|
||||||
|
# try getting recvmsg from python
|
||||||
|
import socket as pythonsocket
|
||||||
|
getattr(pythonsocket.socket, "recvmsg")
|
||||||
|
socket = pythonsocket
|
||||||
|
except AttributeError:
|
||||||
|
# try getting recvmsg from socket_ext library
|
||||||
|
try:
|
||||||
|
import socket_ext
|
||||||
|
getattr(socket_ext.socket, "recvmsg")
|
||||||
|
socket = socket_ext
|
||||||
|
except ImportError:
|
||||||
|
import socket
|
||||||
|
|
||||||
_extra_fd = os.open('/dev/null', os.O_RDONLY)
|
_extra_fd = os.open('/dev/null', os.O_RDONLY)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user