summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_id.c
AgeCommit message (Collapse)Author
2008-06-09rename arc4random_bytes => arc4random_buf to match libc's nicer name;Damien Miller
ok deraadt@
2008-03-15revert - I'm a dumbfuck who doesn't know his own APIDamien Miller
2008-03-15off by one at end of arrayDamien Miller
2008-03-15Because the ip_id code initialisation is a specific case of shufflingDamien Miller
a set of incrementing integers (and not an arbitrary set of values) it is possible to populate the array as we shuffle it in a single forward pass. Clever optimisation from didickman AT gmail.com; ok deraadt@ mcbride@
2008-03-02because arc4random_uniform is being used, the modulo bias is taken care ofTheo de Raadt
2008-03-02Add a arc4random_uniform() that returns a uniformly distributed numberDamien Miller
in the range 0 <= x < upper_bound Please use this new API instead of "arc4random() % upper_bound", as it avoids the "modulo bias" that favours small results when upper_bound is not a power of two. feedback deraadt@ mcbride@; ok deraadt@
2008-02-29replacement algorithm. initialize a 64K-short buffer using DurstenfeldTheo de Raadt
shuffle. Upon allocation, swap-permute the new value to a random slot in the 0..32K-1 th entry of the buffer as we move forward, ensuring randomness but also satisfying the non-repeating property we need. Also avoid the value of 0, since IP ID's of 0 are special. Inspired by Dillon's implementation. We believe this is easier to read though, initializes with less bias, handles the ID of 0 properly, and wins speed tests. Thanks a lot to mcbride and djm for doing a bunch of statistical and speed analysis, and comments from nordin ok mcbride djm
2007-11-26typos; ok jmc@Martynas Venckus
sys/netinet/in_pcb.c and sys/net/bridgestp.c ok henning@ sys/dev/pci/bktr/* ok jakemsr@
2007-05-27remove more static to avoid confusing the profiler (and maybe ddb too)David Gwynne
prodded by art@ ja ja claudio@
2004-06-21First step towards more sane time handling in the kernel -- this changesThorsten Lockert
things such that code that only need a second-resolution uptime or wall time, and used to get that from time.tv_secs or mono_time.tv_secs now get this from separate time_t globals time_second and time_uptime. ok art@ niklas@ nordin@
2004-03-22spelling; jjy2+@pitt.eduTheo de Raadt
2003-12-12niels kindly dropped clause 3/4 from the license. tnx!Jun-ichiro itojun Hagino
2003-12-12previous commit included bad hunk. sorryJun-ichiro itojun Hagino
2003-12-12no need to call arc4random() if we don't skip numbers in ip_randomid().Jun-ichiro itojun Hagino
from markus
2003-12-10correct non-repetitive ID code, based on comments from niels provos.Jun-ichiro itojun Hagino
- seed2 is necessary, but use it as "seed2 + x" not "seed2 ^ x". - skipping number is not needed, so disable it for 16bit generator (makes the repetition period to 30000)
2003-09-21"exp" is a reserved symbol under gcc3/posix. mcbride okJun-ichiro itojun Hagino
2002-03-15Kill #if __STDC__ used to do K&R vs. ANSI varargs/stdarg; just do thingsTodd C. Miller
the ANSI way.
2002-03-14First round of __P removal in sysTodd C. Miller
2001-06-08Cut down on include files.Angelos D. Keromytis
2001-06-04use faster arc4random() for small amounts fo data, some spaces; niels okMichael Shalayeff
1999-08-26add an inner xor to make prediction attacks against the ids harder, dueNiels Provos
to an attack pointed out by David Wagner.
1998-12-26make ip_id random but ensure that ids dont repeat for some period.Niels Provos