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
Rafael Monnerat
re6stnet
Commits
e661f4d5
Commit
e661f4d5
authored
Jul 26, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The trafic is now taken into account to choose the tunnel to delete
openvpns and babeld should now exit correctly
parent
ea9d24b8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
14 deletions
+40
-14
TODO
TODO
+0
-5
registry.py
registry.py
+14
-0
tunnel.py
tunnel.py
+12
-9
vifibnet.py
vifibnet.py
+14
-0
No files found.
TODO
View file @
e661f4d5
...
...
@@ -11,11 +11,6 @@ To be done :
To be discussed:
G : There is a blacklist system now ( blacklisted prefixes are deleted from
the peers database ). Since all nodes whose packets are routed through
the local network are blacklisted, I think we should reset the blacklist
from time to time....
U : Babel seems to be very long to establish the routes : maybe we should
tell him thant we are not on a wired network but on a mobile network ?
G : babel establish routes quickly enough i'd say. There are two new
...
...
registry.py
View file @
e661f4d5
...
...
@@ -5,6 +5,20 @@ from email.mime.text import MIMEText
from
OpenSSL
import
crypto
import
utils
# Fix for librpcxml to avoid doing reverse dns on each request
# it was causing a 10s delay on each request when no reverse DNS was avalaible
# for tis IP
import
BaseHTTPServer
def
not_insane_address_string
(
self
):
host
,
port
=
self
.
client_address
[:
2
]
return
'%s (reverse DNS disabled)'
%
host
# used to call: socket.getfqdn(host)
BaseHTTPServer
.
BaseHTTPRequestHandler
.
address_string
=
not_insane_address_string
# To generate server ca and key with serial for 2001:db8:42::/48
# openssl req -nodes -new -x509 -key ca.key -set_serial 0x120010db80042 -days 365 -out ca.crt
...
...
tunnel.py
View file @
e661f4d5
...
...
@@ -4,6 +4,8 @@ import plib, utils, db
log
=
None
smooth
=
0.3
# this is used to smooth the traffic sampling. Lower value
# mean more smooth
protected
=
0.2
# ratio of the tunnels protected against kill because they are
# used a lot
# Be carfull the refresh interval should let the routes be established
...
...
@@ -22,7 +24,7 @@ class Connection:
self
.
iface
=
iface
self
.
routes
=
0
self
.
_prefix
=
prefix
self
.
_
bandwidth
=
None
self
.
bandwidth
=
None
self
.
_last_trafic
=
None
# TODO : update the stats
...
...
@@ -49,14 +51,14 @@ class Connection:
if
bool
(
self
.
_last_trafic
):
bw
=
(
trafic
-
self
.
_last_trafic
)
/
(
t
-
self
.
_last_trafic_update
)
if
bool
(
self
.
_
bandwidth
):
self
.
_bandwidth
=
((
1
-
smooth
)
*
self
.
_
bandwidth
if
bool
(
self
.
bandwidth
):
self
.
bandwidth
=
((
1
-
smooth
)
*
self
.
bandwidth
+
smooth
*
bw
)
else
:
self
.
_
bandwidth
=
bw
self
.
bandwidth
=
bw
utils
.
log
(
'New bandwidth calculated on iface %s : %s'
%
(
self
.
iface
,
self
.
_
bandwidth
),
4
)
(
self
.
iface
,
self
.
bandwidth
),
4
)
self
.
_last_trafic_update
=
t
self
.
_last_trafic
=
trafic
...
...
@@ -107,9 +109,10 @@ class TunnelManager:
def
_removeSomeTunnels
(
self
):
# Get the candidates to killing
candidates
=
sorted
(
self
.
_connection_dict
,
key
=
lambda
p
:
self
.
_connection_dict
[
p
].
bandwidth
)
candidates
=
sorted
(
candidates
[
0
:
int
(
math
.
ceil
((
1
-
protected
)
*
len
(
candidates
)))],
key
=
lambda
p
:
self
.
_connection_dict
[
p
].
routes
)
print
max
(
0
,
len
(
self
.
_connection_dict
)
-
self
.
_client_count
+
self
.
_refresh_count
)
# DEBUG
print
self
.
_client_count
for
prefix
in
candidates
[
0
:
max
(
0
,
len
(
self
.
_connection_dict
)
-
self
.
_client_count
+
self
.
_refresh_count
)]:
self
.
_kill
(
prefix
)
...
...
vifibnet.py
View file @
e661f4d5
...
...
@@ -174,6 +174,20 @@ def main():
pass
tunnel_manager
.
killAll
()
return
0
except
:
try
:
router
.
kill
()
except
:
pass
try
:
server_process
.
kill
()
except
:
pass
try
:
tunnel_manager
.
killAll
()
except
:
pass
raise
if
__name__
==
"__main__"
:
main
()
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