Page MenuHomeFreeBSD

avoid unneeded call to arc4random() in syncache_add()
ClosedPublic

Authored by gallatin on Sep 10 2019, 7:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 27, 6:01 AM
Unknown Object (File)
Dec 30 2024, 4:54 PM
Unknown Object (File)
Dec 29 2024, 4:09 PM
Unknown Object (File)
Dec 28 2024, 4:18 PM
Unknown Object (File)
Dec 27 2024, 3:13 PM
Unknown Object (File)
Dec 16 2024, 11:00 AM
Unknown Object (File)
Nov 22 2024, 12:04 AM
Unknown Object (File)
Oct 6 2024, 1:45 AM
Subscribers

Details

Summary

We currently call arc4random() unconditionally to initialize sc_iss, but then when syncookies are enabled, we overwrite it with the return value from from syncookie_generate(). It would seem to make more sense to only call arc4random() when syncookies are not enabled.

Note that on a system under a syn flood attack, arc4random() becomes quite expensive, and the chacha_poly crypto that it calls is one of the more expensive things happening on the system. Removing this unneeded arc4random() call reduces CPU from about 40% to about 35% in my test scenario (Broadwell Xeon, 6Mpps syn flood attack).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable