netdev-tunnel: Add CAPWAP userspace interface.
[sliver-openvswitch.git] / lib / netdev.c
index dc27fd7..371bc20 100644 (file)
 #include "poll-loop.h"
 #include "shash.h"
 #include "svec.h"
-
-#define THIS_MODULE VLM_netdev
 #include "vlog.h"
 
+VLOG_DEFINE_THIS_MODULE(netdev)
+
 static const struct netdev_class *base_netdev_classes[] = {
 #ifdef HAVE_NETLINK
     &netdev_linux_class,
     &netdev_tap_class,
     &netdev_patch_class,
     &netdev_gre_class,
+    &netdev_capwap_class,
 #endif
 };
 
@@ -272,8 +273,6 @@ create_device(struct netdev_options *options, struct netdev_dev **netdev_devp)
 
     netdev_class = shash_find_data(&netdev_classes, options->type);
     if (!netdev_class) {
-        VLOG_WARN("could not create netdev %s of unknown type %s",
-                  options->name, options->type);
         return EAFNOSUPPORT;
     }
 
@@ -312,6 +311,10 @@ netdev_open(struct netdev_options *options, struct netdev **netdevp)
     if (!netdev_dev) {
         error = create_device(options, &netdev_dev);
         if (error) {
+            if (error == EAFNOSUPPORT) {
+                VLOG_WARN("could not create netdev %s of unknown type %s",
+                          options->name, options->type);
+            }
             return error;
         }
         update_device_args(netdev_dev, options->args);
@@ -1483,9 +1486,7 @@ netdev_monitor_cb(struct netdev_notifier *notifier)
 {
     struct netdev_monitor *monitor = notifier->aux;
     const char *name = netdev_get_name(notifier->netdev);
-    if (!shash_find(&monitor->changed_netdevs, name)) {
-        shash_add(&monitor->changed_netdevs, name, NULL);
-    }
+    shash_add_once(&monitor->changed_netdevs, name, NULL);
 }
 
 /* Attempts to add 'netdev' as a netdev monitored by 'monitor'.  Returns 0 if