mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-26 03:25:30 +00:00
tun: Set net ns before opening master
Opening tun device is tricky: the net device is allocated from current net namespace, thus we should set it first, otherwise all tuns which live in nested net namespace get moved to the toplevel one. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
parent
64664bb24b
commit
348b2d1176
1 changed files with 5 additions and 4 deletions
|
|
@ -369,13 +369,14 @@ static int tunfile_open(struct file_desc *d, int *new_fd)
|
|||
struct tun_link *tl;
|
||||
|
||||
ti = container_of(d, struct tunfile_info, d);
|
||||
fd = open_reg_by_id(ti->tfe->id);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
ns_id = ti->tfe->ns_id;
|
||||
if (set_netns(ns_id))
|
||||
goto err;
|
||||
return -1;
|
||||
|
||||
fd = open_reg_by_id(ti->tfe->id);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
if (!ti->tfe->netdev)
|
||||
/* just-opened tun file */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue