From 30ae9dfda3788cdfaf1b84d124dbc7feb638c77b Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Thu, 3 Jul 2014 13:34:11 +0530 Subject: 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] --- src/network/networkd.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/network/networkd.h') diff --git a/src/network/networkd.h b/src/network/networkd.h index 0ba9ee588..67ca41b8a 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -82,6 +82,8 @@ typedef enum NetDevKind { NETDEV_KIND_VETH, NETDEV_KIND_VTI, NETDEV_KIND_DUMMY, + NETDEV_KIND_TUN, + NETDEV_KIND_TAP, _NETDEV_KIND_MAX, _NETDEV_KIND_INVALID = -1 } NetDevKind; @@ -110,6 +112,8 @@ struct NetDev { char *description; char *ifname; char *ifname_peer; + char *user_name; + char *group_name; size_t mtu; struct ether_addr *mac; struct ether_addr *mac_peer; @@ -124,6 +128,10 @@ struct NetDev { bool tunnel_pmtudisc; bool learning; + bool one_queue; + bool multi_queue; + bool packet_info; + unsigned ttl; unsigned tos; struct in_addr local; @@ -359,6 +367,7 @@ int netdev_create_vxlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t ca int netdev_create_vlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback); int netdev_create_macvlan(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback); int netdev_create_dummy(NetDev *netdev, sd_rtnl_message_handler_t callback); +int netdev_create_tuntap(NetDev *netdev); const char *netdev_kind_to_string(NetDevKind d) _const_; NetDevKind netdev_kind_from_string(const char *d) _pure_; -- cgit v1.2.3