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

Message ID 20171109173107.26256-3-fbl@redhat.com
State New
Headers show
Series
  • Add minimum network namespace support.
Related show

Commit Message

Flavio Leitner Nov. 9, 2017, 5:31 p.m.
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(+)

Patch

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 184822816..c31334ce1 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;
 }