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

Solved a bun in the incomming connections blacklisting process

parent 12729533
......@@ -166,8 +166,8 @@ class PeerManager:
if script_type == 'client-connect':
logging.info('Incomming connection from %s' % (arg,))
prefix = utils.binFromSubnet(arg)
self.tunnel_manager.checkIncommingTunnel(prefix)
self.blacklist(prefix, 2)
if self.tunnel_manager.checkIncommingTunnel(prefix):
self.blacklist(prefix, 2)
elif script_type == 'client-disconnect':
self.whitelist(utils.binFromSubnet(arg))
logging.info('%s has disconnected' % (arg,))
......
......@@ -149,5 +149,11 @@ class TunnelManager:
self._kill(prefix)
def checkIncommingTunnel(self, prefix):
if prefix in self._connection_dict and prefix >= self._prefix:
self._kill(prefix)
if prefix in self._connection_dict:
if prefix >= self._prefix:
self._kill(prefix)
return True
else:
return False
else:
return True
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