Otherwise it is at least very confusing.

Found during testing.  An upcoming commit adds a test.

Signed-off-by: Ben Pfaff <[email protected]>
---
 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

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to