21ff11503e
This avoids the OPERSTATE unknown when the bridge is brought up but the members are not ready yet. This will make OPERSTATE to down, enabling us to wait until we have brought up completely all the members. Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
22 lines
602 B
Nix
22 lines
602 B
Nix
{
|
|
liminix
|
|
, ifwait
|
|
, lib
|
|
}:
|
|
{ ifname, macAddressFromInterface ? null } :
|
|
let
|
|
inherit (liminix.services) bundle oneshot;
|
|
inherit (lib) mkOption types optional;
|
|
in oneshot rec {
|
|
name = "${ifname}.link";
|
|
up = ''
|
|
${if macAddressFromInterface == null then
|
|
"ip link add name ${ifname} type bridge"
|
|
else
|
|
"ip link add name ${ifname} address $(output ${macAddressFromInterface} ether) type bridge"}
|
|
${liminix.networking.ifup name ifname}
|
|
'';
|
|
down = "ip link set down dev ${ifname}";
|
|
|
|
dependencies = optional (macAddressFromInterface != null) macAddressFromInterface;
|
|
}
|