Commit 1c815211 authored by Ulysse Beaugnon's avatar Ulysse Beaugnon

Remove some debug print

solve a bug in an SQL request
parent 99f1adfd
...@@ -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)
......
...@@ -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))
......
...@@ -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() + 3600 self.next_refresh = time.time() + 100
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment