Create a tuntap interface with libnl

Teto mattator at gmail.com
Thu Oct 31 09:16:00 EDT 2013


Ok here it is.
It's built against f44b82f and tested. git apply prints some warnings
about spaces but it compiles and runs fine (tested).
There is no C tests since I use only the python bindings. I've tested
it with my C bindings and I could create tun/tap (via their name),
delete them and assign ownership via either username or uid. I could
not join my python tests (mimics $ip tuntap in < 100 lines with
argparse which is cool) since I modified quite a few things in the
python libnl API to make it less verbose and more usable.

There is a need to check the tuntap_clone function (I think there i no
need for it and that you should  remove it) and the dumping functions
(add output).
Also I didn't know what kind of error to return in most functions. I've added
TODO prefixes so that you can parse the code easily.

NB: A few remarks, I wonder if it's possible to return an error when
rtnl_link_set_type() is called with an unregistered type ? or is it
done on purpose to support future link types ? Anyway I've added a
lvl4 warning there

Matthieu

2013/10/31 Thomas Graf <tgraf at suug.ch>:
> On 10/31/13 at 01:12am, Teto wrote:
>> I realized afterwards how bad that patch was. I will send a better
>> patch against the official trunk  that can set permissions and create
>> tap as well as tun (cleaned up and without the comments sorry :) ).
>
> NP and no rush
>
>>
>>
>> 2013/10/31 Thomas Graf <tgraf at suug.ch>:
>> > On 10/26/13 at 06:20pm, Teto wrote:
>> >> Thanks for the advice.
>> >> You will find enclosed a patch built upon the other patches sent in
>> >> the topic http://lists.infradead.org/pipermail/libnl/2013-October/001113.html
>> >> that adds basic tuntap support (can create it, set user, set it
>> >> permanent) both in C and python.
>> >
>> > I think this is a good start! Would you mean splitting up the cleanups
>> > and actual tuntap patch and tidy it up a bit? There are various french
>> > comments in there along with debug statements.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tuntap.patch
Type: text/x-patch
Size: 28591 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20131031/722569b3/attachment-0001.bin>


More information about the libnl mailing list