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
1c815211
Commit
1c815211
authored
Aug 10, 2012
by
Ulysse Beaugnon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some debug print
solve a bug in an SQL request
parent
99f1adfd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
13 deletions
+5
-13
re6st/db.py
re6st/db.py
+3
-1
re6st/tunnel.py
re6st/tunnel.py
+0
-11
re6st/upnpigd.py
re6st/upnpigd.py
+2
-1
No files found.
re6st/db.py
View file @
1c815211
...
@@ -127,8 +127,10 @@ class PeerManager:
...
@@ -127,8 +127,10 @@ class PeerManager:
p
=
subprocess
.
Popen
((
'openssl'
,
'rsautl'
,
'-decrypt'
,
'-inkey'
,
self
.
_key_path
),
p
=
subprocess
.
Popen
((
'openssl'
,
'rsautl'
,
'-decrypt'
,
'-inkey'
,
self
.
_key_path
),
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
bootpeer
=
p
.
communicate
(
bootpeer
)[
0
].
split
()
bootpeer
=
p
.
communicate
(
bootpeer
)[
0
].
split
()
print
bootpeer
print
bootpeer
[
0
]
if
bootpeer
[
0
]
!=
self
.
_prefix
:
if
bootpeer
[
0
]
!=
self
.
_prefix
:
if
self
.
_db
.
execute
(
"""SELECT COUNT(*) FROM blacklist.flag WHERE prefix = ?"""
%
bootpeer
[
0
]).
next
(
)
>
0
:
if
int
(
self
.
_db
.
execute
(
"""SELECT COUNT(*) FROM blacklist.flag WHERE prefix = ?"""
,
(
bootpeer
[
0
],)).
next
()[
0
]
)
>
0
:
logging
.
info
(
'BootPeer is blacklisted'
)
logging
.
info
(
'BootPeer is blacklisted'
)
return
False
return
False
self
.
_db
.
execute
(
"INSERT INTO peers (prefix, address) VALUES (?,?)"
,
bootpeer
)
self
.
_db
.
execute
(
"INSERT INTO peers (prefix, address) VALUES (?,?)"
,
bootpeer
)
...
...
re6st/tunnel.py
View file @
1c815211
...
@@ -92,9 +92,6 @@ class TunnelManager:
...
@@ -92,9 +92,6 @@ class TunnelManager:
del
self
.
_iface_to_prefix
[
connection
.
iface
]
del
self
.
_iface_to_prefix
[
connection
.
iface
]
logging
.
trace
(
'Connection with %s/%u killed'
logging
.
trace
(
'Connection with %s/%u killed'
%
(
hex
(
int
(
prefix
,
2
))[
2
:],
len
(
prefix
)))
%
(
hex
(
int
(
prefix
,
2
))[
2
:],
len
(
prefix
)))
# DEBUG
print
self
.
_connection_dict
print
self
.
free_interface_set
def
_makeNewTunnels
(
self
):
def
_makeNewTunnels
(
self
):
tunnel_to_make
=
self
.
_client_count
-
len
(
self
.
_connection_dict
)
tunnel_to_make
=
self
.
_client_count
-
len
(
self
.
_connection_dict
)
...
@@ -107,9 +104,6 @@ class TunnelManager:
...
@@ -107,9 +104,6 @@ class TunnelManager:
for
prefix
,
address
in
self
.
_peer_db
.
getUnusedPeers
(
tunnel_to_make
):
for
prefix
,
address
in
self
.
_peer_db
.
getUnusedPeers
(
tunnel_to_make
):
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
.
_connection_dict
print
self
.
free_interface_set
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
,
...
@@ -118,9 +112,6 @@ class TunnelManager:
...
@@ -118,9 +112,6 @@ class TunnelManager:
self
.
_peer_db
.
usePeer
(
prefix
)
self
.
_peer_db
.
usePeer
(
prefix
)
i
+=
1
i
+=
1
logging
.
trace
(
'%u new tunnels established'
%
(
i
,))
logging
.
trace
(
'%u new tunnels established'
%
(
i
,))
# DEBUG
print
self
.
_connection_dict
print
self
.
free_interface_set
except
KeyError
:
except
KeyError
:
logging
.
warning
(
"""Can't establish connection with %s
logging
.
warning
(
"""Can't establish connection with %s
: no available interface"""
%
prefix
)
: no available interface"""
%
prefix
)
...
@@ -138,8 +129,6 @@ class TunnelManager:
...
@@ -138,8 +129,6 @@ class TunnelManager:
if
ip
.
startswith
(
self
.
_network
):
if
ip
.
startswith
(
self
.
_network
):
iface
=
line
[
-
1
]
iface
=
line
[
-
1
]
# DEBUG
print
line
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
,
ip
,
subnet_size
))
...
...
re6st/upnpigd.py
View file @
1c815211
...
@@ -52,8 +52,9 @@ class Forwarder:
...
@@ -52,8 +52,9 @@ class Forwarder:
return
(
self
.
_external_ip
,
str
(
external_port
),
proto
)
return
(
self
.
_external_ip
,
str
(
external_port
),
proto
)
def
refresh
(
self
):
def
refresh
(
self
):
print
self
.
_rules
logging
.
debug
(
'Refreshing port forwarding'
)
logging
.
debug
(
'Refreshing port forwarding'
)
for
external_port
,
local_port
,
proto
in
self
.
_rules
:
for
external_port
,
local_port
,
proto
in
self
.
_rules
:
self
.
_u
.
addportmapping
(
external_port
,
proto
,
self
.
_u
.
lanaddr
,
self
.
_u
.
addportmapping
(
external_port
,
proto
,
self
.
_u
.
lanaddr
,
local_port
,
're6stnet openvpn server'
,
''
)
local_port
,
're6stnet openvpn server'
,
''
)
self
.
next_refresh
=
time
.
time
()
+
36
00
self
.
next_refresh
=
time
.
time
()
+
1
00
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