Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Move the offset addition in one place and mask t...
details: https://anonhg.NetBSD.org/src/rev/e3ed36aede5d
branches: trunk
changeset: 953447:e3ed36aede5d
user: christos <christos%NetBSD.org@localhost>
date: Tue Mar 09 13:48:16 2021 +0000
description:
Move the offset addition in one place and mask the random generated value
to make sure that the isn is monotonic.
diffstat:
sys/netinet/tcp_subr.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diffs (50 lines):
diff -r 2662bbb8667a -r e3ed36aede5d sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c Tue Mar 09 12:42:46 2021 +0000
+++ b/sys/netinet/tcp_subr.c Tue Mar 09 13:48:16 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $ */
+/* $NetBSD: tcp_subr.c,v 1.288 2021/03/09 13:48:16 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.288 2021/03/09 13:48:16 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -2210,23 +2210,23 @@
#ifdef TCPISS_DEBUG
printf("ISS hash 0x%08x, ", tcp_iss);
#endif
- /*
- * Add the offset in to the computed value.
- */
- tcp_iss += tcp_iss_seq;
-#ifdef TCPISS_DEBUG
- printf("ISS %08x\n", tcp_iss);
-#endif
} else {
/*
* Randomize.
*/
- tcp_iss = cprng_fast32();
+ tcp_iss = cprng_fast32() & TCP_ISS_RANDOM_MASK;
#ifdef TCPISS_DEBUG
printf("ISS random 0x%08x, ", tcp_iss);
#endif
}
+ /*
+ * Add the offset in to the computed value.
+ */
+ tcp_iss += tcp_iss_seq;
+#ifdef TCPISS_DEBUG
+ printf("ISS %08x\n", tcp_iss);
+#endif
return tcp_iss;
}
Home |
Main Index |
Thread Index |
Old Index