From d1568b1ebbe24a0dfe51542a3ac91e9df6ca0e5c Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Fri, 17 Aug 2012 21:59:32 +0200 Subject: [PATCH] Work with tun and p2p interfaces --- setup | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup b/setup index 8f439a57949..facd639ffeb 100755 --- a/setup +++ b/setup @@ -498,12 +498,18 @@ class LinuxNetwork(Network): mtu = words[4] elif words[0].startswith('link/'): iface_type = words[0].split('/')[1] - if iface_type == 'void': + # tun interfaces can have any interface type, but won't have an address + if iface_type in ('void', 'none') or len(words) == 1: macaddress = 'unknown' else: macaddress = words[1] elif words[0] == 'inet': - address, netmask_length = words[1].split('/') + if '/' in words[1]: + address, netmask_length = words[1].split('/') + else: + # pointopoint interfaces do not have a prefix + address = words[1] + netmask_length = "32" address_bin = struct.unpack('!L', socket.inet_aton(address))[0] netmask_bin = (1<<32) - (1<<32>>int(netmask_length))