netdev-linux: Check notifications are for netdev-linux device.
[sliver-openvswitch.git] / lib / netdev.c
index 99b5d24..3102e6e 100644 (file)
@@ -45,6 +45,7 @@ static const struct netdev_class *base_netdev_classes[] = {
     &netdev_linux_class,
     &netdev_tap_class,
     &netdev_gre_class,
+    &netdev_patch_class,
 };
 
 static struct shash netdev_classes = SHASH_INITIALIZER(&netdev_classes);
@@ -434,6 +435,14 @@ netdev_exists(const char *name)
     }
 }
 
+/* Returns true if a network device named 'name' is currently opened,
+ * otherwise false. */
+bool
+netdev_is_open(const char *name)
+{
+    return !!shash_find_data(&netdev_dev_shash, name);
+}
+
 /*  Clears 'svec' and enumerates the names of all known network devices. */
 int
 netdev_enumerate(struct svec *svec)
@@ -1042,6 +1051,13 @@ netdev_dev_get_type(const struct netdev_dev *netdev_dev)
     return netdev_dev->netdev_class->type;
 }
 
+/* Returns the class associated with 'netdev_dev'. */
+const struct netdev_class *
+netdev_dev_get_class(const struct netdev_dev *netdev_dev)
+{
+    return netdev_dev->netdev_class;
+}
+
 /* Returns the name of 'netdev_dev'.
  *
  * The caller must not free the returned value. */