netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: David Miller <davem@davemloft.net>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] tun: Add ability to create tun device with given index
Date: Fri, 14 Jun 2013 13:34:28 +0400	[thread overview]
Message-ID: <51BAE3A4.2030609@parallels.com> (raw)
In-Reply-To: <20130613095248.68c52109@nehalam.linuxnetplumber.net>

On 06/13/2013 08:52 PM, Stephen Hemminger wrote:
> On Thu, 13 Jun 2013 14:04:54 +0400
> Pavel Emelyanov <xemul@parallels.com> wrote:
> 
>> Tun devices cannot be created with ifidex user wants, but it's
>> required by checkpoint-restore project.
>>
>> Long time ago such ability was implemented for rtnl_ops-based
>> interface for creating links (9c7dafbf net: Allow to create links
>> with given ifindex), but the only API for creating and managing 
>> tuntap devices is ioctl-based and is evolving with adding new ones
>> (cde8b15f tuntap: add ioctl to attach or detach a file form tuntap
>> device).
>>
>> Following that trend, here's how a new ioctl that sets the ifindex
>> for device, that _will_ be created by TUNSETIFF ioctl looks like.
>> So those who want a tuntap device with the ifindex I, should open
>> the tun device, call ioctl(fd, TUNSETIFINDEX, I), then call TUNSETIFF.
>> If setifindex is not called, then it will be generated as before.
>>
>> Is it OK to extend ioctls with this, or should we rather switch the
>> whole tuntap driver on full-featured rtln-ops?
>>
>> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
>>
> 
> I see no check for the most fundamental thing, the ifindex must be unique!
> 

The register_netdev() will check for this and report -EBUSY if it is (and
add device to list if not, all atomically).

Thanks,
Pavel

      reply	other threads:[~2013-06-14  9:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-13 10:04 [PATCH net-next] tun: Add ability to create tun device with given index Pavel Emelyanov
2013-06-13 16:52 ` Stephen Hemminger
2013-06-14  9:34   ` Pavel Emelyanov [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=51BAE3A4.2030609@parallels.com \
    --to=xemul@parallels.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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).