nixos/networkd: make default networks RequiredForOnline when possible
When `systemd.network.wait-online.anyInterface` is enabled, `RequiredForOnline` really means "sufficient for online", so enable it.
This commit is contained in:
@@ -88,20 +88,20 @@ in
|
|||||||
# more likely to result in interfaces being configured to
|
# more likely to result in interfaces being configured to
|
||||||
# use DHCP when they shouldn't.
|
# use DHCP when they shouldn't.
|
||||||
|
|
||||||
# We set RequiredForOnline to false, because it's fairly
|
# When wait-online.anyInterface is enabled, RequiredForOnline really
|
||||||
# common for such devices to have multiple interfaces and
|
# means "sufficient for online", so we can enable it.
|
||||||
# only one of them to be connected (e.g. a laptop with
|
# Otherwise, don't block the network coming online because of default networks.
|
||||||
# ethernet and WiFi interfaces). Maybe one day networkd will
|
|
||||||
# support "any"-style RequiredForOnline...
|
|
||||||
matchConfig.Name = ["en*" "eth*"];
|
matchConfig.Name = ["en*" "eth*"];
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
linkConfig.RequiredForOnline = lib.mkDefault false;
|
linkConfig.RequiredForOnline =
|
||||||
|
lib.mkDefault config.systemd.network.wait-online.anyInterface;
|
||||||
};
|
};
|
||||||
networks."99-wireless-client-dhcp" = lib.mkIf cfg.useDHCP {
|
networks."99-wireless-client-dhcp" = lib.mkIf cfg.useDHCP {
|
||||||
# Like above, but this is much more likely to be correct.
|
# Like above, but this is much more likely to be correct.
|
||||||
matchConfig.WLANInterfaceType = "station";
|
matchConfig.WLANInterfaceType = "station";
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
linkConfig.RequiredForOnline = lib.mkDefault false;
|
linkConfig.RequiredForOnline =
|
||||||
|
lib.mkDefault config.systemd.network.wait-online.anyInterface;
|
||||||
# We also set the route metric to one more than the default
|
# We also set the route metric to one more than the default
|
||||||
# of 1024, so that Ethernet is preferred if both are
|
# of 1024, so that Ethernet is preferred if both are
|
||||||
# available.
|
# available.
|
||||||
|
|||||||
Reference in New Issue
Block a user