Signed-off-by: Thomas Graf <[email protected]>
---
 src/nm-system.c       |   32 ++++++++++++++++++++++++++++++++
 src/nm-system.h       |    2 ++
 src/nm-udev-manager.c |   13 +++++++++++--
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/src/nm-system.c b/src/nm-system.c
index 2d0393a..1b8f224 100644
--- a/src/nm-system.c
+++ b/src/nm-system.c
@@ -1206,3 +1206,35 @@ nm_system_add_bonding_master(NMSettingBond *setting)
 
        return TRUE;
 }
+
+/**
+ * nm_system_get_link_type:
+ * @name: name of link
+ *
+ * Lookup virtual link type. The returned string is allocated and needs
+ * to be freed after usage.
+ *
+ * Returns: Name of virtual link type or NULL if not a virtual link.
+ **/
+char *
+nm_system_get_link_type(const char *name)
+{
+       struct rtnl_link *result;
+       struct nl_sock *nlh;
+       char *type;
+
+       nlh = nm_netlink_get_default_handle ();
+       if (!nlh)
+               return NULL;
+
+       if (rtnl_link_get_kernel (nlh, 0, name, &result) < 0)
+               return NULL;
+
+       if ((type = rtnl_link_get_type (result)))
+               type = g_strdup(type);
+
+       rtnl_link_put (result);
+
+       return type;
+}
+
diff --git a/src/nm-system.h b/src/nm-system.h
index a606503..1fe91f6 100644
--- a/src/nm-system.h
+++ b/src/nm-system.h
@@ -92,4 +92,6 @@ gboolean              nm_system_iface_set_mac                 
(int ifindex, const struct eth
 
 gboolean               nm_system_add_bonding_master    (NMSettingBond 
*setting);
 
+char *                 nm_system_get_link_type         (const char *name);
+
 #endif
diff --git a/src/nm-udev-manager.c b/src/nm-udev-manager.c
index 72501c2..0f2b066 100644
--- a/src/nm-udev-manager.c
+++ b/src/nm-udev-manager.c
@@ -41,6 +41,7 @@
 #if WITH_WIMAX
 #include "nm-device-wimax.h"
 #endif
+#include "nm-system.h"
 
 typedef struct {
        GUdevClient *client;
@@ -458,9 +459,17 @@ device_creator (NMUdevManager *manager,
        }
 
        if (!driver) {
-               if (g_str_has_prefix (ifname, "easytether")) {
+               char *type;
+
+               type = nm_system_get_link_type (ifname);
+               if (type) {
+                       if (g_strcmp0 (type, "bond") == 0)
+                               driver = "bonding";
+               } else if (g_str_has_prefix (ifname, "easytether")) {
                        driver = "easytether";
-               } else {
+               }
+               
+               if (!driver) {
                        nm_log_warn (LOGD_HW, "%s: couldn't determine device 
driver; ignoring...", path);
                        goto out;
                }
-- 
1.7.6

_______________________________________________
networkmanager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to