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

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

Commit Message

Flavio Leitner Nov. 2, 2017, 7:05 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 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;
 }