summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/netdev.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/netdev.c b/lib/netdev.c
index 1e6bb2b15..a8d8edad7 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -343,6 +343,14 @@ netdev_open(const char *name, const char *type, struct netdev **netdevp)
struct netdev *netdev;
int error;
+ if (!name[0]) {
+ /* Reject empty names. This saves the providers having to do this. At
+ * least one screwed this up: the netdev-linux "tap" implementation
+ * passed the name directly to the Linux TUNSETIFF call, which treats
+ * an empty string as a request to generate a unique name. */
+ return EINVAL;
+ }
+
netdev_initialize();
ovs_mutex_lock(&netdev_mutex);