Several fixes:
[nepi.git] / src / nepi / testbeds / planetlab / interfaces.py
index f7cc5d6..552360d 100644 (file)
@@ -94,7 +94,12 @@ class _CrossIface(object):
         self.tun_addr = addr
         self.tun_port = port
         self.tun_cipher = cipher
-        
+
+        # Attributes
+        self.address = None
+        self.netprefix = None
+        self.netmask = None
         # Cannot access cross peers
         self.peer_proto_impl = None
     
@@ -165,11 +170,7 @@ class TunIface(object):
         # Generate an initial random cryptographic key to use for tunnelling
         # Upon connection, both endpoints will agree on a common one based on
         # this one.
-        self.tun_key = ( ''.join(map(chr, [ 
-                    r.getrandbits(8) 
-                    for i in xrange(32) 
-                    for r in (random.SystemRandom(),) ])
-                ).encode("base64").strip() )        
+        self.tun_key = os.urandom(32).encode("base64").strip()
         
 
     def __str__(self):