DragonFly submit List (threaded) for 2004-04
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: [PATCH] Ephemeral port randomization
On Wed, Apr 28, 2004 at 06:04:37PM -0400, Skip Ford wrote:
> /*
> * counting down
> */
> + if (ipport_randomized)
> + *lastport = first -
> + (arc4random() % (first - last));
> count = first - last;
>
> do {
> @@ -341,6 +349,9 @@
> /*
> * counting up
> */
> + if (ipport_randomized)
> + *lastport = first +
> + (arc4random() % (last - first));
> count = last - first;
I don't purport to know this code at all, but, based on these snippets
from the diff, wouldn't it make sense to compute 'count' before the
'ipport_randomized' test and then use 'count' in the '*lastport'
calculation (instead of repeating the '(last - first)' arithmetic)?
--
Jon Parise (jon@xxxxxxxxxxxxx) :: "Scientia est Potentia"
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]