networkd: Introduce tun/tap device

This patch introduces TUN/TAP device creation support
to networkd.

Example conf to create a tap device:

file: tap.netdev
------------------
[NetDev]
Name=tap-test
Kind=tap

[Tap]
OneQueue=true
MultiQueue=true
PacketInfo=true
User=sus
Group=sus
------------------

Test:
1. output of ip link
tap-test: tap pi one_queue UNKNOWN_FLAGS:900 user 1000 group 1000

id:
uid=1000(sus) gid=10(wheel) groups=10(wheel),1000(sus)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Modifications:

Added:
1. file networkd-tuntap.c
3. netdev kind NETDEV_KIND_TUN and NETDEV_KIND_TAP
2. Tun and Tap Sections and config params to parse
   conf and gperf conf parameters

[tomegun: tweak the 'kind' checking for received ifindex]
This commit is contained in:
Susant Sahani
2014-07-03 11:00:02 +02:00
committed by Tom Gundersen
parent 866ee36822
commit 30ae9dfda3
6 changed files with 317 additions and 7 deletions
+10
View File
@@ -38,3 +38,13 @@ VXLAN.Group, config_parse_tunnel_address, 0,
VXLAN.TOS, config_parse_unsigned, 0, offsetof(NetDev, tos)
VXLAN.TTL, config_parse_unsigned, 0, offsetof(NetDev, ttl)
VXLAN.MacLearning, config_parse_bool, 0, offsetof(NetDev, learning)
Tun.OneQueue, config_parse_bool, 0, offsetof(NetDev, one_queue)
Tun.MultiQueue, config_parse_bool, 0, offsetof(NetDev, multi_queue)
Tun.PacketInfo, config_parse_bool, 0, offsetof(NetDev, packet_info)
Tun.User, config_parse_string, 0, offsetof(NetDev, user_name)
Tun.Group, config_parse_string, 0, offsetof(NetDev, group_name)
Tap.OneQueue, config_parse_bool, 0, offsetof(NetDev, one_queue)
Tap.MultiQueue, config_parse_bool, 0, offsetof(NetDev, multi_queue)
Tap.PacketInfo, config_parse_bool, 0, offsetof(NetDev, packet_info)
Tap.User, config_parse_string, 0, offsetof(NetDev, user_name)
Tap.Group, config_parse_string, 0, offsetof(NetDev, group_name)