From d9c52fa045d53e2b802102114e9c557c43024eb5 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mon, 21 Jul 2014 19:14:48 +0530 Subject: networkd: add support for bond options The following bond options are supported by this patch. MIIMonitorSec: Specifies the frequency in milli-seconds that MII link monitoring will occur. UpDelaySec: Specifies the delay time in milli-seconds to enable a link after a link up status has been detected. DownDelaySec: Specifies the delay time in milli-seconds to disable a link after a link failure has been detected. changes: 1. Added gconf variables. 2. man page conf: [NetDev] Name=bond1 Kind=bond [Bond] Mode=802.3ad TransmitHashPolicy=layer2+3 LacpduTransmitRate=fast MIIMonitorSec=1s UpDelaySec=2s DownDelaySec=8s cat /proc/net/bonding/bond1 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: IEEE 802.3ad Dynamic link aggregation Transmit Hash Policy: layer2+3 (2) MII Status: up MII Polling Interval (ms): 1000 Up Delay (ms): 2000 Down Delay (ms): 8000 802.3ad info LACP rate: fast Min links: 0 Aggregator selection policy (ad_select): stable bond bond1 has no active aggregator [tomegun: rephrased manpage, dropped bond_ prefix from variables] --- src/network/networkd-netdev-bond.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/network/networkd-netdev-bond.c') diff --git a/src/network/networkd-netdev-bond.c b/src/network/networkd-netdev-bond.c index e3f3333560..1f57083626 100644 --- a/src/network/networkd-netdev-bond.c +++ b/src/network/networkd-netdev-bond.c @@ -145,6 +145,36 @@ static int netdev_bond_fill_message_create(NetDev *netdev, Link *link, sd_rtnl_m } } + if (b->miimon != 0) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_MIIMON, b->miimon / 1000); + if (r < 0) { + log_error_netdev(netdev, + "Could not append IFLA_BOND_BOND_MIIMON attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->downdelay != 0) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_DOWNDELAY, b->downdelay / 1000); + if (r < 0) { + log_error_netdev(netdev, + "Could not append IFLA_BOND_DOWNDELAY attribute: %s", + strerror(-r)); + return r; + } + } + + if (b->updelay != 0) { + r = sd_rtnl_message_append_u32(m, IFLA_BOND_UPDELAY, b->updelay / 1000); + if (r < 0) { + log_error_netdev(netdev, + "Could not append IFLA_BOND_UPDELAY attribute: %s", + strerror(-r)); + return r; + } + } + return 0; } -- cgit v1.2.3-54-g00ecf