From f975bbae114682523197385e820b4f51dcd04cf6 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 12 Apr 2019 17:17:19 +0200 Subject: nixos/hostapd: escape interface names for hostapd Same problem as described in acbadcdbba3e768a936c88e45a843bd72ecf247c. When using multiple interfaces for wifi with `networking.wlanInterfaces` and the interface for `hostapd` contains a dash, this will fail as systemd escapes dashes in its device names. --- nixos/modules/services/networking/hostapd.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/services/networking/hostapd.nix b/nixos/modules/services/networking/hostapd.nix index 3fbc08e90607..7add48308f80 100644 --- a/nixos/modules/services/networking/hostapd.nix +++ b/nixos/modules/services/networking/hostapd.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, utils, ... }: # TODO: # @@ -12,6 +12,8 @@ let cfg = config.services.hostapd; + escapedInterface = utils.escapeSystemdPath cfg.interface; + configFile = pkgs.writeText "hostapd.conf" '' interface=${cfg.interface} driver=${cfg.driver} @@ -157,8 +159,8 @@ in { description = "hostapd wireless AP"; path = [ pkgs.hostapd ]; - after = [ "sys-subsystem-net-devices-${cfg.interface}.device" ]; - bindsTo = [ "sys-subsystem-net-devices-${cfg.interface}.device" ]; + after = [ "sys-subsystem-net-devices-${escapedInterface}.device" ]; + bindsTo = [ "sys-subsystem-net-devices-${escapedInterface}.device" ]; requiredBy = [ "network-link-${cfg.interface}.service" ]; serviceConfig = -- cgit 1.4.1