summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-03-21 15:52:27 +0000
committerbluhm <bluhm@openbsd.org>2016-03-21 15:52:27 +0000
commit2434a7d20d110cf0b57323c92059df148d7cb1e3 (patch)
tree9a6feffa89549e49cb93c918a152764bbce4bdf2 /sys/netinet/tcp_input.c
parentReduce the FUN() macro madness by no longer applying it to el_[w]getc(3). (diff)
downloadwireguard-openbsd-2434a7d20d110cf0b57323c92059df148d7cb1e3.tar.xz
wireguard-openbsd-2434a7d20d110cf0b57323c92059df148d7cb1e3.zip
Add a tcps_sc_seedrandom counter in TCP SYN cache and netstat -s.
This shows how often the hash function is reseeded and the random bucket distribution changes. OK mpi@ claudio@
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index b367d703ca6..7276b44598b 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.314 2016/03/07 18:44:00 naddy Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.315 2016/03/21 15:52:27 bluhm Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -3371,8 +3371,10 @@ syn_cache_insert(struct syn_cache *sc, struct tcpcb *tp)
* If there are no entries in the hash table, reinitialize
* the hash secrets.
*/
- if (tcp_syn_cache_count == 0)
+ if (tcp_syn_cache_count == 0) {
arc4random_buf(tcp_syn_hash, sizeof(tcp_syn_hash));
+ tcpstat.tcps_sc_seedrandom++;
+ }
SYN_HASHALL(sc->sc_hash, &sc->sc_src.sa, &sc->sc_dst.sa);
sc->sc_bucketidx = sc->sc_hash % tcp_syn_cache_size;