+diff -r f860e2eac903 src/nepi/testbeds/ns3/connection_metadata.py
+--- a/src/nepi/testbeds/ns3/connection_metadata.py Wed Aug 15 18:22:33 2012 +0200
++++ b/src/nepi/testbeds/ns3/connection_metadata.py Thu Aug 16 19:02:36 2012 +0200
+@@ -121,7 +121,34 @@
+ (fd, msg) = passfd.recvfd(sock)
+ # Store a reference to the endpoint to keep the socket alive
+ fdnd.SetFileDescriptor(fd)
+-
++
++ try:
++ import fcntl
++ import struct
++ TUNGETIFF = 0x800454d2
++ IFF_NO_PI = 0x00001000
++ IFF_TUN = 0x00000001
++ IFF_TAP = 0x00000002
++ struct_ifreq = "x"*16+"H"+"x"*22
++
++ (flags, ) = struct.unpack(struct_ifreq,
++ fcntl.ioctl(fd, TUNGETIFF, struct.pack(struct_ifreq, 0)))
++
++ with_pi = (0 == (flags & IFF_NO_PI))
++ is_tap = (0 == (flags & IFF_TUN))
++
++ if is_tap and with_pi:
++ fdnd.SetEncapsulationMode(fdnd.DIXPI)
++ elif not is_tap and with_pi:
++ fdnd.SetEncapsulationMode(fdnd.PI)
++ except:
++ # maybe the kernel doesn't support the IOCTL,
++ # in which case, we assume it uses PI headers (as is usual)
++ pass
++
++ #import traceback
++ #err = traceback.format_exc()
++
+ import threading
+ import passfd
+ import socket
+diff -r f860e2eac903 src/nepi/testbeds/ns3/ns3_bindings_import.py
+--- a/src/nepi/testbeds/ns3/ns3_bindings_import.py Wed Aug 15 18:22:33 2012 +0200
++++ b/src/nepi/testbeds/ns3/ns3_bindings_import.py Thu Aug 16 19:02:36 2012 +0200
+@@ -16,7 +16,7 @@
+ #from ns.click import *
+ from ns.mobility import *
+ from ns.wifi import *
+-from ns.netanim import *
++#from ns.netanim import *
+ from ns.stats import *
+ from ns.uan import *
+ from ns.spectrum import *
+diff -r f860e2eac903 src/nepi/testbeds/planetlab/application.py
+--- a/src/nepi/testbeds/planetlab/application.py Wed Aug 15 18:22:33 2012 +0200
++++ b/src/nepi/testbeds/planetlab/application.py Thu Aug 16 19:02:36 2012 +0200
+@@ -907,10 +907,12 @@
+ # We have to download the sources, untar, build...
+ #pygccxml_source_url = "http://leaseweb.dl.sourceforge.net/project/pygccxml/pygccxml/pygccxml-1.0/pygccxml-1.0.0.zip"
+ pygccxml_source_url = "http://yans.pl.sophia.inria.fr/libs/pygccxml-1.0.0.zip"
+- ns3_source_url = "http://nepi.inria.fr/code/nepi-ns3.13/archive/tip.tar.gz"
++ #ns3_source_url = "http://nepi.inria.fr/code/nepi-ns3.13/archive/tip.tar.gz"
++ ns3_source_url = "http://nepi.inria.fr/code/nepi-ns3.fdnetdev/archive/tip.tar.gz"
+ passfd_source_url = "http://nepi.inria.fr/code/python-passfd/archive/tip.tar.gz"
+
+- pybindgen_version = "797"
++ #pybindgen_version = "797"
++ pybindgen_version = "809"
+
+ self.build =(
+ " ( "
+@@ -927,21 +929,21 @@
+ "echo '7158877faff2254e6c094bf18e6b4283cac19137 pygccxml-1.0.0.zip' > archive_sums.txt && "
+ " ( " # check existing files
+ " sha1sum -c archive_sums.txt && "
+- " test -f passfd-src.tar.gz && "
++ " test -f passfd.tar.gz && "
+ " test -f ns3-src.tar.gz "
+ " ) || ( " # nope? re-download
+- " rm -rf pybindgen pygccxml-1.0.0.zip passfd-src.tar.gz ns3-src.tar.gz && "
++ " rm -rf pybindgen pygccxml-1.0.0.zip passfd.tar.gz ns3-src.tar.gz && "
+ " bzr checkout lp:pybindgen -r %(pybindgen_version)s && " # continue, to exploit the case when it has already been dl'ed
+ " wget -q -c -O pygccxml-1.0.0.zip %(pygccxml_source_url)s && "
+- " wget -q -c -O passfd-src.tar.gz %(passfd_source_url)s && "
++ " wget -q -c -O passfd.tar.gz %(passfd_source_url)s && "
+ " wget -q -c -O ns3-src.tar.gz %(ns3_source_url)s && "
+ " sha1sum -c archive_sums.txt " # Check SHA1 sums when applicable
+ " ) && "
+ "unzip -n pygccxml-1.0.0.zip && "
+ "mkdir -p ns3-src && "
+- "mkdir -p passfd-src && "
++ "mkdir -p passfd && "
+ "tar xzf ns3-src.tar.gz --strip-components=1 -C ns3-src && "
+- "tar xzf passfd-src.tar.gz --strip-components=1 -C passfd-src && "
++ "tar xzf passfd.tar.gz --strip-components=1 -C passfd && "
+ "rm -rf target && " # mv doesn't like unclean targets
+ "mkdir -p target && "
+ "cd pygccxml-1.0.0 && "
+@@ -957,12 +959,12 @@
+ "./waf clean && "
+ "mv -f ${BUILD}/target/lib/python*/site-packages/pybindgen ${BUILD}/target/. && "
+ "rm -rf ${BUILD}/target/lib && "
+- "cd ../passfd-src && "
++ "cd ../passfd && "
+ "python setup.py build && "
+ "python setup.py install --install-lib ${BUILD}/target && "
+ "python setup.py clean && "
+ "cd ../ns3-src && "
+- "./waf configure --prefix=${BUILD}/target --with-pybindgen=../pybindgen-src -d release --disable-examples --disable-tests && "
++ "./waf configure --prefix=${BUILD}/target --with-pybindgen=../pybindgen -d release --disable-examples --disable-tests && "
+ "./waf &&"
+ "./waf install && "
+ "rm -f ${BUILD}/target/lib/*.so && "