[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Creating tap interface with custom name
From:       Roman Bogorodskiy <novel () FreeBSD ! org>
Date:       2013-01-22 6:34:51
Message-ID: 20130122063450.GB39359 () ritual ! srt ! mirantis ! net
[Download RAW message or body]


Hi,

I have a thing I want to do and I'm not sure what's the best way to do
it, hopefully somebody could suggest a solution.

The idea is to create a 'tap' interfaces with a custom name, e.g.
foobarN instead of tapN, from an application.

So the current workflow looks this way:

 - a request comes to create new 'foobar' interface
 - 'tap' device is created via SIOCIFCREATE2
 - code finds the first free interface name, that it could use by
   going from foobar0, foobar1 etc until it finds an unused name
 - code renames 'tap' device to the new 'foobarN' via SIOCSIFNAME

As you can see, this code is not optimal and very fragile. It spends a
lot of time trying to find an appropriate interface name and it will
break if something happens while it's running (tap device will be
deleted by user before it gets renamed, new foobarN will be created
manually before the code will create it, etc).

Is there any better to implement this?

Roman Bogorodskiy

[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic