device: add new NMDeviceType NM_DEVICE_TYPE_VETH
authorThomas Haller <thaller@redhat.com>
Tue, 23 Feb 2016 16:40:54 +0000 (17:40 +0100)
committerThomas Haller <thaller@redhat.com>
Tue, 23 Feb 2016 22:15:37 +0000 (23:15 +0100)
Based-on-patch-by: Jiří Klimeš <jklimes@redhat.com>
examples/python/dbus/list-devices.py
examples/ruby/list-devices.rb
examples/shell/list-devices.sh
libnm-core/nm-dbus-interface.h
libnm-glib/nm-device.c
libnm-util/NetworkManager.h
libnm/nm-device.c
src/devices/nm-device-veth.c
src/devices/nm-device.c

index c9c753e..8dd41f6 100755 (executable)
@@ -40,6 +40,7 @@ devtypes = { 1: "Ethernet",
              17: "IPTunnel"
              18: "MACVLAN"
              19: "VXLAN"
+             20: "Veth"
            }
 
 states = { 0: "Unknown",
index 9949a40..bf37425 100755 (executable)
@@ -43,6 +43,7 @@ devtypes = { 1 => "Ethernet",
              17 => "IPTunnel",
              18 => "MACVLAN",
              19 => "VXLAN",
+             20 => "Veth",
            }
 
 states = { 0   => "Unknown",
index 817c8b7..c5c4114 100755 (executable)
@@ -52,6 +52,7 @@ devtype_to_name()
    17) echo "IPTunnel" ;;
    18) echo "MACVLAN" ;;
    19) echo "VXLAN" ;;
+   20) echo "Veth" ;;
     *) echo "Unknown" ;;
   esac
 }
index 2edc8cb..1b16cce 100644 (file)
@@ -152,6 +152,7 @@ typedef enum {
  * @NM_DEVICE_TYPE_IP_TUNNEL: a IP tunnel interface
  * @NM_DEVICE_TYPE_MACVLAN: a MACVLAN interface
  * @NM_DEVICE_TYPE_VXLAN: a VXLAN interface
+ * @NM_DEVICE_TYPE_VETH: a VETH interface
  *
  * #NMDeviceType values indicate the type of hardware represented by
  * an #NMDevice.
@@ -179,6 +180,7 @@ typedef enum {
        NM_DEVICE_TYPE_IP_TUNNEL  = 17,
        NM_DEVICE_TYPE_MACVLAN    = 18,
        NM_DEVICE_TYPE_VXLAN      = 19,
+       NM_DEVICE_TYPE_VETH       = 20,
 } NMDeviceType;
 
 /**
index a16278a..312f970 100644 (file)
@@ -296,6 +296,7 @@ static GType
 _nm_device_gtype_from_dtype (NMDeviceType dtype)
 {
        switch (dtype) {
+       case NM_DEVICE_TYPE_VETH:
        case NM_DEVICE_TYPE_ETHERNET:
                return NM_TYPE_DEVICE_ETHERNET;
        case NM_DEVICE_TYPE_WIFI:
@@ -1876,6 +1877,8 @@ get_type_name (NMDevice *device)
                return _("IPTunnel");
        case NM_DEVICE_TYPE_TUN:
                return _("Tun");
+       case NM_DEVICE_TYPE_VETH:
+               return _("Veth");
        case NM_DEVICE_TYPE_GENERIC:
        case NM_DEVICE_TYPE_UNUSED1:
        case NM_DEVICE_TYPE_UNUSED2:
index 8b083b9..c4105fd 100644 (file)
@@ -155,6 +155,7 @@ typedef enum {
  * @NM_DEVICE_TYPE_IP_TUNNEL: an IP tunnel interface
  * @NM_DEVICE_TYPE_MACVLAN: a MACVLAN interface
  * @NM_DEVICE_TYPE_VXLAN: a VXLAN interface
+ * @NM_DEVICE_TYPE_VETH: a VETH interface
  *
  * #NMDeviceType values indicate the type of hardware represented by
  * an #NMDevice.
@@ -182,6 +183,7 @@ typedef enum {
        NM_DEVICE_TYPE_IP_TUNNEL  = 17,
        NM_DEVICE_TYPE_MACVLAN    = 18,
        NM_DEVICE_TYPE_VXLAN      = 19,
+       NM_DEVICE_TYPE_VETH       = 20,
 } NMDeviceType;
 
 /**
index 80ae55e..53f42f8 100644 (file)
@@ -341,6 +341,7 @@ static GType
 _nm_device_gtype_from_dtype (NMDeviceType dtype)
 {
        switch (dtype) {
+       case NM_DEVICE_TYPE_VETH:
        case NM_DEVICE_TYPE_ETHERNET:
                return NM_TYPE_DEVICE_ETHERNET;
        case NM_DEVICE_TYPE_WIFI:
@@ -1827,6 +1828,8 @@ get_type_name (NMDevice *device)
                return _("IPTunnel");
        case NM_DEVICE_TYPE_TUN:
                return _("Tun");
+       case NM_DEVICE_TYPE_VETH:
+               return _("Veth");
        case NM_DEVICE_TYPE_GENERIC:
        case NM_DEVICE_TYPE_UNUSED1:
        case NM_DEVICE_TYPE_UNUSED2:
index 3b84564..ff198a7 100644 (file)
@@ -187,7 +187,7 @@ create_device (NMDeviceFactory *factory,
        return (NMDevice *) g_object_new (NM_TYPE_DEVICE_VETH,
                                          NM_DEVICE_IFACE, iface,
                                          NM_DEVICE_TYPE_DESC, "Veth",
-                                         NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_ETHERNET,
+                                         NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_VETH,
                                          NM_DEVICE_LINK_TYPE, NM_LINK_TYPE_VETH,
                                          NULL);
 }
index bbad109..6e399ca 100644 (file)
@@ -803,6 +803,8 @@ nm_device_get_priority (NMDevice *self)
                return 600;
        case NM_DEVICE_TYPE_OLPC_MESH:
                return 650;
+       case NM_DEVICE_TYPE_VETH:
+               return 665;
        case NM_DEVICE_TYPE_IP_TUNNEL:
                return 675;
        case NM_DEVICE_TYPE_MODEM: