The empty string is not a valid name for a network device. I would have expected that each of the netdev provider implementations would reject an empty string, but there was a special case for Linux tap devices where they instead caused unexpected behavior. This commit should fix the problem for those devices and every other kind.
Reported-by: Gabor Locsei <gabor.loc...@ericsson.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2017-February/043613.html Signed-off-by: Ben Pfaff <b...@ovn.org> --- lib/netdev.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/netdev.c b/lib/netdev.c index 1e6bb2b..a8d8eda 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); -- 2.10.2 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev