summaryrefslogtreecommitdiff
path: root/src/network/networkd-netdev-tuntap.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-08-18 12:29:45 +0200
committerTom Gundersen <teg@jklm.no>2014-08-18 18:11:42 +0200
commite0fbf1fcffe014d5af6767b29f9108c2f2444888 (patch)
treecadef3f6460bd1b44b3a5c982a4fd01a42ceecaf /src/network/networkd-netdev-tuntap.c
parentfac9c0d508f72cc5d469c969a4acc3694247c03b (diff)
networkd: warn when ignoring unsupported tuntap options
The interface for creating tuntap devices should be ported to rtnl so it would support the same settings as other kinds. In the meantime, the best one can do is to drop in a .link file to set the desired options.
Diffstat (limited to 'src/network/networkd-netdev-tuntap.c')
-rw-r--r--src/network/networkd-netdev-tuntap.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c
index dd3bd96dbb..eef8747210 100644
--- a/src/network/networkd-netdev-tuntap.c
+++ b/src/network/networkd-netdev-tuntap.c
@@ -172,9 +172,35 @@ static void tuntap_done(NetDev *netdev) {
t->group_name = NULL;
}
+static int tuntap_verify(NetDev *netdev, const char *filename) {
+ TunTap *t = NULL;
+
+ assert(netdev);
+
+ if (netdev->kind == NETDEV_KIND_TUN)
+ t = TUN(netdev);
+ else
+ t = TAP(netdev);
+
+ assert(t);
+
+ if (netdev->mtu) {
+ log_warning_netdev(netdev, "MTU configured for %s, ignoring",
+ netdev_kind_to_string(netdev->kind));
+ }
+
+ if (netdev->mac) {
+ log_warning_netdev(netdev, "MAC configured for %s, ignoring",
+ netdev_kind_to_string(netdev->kind));
+ }
+
+ return 0;
+}
+
const NetDevVTable tun_vtable = {
.object_size = sizeof(TunTap),
.sections = "Match\0NetDev\0Tun\0",
+ .config_verify = tuntap_verify,
.done = tuntap_done,
.create = netdev_create_tuntap,
.create_type = NETDEV_CREATE_INDEPENDENT,
@@ -183,6 +209,7 @@ const NetDevVTable tun_vtable = {
const NetDevVTable tap_vtable = {
.object_size = sizeof(TunTap),
.sections = "Match\0NetDev\0Tap\0",
+ .config_verify = tuntap_verify,
.done = tuntap_done,
.create = netdev_create_tuntap,
.create_type = NETDEV_CREATE_INDEPENDENT,