History log of /openbsd-current/sys/netinet/ip_id.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.25 10-Mar-2021 jsg

spelling

ok gnezdo@ semarie@ mpi@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.24 18-Nov-2014 tedu

move arc4random prototype to systm.h. more appropriate for most code
to include that than rdnvar.h. ok deraadt dlg


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.23 31-Mar-2011 jasper

- use nitems(); no binary change

ok claudio@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 09-Jun-2008 djm

rename arc4random_bytes => arc4random_buf to match libc's nicer name;
ok deraadt@


# 1.21 15-Mar-2008 djm

revert - I'm a dumbfuck who doesn't know his own API


# 1.20 15-Mar-2008 djm

off by one at end of array


# 1.19 15-Mar-2008 djm

Because the ip_id code initialisation is a specific case of shuffling
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@


Revision tags: OPENBSD_4_3_BASE
# 1.18 02-Mar-2008 deraadt

because arc4random_uniform is being used, the modulo bias is taken care of


# 1.17 02-Mar-2008 djm

Add a arc4random_uniform() that returns a uniformly distributed number
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@


# 1.16 29-Feb-2008 deraadt

replacement algorithm. initialize a 64K-short buffer using Durstenfeld
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


# 1.15 26-Nov-2007 martynas

typos; ok jmc@
sys/netinet/in_pcb.c and sys/net/bridgestp.c ok henning@
sys/dev/pci/bktr/* ok jakemsr@


Revision tags: OPENBSD_4_2_BASE
# 1.14 27-May-2007 dlg

remove more static to avoid confusing the profiler (and maybe ddb too)

prodded by art@ ja ja claudio@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.13 21-Jun-2004 tholo

First step towards more sane time handling in the kernel -- this changes
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@


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.12 22-Mar-2004 deraadt

spelling; jjy2+@pitt.edu


# 1.11 12-Dec-2003 itojun

niels kindly dropped clause 3/4 from the license. tnx!


# 1.10 12-Dec-2003 itojun

previous commit included bad hunk. sorry


# 1.9 12-Dec-2003 itojun

no need to call arc4random() if we don't skip numbers in ip_randomid().
from markus


# 1.8 10-Dec-2003 itojun

correct non-repetitive ID code, based on comments from niels provos.
- 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)


# 1.7 21-Sep-2003 itojun

"exp" is a reserved symbol under gcc3/posix. mcbride ok


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.6 15-Mar-2002 millert

Kill #if __STDC__ used to do K&R vs. ANSI varargs/stdarg; just do things
the ANSI way.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.4 08-Jun-2001 angelos

branches: 1.4.4;
Cut down on include files.


# 1.3 04-Jun-2001 mickey

use faster arc4random() for small amounts fo data, some spaces; niels ok


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE SMP_BASE kame_19991208
# 1.2 26-Aug-1999 provos

branches: 1.2.4;
add an inner xor to make prediction attacks against the ids harder, due
to an attack pointed out by David Wagner.


Revision tags: OPENBSD_2_5_BASE
# 1.1 26-Dec-1998 provos

make ip_id random but ensure that ids dont repeat for some period.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.24 18-Nov-2014 tedu

move arc4random prototype to systm.h. more appropriate for most code
to include that than rdnvar.h. ok deraadt dlg


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.23 31-Mar-2011 jasper

- use nitems(); no binary change

ok claudio@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 09-Jun-2008 djm

rename arc4random_bytes => arc4random_buf to match libc's nicer name;
ok deraadt@


# 1.21 15-Mar-2008 djm

revert - I'm a dumbfuck who doesn't know his own API


# 1.20 15-Mar-2008 djm

off by one at end of array


# 1.19 15-Mar-2008 djm

Because the ip_id code initialisation is a specific case of shuffling
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@


Revision tags: OPENBSD_4_3_BASE
# 1.18 02-Mar-2008 deraadt

because arc4random_uniform is being used, the modulo bias is taken care of


# 1.17 02-Mar-2008 djm

Add a arc4random_uniform() that returns a uniformly distributed number
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@


# 1.16 29-Feb-2008 deraadt

replacement algorithm. initialize a 64K-short buffer using Durstenfeld
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


# 1.15 26-Nov-2007 martynas

typos; ok jmc@
sys/netinet/in_pcb.c and sys/net/bridgestp.c ok henning@
sys/dev/pci/bktr/* ok jakemsr@


Revision tags: OPENBSD_4_2_BASE
# 1.14 27-May-2007 dlg

remove more static to avoid confusing the profiler (and maybe ddb too)

prodded by art@ ja ja claudio@


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.13 21-Jun-2004 tholo

First step towards more sane time handling in the kernel -- this changes
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@


Revision tags: OPENBSD_3_5_BASE SMP_SYNC_A SMP_SYNC_B
# 1.12 22-Mar-2004 deraadt

spelling; jjy2+@pitt.edu


# 1.11 12-Dec-2003 itojun

niels kindly dropped clause 3/4 from the license. tnx!


# 1.10 12-Dec-2003 itojun

previous commit included bad hunk. sorry


# 1.9 12-Dec-2003 itojun

no need to call arc4random() if we don't skip numbers in ip_randomid().
from markus


# 1.8 10-Dec-2003 itojun

correct non-repetitive ID code, based on comments from niels provos.
- 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)


# 1.7 21-Sep-2003 itojun

"exp" is a reserved symbol under gcc3/posix. mcbride ok


Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.6 15-Mar-2002 millert

Kill #if __STDC__ used to do K&R vs. ANSI varargs/stdarg; just do things
the ANSI way.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.4 08-Jun-2001 angelos

branches: 1.4.4;
Cut down on include files.


# 1.3 04-Jun-2001 mickey

use faster arc4random() for small amounts fo data, some spaces; niels ok


Revision tags: OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE SMP_BASE kame_19991208
# 1.2 26-Aug-1999 provos

branches: 1.2.4;
add an inner xor to make prediction attacks against the ids harder, due
to an attack pointed out by David Wagner.


Revision tags: OPENBSD_2_5_BASE
# 1.1 26-Dec-1998 provos

make ip_id random but ensure that ids dont repeat for some period.