Commit 1943d08c authored by Pavel Emelyanov's avatar Pavel Emelyanov

tun: Don't dump tun file if we're not taking netns with us

Tun files are attached to tun links, thus we need the latter to
be dumped together with the former.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 369f366a
......@@ -12,6 +12,7 @@
#include "files-reg.h"
#include "tun.h"
#include "net.h"
#include "namespaces.h"
#include "protobuf/tun.pb-c.h"
......@@ -268,6 +269,11 @@ static int dump_tunfile(int lfd, u32 id, const struct fd_parms *p)
TunfileEntry tfe = TUNFILE_ENTRY__INIT;
struct ifreq ifr;
if (!(current_ns_mask & CLONE_NEWNET)) {
pr_err("Net namespace is required to dump tun link\n");
return -1;
}
if (dump_one_reg_file(lfd, id, p))
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment