Commit 358f0d18 authored by Ulysse Beaugnon's avatar Ulysse Beaugnon

2 bug solved :

    When the bootpeer was blacklisted, it was still inserted in the peers table
    When 0 tunnels had to be made, re6stnet asked for 0 unsed peers, recieved an empty list and thought he had to ask new peers to the server
parent 1a6e2706
Bug : Bug :
Peers stay connected to the bootstrap node so none can enter possible bug in the upnp refresh, when refreshing after a too long time
possible bug in the upnp refresh sometime reading /proc/net/ipv6_table bug
possible freeze in the regisrty
To be done : To be done :
test with python 2.6 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
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.
Test the package
Package miniupnpc
Do a test, on one ( or more ) real machine(s) preferably : ---------------------------------------------------------------------------------
- package re6stnet
- install re6stnet
- follow the HOW TO section of the man page to setup a network
- 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
...@@ -27,6 +23,5 @@ To be done : ...@@ -27,6 +23,5 @@ 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
...@@ -86,9 +86,6 @@ class PeerManager: ...@@ -86,9 +86,6 @@ 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(utils.address_str(self._address)) self._proxy.declare(utils.address_str(self._address))
logging.debug('Info sent') logging.debug('Info sent')
...@@ -131,6 +128,9 @@ class PeerManager: ...@@ -131,6 +128,9 @@ class PeerManager:
stdin=subprocess.PIPE, stdout=subprocess.PIPE) stdin=subprocess.PIPE, stdout=subprocess.PIPE)
bootpeer = p.communicate(bootpeer)[0].split() bootpeer = p.communicate(bootpeer)[0].split()
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:
logging.info('BootPeer is blacklisted')
return False
self._db.execute("INSERT INTO peers (prefix, address) VALUES (?,?)", bootpeer) self._db.execute("INSERT INTO peers (prefix, address) VALUES (?,?)", bootpeer)
logging.debug('Boot peer added') logging.debug('Boot peer added')
return True return True
......
...@@ -92,16 +92,24 @@ class TunnelManager: ...@@ -92,16 +92,24 @@ 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)
if tunnel_to_make <= 0:
return
i = 0 i = 0
logging.trace('Trying to make %i new tunnels...' % logging.trace('Trying to make %i new tunnels...' % tunnel_to_make)
(self._client_count - len(self._connection_dict)))
try: try:
for prefix, address in self._peer_db.getUnusedPeers( for prefix, address in self._peer_db.getUnusedPeers(tunnel_to_make):
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._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,
...@@ -110,6 +118,9 @@ class TunnelManager: ...@@ -110,6 +118,9 @@ 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)
...@@ -127,6 +138,8 @@ class TunnelManager: ...@@ -127,6 +138,8 @@ 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))
......
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