Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sshuttle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
sshuttle
Commits
bd489b33
Commit
bd489b33
authored
May 31, 2011
by
Brian May
Committed by
Avery Pennarun
May 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass socket through to handlers. Required for IPv6 support.
parent
8ab5ef28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
client.py
client.py
+7
-7
No files found.
client.py
View file @
bd489b33
...
...
@@ -255,17 +255,17 @@ def _main(listener, fw, ssh_cmd, remotename, python, latency_control,
fw
.
sethostip
(
name
,
ip
)
mux
.
got_host_list
=
onhostlist
def
onaccept
():
def
onaccept
(
listener_sock
):
global
_extra_fd
try
:
sock
,
srcip
=
listener
.
accept
()
sock
,
srcip
=
listener
_sock
.
accept
()
except
socket
.
error
,
e
:
if
e
.
args
[
0
]
in
[
errno
.
EMFILE
,
errno
.
ENFILE
]:
debug1
(
'Rejected incoming connection: too many open files!
\n
'
)
# free up an fd so we can eat the connection
os
.
close
(
_extra_fd
)
try
:
sock
,
srcip
=
listener
.
accept
()
sock
,
srcip
=
listener
_sock
.
accept
()
sock
.
close
()
finally
:
_extra_fd
=
os
.
open
(
'/dev/null'
,
os
.
O_RDONLY
)
...
...
@@ -287,7 +287,7 @@ def _main(listener, fw, ssh_cmd, remotename, python, latency_control,
mux
.
send
(
chan
,
ssnet
.
CMD_CONNECT
,
'
%
s,
%
s'
%
dstip
)
outwrap
=
MuxWrapper
(
mux
,
chan
)
handlers
.
append
(
Proxy
(
SockWrapper
(
sock
,
sock
),
outwrap
))
handlers
.
append
(
Handler
([
listener
],
onaccept
))
handlers
.
append
(
Handler
([
listener
],
lambda
:
onaccept
(
listener
)
))
dnsreqs
=
{}
def
dns_done
(
chan
,
data
):
...
...
@@ -297,8 +297,8 @@ def _main(listener, fw, ssh_cmd, remotename, python, latency_control,
del
dnsreqs
[
chan
]
debug3
(
'doing sendto
%
r
\n
'
%
(
peer
,))
dnslistener
.
sendto
(
data
,
peer
)
def
ondns
():
pkt
,
peer
=
dnslistener
.
recvfrom
(
4096
)
def
ondns
(
listener_sock
):
pkt
,
peer
=
listener_sock
.
recvfrom
(
4096
)
now
=
time
.
time
()
if
pkt
:
debug1
(
'DNS request from
%
r:
%
d bytes
\n
'
%
(
peer
,
len
(
pkt
)))
...
...
@@ -311,7 +311,7 @@ def _main(listener, fw, ssh_cmd, remotename, python, latency_control,
del
dnsreqs
[
chan
]
debug3
(
'Remaining DNS requests:
%
d
\n
'
%
len
(
dnsreqs
))
if
dnslistener
:
handlers
.
append
(
Handler
([
dnslistener
],
ondns
))
handlers
.
append
(
Handler
([
dnslistener
],
lambda
:
ondns
(
dnslistener
)
))
if
seed_hosts
!=
None
:
debug1
(
'seed_hosts:
%
r
\n
'
%
seed_hosts
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment