diff mbox series

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

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

Commit Message

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

Comments

Ben Pfaff Dec. 1, 2017, 9:15 p.m. UTC | #1
On Thu, Nov 09, 2017 at 03:31:01PM -0200, Flavio Leitner wrote:
> 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>

This doesn't build for me:
    ../lib/netdev-linux.c:793:32: error: no member named 'netns' in 'struct netdev_linux'

Thanks,

Ben.
Flavio Leitner Dec. 4, 2017, 1:54 p.m. UTC | #2
On Fri, 1 Dec 2017 13:15:06 -0800
Ben Pfaff <blp@ovn.org> wrote:

> On Thu, Nov 09, 2017 at 03:31:01PM -0200, Flavio Leitner wrote:
> > 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>  
> 
> This doesn't build for me:
>     ../lib/netdev-linux.c:793:32: error: no member named 'netns' in 'struct netdev_linux'

Yeah, it should have been after patch 3/8.
Based on your comments for the other patch, I think we don't need
this as a separate patch if I improve the documentation in the
sources.

Thanks.
diff mbox series

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;
 }