mirror of
https://github.com/sshuttle/sshuttle.git
synced 2024-11-22 07:53:43 +01:00
client.py: do DNS listener on the same port as the TCP listener.
UDP and TCP have separate port namespaces, so to make it easier to keep track of what's going on, just use the same transproxy port number for both. We still need two sockets, but now tcpdumps are easier to understand.
This commit is contained in:
parent
7f3c522c56
commit
88937e148e
15
client.py
15
client.py
@ -330,8 +330,6 @@ def main(listenip, ssh_cmd, remotename, python, latency_control, dns,
|
||||
return 5
|
||||
debug1('Starting sshuttle proxy.\n')
|
||||
|
||||
listener = socket.socket()
|
||||
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
if listenip[1]:
|
||||
ports = [listenip[1]]
|
||||
else:
|
||||
@ -341,8 +339,13 @@ def main(listenip, ssh_cmd, remotename, python, latency_control, dns,
|
||||
debug2('Binding:')
|
||||
for port in ports:
|
||||
debug2(' %d' % port)
|
||||
listener = socket.socket()
|
||||
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
dnslistener = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
dnslistener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
try:
|
||||
listener.bind((listenip[0], port))
|
||||
dnslistener.bind((listenip[0], port))
|
||||
bound = True
|
||||
break
|
||||
except socket.error, e:
|
||||
@ -355,14 +358,14 @@ def main(listenip, ssh_cmd, remotename, python, latency_control, dns,
|
||||
listenip = listener.getsockname()
|
||||
debug1('Listening on %r.\n' % (listenip,))
|
||||
|
||||
dnsport = 0
|
||||
dnslistener = None
|
||||
if dns:
|
||||
dnslistener = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
dnslistener.bind((listenip[0], 0))
|
||||
dnsip = dnslistener.getsockname()
|
||||
debug1('DNS listening on %r.\n' % (dnsip,))
|
||||
dnsport = dnsip[1]
|
||||
else:
|
||||
dnsport = 0
|
||||
dnslistener = None
|
||||
dnslistener.bind((listenip[0], 0))
|
||||
|
||||
fw = FirewallClient(listenip[1], subnets_include, subnets_exclude, dnsport)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user