This makes better use of the unsigned values improving the randomness.
It should make little, if any, difference from a user view point though.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 28320 Build 26423: arc lint + arc unit
Event Timeline
sys/netpfil/ipfw/ip_dn_io.c | ||
---|---|---|
408–417 | Forwarding my remarks from the earlier review: I don't believe unpredictability matters here. I also don't believe there is any significant benefit outside of unpredictability for this use. (Although, yikes, random(9) is actually rand(3), not random(3). Perhaps we should replace random(9) with a better PRNG.) I may be mistaken on either or both counts. | |
514–515 | This is now half as likely to happen, due to the differing ranges of the random(9) and arc4random(9) functions. I believe that violates the intent of the code. |
sys/netpfil/ipfw/ip_dn_io.c | ||
---|---|---|
408–417 | I'll add: if we do actually want arc4random-quality entropy, and only need 16 bits, we can waste a few less cycles by using fewer bytes: arc4random_buf(&q->random, 2) (paired with apropriate resizing of dn_queue::random from int to uint16_t). This is basically insignificant with today's arc4random(9) but would be more significant if this was a significant consumer of arc4random(9) and we adopted the buffered approach arc4random(3) uses today. |