Simple cross ping experiment between linux and ns3
[nepi.git] / src / nepi / resources / linux / tap.py
index 4f5492c..636e471 100644 (file)
@@ -34,6 +34,9 @@ class LinuxTap(LinuxApplication):
     _help = "Creates a TAP device on a Linux host"
     _backend = "linux"
 
+    IFF_TUN = 0x0001
+    IFF_TAP = 0x0002
+
     @classmethod
     def _register_attributes(cls):
         endpoint_ip = Attribute("endpoint_ip", "IPv4 Address",
@@ -105,7 +108,7 @@ class LinuxTap(LinuxApplication):
     def node(self):
         node = self.get_connected(LinuxNode.get_rtype())
         if node: return node[0]
-        raise RuntimeError, "TAP/TUN devices must be connected to Node"
+        raise RuntimeError, "linux::TAP/TUN devices must be connected to a linux::Node"
 
     @property
     def gre_enabled(self):
@@ -222,7 +225,7 @@ class LinuxTap(LinuxApplication):
                 tdiffsec(tnow(), self._last_state_check) > state_check_delay:
 
             if self.get("deviceName"):
-                (out, err), proc = self.node.execute("ifconfig")
+                (out, err), proc = self.node.execute("ip a")
 
                 if out.strip().find(self.get("deviceName")) == -1: 
                     # tap is not running is not running (socket not found)
@@ -524,6 +527,10 @@ class LinuxTap(LinuxApplication):
     def vif_type(self):
         return "IFF_TAP"
 
+    @property
+    def vif_type_flag(self):
+        return LinuxTap.IFF_TAP
     @property
     def vif_prefix(self):
         return "tap"