Fix hostapd's place in systemd dependency tree. (#45464)
* nat/bind/dhcp.service:
Remove. Those services have nothing to do with a link-level service.
* sys-subsystem-net-devices-${if}.device:
Add as BindsTo dependency as this will make hostapd stop when the
device is unplugged.
* network-link-${if}.service:
Add hostapd as dependency for this service via requiredBy clause,
so that the network link is only considered to be established
only after hostapd has started.
* network.target:
Remove this from wantedBy clause as this is already implied from
dependencies stacked above hostapd. And if it's not implied than
starting hostapd is not required for this particular network
configuration.
commit725fcdef3f675e96e591377ff9776c72edb13c60
authorclefru <clemens@endorphin.org>
dateWed 17 Oct 2018, 09:18 (8 years ago)
parentc2c39a2
nixos/modules/services/networking/hostapd.nix+3−3
@@ -157,9 +157,9 @@ in
157157 { description = "hostapd wireless AP";
158158
159159 path = [ pkgs.hostapd ];
160− wantedBy = [ "network.target" ];
161−
162− after = [ "${cfg.interface}-cfg.service" "nat.service" "bind.service" "dhcpd.service" "sys-subsystem-net-devices-${cfg.interface}.device" ];
160+ after = [ "sys-subsystem-net-devices-${cfg.interface}.device" ];
161+ bindsTo = [ "sys-subsystem-net-devices-${cfg.interface}.device" ];
162+ requiredBy = [ "network-link-${cfg.interface}.service" ];
163163
164164 serviceConfig =
165165 { ExecStart = "${pkgs.hostapd}/bin/hostapd ${configFile}";