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

Tom Gundersen tomegun at kemper.freedesktop.org
Mon Jul 14 03:25:55 PDT 2014


 man/systemd.netdev.xml                   |    5 ++++-
 src/network/networkd-bond.c              |   26 ++++++++++++++++++++++++--
 src/network/networkd-network-gperf.gperf |    1 +
 3 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 7c1cff4ff79f3121189403a8c1b7c350925b3aaa
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jul 14 12:25:42 2014 +0200

    man: systemd.netdev - make it clear that we do not touch preexisting netdevs
    
    We will happily use bridges/bonds as master devices, but we will not change their settings if they were created by
    someone else.

diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml
index e7eb5a0..0a2cbab 100644
--- a/man/systemd.netdev.xml
+++ b/man/systemd.netdev.xml
@@ -60,7 +60,10 @@
 
                 <para>Virtual Network Device files must have the extension
                 <filename>.netdev</filename>; other extensions are ignored. Virtual
-                network devices are created as soon as networkd is started.</para>
+                network devices are created as soon as networkd is started. If a netdev
+                with the specified name already exists, networkd will use that as-is
+                rather than create its own. Note that the settings of the pre-existing
+                netdev will not be changed by networkd.</para>
 
                 <para>The <filename>.netdev</filename> files are read from the files located in the
                 system network directory <filename>/usr/lib/systemd/network</filename>,

commit dde2efef37b25f759a8690be7b8be353daa3ff75
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jul 14 12:14:23 2014 +0200

    networkd: add back route destination support
    
    This was accidentally dropped when adding metric support.

diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 5c1c013..61dd8ef 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -43,6 +43,7 @@ Address.Peer,                config_parse_address,               0,
 Address.Broadcast,           config_parse_broadcast,             0,                             0
 Address.Label,               config_parse_label,                 0,                             0
 Route.Gateway,               config_parse_gateway,               0,                             0
+Route.Destination,           config_parse_destination,           0,                             0
 Route.Metric,                config_parse_route_priority,        0,                             0
 DHCP.UseDNS,                 config_parse_bool,                  0,                             offsetof(Network, dhcp_dns)
 DHCP.UseMTU,                 config_parse_bool,                  0,                             offsetof(Network, dhcp_mtu)

commit b621239e29ac5483fb3f340d4e46fbb4b081fee7
Author: Tom Gundersen <teg at jklm.no>
Date:   Mon Jul 14 12:13:45 2014 +0200

    networkd: bond - explicitly map to kernel mode values

diff --git a/src/network/networkd-bond.c b/src/network/networkd-bond.c
index 4437ee4..1e15677 100644
--- a/src/network/networkd-bond.c
+++ b/src/network/networkd-bond.c
@@ -22,7 +22,7 @@
 
 #include <netinet/ether.h>
 #include <arpa/inet.h>
-#include <net/if.h>
+#include <linux/if_bonding.h>
 
 #include "conf-parser.h"
 #include "sd-rtnl.h"
@@ -42,6 +42,27 @@ static const char* const bond_mode_table[_NETDEV_BOND_MODE_MAX] = {
 DEFINE_STRING_TABLE_LOOKUP(bond_mode, BondMode);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_bond_mode, bond_mode, BondMode, "Failed to parse bond mode");
 
+static uint8_t bond_mode_to_kernel(BondMode mode) {
+        switch (mode) {
+        case NETDEV_BOND_MODE_BALANCE_RR:
+                return BOND_MODE_ROUNDROBIN;
+        case NETDEV_BOND_MODE_ACTIVE_BACKUP:
+                return BOND_MODE_ACTIVEBACKUP;
+        case NETDEV_BOND_MODE_BALANCE_XOR:
+                return BOND_MODE_XOR;
+        case NETDEV_BOND_MODE_BROADCAST:
+                return BOND_MODE_BROADCAST;
+        case NETDEV_BOND_MODE_802_3AD:
+                return BOND_MODE_8023AD;
+        case NETDEV_BOND_MODE_BALANCE_TLB:
+                return BOND_MODE_TLB;
+        case NETDEV_BOND_MODE_BALANCE_ALB:
+                return BOND_MODE_ALB;
+        default:
+                return (uint8_t) -1;
+        }
+}
+
 static int netdev_fill_bond_rtnl_message(NetDev *netdev, sd_rtnl_message *m) {
         int r;
 
@@ -73,7 +94,8 @@ static int netdev_fill_bond_rtnl_message(NetDev *netdev, sd_rtnl_message *m) {
         }
 
         if (netdev->bond_mode != _NETDEV_BOND_MODE_INVALID) {
-                r = sd_rtnl_message_append_u8(m, IFLA_BOND_MODE, netdev->bond_mode);
+                r = sd_rtnl_message_append_u8(m, IFLA_BOND_MODE,
+                                              bond_mode_to_kernel(netdev->bond_mode));
                 if (r < 0) {
                         log_error_netdev(netdev,
                                          "Could not append IFLA_BOND_MODE attribute: %s",



More information about the systemd-commits mailing list