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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Yohann D'Anello
re6stnet
Commits
d4462559
Commit
d4462559
authored
Jul 12, 2021
by
Yohann D'Anello
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take decision to update cost multipliers, for now there are hysterisis issues
Signed-off-by:
Yohann D'ANELLO
<
ynerant@crans.org
>
parent
35ed0e88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
re6st/tunnel.py
re6st/tunnel.py
+22
-6
No files found.
re6st/tunnel.py
View file @
d4462559
...
@@ -549,7 +549,7 @@ class BaseTunnelManager(object):
...
@@ -549,7 +549,7 @@ class BaseTunnelManager(object):
self
.
_received_pings_distance_2
.
setdefault
(
peer
,
[])
self
.
_received_pings_distance_2
.
setdefault
(
peer
,
[])
self
.
_received_pings_distance_2
[
peer
].
append
(
datetime
.
now
())
self
.
_received_pings_distance_2
[
peer
].
append
(
datetime
.
now
())
else
:
else
:
print
(
"[ping] Unknown code: "
+
msg
)
logging
.
warn
(
"[ping] Unknown code: "
+
msg
)
def
askInfo
(
self
,
prefix
):
def
askInfo
(
self
,
prefix
):
return
self
.
sendto
(
prefix
,
'
\
4
'
+
self
.
_info
(
True
))
return
self
.
sendto
(
prefix
,
'
\
4
'
+
self
.
_info
(
True
))
...
@@ -835,13 +835,13 @@ class TunnelManager(BaseTunnelManager):
...
@@ -835,13 +835,13 @@ class TunnelManager(BaseTunnelManager):
# 10 pings over 12 failed, node is not contactable.
# 10 pings over 12 failed, node is not contactable.
# Add bad score to the forwarding node
# Add bad score to the forwarding node
if
len
(
self
.
_sent_pings_distance_2
[
peer
])
-
len
(
self
.
_received_pings_distance_2
[
peer
])
>=
10
:
if
len
(
self
.
_sent_pings_distance_2
[
peer
])
-
len
(
self
.
_received_pings_distance_2
[
peer
])
>=
10
:
print
(
peer
+
" is not reachable"
)
logging
.
warn
(
peer
+
" is not reachable"
)
for
node
,
value
in
self
.
ctl
.
neighbours
.
items
():
for
node
,
value
in
self
.
ctl
.
neighbours
.
items
():
neighbour
,
routes
=
value
neighbour
,
routes
=
value
if
peer
in
routes
.
keys
():
if
peer
in
routes
.
keys
():
break
break
else
:
else
:
print
(
"Unknown peer: "
+
peer
+
", ignoring..."
)
logging
.
warn
(
"Unknown peer: "
+
peer
+
", ignoring..."
)
break
break
self
.
_bad_scores
.
setdefault
(
node
,
[])
self
.
_bad_scores
.
setdefault
(
node
,
[])
self
.
_bad_scores
[
node
].
append
((
peer
,
datetime
.
now
()))
self
.
_bad_scores
[
node
].
append
((
peer
,
datetime
.
now
()))
...
@@ -854,12 +854,28 @@ class TunnelManager(BaseTunnelManager):
...
@@ -854,12 +854,28 @@ class TunnelManager(BaseTunnelManager):
self
.
_bad_scores
=
{
k
:
[(
peer
,
d
)
for
(
peer
,
d
)
in
v
if
(
datetime
.
now
()
-
d
).
seconds
<
60
]
self
.
_bad_scores
=
{
k
:
[(
peer
,
d
)
for
(
peer
,
d
)
in
v
if
(
datetime
.
now
()
-
d
).
seconds
<
60
]
for
k
,
v
in
self
.
_bad_scores
.
items
()}
for
k
,
v
in
self
.
_bad_scores
.
items
()}
# Reset cost multiplier
for
node
,
value
in
self
.
ctl
.
neighbours
.
items
():
neigh
=
value
[
0
]
if
neigh
is
None
:
continue
# Default to 256
self
.
ctl
.
send
(
ctl
.
SetCostMultiplier
(
neigh
.
address
,
neigh
.
ifindex
,
256
))
# Ignore bad nodes
# Ignore bad nodes
for
peer
in
self
.
_bad_scores
.
keys
():
for
peer
in
self
.
_bad_scores
.
keys
():
# FIXME Find better rule
if
peer
is
None
or
not
self
.
_bad_scores
[
peer
]
or
peer
not
in
self
.
ctl
.
neighbours
:
if
self
.
_bad_scores
[
peer
]:
continue
print
(
peer
+
" IS A BAD PEER!"
)
paths_count
=
len
(
self
.
ctl
.
neighbours
[
peer
][
1
].
keys
())
bad_paths
=
len
(
set
(
v
[
0
]
for
v
in
self
.
_bad_scores
[
peer
]))
if
bad_paths
>=
paths_count
-
1
and
paths_count
>
1
:
print
(
peer
+
" IS A BAD PEER!"
)
try
:
neigh
=
self
.
ctl
.
neighbours
[
peer
][
0
]
self
.
ctl
.
send
(
ctl
.
SetCostMultiplier
(
neigh
.
address
,
neigh
.
ifindex
,
65535
))
except
Exception
,
e
:
print
(
e
)
def
babel_dump
(
self
):
def
babel_dump
(
self
):
t
=
time
.
time
()
t
=
time
.
time
()
...
...
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