[systemd-commits] 2 commits - Makefile.am man/udev.xml network/80-container-host0.network src/udev

Tom Gundersen tomegun at kemper.freedesktop.org
Sat Feb 22 09:29:38 PST 2014


 Makefile.am                          |    3 ++-
 man/udev.xml                         |    9 +++++----
 network/80-container-host0.network   |    6 ++++++
 src/udev/net/link-config-gperf.gperf |    4 ++--
 src/udev/net/link-config.c           |    7 ++++---
 5 files changed, 19 insertions(+), 10 deletions(-)

New commits:
commit 733f7a2c69c794a81978a08a79916c224ba355a6
Author: Tom Gundersen <teg at jklm.no>
Date:   Sat Feb 22 18:23:19 2014 +0100

    udev: net - allow MTU and Speed to be specified with units
    
    This also changes the names to MTUBytes and BitsPerSecond, respectively. Notice
    that the speed was mistakenly documented to be in bytes before this change.

diff --git a/man/udev.xml b/man/udev.xml
index ae7dc61..9733b85 100644
--- a/man/udev.xml
+++ b/man/udev.xml
@@ -982,15 +982,16 @@
           </listitem>
         </varlistentry>
         <varlistentry>
-          <term><varname>MTU=</varname></term>
+          <term><varname>MTUBytes=</varname></term>
           <listitem>
-            <para>The MTU to set for the device.</para>
+            <para>The maximum transmission unit in bytes to set for the device.</para>
           </listitem>
         </varlistentry>
         <varlistentry>
-          <term><varname>SpeedMBytes=</varname></term>
+          <term><varname>BitsPerSecond=</varname></term>
           <listitem>
-            <para>The speed to set for the device.</para>
+            <para>The speed to set for the device, the value is rounded down
+            to the nearest Mbps.</para>
           </listitem>
         </varlistentry>
         <varlistentry>
diff --git a/src/udev/net/link-config-gperf.gperf b/src/udev/net/link-config-gperf.gperf
index 277ceb5..3384ca0 100644
--- a/src/udev/net/link-config-gperf.gperf
+++ b/src/udev/net/link-config-gperf.gperf
@@ -30,7 +30,7 @@ Link.MACAddress,           config_parse_hwaddr,        0,
 Link.NamePolicy,           config_parse_name_policy,   0,                             offsetof(link_config, name_policy)
 Link.Name,                 config_parse_ifname,        0,                             offsetof(link_config, name)
 Link.Alias,                config_parse_ifalias,       0,                             offsetof(link_config, alias)
-Link.MTU,                  config_parse_unsigned,      0,                             offsetof(link_config, mtu)
-Link.SpeedMBytes,          config_parse_unsigned,      0,                             offsetof(link_config, speed)
+Link.MTUBytes,             config_parse_bytes_size,    0,                             offsetof(link_config, mtu)
+Link.BitsPerSecond,        config_parse_bytes_size,    0,                             offsetof(link_config, speed)
 Link.Duplex,               config_parse_duplex,        0,                             offsetof(link_config, duplex)
 Link.WakeOnLan,            config_parse_wol,           0,                             offsetof(link_config, wol)
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
index 92d248f..05225e0 100644
--- a/src/udev/net/link-config.c
+++ b/src/udev/net/link-config.c
@@ -365,10 +365,11 @@ int link_config_apply(link_config_ctx *ctx, link_config *config, struct udev_dev
         if (!old_name)
                 return -EINVAL;
 
-        r = ethtool_set_speed(ctx->ethtool_fd, old_name, config->speed, config->duplex);
+        r = ethtool_set_speed(ctx->ethtool_fd, old_name, config->speed / 1024, config->duplex);
         if (r < 0)
-                log_warning("Could not set speed or duplex of %s to %u Mbytes (%s): %s",
-                             old_name, config->speed, duplex_to_string(config->duplex), strerror(-r));
+                log_warning("Could not set speed or duplex of %s to %u Mbps (%s): %s",
+                            old_name, config->speed / 1024, duplex_to_string(config->duplex),
+                            strerror(-r));
 
         r = ethtool_set_wol(ctx->ethtool_fd, old_name, config->wol);
         if (r < 0)

commit dd4d2c1cd1eb7c1f3163f6f922362af3189df0a3
Author: Tom Gundersen <teg at jklm.no>
Date:   Fri Feb 21 22:44:42 2014 +0100

    networkd/nspawn: enable dhcp client on veth device created in guest
    
    When starting systemd-nspawn with --network-veth, we create a veth device called
    host0 in the guest. Pick up on this and start a dhcp client on it. We will also
    pick up host0 netdevs created by other containers should they chose to use the
    same name.

diff --git a/Makefile.am b/Makefile.am
index 0699712..647e993 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2464,7 +2464,8 @@ INSTALL_DIRS += \
 	$(sysconfdir)/udev/hwdb.d
 
 dist_network_DATA = \
-	network/99-default.link
+	network/99-default.link \
+	network/80-container-host0.network
 
 dist_udevrules_DATA += \
 	rules/99-systemd.rules \
diff --git a/network/80-container-host0.network b/network/80-container-host0.network
new file mode 100644
index 0000000..d49fba0
--- /dev/null
+++ b/network/80-container-host0.network
@@ -0,0 +1,6 @@
+[Match]
+Virtualization=container
+Name=host0
+
+[Network]
+DHCP=yes



More information about the systemd-commits mailing list