about summary refs log tree commit diff
path: root/nixos/modules/services/networking/wpa_supplicant.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-01-27 10:55:33 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2019-01-27 11:59:18 +0100
commitacbadcdbba3e768a936c88e45a843bd72ecf247c (patch)
tree249ab7e0c8f40cf6e312c47b1fd63d442aa43fb2 /nixos/modules/services/networking/wpa_supplicant.nix
parenteb965a4b3821af91c5988580fbb6624b9d22072e (diff)
downloadnixlib-acbadcdbba3e768a936c88e45a843bd72ecf247c.tar
nixlib-acbadcdbba3e768a936c88e45a843bd72ecf247c.tar.gz
nixlib-acbadcdbba3e768a936c88e45a843bd72ecf247c.tar.bz2
nixlib-acbadcdbba3e768a936c88e45a843bd72ecf247c.tar.lz
nixlib-acbadcdbba3e768a936c88e45a843bd72ecf247c.tar.xz
nixlib-acbadcdbba3e768a936c88e45a843bd72ecf247c.tar.zst
nixlib-acbadcdbba3e768a936c88e45a843bd72ecf247c.zip
nixos/wpa_supplicant: escape interface names to listen on
Systemd provides some functionality to escape strings that are supposed
to be part of a unit name[1]. This seems to be used for interface names
in `sys-subsystem-net-devices-{interface}.device` and breaks
wpa_supplicant if the wireless interface name has a dash which is
encoded to \x2d.

Such an interface name is rather rare, but used i.e. when configuring
multiple wireless interfaces with `networking.wlanInterfaces`[2] to have on
interface for `wpa_supplicant` and another one for `hostapd`.

[1] https://www.freedesktop.org/software/systemd/man/systemd-escape.html
[2] https://nixos.org/nixos/options.html#networking.wlaninterfaces
Diffstat (limited to 'nixos/modules/services/networking/wpa_supplicant.nix')
-rw-r--r--nixos/modules/services/networking/wpa_supplicant.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index c788528fa47b..8622212f0856 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, utils, ... }:
 
 with lib;
 
@@ -193,7 +193,7 @@ in {
     # FIXME: start a separate wpa_supplicant instance per interface.
     systemd.services.wpa_supplicant = let
       ifaces = cfg.interfaces;
-      deviceUnit = interface: [ "sys-subsystem-net-devices-${interface}.device" ];
+      deviceUnit = interface: [ "sys-subsystem-net-devices-${utils.escapeSystemdPath interface}.device" ];
     in {
       description = "WPA Supplicant";