summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2022-02-04 08:45:28 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2022-02-04 08:46:32 +0100
commit3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0 (patch)
tree7cde7c6d56fdc9df6bb5e3f86c8826582280470c /nixos/modules/services/networking
parentd67ad28fc301305baeeb364a04f0565c5f5118c8 (diff)
downloadnixpkgs-3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0.tar
nixpkgs-3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0.tar.gz
nixpkgs-3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0.tar.bz2
nixpkgs-3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0.tar.lz
nixpkgs-3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0.tar.xz
nixpkgs-3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0.tar.zst
nixpkgs-3b8fa47f58bd96b59bdcd9a14b36ad2ee9d0d8f0.zip
nixos/wireless: don't attempt fallback on WPA3 only networks
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/wpa_supplicant.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index 9989b6df659..c2e1d37e28b 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -11,11 +11,15 @@ let
   opt = options.networking.wireless;
 
   wpa3Protocols = [ "SAE" "FT-SAE" ];
-  hasWPA3 = opts: !mutuallyExclusive opts.authProtocols wpa3Protocols;
+  hasMixedWPA = opts:
+    let
+      hasWPA3 = !mutuallyExclusive opts.authProtocols wpa3Protocols;
+      others = subtractLists wpa3Protocols opts.authProtocols;
+    in hasWPA3 && others != [];
 
   # Gives a WPA3 network higher priority
   increaseWPA3Priority = opts:
-    opts // optionalAttrs (hasWPA3 opts)
+    opts // optionalAttrs (hasMixedWPA opts)
       { priority = if opts.priority == null
                      then 1
                      else opts.priority + 1;
@@ -33,7 +37,7 @@ let
   allNetworks =
     if cfg.fallbackToWPA2
       then map increaseWPA3Priority networkList
-           ++ map mkWPA2Fallback (filter hasWPA3 networkList)
+           ++ map mkWPA2Fallback (filter hasMixedWPA networkList)
       else networkList;
 
   # Content of wpa_supplicant.conf