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
0e054578
Commit
0e054578
authored
Aug 09, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sevral bug fix
parent
f73a5631
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
50 deletions
+39
-50
TODO
TODO
+6
-14
docs/re6stnet.rst
docs/re6stnet.rst
+0
-7
re6st-registry
re6st-registry
+2
-1
re6st/db.py
re6st/db.py
+3
-0
re6st/ovpn-server
re6st/ovpn-server
+5
-2
re6st/plib.py
re6st/plib.py
+6
-4
re6st/tunnel.py
re6st/tunnel.py
+5
-0
re6st/upnpigd.py
re6st/upnpigd.py
+1
-1
re6stnet
re6stnet
+1
-4
simulation/main.cpp
simulation/main.cpp
+10
-17
No files found.
TODO
View file @
0e054578
Bug :
Bug :
Peers stay connected to the bootstrap node so none can enter
Peers stay connected to the bootstrap node so none can enter
re6stnet adress should appear on only one interface
possible bug in the upnp refresh
Bug in the upnp refresh
Check :
Check that boostrap nodes work as intended
To be done :
To be done :
Choose the metric to add to bootstrap peers
test with python 2.6
Choose peer DB size.
Choose peer DB size.
Choose the number of peer we ask to the server
Choose the number of peer we ask to the server
Compare prefixes when 2 tunnels are established between the 2 same machines
Warn babeld about the tunnels wich are about to be deleted. Maybe we could just increase the cost.
Warn babeld about the tunnels wich are about to be deleted. Maybe we could
just increase the cost.
Do a test, on one ( or more ) real machine(s) preferably :
Do a test, on one ( or more ) real machine(s) preferably :
- package re6stnet
- package re6stnet
...
@@ -21,14 +14,11 @@ To be done :
...
@@ -21,14 +14,11 @@ To be done :
- follow the HOW TO section of the man page to setup a network
- follow the HOW TO section of the man page to setup a network
- see if it works....
- see if it works....
Put more information in the token mail ( registry ), such as :
Put more information in the token mail ( registry ), such as :
- the ip address of the network being built
- the ip address of the network being built
- the creator of the network ( add option in registry ? )
- the creator of the network ( add option in registry ? )
Make sure the re6stnet ip address is added on only one interface
( tweak the ovpn-server script ), else duplicate addresses appears in routing
tables.
Fix bootstrap problem :
Fix bootstrap problem :
registry & --private option ( see re6stnet man page HOW TO ).
registry & --private option ( see re6stnet man page HOW TO ).
one have to start the registry twice, the first time without
one have to start the registry twice, the first time without
...
@@ -36,4 +26,6 @@ To be done :
...
@@ -36,4 +26,6 @@ To be done :
Put a section about how to build the package from the sources in the README
Put a section about how to build the package from the sources in the README
Remove unnecessary information when sending a request to the server
docs/re6stnet.rst
View file @
0e054578
...
@@ -266,13 +266,6 @@ you can get them in the python interpreter::
...
@@ -266,13 +266,6 @@ you can get them in the python interpreter::
>>> print prefix
>>> print prefix
0000000000000011
0000000000000011
from re6st import utils
network = utils.networkFromCa('clients/server/ca.pem')
re6st_ip, prefix = utils.ipFromCert(network, 'clients/server/cert.crt')
print re6st_ip
print prefix
Now you can restart your re6st-registry with two more options:
Now you can restart your re6st-registry with two more options:
``re6st-registry port_number --db db_path --ca path_to_ca.crt
``re6st-registry port_number --db db_path --ca path_to_ca.crt
...
...
re6st-registry
View file @
0e054578
...
@@ -235,7 +235,7 @@ class main(object):
...
@@ -235,7 +235,7 @@ class main(object):
def
declare
(
self
,
handler
,
address
):
def
declare
(
self
,
handler
,
address
):
print
"declaring new node"
print
"declaring new node"
client_address
,
address
=
address
client_address
,
address
=
address
client_address
,
_
=
handler
.
client_address
client_address
,
_
,
_
,
_
=
handler
.
client_address
client_ip
=
utils
.
binFromIp
(
client_address
)
client_ip
=
utils
.
binFromIp
(
client_address
)
if
client_ip
.
startswith
(
self
.
network
):
if
client_ip
.
startswith
(
self
.
network
):
prefix
=
client_ip
[
len
(
self
.
network
):]
prefix
=
client_ip
[
len
(
self
.
network
):]
...
@@ -249,6 +249,7 @@ class main(object):
...
@@ -249,6 +249,7 @@ class main(object):
def
getPeerList
(
self
,
handler
,
n
,
client_address
):
def
getPeerList
(
self
,
handler
,
n
,
client_address
):
assert
0
<
n
<
1000
assert
0
<
n
<
1000
client_address
,
_
,
_
,
_
=
handler
.
client_address
client_ip
=
utils
.
binFromIp
(
client_address
)
client_ip
=
utils
.
binFromIp
(
client_address
)
if
client_ip
.
startswith
(
self
.
network
):
if
client_ip
.
startswith
(
self
.
network
):
if
time
.
time
()
>
self
.
last_refresh
+
self
.
refresh_interval
:
if
time
.
time
()
>
self
.
last_refresh
+
self
.
refresh_interval
:
...
...
re6st/db.py
View file @
0e054578
...
@@ -86,6 +86,9 @@ class PeerManager:
...
@@ -86,6 +86,9 @@ class PeerManager:
def
_declare
(
self
):
def
_declare
(
self
):
if
self
.
_address
!=
None
:
if
self
.
_address
!=
None
:
print
self
.
_internal_ip
print
self
.
_address
print
utils
.
address_str
(
self
.
_address
)
logging
.
info
(
'Sending connection info to server...'
)
logging
.
info
(
'Sending connection info to server...'
)
self
.
_proxy
.
declare
((
self
.
_internal_ip
,
self
.
_proxy
.
declare
((
self
.
_internal_ip
,
utils
.
address_str
(
self
.
_address
)))
utils
.
address_str
(
self
.
_address
)))
...
...
re6st/ovpn-server
View file @
0e054578
...
@@ -42,8 +42,11 @@ script_type = os.environ['script_type']
...
@@ -42,8 +42,11 @@ script_type = os.environ['script_type']
if
script_type
==
'up'
:
if
script_type
==
'up'
:
from
subprocess
import
call
from
subprocess
import
call
dev
=
os
.
environ
[
'dev'
]
dev
=
os
.
environ
[
'dev'
]
sys
.
exit
(
call
((
'ip'
,
'link'
,
'set'
,
dev
,
'up'
))
if
sys
.
argv
[
1
]
!=
'none'
:
or
call
((
'ip'
,
'addr'
,
'add'
,
sys
.
argv
[
1
],
'dev'
,
dev
)))
sys
.
exit
(
call
((
'ip'
,
'link'
,
'set'
,
dev
,
'up'
))
or
call
((
'ip'
,
'addr'
,
'add'
,
sys
.
argv
[
1
],
'dev'
,
dev
)))
else
:
sys
.
exit
(
call
((
'ip'
,
'link'
,
'set'
,
dev
,
'up'
)))
if
script_type
==
'client-connect'
:
if
script_type
==
'client-connect'
:
# Send client its external ip address
# Send client its external ip address
...
...
re6st/plib.py
View file @
0e054578
...
@@ -25,10 +25,14 @@ def openvpn(hello_interval, *args, **kw):
...
@@ -25,10 +25,14 @@ def openvpn(hello_interval, *args, **kw):
def
server
(
server_ip
,
ip_length
,
max_clients
,
dh_path
,
pipe_fd
,
port
,
proto
,
hello_interval
,
*
args
,
**
kw
):
def
server
(
server_ip
,
ip_length
,
max_clients
,
dh_path
,
pipe_fd
,
port
,
proto
,
hello_interval
,
*
args
,
**
kw
):
logging
.
debug
(
'Starting server...'
)
logging
.
debug
(
'Starting server...'
)
if
server_ip
!=
''
:
script_up
=
'%s %s/%u'
%
(
ovpn_server
,
server_ip
,
64
)
else
:
script_up
=
'%s none'
%
ovpn_server
return
openvpn
(
hello_interval
,
return
openvpn
(
hello_interval
,
'--tls-server'
,
'--tls-server'
,
'--mode'
,
'server'
,
'--mode'
,
'server'
,
'--up'
,
'%s %s/%u'
%
(
ovpn_server
,
server_ip
,
64
)
,
'--up'
,
script_up
,
'--client-connect'
,
ovpn_server
+
' '
+
str
(
pipe_fd
),
'--client-connect'
,
ovpn_server
+
' '
+
str
(
pipe_fd
),
'--client-disconnect'
,
ovpn_server
+
' '
+
str
(
pipe_fd
),
'--client-disconnect'
,
ovpn_server
+
' '
+
str
(
pipe_fd
),
'--dh'
,
dh_path
,
'--dh'
,
dh_path
,
...
@@ -56,7 +60,7 @@ def client(server_address, pipe_fd, hello_interval, *args, **kw):
...
@@ -56,7 +60,7 @@ def client(server_address, pipe_fd, hello_interval, *args, **kw):
return
openvpn
(
hello_interval
,
*
remote
,
**
kw
)
return
openvpn
(
hello_interval
,
*
remote
,
**
kw
)
def
router
(
network
,
internal_ip
,
interface_list
,
isBootstrap
,
def
router
(
network
,
internal_ip
,
interface_list
,
wireless
,
hello_interval
,
state_path
,
**
kw
):
wireless
,
hello_interval
,
state_path
,
**
kw
):
logging
.
info
(
'Starting babel...'
)
logging
.
info
(
'Starting babel...'
)
args
=
[
'babeld'
,
args
=
[
'babeld'
,
...
@@ -76,8 +80,6 @@ def router(network, internal_ip, interface_list, isBootstrap,
...
@@ -76,8 +80,6 @@ def router(network, internal_ip, interface_list, isBootstrap,
'-S'
,
state_path
,
'-S'
,
state_path
,
'-s'
,
'-s'
,
]
]
#if isBootstrap:
# args.extend(['-C', 'redistribute ip %s::/%u metric 16000' % (utils.ipFromBin(network), len(network))])
if
wireless
:
if
wireless
:
args
.
append
(
'-w'
)
args
.
append
(
'-w'
)
args
=
args
+
interface_list
args
=
args
+
interface_list
...
...
re6st/tunnel.py
View file @
0e054578
...
@@ -102,6 +102,11 @@ class TunnelManager:
...
@@ -102,6 +102,11 @@ class TunnelManager:
self
.
_client_count
-
len
(
self
.
_connection_dict
)):
self
.
_client_count
-
len
(
self
.
_connection_dict
)):
logging
.
info
(
'Establishing a connection with %s/%u'
%
logging
.
info
(
'Establishing a connection with %s/%u'
%
(
hex
(
int
(
prefix
,
2
))[
2
:],
len
(
prefix
)))
(
hex
(
int
(
prefix
,
2
))[
2
:],
len
(
prefix
)))
# DEBUG
print
self
.
free_interface_set
print
self
.
_client_count
print
self
.
_connection_dict
print
len
(
self
.
_connection_dict
)
iface
=
self
.
free_interface_set
.
pop
()
iface
=
self
.
free_interface_set
.
pop
()
self
.
_connection_dict
[
prefix
]
=
Connection
(
address
,
self
.
_connection_dict
[
prefix
]
=
Connection
(
address
,
self
.
_write_pipe
,
self
.
_hello
,
iface
,
self
.
_write_pipe
,
self
.
_hello
,
iface
,
...
...
re6st/upnpigd.py
View file @
0e054578
...
@@ -44,7 +44,7 @@ class Forwarder:
...
@@ -44,7 +44,7 @@ class Forwarder:
return
None
return
None
# Make the redirection
# Make the redirection
if
self
.
_u
.
addportmapping
(
external_port
,
'UDP'
,
self
.
_u
.
lanaddr
,
if
self
.
_u
.
addportmapping
(
external_port
,
upnp_proto
,
self
.
_u
.
lanaddr
,
int
(
local_port
),
're6stnet openvpn server'
,
''
):
int
(
local_port
),
're6stnet openvpn server'
,
''
):
logging
.
debug
(
'Forwarding %s:%s to %s:%s'
%
(
self
.
_external_ip
,
logging
.
debug
(
'Forwarding %s:%s to %s:%s'
%
(
self
.
_external_ip
,
external_port
,
self
.
_u
.
lanaddr
,
local_port
))
external_port
,
self
.
_u
.
lanaddr
,
local_port
))
...
...
re6stnet
View file @
0e054578
...
@@ -59,9 +59,6 @@ def getConfig():
...
@@ -59,9 +59,6 @@ def getConfig():
_
(
'-w'
,
'--wireless'
,
action
=
'store_true'
,
_
(
'-w'
,
'--wireless'
,
action
=
'store_true'
,
help
=
'''Set all interfaces to be treated as wireless interfaces
help
=
'''Set all interfaces to be treated as wireless interfaces
for the routing protocol'''
)
for the routing protocol'''
)
_
(
'--isbootstrap'
,
default
=
False
,
action
=
'store_true'
,
help
=
"""Notify that the peer is a bootstrap peer and that other
peers shouldn't stay connected to it for too long"""
)
# Tunnel options
# Tunnel options
_
(
'--pp'
,
nargs
=
2
,
action
=
'append'
,
_
(
'--pp'
,
nargs
=
2
,
action
=
'append'
,
...
@@ -149,7 +146,7 @@ def main():
...
@@ -149,7 +146,7 @@ def main():
interface_list
=
list
(
tunnel_manager
.
free_interface_set
)
\
interface_list
=
list
(
tunnel_manager
.
free_interface_set
)
\
+
config
.
iface_list
+
list
(
iface
+
config
.
iface_list
+
list
(
iface
for
_
,
_
,
iface
in
config
.
pp
)
for
_
,
_
,
iface
in
config
.
pp
)
router
=
plib
.
router
(
network
,
internal_ip
,
interface_list
,
config
.
isbootstrap
,
config
.
wireless
,
router
=
plib
.
router
(
network
,
internal_ip
,
interface_list
,
config
.
wireless
,
config
.
hello
,
os
.
path
.
join
(
config
.
state
,
'babeld.state'
),
config
.
hello
,
os
.
path
.
join
(
config
.
state
,
'babeld.state'
),
stdout
=
os
.
open
(
os
.
path
.
join
(
config
.
log
,
'babeld.log'
),
stdout
=
os
.
open
(
os
.
path
.
join
(
config
.
log
,
'babeld.log'
),
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_TRUNC
),
stderr
=
subprocess
.
STDOUT
)
os
.
O_WRONLY
|
os
.
O_CREAT
|
os
.
O_TRUNC
),
stderr
=
subprocess
.
STDOUT
)
...
...
simulation/main.cpp
View file @
0e054578
...
@@ -14,8 +14,8 @@ Results Simulate(int seed, int n, int k, int maxPeer, int maxDistanceFrom, floa
...
@@ -14,8 +14,8 @@ Results Simulate(int seed, int n, int k, int maxPeer, int maxDistanceFrom, floa
for
(
int
r
=
0
;
r
<
runs
;
r
++
)
for
(
int
r
=
0
;
r
<
runs
;
r
++
)
{
{
Graph
graph
(
n
,
k
,
maxPeer
,
rng
);
Graph
graph
(
n
,
k
,
maxPeer
,
rng
);
//
graph.KillMachines(alivePercent);
graph
.
KillMachines
(
alivePercent
);
//
results.AddAccessibilitySample(((double)graph.CountUnreachableFrom(0))/((double)n));
results
.
AddAccessibilitySample
(((
double
)
graph
.
CountUnreachableFrom
(
0
))
/
((
double
)
n
));
//int minCut = graph.GetMinCut();
//int minCut = graph.GetMinCut();
//if(results.minKConnexity == -1 || results.minKConnexity > minCut)
//if(results.minKConnexity == -1 || results.minKConnexity > minCut)
//results.minKConnexity = minCut;
//results.minKConnexity = minCut;
...
@@ -29,7 +29,7 @@ Results Simulate(int seed, int n, int k, int maxPeer, int maxDistanceFrom, floa
...
@@ -29,7 +29,7 @@ Results Simulate(int seed, int n, int k, int maxPeer, int maxDistanceFrom, floa
results.UpdateDistance(distance, graph.size);
results.UpdateDistance(distance, graph.size);
}*/
}*/
int
distance
[
graph
.
size
];
/*
int distance[graph.size];
float routesCount[graph.size];
float routesCount[graph.size];
int nRefresh = 1;
int nRefresh = 1;
...
@@ -77,7 +77,7 @@ Results Simulate(int seed, int n, int k, int maxPeer, int maxDistanceFrom, floa
...
@@ -77,7 +77,7 @@ Results Simulate(int seed, int n, int k, int maxPeer, int maxDistanceFrom, floa
moy += distance[i];
moy += distance[i];
moy /= graph.size;
moy /= graph.size;
cout << "Avg distance : " << moy << endl;
cout << "Avg distance : " << moy << endl;
}
}
*/
}
}
results
.
Finalise
();
results
.
Finalise
();
...
@@ -90,26 +90,19 @@ int main(int argc, char** argv)
...
@@ -90,26 +90,19 @@ int main(int argc, char** argv)
FILE
*
output
=
fopen
(
outName
,
"wt"
);
FILE
*
output
=
fopen
(
outName
,
"wt"
);
int
fno
=
fileno
(
output
);
int
fno
=
fileno
(
output
);
fprintf
(
output
,
"n,k,a,maxPeer,avgDistance,disconnected,disconnectionProba,"
fprintf
(
output
,
"n,k,a,accessibility
\n
"
);
"maxDistance,maxArityDistrib,minCut,accessibility
\n
"
);
vector
<
future
<
string
>>
outputStrings
;
vector
<
future
<
string
>>
outputStrings
;
for
(
int
n
=
2000
;
n
<=
2
000
;
n
*=
2
)
for
(
int
n
=
10000
;
n
<=
10
000
;
n
*=
2
)
for
(
int
k
=
10
;
k
<=
10
;
k
+=
5
)
for
(
int
k
=
5
;
k
<=
15
;
k
+=
5
)
for
(
float
a
=
1
;
a
<=
1
;
a
+=
0.05
)
for
(
float
a
=
0.05
;
a
<
1
;
a
+=
0.05
)
{
{
int
seed
=
rng
();
int
seed
=
rng
();
outputStrings
.
push_back
(
async
(
launch
::
async
,
[
seed
,
n
,
k
,
a
]()
outputStrings
.
push_back
(
async
(
launch
::
async
,
[
seed
,
n
,
k
,
a
]()
{
{
Results
results
=
Simulate
(
seed
,
n
,
k
,
2.5
*
k
,
10000
,
a
,
1
);
Results
results
=
Simulate
(
seed
,
n
,
k
,
2.5
*
k
,
10000
,
a
,
1
00
);
ostringstream
out
;
ostringstream
out
;
out
<<
n
<<
","
<<
k
<<
","
<<
a
<<
","
<<
3
*
k
<<
","
out
<<
n
<<
","
<<
k
<<
","
<<
a
<<
","
<<
results
.
avgDistance
<<
","
<<
results
.
disconnected
<<
","
<<
results
.
disconnectionProba
<<
","
<<
results
.
maxDistanceReached
<<
","
<<
results
.
arityDistrib
[
3
*
k
]
<<
","
<<
results
.
minKConnexity
<<
","
<<
results
.
avgAccessibility
<<
results
.
avgAccessibility
<<
endl
;
<<
endl
;
return
out
.
str
();
return
out
.
str
();
...
...
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