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
4bfcd709
Commit
4bfcd709
authored
May 31, 2011
by
Brian May
Committed by
Avery Pennarun
May 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send DNS request back on same sock we received it on.
parent
bd489b33
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
client.py
client.py
+4
-4
No files found.
client.py
View file @
4bfcd709
...
@@ -291,22 +291,22 @@ def _main(listener, fw, ssh_cmd, remotename, python, latency_control,
...
@@ -291,22 +291,22 @@ def _main(listener, fw, ssh_cmd, remotename, python, latency_control,
dnsreqs
=
{}
dnsreqs
=
{}
def
dns_done
(
chan
,
data
):
def
dns_done
(
chan
,
data
):
peer
,
timeout
=
dnsreqs
.
get
(
chan
)
or
(
None
,
None
)
peer
,
sock
,
timeout
=
dnsreqs
.
get
(
chan
)
or
(
None
,
None
,
None
)
debug3
(
'dns_done: channel=
%
r peer=
%
r
\n
'
%
(
chan
,
peer
))
debug3
(
'dns_done: channel=
%
r peer=
%
r
\n
'
%
(
chan
,
peer
))
if
peer
:
if
peer
:
del
dnsreqs
[
chan
]
del
dnsreqs
[
chan
]
debug3
(
'doing sendto
%
r
\n
'
%
(
peer
,))
debug3
(
'doing sendto
%
r
\n
'
%
(
peer
,))
dnslistener
.
sendto
(
data
,
peer
)
sock
.
sendto
(
data
,
peer
)
def
ondns
(
listener_sock
):
def
ondns
(
listener_sock
):
pkt
,
peer
=
listener_sock
.
recvfrom
(
4096
)
pkt
,
peer
=
listener_sock
.
recvfrom
(
4096
)
now
=
time
.
time
()
now
=
time
.
time
()
if
pkt
:
if
pkt
:
debug1
(
'DNS request from
%
r:
%
d bytes
\n
'
%
(
peer
,
len
(
pkt
)))
debug1
(
'DNS request from
%
r:
%
d bytes
\n
'
%
(
peer
,
len
(
pkt
)))
chan
=
mux
.
next_channel
()
chan
=
mux
.
next_channel
()
dnsreqs
[
chan
]
=
peer
,
now
+
30
dnsreqs
[
chan
]
=
peer
,
listener_sock
,
now
+
30
mux
.
send
(
chan
,
ssnet
.
CMD_DNS_REQ
,
pkt
)
mux
.
send
(
chan
,
ssnet
.
CMD_DNS_REQ
,
pkt
)
mux
.
channels
[
chan
]
=
lambda
cmd
,
data
:
dns_done
(
chan
,
data
)
mux
.
channels
[
chan
]
=
lambda
cmd
,
data
:
dns_done
(
chan
,
data
)
for
chan
,(
peer
,
timeout
)
in
dnsreqs
.
items
():
for
chan
,(
peer
,
sock
,
timeout
)
in
dnsreqs
.
items
():
if
timeout
<
now
:
if
timeout
<
now
:
del
dnsreqs
[
chan
]
del
dnsreqs
[
chan
]
debug3
(
'Remaining DNS requests:
%
d
\n
'
%
len
(
dnsreqs
))
debug3
(
'Remaining DNS requests:
%
d
\n
'
%
len
(
dnsreqs
))
...
...
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