Subject: Re: Problem with tun driver

From: [email-masked] (Eric W. Biederman)
Date: Thu, 16 Sep 2010 06:16:42 -0700

Martín Ferrari <[email-masked]> writes:

> (copying Eric as he seems to have been writing patches for tun to work
> with netns)
>
> Hello,
>
> I am seeing a strange behaviour with the TUN driver when using it
> inside a network name space, hope that somebody can help me...
>
> I still couldn' t reproduce this problem outside of my program, so it
> complicates things more. What I am doing is creating a tap device,
> moving it into a namespace and then passing the filedescriptor to
> another process which in turn starts reading from it.
>
> From strace I see that many reads succeed (Ipv6 autoconfig and arp
> requests), and at some point, read returns EBADF. I don't see the
> other processes doing anything suspicious on it at the same time. From
> reading the kernel sources, it seems to be failing the call to
> tun_get(), but I don' t understand how that could be happening...

Is it possible all of the processes in the network namespace you have
passed the tun dev into are dying, and thus destroying the network
namespace the tun dev is in?

It sounds like you are dealing with the network namespace death case,
or that someone is closing your filedescriptor on you.

Eric