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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
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
Hide 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 :
...
@@ -11,11 +11,6 @@ To be done :
To be discussed:
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
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 ?
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
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
...
@@ -5,6 +5,20 @@ from email.mime.text import MIMEText
from
OpenSSL
import
crypto
from
OpenSSL
import
crypto
import
utils
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
# 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
# openssl req -nodes -new -x509 -key ca.key -set_serial 0x120010db80042 -days 365 -out ca.crt
...
...
tunnel.py
View file @
e661f4d5
...
@@ -2,8 +2,10 @@ import os, random, traceback, time, struct, subprocess, operator, math
...
@@ -2,8 +2,10 @@ import os, random, traceback, time, struct, subprocess, operator, math
import
plib
,
utils
,
db
import
plib
,
utils
,
db
log
=
None
log
=
None
smooth
=
0.3
# this is used to smooth the traffic sampling. Lower value
smooth
=
0.3
# this is used to smooth the traffic sampling. Lower value
# mean more smooth
# 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
# Be carfull the refresh interval should let the routes be established
...
@@ -22,7 +24,7 @@ class Connection:
...
@@ -22,7 +24,7 @@ class Connection:
self
.
iface
=
iface
self
.
iface
=
iface
self
.
routes
=
0
self
.
routes
=
0
self
.
_prefix
=
prefix
self
.
_prefix
=
prefix
self
.
_
bandwidth
=
None
self
.
bandwidth
=
None
self
.
_last_trafic
=
None
self
.
_last_trafic
=
None
# TODO : update the stats
# TODO : update the stats
...
@@ -49,14 +51,14 @@ class Connection:
...
@@ -49,14 +51,14 @@ class Connection:
if
bool
(
self
.
_last_trafic
):
if
bool
(
self
.
_last_trafic
):
bw
=
(
trafic
-
self
.
_last_trafic
)
/
(
t
-
bw
=
(
trafic
-
self
.
_last_trafic
)
/
(
t
-
self
.
_last_trafic_update
)
self
.
_last_trafic_update
)
if
bool
(
self
.
_
bandwidth
):
if
bool
(
self
.
bandwidth
):
self
.
_bandwidth
=
((
1
-
smooth
)
*
self
.
_
bandwidth
self
.
bandwidth
=
((
1
-
smooth
)
*
self
.
bandwidth
+
smooth
*
bw
)
+
smooth
*
bw
)
else
:
else
:
self
.
_
bandwidth
=
bw
self
.
bandwidth
=
bw
utils
.
log
(
'New bandwidth calculated on iface %s : %s'
%
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_update
=
t
self
.
_last_trafic
=
trafic
self
.
_last_trafic
=
trafic
...
@@ -107,9 +109,10 @@ class TunnelManager:
...
@@ -107,9 +109,10 @@ class TunnelManager:
def
_removeSomeTunnels
(
self
):
def
_removeSomeTunnels
(
self
):
# Get the candidates to killing
# Get the candidates to killing
candidates
=
sorted
(
self
.
_connection_dict
,
key
=
lambda
p
:
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
)
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
)
-
for
prefix
in
candidates
[
0
:
max
(
0
,
len
(
self
.
_connection_dict
)
-
self
.
_client_count
+
self
.
_refresh_count
)]:
self
.
_client_count
+
self
.
_refresh_count
)]:
self
.
_kill
(
prefix
)
self
.
_kill
(
prefix
)
...
...
vifibnet.py
View file @
e661f4d5
...
@@ -174,6 +174,20 @@ def main():
...
@@ -174,6 +174,20 @@ def main():
pass
pass
tunnel_manager
.
killAll
()
tunnel_manager
.
killAll
()
return
0
return
0
except
:
try
:
router
.
kill
()
except
:
pass
try
:
server_process
.
kill
()
except
:
pass
try
:
tunnel_manager
.
killAll
()
except
:
pass
raise
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
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