netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cross namespace interface notification for tun devices
@ 2017-09-18 18:47 Jason A. Donenfeld
  2017-09-19  1:24 ` Jason A. Donenfeld
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jason A. Donenfeld @ 2017-09-18 18:47 UTC (permalink / raw)
  To: Netdev; +Cc: Mathias

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 in A but not when it moves to B.

Any tricks or APIs to get around this?

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
returns -EFAULT. This seems to be a reliable distinguisher, but is a
pretty insane way of doing it. And sleep loops are somewhat different
from events too.

If there aren't any current APIs for receiving events directly from
the fd of a tun interface, would this list be happy with a patch that
adds one?

Thanks,
Jason

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-05  1:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 18:47 cross namespace interface notification for tun devices Jason A. Donenfeld
2017-09-19  1:24 ` Jason A. Donenfeld
2017-09-19 20:40 ` Cong Wang
2017-09-19 21:02   ` Jason A. Donenfeld
2017-09-20 18:29     ` Cong Wang
2017-09-20 19:57       ` Dan Williams
2017-09-20 20:13       ` Jason A. Donenfeld
2017-10-02  9:32 ` Nicolas Dichtel
2017-10-02 11:11   ` Jason A. Donenfeld
2017-10-02 12:06     ` Nicolas Dichtel
2017-10-03 11:53       ` [PATCH net-next] dev: advertise the new nsid when the netns iface changes Nicolas Dichtel
2017-10-05  1:05         ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).