diff options
author | Susant Sahani <susant@redhat.com> | 2014-07-04 22:35:02 +0530 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-07-07 21:52:01 +0200 |
commit | fe8ac65b683ec7408b26ba40040134e6d66b1c5c (patch) | |
tree | 7254c1e0b945ecd2bf80ffd91be54cf3d0991348 /src/network/networkd-netdev.c | |
parent | 948a6f8eb42c85d2b96e9b5817fcfa29ad4752ae (diff) |
networkd: add support for mode
This patch adds supports networkd to configure bond mode
during creation via persistent conf. Mode can be configured
with conf param 'Mode'. A new section Bond is added to the
conf to support bond mode.
These modes can be configured now.
balance-rr
active-backup
balance-xor
broadcast
802.3ad
balance-tlb
balance-alb
Example conf file: test-bond.conf
[NetDev]
Name=bond1
Kind=bond
[Bond]
Mode=balance-xor
Test case:
1. start networkd service:
12: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UNKNOWN mode DEFAULT group default
link/ether 22:89:6c:47:23:d2 brd ff:ff:ff:ff:ff:ff
2. find bond mode:
cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (xor)
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Changes:
1. Added file networkd-bond.c
2. Bond mode enum BondMode
3. conf section [Bond]
[tomegun: whitespace]
Diffstat (limited to 'src/network/networkd-netdev.c')
-rw-r--r-- | src/network/networkd-netdev.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index a8c1ea3b44..88b692fbab 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -48,6 +48,7 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = { DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind); DEFINE_CONFIG_PARSE_ENUM(config_parse_netdev_kind, netdev_kind, NetDevKind, "Failed to parse netdev kind"); + static void netdev_cancel_callbacks(NetDev *netdev) { _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL; netdev_enslave_callback *callback; @@ -565,13 +566,14 @@ static int netdev_load_one(Manager *manager, const char *filename) { netdev->state = _NETDEV_STATE_INVALID; netdev->kind = _NETDEV_KIND_INVALID; netdev->macvlan_mode = _NETDEV_MACVLAN_MODE_INVALID; + netdev->bond_mode = _NETDEV_BOND_MODE_INVALID; netdev->vlanid = VLANID_MAX + 1; netdev->vxlanid = VXLAN_VID_MAX + 1; netdev->tunnel_pmtudisc = true; netdev->learning = true; r = config_parse(NULL, filename, file, - "Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0Tun\0Tap\0", + "Match\0NetDev\0VLAN\0MACVLAN\0VXLAN\0Tunnel\0Peer\0Tun\0Tap\0Bond\0", config_item_perf_lookup, (void*) network_netdev_gperf_lookup, false, false, netdev); if (r < 0) { @@ -694,19 +696,15 @@ static int netdev_load_one(Manager *manager, const char *filename) { break; case NETDEV_KIND_BRIDGE: - case NETDEV_KIND_BOND: r = netdev_create(netdev); if (r < 0) return r; break; - - case NETDEV_KIND_TUN: - case NETDEV_KIND_TAP: - r = netdev_create_tuntap(netdev); + case NETDEV_KIND_BOND: + r = netdev_create_bond(netdev, netdev_create_handler); if (r < 0) return r; break; - default: break; } |