[ovs-dev] [PATCH 2/3] dpif-netdev: Reject adding duplicate ports.
Ben Pfaff
blp at nicira.com
Wed Apr 15 18:19:35 UTC 2015
Otherwise it is at least very confusing.
Found during testing. An upcoming commit adds a test.
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
lib/dpif-netdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 2cdb2cd..2ff2eac 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1035,7 +1035,10 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
int error;
int i;
- /* XXX reject devices already in some dp_netdev. */
+ /* Reject devices already in 'dp'. */
+ if (!get_port_by_name(dp, devname, &port)) {
+ return EEXIST;
+ }
/* Open and validate network device. */
open_type = dpif_netdev_port_open_type(dp->class, type);
--
2.1.3
More information about the dev
mailing list