Commit c899b4ec authored by Guillaume Bury's avatar Guillaume Bury

Cleaner handling of reading lines for routes

parent de4d352d
......@@ -8,20 +8,14 @@ To be done :
favorise most used roads
Handle LAN internally in order not to have catastrophic results ....
the first thing to do is to include the LAN iface on the intarfaces
given to babel => pb : someone who has a lan acces to our network can
provide false informations. Needs of signature
If it is not sufficient, we could use avahi (dm-dns for linux)
pb : someone who has a lan acces to our network can provide false
informations. Needs of signature
=> yeah it is a security problem to fix
Write docstrings for all class/methods/functions
To be discussed:
G : There is a blacklist system now ( blacklisted prefixes are deleted from
the peers database ). Since all nodes whose packets are routed through
the local network are blacklisted, I think we should reset the blacklist
from time to time....
U : Babel seems to be very long to establish the routes : maybe we should
tell him thant we are not on a wired network but on a mobile network ?
G : babel establish routes quickly enough i'd say. There are two new
......
......@@ -135,3 +135,4 @@ class PeerManager:
else:
utils.log('Unknow message recieved from the openvpn pipe : '
+ msg, 1)
......@@ -5,7 +5,6 @@ log = None
smooth = 0.3 # this is used to smooth the traffic sampling. Lower value
# mean more smooth
# Be carfull the refresh interval should let the routes be established
......@@ -153,15 +152,13 @@ class TunnelManager:
self._peer_db.clear_blacklist(0)
for iface in self._iface_to_prefix.keys():
self._connection_dict[self._iface_to_prefix[iface]].routes = 0
f = open('/proc/net/ipv6_route', 'r')
for line in f:
ip, subnet_size, iface = struct.unpack('32s x 2s 106x %ss x'
% (len(line) - 142), line)
ip = bin(int(ip, 16))[2:].rjust(128, '0')
for line in open('/proc/net/ipv6_route'):
line = line.split()
ip = bin(int(line[0], 16))[2:].rjust(128, '0')
if ip.startswith(self._network):
iface = iface.strip()
subnet_size = int(subnet_size, 16)
iface = line[-1]
subnet_size = int(line[1], 16)
utils.log('Route on iface %s detected to %s/%s'
% (iface, ip, subnet_size), 8)
if iface in self._iface_to_prefix.keys():
......
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