Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
re6stnet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
4
Merge Requests
4
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
re6stnet
Commits
c84b2cec
Commit
c84b2cec
authored
Apr 29, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
security: drop UDP packets that are empty or from outside same re6st network
Also accepts packets from loopback.
parent
543e4faa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
re6st/tunnel.py
re6st/tunnel.py
+8
-2
No files found.
re6st/tunnel.py
View file @
c84b2cec
...
@@ -412,8 +412,14 @@ class TunnelManager(object):
...
@@ -412,8 +412,14 @@ class TunnelManager(object):
def
handlePeerEvent
(
self
):
def
handlePeerEvent
(
self
):
msg
,
address
=
self
.
sock
.
recvfrom
(
1
<<
16
)
msg
,
address
=
self
.
sock
.
recvfrom
(
1
<<
16
)
if
not
(
msg
or
utils
.
binFromIp
(
address
[
0
]).
startswith
(
self
.
_network
)):
if
address
[
0
]
==
'::1'
:
sender
=
None
else
:
sender
=
utils
.
binFromIp
(
address
[
0
])
if
not
sender
.
startswith
(
self
.
_network
):
return
return
if
not
msg
:
return
code
=
ord
(
msg
[
0
])
code
=
ord
(
msg
[
0
])
if
code
==
1
:
# answer
if
code
==
1
:
# answer
# Old versions may send additional and obsolete addresses.
# Old versions may send additional and obsolete addresses.
...
@@ -442,7 +448,7 @@ class TunnelManager(object):
...
@@ -442,7 +448,7 @@ class TunnelManager(object):
#else: # I don't know my IP yet!
#else: # I don't know my IP yet!
elif
code
==
255
:
elif
code
==
255
:
# the registry wants to know the topology for debugging purpose
# the registry wants to know the topology for debugging purpose
if
utils
.
binFromIp
(
address
[
0
])
[
len
(
self
.
_network
):].
startswith
(
if
not
sender
or
sender
[
len
(
self
.
_network
):].
startswith
(
self
.
peer_db
.
registry_prefix
):
self
.
peer_db
.
registry_prefix
):
msg
=
[
'
\
xfe
%s%u/%u
\
n
%u
\
n
'
%
(
msg
[
1
:],
msg
=
[
'
\
xfe
%s%u/%u
\
n
%u
\
n
'
%
(
msg
[
1
:],
int
(
self
.
_prefix
,
2
),
len
(
self
.
_prefix
),
int
(
self
.
_prefix
,
2
),
len
(
self
.
_prefix
),
...
...
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