From: Claudio-Daniel Freire Date: Wed, 18 May 2011 09:42:47 +0000 (+0200) Subject: Fix TUNGETIFF ioctl invocation to use the correct buffer structure X-Git-Tag: nepi_v2~22 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=de7a135c7489eab2c1fc402564d82faffa82790a;p=nepi.git Fix TUNGETIFF ioctl invocation to use the correct buffer structure --- diff --git a/src/nepi/testbeds/netns/metadata_v01.py b/src/nepi/testbeds/netns/metadata_v01.py index 0c5bf0ad..4c6fc0fc 100644 --- a/src/nepi/testbeds/netns/metadata_v01.py +++ b/src/nepi/testbeds/netns/metadata_v01.py @@ -65,8 +65,9 @@ def connect_tunchannel_tap(testbed_instance, chan_guid, tap_guid): import struct TUNGETIFF = 0x800454d2 IFF_NO_PI = 0x00001000 - flags = struct.unpack("I", - fcntl.ioctl(tap.fd, TUNGETIFF, struct.pack("I",0)) ) + struct_ifreq = "x"*16+"H"+"x"*22 + flags = struct.unpack(struct_ifreq, + fcntl.ioctl(tap.fd, TUNGETIFF, struct.pack(struct_ifreq,0)) ) with_pi = (0 == (flags & IFF_NO_PI)) except: # maybe the kernel doesn't support the IOCTL,