From acbadcdbba3e768a936c88e45a843bd72ecf247c Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 27 Jan 2019 10:55:33 +0100 Subject: [PATCH] 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 --- nixos/modules/services/networking/wpa_supplicant.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix index c788528fa47..8622212f085 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";