diff options
author | William A. Kennington III <william@wkennington.com> | 2014-10-04 18:37:00 -0700 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2014-10-04 18:37:00 -0700 |
commit | f1572d37c3e36f0428b75085f06b8de4192ec24b (patch) | |
tree | 486d5cc65a3fe62c3837ec3f53fc63bd5a92278a | |
parent | 93eb325004e8db6d6307067c8db921ddfad4727b (diff) | |
download | nixlib-f1572d37c3e36f0428b75085f06b8de4192ec24b.tar nixlib-f1572d37c3e36f0428b75085f06b8de4192ec24b.tar.gz nixlib-f1572d37c3e36f0428b75085f06b8de4192ec24b.tar.bz2 nixlib-f1572d37c3e36f0428b75085f06b8de4192ec24b.tar.lz nixlib-f1572d37c3e36f0428b75085f06b8de4192ec24b.tar.xz nixlib-f1572d37c3e36f0428b75085f06b8de4192ec24b.tar.zst nixlib-f1572d37c3e36f0428b75085f06b8de4192ec24b.zip |
network-interfaces: Bonding fixes
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 4ed8d79bd652..6f6000cf3397 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -778,7 +778,9 @@ in path = [ pkgs.ifenslave pkgs.iproute ]; script = '' # Remove Dead Interfaces - ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}" + ip link set "${n}" down >/dev/null 2>&1 || true + ifenslave -d "${n}" >/dev/null 2>&1 || true + ip link del "${n}" >/dev/null 2>&1 || true ip link add name "${n}" type bond @@ -786,25 +788,25 @@ in while [ ! -d /sys/class/net/${n} ]; do sleep 0.1; done; # 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) "echo ${toString v.miimon} > /sys/class/net/${n}/bonding/miimon"} ${optionalString (v.mode != null) "echo \"${v.mode}\" > /sys/class/net/${n}/bonding/mode"} + ${optionalString (v.lacp_rate != null) + "echo \"${v.lacp_rate}\" > /sys/class/net/${n}/bonding/lacp_rate"} ${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 bond and enslave the specified interfaces ip link set "${n}" up ${flip concatMapStrings v.interfaces (i: '' ifenslave "${n}" "${i}" '')} ''; postStop = '' - ip link set "${n}" down - ifenslave -d "${n}" - ip link delete "${n}" + ip link set "${n}" down >dev/null 2>&1 || true + ifenslave -d "${n}" >/dev/null 2>&1 || true + ip link del "${n}" >/dev/null 2>&1 || true ''; }); |