Re: cross namespace interface notification for tun devices

2017-10-02 Thread Nicolas Dichtel
Le 02/10/2017 à 13:11, Jason A. Donenfeld a écrit : > On Mon, Oct 2, 2017 at 11:32 AM, Nicolas Dichtel > wrote: >> 1. Move the process to netns B, open the netlink socket and move back the >> process to netns A. The socket will remain in netns B and you will receive >>

Re: cross namespace interface notification for tun devices

2017-10-02 Thread Jason A. Donenfeld
On Mon, Oct 2, 2017 at 11:32 AM, Nicolas Dichtel wrote: > 1. Move the process to netns B, open the netlink socket and move back the > process to netns A. The socket will remain in netns B and you will receive all > netlink messages related to netns B. > > 2. Assign a

Re: cross namespace interface notification for tun devices

2017-10-02 Thread Nicolas Dichtel
Le 18/09/2017 à 20:47, Jason A. Donenfeld a écrit : > Hey guys, > > It's possible to create a tun device in a process in namespace A and > then move that interface to namespace B. The controlling process in A > needs to receive notifications on when the interface is brought up or > down. It can

Re: cross namespace interface notification for tun devices

2017-09-20 Thread Jason A. Donenfeld
On Wed, Sep 20, 2017 at 8:29 PM, Cong Wang wrote: > Sounds like we should set NETIF_F_NETNS_LOCAL for tun > device. Absolutely do not do this under any circumstances. This would be a regression and would break API compatibility. As I wrote in my first email, it's

Re: cross namespace interface notification for tun devices

2017-09-20 Thread Dan Williams
On Wed, 2017-09-20 at 11:29 -0700, Cong Wang wrote: > On Tue, Sep 19, 2017 at 2:02 PM, Jason A. Donenfeld > wrote: > > On Tue, Sep 19, 2017 at 10:40 PM, Cong Wang > om> wrote: > > > By "notification" I assume you mean netlink notification. > > > > Yes,

Re: cross namespace interface notification for tun devices

2017-09-20 Thread Cong Wang
On Tue, Sep 19, 2017 at 2:02 PM, Jason A. Donenfeld wrote: > On Tue, Sep 19, 2017 at 10:40 PM, Cong Wang wrote: >> By "notification" I assume you mean netlink notification. > > Yes, netlink notification. > >> The question is why does the process in A

Re: cross namespace interface notification for tun devices

2017-09-19 Thread Jason A. Donenfeld
On Tue, Sep 19, 2017 at 10:40 PM, Cong Wang wrote: > By "notification" I assume you mean netlink notification. Yes, netlink notification. > The question is why does the process in A still care about > the device sitting in B? > > Also, the process should be able to

Re: cross namespace interface notification for tun devices

2017-09-19 Thread Cong Wang
On Mon, Sep 18, 2017 at 11:47 AM, Jason A. Donenfeld wrote: > Hey guys, > > It's possible to create a tun device in a process in namespace A and > then move that interface to namespace B. The controlling process in A > needs to receive notifications on when the interface is

Re: cross namespace interface notification for tun devices

2017-09-18 Thread Jason A. Donenfeld
On Mon, Sep 18, 2017 at 8:47 PM, Jason A. Donenfeld wrote: > The best I've come up with is, in a sleep loop, writing to the tun > device's fd something with a NULL or invalid payload. If the interface > is down, the kernel returns -EIO. If the interface is up, the kernel >

cross namespace interface notification for tun devices

2017-09-18 Thread Jason A. Donenfeld
Hey guys, It's possible to create a tun device in a process in namespace A and then move that interface to namespace B. The controlling process in A needs to receive notifications on when the interface is brought up or down. It can receive these notifications via netlink while the interface lives