summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjlemon <jlemon@FreeBSD.org>2001-12-21 04:41:08 +0000
committerjlemon <jlemon@FreeBSD.org>2001-12-21 04:41:08 +0000
commit87be243fa61c8f92dfb48e69ccb8e0ff79ab22cc (patch)
treedcae0b83a338727559fd79c7cbb292628a983d0d /sys
parentd39f9b45170a78e9b6575fa4c1780fa7dfeda9ed (diff)
downloadFreeBSD-src-87be243fa61c8f92dfb48e69ccb8e0ff79ab22cc.zip
FreeBSD-src-87be243fa61c8f92dfb48e69ccb8e0ff79ab22cc.tar.gz
If syncookies are disabled (net.inet.tcp.syncookies) then use the faster
arc4random() routine to generate ISNs instead of creating them with MD5(). Suggested by: silby
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_debug.c1
-rw-r--r--sys/netinet/tcp_syncache.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/sys/netinet/tcp_debug.c b/sys/netinet/tcp_debug.c
index 89e9d7c..531d894 100644
--- a/sys/netinet/tcp_debug.c
+++ b/sys/netinet/tcp_debug.c
@@ -55,6 +55,7 @@
#include <sys/protosw.h>
#include <sys/socket.h>
+#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index d6ce983..bf6432b 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -900,7 +900,10 @@ syncache_add(inc, to, th, sop, m)
sc->sc_route.ro_rt = NULL;
}
sc->sc_irs = th->th_seq;
- sc->sc_iss = syncookie_generate(sc);
+ if (tcp_syncookies)
+ sc->sc_iss = syncookie_generate(sc);
+ else
+ sc->sc_iss = arc4random();
/* Initial receive window: clip sbspace to [0 .. TCP_MAXWIN] */
win = sbspace(&so->so_rcv);
OpenPOWER on IntegriCloud