Add some randomness to the iss offset

This commit is contained in:
christos 2021-03-08 17:54:43 +00:00
parent a07b5793ea
commit fa908c0b8c

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $ */
/* $NetBSD: tcp_timer.c,v 1.96 2021/03/08 17:54:43 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.96 2021/03/08 17:54:43 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $");
#include <sys/kernel.h>
#include <sys/callout.h>
#include <sys/workqueue.h>
#include <sys/cprng.h>
#include <net/if.h>
@ -257,7 +258,7 @@ tcp_slowtimo_work(struct work *wk, void *arg)
{
mutex_enter(softnet_lock);
tcp_iss_seq += TCP_ISSINCR; /* increment iss */
tcp_iss_seq += TCP_ISSINCR + (TCP_ISS_RANDOM_MASK & cprng_fast32());
tcp_now++; /* for timestamps */
mutex_exit(softnet_lock);