mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
network-interface: Add extra bond options
This commit is contained in:
parent
9e5825ba8e
commit
93eb325004
1 changed files with 26 additions and 2 deletions
|
@ -345,10 +345,20 @@ in
|
||||||
|
|
||||||
interfaces = mkOption {
|
interfaces = mkOption {
|
||||||
example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
|
example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
|
||||||
type = types.listOf types.string;
|
type = types.listOf types.str;
|
||||||
description = "The interfaces to bond together";
|
description = "The interfaces to bond together";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lacp_rate = mkOption {
|
||||||
|
default = null;
|
||||||
|
example = "fast";
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = ''
|
||||||
|
Option specifying the rate in which we'll ask our link partner
|
||||||
|
to transmit LACPDU packets in 802.3ad mode.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
miimon = mkOption {
|
miimon = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
example = 100;
|
example = 100;
|
||||||
|
@ -364,7 +374,7 @@ in
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
example = "active-backup";
|
example = "active-backup";
|
||||||
type = types.nullOr types.string;
|
type = types.nullOr types.str;
|
||||||
description = ''
|
description = ''
|
||||||
The mode which the bond will be running. The default mode for
|
The mode which the bond will be running. The default mode for
|
||||||
the bonding driver is balance-rr, optimizing for throughput.
|
the bonding driver is balance-rr, optimizing for throughput.
|
||||||
|
@ -373,6 +383,16 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xmit_hash_policy = mkOption {
|
||||||
|
default = null;
|
||||||
|
example = "layer2+3";
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = ''
|
||||||
|
Selects the transmit hash policy to use for slave selection in
|
||||||
|
balance-xor, 802.3ad, and tlb modes.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -766,10 +786,14 @@ in
|
||||||
while [ ! -d /sys/class/net/${n} ]; do sleep 0.1; done;
|
while [ ! -d /sys/class/net/${n} ]; do sleep 0.1; done;
|
||||||
|
|
||||||
# Set the miimon and mode options
|
# Set the miimon and mode options
|
||||||
|
${optionalString (v.lacp_rate != null)
|
||||||
|
"echo \"${v.lacp_rate}\" > /sys/class/net/${n}/bonding/lacp_rate"}
|
||||||
${optionalString (v.miimon != null)
|
${optionalString (v.miimon != null)
|
||||||
"echo ${toString v.miimon} > /sys/class/net/${n}/bonding/miimon"}
|
"echo ${toString v.miimon} > /sys/class/net/${n}/bonding/miimon"}
|
||||||
${optionalString (v.mode != null)
|
${optionalString (v.mode != null)
|
||||||
"echo \"${v.mode}\" > /sys/class/net/${n}/bonding/mode"}
|
"echo \"${v.mode}\" > /sys/class/net/${n}/bonding/mode"}
|
||||||
|
${optionalString (v.xmit_hash_policy != null)
|
||||||
|
"echo \"${v.xmit_hash_policy}\" > /sys/class/net/${n}/bonding/xmit_hash_policy"}
|
||||||
|
|
||||||
# Bring up the bridge and enslave the specified interfaces
|
# Bring up the bridge and enslave the specified interfaces
|
||||||
ip link set "${n}" up
|
ip link set "${n}" up
|
||||||
|
|
Loading…
Reference in a new issue