[systemd-commits] man/systemd.netdev.xml src/network

Tom Gundersen tomegun at kemper.freedesktop.org
Mon Aug 18 09:11:53 PDT 2014


 man/systemd.netdev.xml               |    5 ++++-
 src/network/networkd-netdev-tuntap.c |   27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit e0fbf1fcffe014d5af6767b29f9108c2f2444888
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Aug 18 12:29:45 2014 +0200

    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.

diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml
index acd8454..275ee52 100644
--- a/man/systemd.netdev.xml
+++ b/man/systemd.netdev.xml
@@ -177,7 +177,9 @@
                                                 <para>The maximum transmission unit in bytes to
                                                 set for the device. The usual suffixes K, M, G,
                                                 are supported and are understood to the base of
-                                                1024.</para>
+                                                1024. This key is not currently suported for
+                                                <literal>tun</literal> or <literal>tap</literal> devices.
+                                                </para>
                                         </listitem>
                                 </varlistentry>
                                 <varlistentry>
@@ -187,6 +189,7 @@
                                                 If none is given, one is generated based on
                                                 the interface name and the
                                                 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+                                                This key is not currently suported for <literal>tun</literal> or <literal>tap</literal> devices.
                                                 </para>
                                         </listitem>
                                 </varlistentry>
diff --git a/src/network/networkd-netdev-tuntap.c b/src/network/networkd-netdev-tuntap.c
index dd3bd96..eef8747 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,



More information about the systemd-commits mailing list