diff options
author | Naïm Favier <n@monade.li> | 2022-02-07 20:44:03 +0100 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-02-07 20:45:08 +0100 |
commit | ffdcd39c0b0e62c7a6be5577f913e38e8cae4783 (patch) | |
tree | 1e3778d90d0093aeefac2e85f9593d549191aafd /pkgs/os-specific/linux/wpa_supplicant | |
parent | cda4084518db305120c215cba7f70ae982d633b7 (diff) | |
download | nixpkgs-ffdcd39c0b0e62c7a6be5577f913e38e8cae4783.tar nixpkgs-ffdcd39c0b0e62c7a6be5577f913e38e8cae4783.tar.gz nixpkgs-ffdcd39c0b0e62c7a6be5577f913e38e8cae4783.tar.bz2 nixpkgs-ffdcd39c0b0e62c7a6be5577f913e38e8cae4783.tar.lz nixpkgs-ffdcd39c0b0e62c7a6be5577f913e38e8cae4783.tar.xz nixpkgs-ffdcd39c0b0e62c7a6be5577f913e38e8cae4783.tar.zst nixpkgs-ffdcd39c0b0e62c7a6be5577f913e38e8cae4783.zip |
wpa_supplicant: use unique IDs for networks and credentials
Fixes the bug described at https://github.com/NixOS/nixpkgs/pull/155266#issuecomment-1031711094
Diffstat (limited to 'pkgs/os-specific/linux/wpa_supplicant')
-rw-r--r-- | pkgs/os-specific/linux/wpa_supplicant/Use-unique-IDs-for-networks-and-credentials.patch | 32 | ||||
-rw-r--r-- | pkgs/os-specific/linux/wpa_supplicant/default.nix | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/wpa_supplicant/Use-unique-IDs-for-networks-and-credentials.patch b/pkgs/os-specific/linux/wpa_supplicant/Use-unique-IDs-for-networks-and-credentials.patch new file mode 100644 index 00000000000..09e5b3673ac --- /dev/null +++ b/pkgs/os-specific/linux/wpa_supplicant/Use-unique-IDs-for-networks-and-credentials.patch @@ -0,0 +1,32 @@ +The id and cred_id variables are reset to 0 every time the +wpa_config_read function is called, which is fine as long as it is only +called once. However, this is not the case when using both the -c and -I +options to specify two config files. + +This is a problem because the GUI, since eadfeb0e93748eb396ae62012b92d21a7f533646, +relies on the network IDs being unique (and increasing), and might get +into an infinite loop otherwise. + +This is solved by simply making the variables static. +--- + wpa_supplicant/config_file.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c +index 6db5010db..c996e3916 100644 +--- a/wpa_supplicant/config_file.c ++++ b/wpa_supplicant/config_file.c +@@ -297,8 +297,8 @@ struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp) + struct wpa_ssid *ssid, *tail, *head; + struct wpa_cred *cred, *cred_tail, *cred_head; + struct wpa_config *config; +- int id = 0; +- int cred_id = 0; ++ static int id = 0; ++ static int cred_id = 0; + + if (name == NULL) + return NULL; +-- +2.34.1 + diff --git a/pkgs/os-specific/linux/wpa_supplicant/default.nix b/pkgs/os-specific/linux/wpa_supplicant/default.nix index 380fca42975..414c435b35a 100644 --- a/pkgs/os-specific/linux/wpa_supplicant/default.nix +++ b/pkgs/os-specific/linux/wpa_supplicant/default.nix @@ -18,6 +18,8 @@ stdenv.mkDerivation rec { }; patches = [ + # Fix a bug when using two config files + ./Use-unique-IDs-for-networks-and-credentials.patch ] ++ lib.optionals readOnlyModeSSIDs [ # Allow read-only networks ./0001-Implement-read-only-mode-for-ssids.patch |