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
Xiaowu Zhang
re6stnet
Commits
150b92a3
Commit
150b92a3
authored
Aug 16, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A peer now only advertise one route for its /64 instead of 3 (/64, /128, /128 anycast)
parent
4f82d0fa
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
18 deletions
+75
-18
TODO
TODO
+5
-4
re6st/db.py
re6st/db.py
+2
-2
re6st/plib.py
re6st/plib.py
+4
-2
re6st/tunnel.py
re6st/tunnel.py
+2
-2
re6stnet
re6stnet
+3
-2
simulation/realistic_dataset/graph.cpp
simulation/realistic_dataset/graph.cpp
+50
-0
simulation/realistic_dataset/main.cpp
simulation/realistic_dataset/main.cpp
+8
-6
simulation/realistic_dataset/main.h
simulation/realistic_dataset/main.h
+1
-0
No files found.
TODO
View file @
150b92a3
...
@@ -2,14 +2,15 @@ Bug :
...
@@ -2,14 +2,15 @@ Bug :
possible bug in the upnp refresh, when refreshing after a too long time
possible bug in the upnp refresh, when refreshing after a too long time
To be done :
To be done :
Choose the db size and
who
peers are deleted
Choose the db size and
how
peers are deleted
find out who to have an automatic recovery without declare
find out who to have an automatic recovery without declare
Test the package
Test the package
PB : at the beggining a node tries to find 10 other nodes so ask for 10 bootsrap nodes
at the beggining a node tries to find 10 other nodes so ask for 10 bootsrap nodes
This slow the beginning !!
This slow the beginning and might overload the server
If their is too many nodes flaged as bad, the node never ask for some bootstrap peer
When a node arrive it is in nobody DB => very slow beginning. It should advertise itself more
When a node arrive it is in nobody DB => very slow beginning. It should advertise itself more
.
check the ips attributed
check the ips attributed
remove decalre
remove decalre
...
...
re6st/db.py
View file @
150b92a3
...
@@ -119,8 +119,8 @@ class PeerManager:
...
@@ -119,8 +119,8 @@ class PeerManager:
except
sqlite3
.
IntegrityError
,
e
:
except
sqlite3
.
IntegrityError
,
e
:
if
e
.
args
[
0
]
!=
'column prefix is not unique'
:
if
e
.
args
[
0
]
!=
'column prefix is not unique'
:
raise
raise
#
except Exception, e:
except
Exception
,
e
:
#
logging.info('Unable to bootstrap : %s' % e)
logging
.
info
(
'Unable to bootstrap : %s'
%
e
)
return
False
return
False
def
usePeer
(
self
,
prefix
):
def
usePeer
(
self
,
prefix
):
...
...
re6st/plib.py
View file @
150b92a3
...
@@ -62,12 +62,14 @@ def client(server_address, pipe_fd, hello_interval, encrypt, *args, **kw):
...
@@ -62,12 +62,14 @@ def client(server_address, pipe_fd, hello_interval, encrypt, *args, **kw):
return
openvpn
(
hello_interval
,
encrypt
,
*
remote
,
**
kw
)
return
openvpn
(
hello_interval
,
encrypt
,
*
remote
,
**
kw
)
def
router
(
network
,
internal_ip
,
interface_list
,
def
router
(
network
,
subnet
,
subnet_size
,
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'
,
'-C'
,
'redistribute local ip %s'
%
(
internal_ip
),
'-C'
,
'redistribute local ip %s/%s le %s'
%
(
subnet
,
subnet_size
,
subnet_size
),
'-C'
,
'redistribute local deny'
,
'-C'
,
'redistribute local deny'
,
'-C'
,
'redistribute ip %s/%s le %s'
%
(
subnet
,
subnet_size
,
subnet_size
),
'-C'
,
'redistribute deny'
,
# Route VIFIB ip adresses
# Route VIFIB ip adresses
'-C'
,
'in ip %s::/%u'
%
(
utils
.
ipFromBin
(
network
),
len
(
network
)),
'-C'
,
'in ip %s::/%u'
%
(
utils
.
ipFromBin
(
network
),
len
(
network
)),
# Route only addresse in the 'local' network,
# Route only addresse in the 'local' network,
...
...
re6st/tunnel.py
View file @
150b92a3
...
@@ -135,7 +135,7 @@ class TunnelManager:
...
@@ -135,7 +135,7 @@ class TunnelManager:
iface
=
line
[
-
1
]
iface
=
line
[
-
1
]
subnet_size
=
int
(
line
[
1
],
16
)
subnet_size
=
int
(
line
[
1
],
16
)
logging
.
trace
(
'Route on iface %s detected to %s/%s'
logging
.
trace
(
'Route on iface %s detected to %s/%s'
%
(
iface
,
ip
,
subnet_size
))
%
(
iface
,
line
[
0
]
,
subnet_size
))
if
iface
in
self
.
_iface_to_prefix
.
keys
():
if
iface
in
self
.
_iface_to_prefix
.
keys
():
self
.
_connection_dict
[
self
.
_iface_to_prefix
[
iface
]].
routes
+=
1
self
.
_connection_dict
[
self
.
_iface_to_prefix
[
iface
]].
routes
+=
1
if
iface
in
self
.
_iface_list
and
self
.
_net_len
<
subnet_size
<
128
:
if
iface
in
self
.
_iface_list
and
self
.
_net_len
<
subnet_size
<
128
:
...
@@ -168,7 +168,7 @@ class TunnelManager:
...
@@ -168,7 +168,7 @@ class TunnelManager:
if
self
.
_peer_db
.
address
:
if
self
.
_peer_db
.
address
:
ip
=
'%s:%s:%s:%s:%s:%s:%s:%s'
%
(
peerIp
[
0
:
4
],
peerIp
[
4
:
8
],
peerIp
[
8
:
12
],
ip
=
'%s:%s:%s:%s:%s:%s:%s:%s'
%
(
peerIp
[
0
:
4
],
peerIp
[
4
:
8
],
peerIp
[
8
:
12
],
peerIp
[
12
:
16
],
peerIp
[
16
:
20
],
peerIp
[
20
:
24
],
peerIp
[
24
:
28
],
peerIp
[
28
:
32
])
peerIp
[
12
:
16
],
peerIp
[
16
:
20
],
peerIp
[
20
:
24
],
peerIp
[
24
:
28
],
peerIp
[
28
:
32
])
logging
.
debug
(
'Notifying peer %s'
%
ip
)
logging
.
trace
(
'Notifying peer %s'
%
ip
)
sock
=
socket
.
socket
(
socket
.
AF_INET6
,
socket
.
SOCK_DGRAM
)
sock
=
socket
.
socket
(
socket
.
AF_INET6
,
socket
.
SOCK_DGRAM
)
sock
.
sendto
(
'%s %s
\
n
'
%
(
self
.
_prefix
,
utils
.
address_str
(
self
.
_peer_db
.
address
)),
(
ip
,
326
))
sock
.
sendto
(
'%s %s
\
n
'
%
(
self
.
_prefix
,
utils
.
address_str
(
self
.
_peer_db
.
address
)),
(
ip
,
326
))
except
socket
.
error
,
e
:
except
socket
.
error
,
e
:
...
...
re6stnet
View file @
150b92a3
...
@@ -153,8 +153,9 @@ def main():
...
@@ -153,8 +153,9 @@ 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
.
wireless
,
subnet
=
utils
.
ipFromBin
((
network
+
prefix
).
ljust
(
128
,
'0'
))
config
.
hello
,
os
.
path
.
join
(
config
.
state
,
'babeld.state'
),
router
=
plib
.
router
(
network
,
subnet
,
len
(
prefix
)
+
len
(
network
),
interface_list
,
config
.
wireless
,
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/realistic_dataset/graph.cpp
View file @
150b92a3
...
@@ -110,6 +110,56 @@ void Graph::GetRoutesFrom(int from, int* nRoutes, int* prevs, int* distances)
...
@@ -110,6 +110,56 @@ void Graph::GetRoutesFrom(int from, int* nRoutes, int* prevs, int* distances)
}
}
}
}
void
Graph
::
GetRoutesFromHop
(
int
from
,
int
*
nRoutes
,
int
*
prevs
,
int
*
distances
)
{
// init vars
stack
<
int
>
order
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
distances
[
i
]
=
-
1
;
nRoutes
[
i
]
=
1
;
}
distances
[
from
]
=
0
;
priority_queue
<
pair
<
int
,
int
>>
remainingNodes
;
remainingNodes
.
push
(
pair
<
int
,
int
>
(
-
0
,
from
));
// Get the order
while
(
!
remainingNodes
.
empty
())
{
pair
<
int
,
int
>
p
=
remainingNodes
.
top
();
int
node
=
p
.
second
;
int
d
=
-
p
.
first
;
remainingNodes
.
pop
();
if
(
d
==
distances
[
node
])
{
order
.
push
(
node
);
for
(
int
neighbor
:
adjacency
[
node
])
{
int
neighborDist
=
d
+
1
;
if
(
distances
[
neighbor
]
==
-
1
||
distances
[
neighbor
]
>
neighborDist
)
{
distances
[
neighbor
]
=
neighborDist
;
prevs
[
neighbor
]
=
node
;
remainingNodes
.
push
(
pair
<
int
,
int
>
(
-
neighborDist
,
neighbor
));
}
}
}
}
// get the BC
while
(
!
order
.
empty
())
{
int
node
=
order
.
top
();
order
.
pop
();
if
(
distances
[
node
]
!=
-
1
&&
node
!=
from
)
nRoutes
[
prevs
[
node
]]
+=
nRoutes
[
node
];
}
}
routesResult
Graph
::
GetRouteResult
(
int
node
,
int
nRefresh
,
double
*
bc
)
routesResult
Graph
::
GetRouteResult
(
int
node
,
int
nRefresh
,
double
*
bc
)
{
{
int
nRoutes
[
size
],
prevs
[
size
],
distances
[
size
];
int
nRoutes
[
size
],
prevs
[
size
],
distances
[
size
];
...
...
simulation/realistic_dataset/main.cpp
View file @
150b92a3
...
@@ -89,6 +89,8 @@ void testOptimized(int size, int k, int maxPeer, int seed, Latency* latency, con
...
@@ -89,6 +89,8 @@ void testOptimized(int size, int k, int maxPeer, int seed, Latency* latency, con
fflush
(
output
);
fflush
(
output
);
fsync
(
fno
);
fsync
(
fno
);
graph
.
Reboot
(
1.0
/
(
2500
+
1.0
),
i
);
cout
<<
"
\r
"
<<
i
+
1
<<
"/"
<<
3000
;
cout
<<
"
\r
"
<<
i
+
1
<<
"/"
<<
3000
;
cout
.
flush
();
cout
.
flush
();
}
}
...
@@ -121,9 +123,7 @@ void Optimize(int size, int k, int maxPeer, int seed, Latency* latency, const ch
...
@@ -121,9 +123,7 @@ void Optimize(int size, int k, int maxPeer, int seed, Latency* latency, const ch
double
nRoutesKilled
=
0
;
double
nRoutesKilled
=
0
;
int
arityDistrib
[
maxPeer
+
1
];
int
arityDistrib
[
maxPeer
+
1
];
//graph.Reboot(1.0/(100 + 1.0), i);
for
(
int
i
=
0
;
i
<
1000
;
i
++
)
for
(
int
i
=
0
;
i
<
3000
;
i
++
)
{
{
vector
<
future
<
pair
<
double
,
double
>>>
threads
;
vector
<
future
<
pair
<
double
,
double
>>>
threads
;
for
(
int
a
=
0
;
a
<
range
;
a
++
)
for
(
int
a
=
0
;
a
<
range
;
a
++
)
...
@@ -172,6 +172,8 @@ void Optimize(int size, int k, int maxPeer, int seed, Latency* latency, const ch
...
@@ -172,6 +172,8 @@ void Optimize(int size, int k, int maxPeer, int seed, Latency* latency, const ch
fflush
(
output
);
fflush
(
output
);
fsync
(
fno
);
fsync
(
fno
);
graph
->
Reboot
(
1.0
/
(
2500
+
1.0
),
i
);
cout
<<
"
\r
"
<<
i
+
1
<<
"/"
<<
3000
;
cout
.
flush
();
cout
<<
"
\r
"
<<
i
+
1
<<
"/"
<<
3000
;
cout
.
flush
();
}
}
...
@@ -191,7 +193,7 @@ int main(int argc, char** argv)
...
@@ -191,7 +193,7 @@ int main(int argc, char** argv)
vector
<
future
<
void
>>
threads
;
vector
<
future
<
void
>>
threads
;
for
(
int
i
=
0
;
i
<
1
;
i
++
)
/*
for(int i=0; i<1; i++)
{
{
int seed = rng();
int seed = rng();
char* out = new char[100];
char* out = new char[100];
...
@@ -201,9 +203,9 @@ int main(int argc, char** argv)
...
@@ -201,9 +203,9 @@ int main(int argc, char** argv)
}
}
for(int i=0; i<4; i++)
for(int i=0; i<4; i++)
threads
[
i
].
get
();
threads[i].get();
*/
//
Optimize(2500, 10, 30, rng(), latency, "out.csv");
Optimize
(
2500
,
10
,
30
,
rng
(),
latency
,
"out.csv"
);
delete
latency
;
delete
latency
;
return
0
;
return
0
;
...
...
simulation/realistic_dataset/main.h
View file @
150b92a3
...
@@ -46,6 +46,7 @@ public:
...
@@ -46,6 +46,7 @@ public:
void
KillMachines
(
float
proportion
);
void
KillMachines
(
float
proportion
);
pair
<
double
,
double
>
UpdateLowRoutesArity
(
int
arityToUpdate
);
pair
<
double
,
double
>
UpdateLowRoutesArity
(
int
arityToUpdate
);
void
GetArity
(
int
*
arity
);
void
GetArity
(
int
*
arity
);
void
GetRoutesFromHop
(
int
from
,
int
*
nRoutes
,
int
*
prevs
,
int
*
distances
)
private:
private:
void
SaturateNode
(
int
node
);
void
SaturateNode
(
int
node
);
...
...
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