netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: dwmw2@infradead.org
Cc: netdev@vger.kernel.org
Subject: Re: tun: add IFF_TUN_EXCL flag to avoid opening a persistent device.
Date: Mon, 27 Apr 2009 03:24:05 -0700 (PDT)	[thread overview]
Message-ID: <20090427.032405.50493174.davem@davemloft.net> (raw)
In-Reply-To: <1240506258.15245.11.camel@macbook.infradead.org>

From: David Woodhouse <dwmw2@infradead.org>
Date: Thu, 23 Apr 2009 18:04:18 +0100

> When creating a certain types of VPN, NetworkManager will first attempt
> to find an available tun device by iterating through 'vpn%d' until it
> finds one that isn't already busy. Then it'll set that to be persistent
> and owned by the otherwise unprivileged user that the VPN dæmon itself
> runs as.
> 
> There's a race condition here -- during the period where the vpn%d
> device is created and we're waiting for the VPN dæmon to actually
> connect and use it, if we try to create _another_ device we could end up
> re-using the same one -- because trying to open it again doesn't get
> -EBUSY as it would while it's _actually_ busy.
> 
> So solve this, we add an IFF_TUN_EXCL flag which causes tun_set_iff() to
> fail if it would be opening an existing persistent tundevice -- so that
> we can make sure we're getting an entirely _new_ device.
> 
> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Applied to net-next-2.6, thanks David.

      reply	other threads:[~2009-04-27 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 17:04 tun: add IFF_TUN_EXCL flag to avoid opening a persistent device David Woodhouse
2009-04-27 10:24 ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090427.032405.50493174.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).