Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostapd: use getrandom(2) #75140

Merged
merged 1 commit into from Dec 7, 2019
Merged

hostapd: use getrandom(2) #75140

merged 1 commit into from Dec 7, 2019

Conversation

tomfitzhenry
Copy link
Contributor

Motivation: Devices with few entropy sources on boot hang/block if many services try to
read from /dev/random.

https://w1.fi/cgit/hostap/commit/?id=89a7cdd690b48a0c56380cf4609442ed13527f44
states getrandom() is recommended, but not enabled by default since it
relies on:

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @Phreedom @NinjaTrappeur

Motivation: Devices with few entropy sources on boot hang/block if many services try to
read from /dev/random.

https://w1.fi/cgit/hostap/commit/?id=89a7cdd690b48a0c56380cf4609442ed13527f44
states getrandom() is recommended, but not enabled by default since it
relies on:

* Linux kernel 3.17 (NixOS 19.09 has 4.19; master presumably later)
* glibc 2.25 (NixOS master has 2.27
  https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/glibc/common.nix#L37 )
Copy link
Member

@picnoir picnoir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for the PR!

Successfully tested on my test router.

@picnoir
Copy link
Member

picnoir commented Dec 7, 2019

@flokli Could you please merge that?

@picnoir picnoir mentioned this pull request Dec 7, 2019
10 tasks
@flokli
Copy link
Contributor

flokli commented Dec 7, 2019

There's other kernel versions in nixpkgs, but hopefully all > 3.17.

On the other hand, hostapd just falls back to /dev/random if getrandom() isn't supported on the running kernel:

wpa_printf(MSG_DEBUG,
+				   "random: getrandom() not supported, falling back to /dev/random");

so this should be a nobrainer.

Thanks a lot!

@flokli flokli merged commit c36b8c5 into NixOS:master Dec 7, 2019
@flokli
Copy link
Contributor

flokli commented Dec 7, 2019

backported to 19.09 in b156188.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants