diff mbox series

[ovs-dev,2/8] netdev-linux: initialize netns as invalid.

Message ID 20171102190509.2688-3-fbl@redhat.com
State Superseded
Headers show
Series Add minimum network namespace support. | expand

Commit Message

Flavio Leitner Nov. 2, 2017, 7:05 p.m. UTC
A port might be already in another netns, so initialize it
as invalid to force a state update.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
 lib/netdev-linux.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 0d03ca876..3c80690f4 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -788,6 +788,10 @@  netdev_linux_common_construct(struct netdev *netdev_)
         return EINVAL;
     }
 
+    /* The device could be in the same network namespace or in another one.
+     * Initialize as invalid to force a state update. */
+    netns_set_invalid(&netdev->netns);
+
     ovs_mutex_init(&netdev->mutex);
     return 0;
 }