Module Name: src
Committed By: christos
Date: Mon Mar 8 18:17:27 UTC 2021
Modified Files:
src/sys/netinet: tcp_input.c tcp_subr.c tcp_usrreq.c tcp_var.h
Log Message:
Remove the unused "addin" argument (it was always 0) and go back using
a random iss by default (instead of rfc1948)
To generate a diff of this commit:
cvs rdiff -u -r1.427 -r1.428 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.286 -r1.287 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.228 -r1.229 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/tcp_var.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.427 src/sys/netinet/tcp_input.c:1.428
--- src/sys/netinet/tcp_input.c:1.427 Fri Feb 19 10:43:56 2021
+++ src/sys/netinet/tcp_input.c Mon Mar 8 13:17:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $ */
+/* $NetBSD: tcp_input.c,v 1.428 2021/03/08 18:17:27 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.428 2021/03/08 18:17:27 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -4258,7 +4258,7 @@ syn_cache_add(struct sockaddr *src, stru
sc->sc_iss = tcp_new_iss1(&dstin->sin_addr,
&srcin->sin_addr, dstin->sin_port,
- srcin->sin_port, sizeof(dstin->sin_addr), 0);
+ srcin->sin_port, sizeof(dstin->sin_addr));
break;
}
#ifdef INET6
@@ -4269,7 +4269,7 @@ syn_cache_add(struct sockaddr *src, stru
sc->sc_iss = tcp_new_iss1(&dstin6->sin6_addr,
&srcin6->sin6_addr, dstin6->sin6_port,
- srcin6->sin6_port, sizeof(dstin6->sin6_addr), 0);
+ srcin6->sin6_port, sizeof(dstin6->sin6_addr));
break;
}
#endif
Index: src/sys/netinet/tcp_subr.c
diff -u src/sys/netinet/tcp_subr.c:1.286 src/sys/netinet/tcp_subr.c:1.287
--- src/sys/netinet/tcp_subr.c:1.286 Mon Mar 8 12:53:20 2021
+++ src/sys/netinet/tcp_subr.c Mon Mar 8 13:17:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $ */
+/* $NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 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.286 2021/03/08 17:53:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -163,7 +163,7 @@ int tcp_mssdflt = TCP_MSS;
int tcp_minmss = TCP_MINMSS;
int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
int tcp_do_rfc1323 = 1; /* window scaling / timestamps (obsolete) */
-int tcp_do_rfc1948 = 1; /* ISS by cryptographic hash */
+int tcp_do_rfc1948 = 0; /* ISS by cryptographic hash */
int tcp_do_sack = 1; /* selective acknowledgement */
int tcp_do_win_scale = 1; /* RFC1323 window scaling */
int tcp_do_timestamps = 1; /* RFC1323 timestamps */
@@ -2136,21 +2136,19 @@ tcp_seq tcp_iss_seq = 0; /* tcp initial
* Get a new sequence value given a tcp control block
*/
tcp_seq
-tcp_new_iss(struct tcpcb *tp, tcp_seq addin)
+tcp_new_iss(struct tcpcb *tp)
{
if (tp->t_inpcb != NULL) {
- return (tcp_new_iss1(&tp->t_inpcb->inp_laddr,
+ return tcp_new_iss1(&tp->t_inpcb->inp_laddr,
&tp->t_inpcb->inp_faddr, tp->t_inpcb->inp_lport,
- tp->t_inpcb->inp_fport, sizeof(tp->t_inpcb->inp_laddr),
- addin));
+ tp->t_inpcb->inp_fport, sizeof(tp->t_inpcb->inp_laddr));
}
#ifdef INET6
if (tp->t_in6pcb != NULL) {
- return (tcp_new_iss1(&tp->t_in6pcb->in6p_laddr,
+ return tcp_new_iss1(&tp->t_in6pcb->in6p_laddr,
&tp->t_in6pcb->in6p_faddr, tp->t_in6pcb->in6p_lport,
- tp->t_in6pcb->in6p_fport, sizeof(tp->t_in6pcb->in6p_laddr),
- addin));
+ tp->t_in6pcb->in6p_fport, sizeof(tp->t_in6pcb->in6p_laddr));
}
#endif
@@ -2176,7 +2174,7 @@ tcp_iss_secret_init(void)
*/
tcp_seq
tcp_new_iss1(void *laddr, void *faddr, u_int16_t lport, u_int16_t fport,
- size_t addrsz, tcp_seq addin)
+ size_t addrsz)
{
tcp_seq tcp_iss;
@@ -2209,55 +2207,27 @@ tcp_new_iss1(void *laddr, void *faddr, u
memcpy(&tcp_iss, hash, sizeof(tcp_iss));
- /*
- * Now increment our "timer", and add it in to
- * the computed value.
- *
- * XXX Use `addin'?
- * XXX TCP_ISSINCR too large to use?
- */
#ifdef TCPISS_DEBUG
printf("ISS hash 0x%08x, ", tcp_iss);
#endif
- tcp_iss += tcp_iss_seq + addin;
+ /*
+ * Add the offset in to the computed value.
+ */
+ tcp_iss += tcp_iss_seq;
#ifdef TCPISS_DEBUG
- printf("new ISS 0x%08x\n", tcp_iss);
+ printf("ISS %08x\n", tcp_iss);
#endif
} else {
/*
* Randomize.
*/
tcp_iss = cprng_fast32();
-
- /*
- * If we were asked to add some amount to a known value,
- * we will take a random value obtained above, mask off
- * the upper bits, and add in the known value. We also
- * add in a constant to ensure that we are at least a
- * certain distance from the original value.
- *
- * This is used when an old connection is in timed wait
- * and we have a new one coming in, for instance.
- */
- if (addin != 0) {
-#ifdef TCPISS_DEBUG
- printf("Random %08x, ", tcp_iss);
-#endif
- tcp_iss &= TCP_ISS_RANDOM_MASK;
- tcp_iss += addin + TCP_ISSINCR;
#ifdef TCPISS_DEBUG
- printf("Old ISS %08x, ISS %08x\n", addin, tcp_iss);
+ printf("ISS random 0x%08x, ", tcp_iss);
#endif
- } else {
- tcp_iss &= TCP_ISS_RANDOM_MASK;
- tcp_iss += tcp_iss_seq;
-#ifdef TCPISS_DEBUG
- printf("ISS %08x\n", tcp_iss);
-#endif
- }
}
- return (tcp_iss);
+ return tcp_iss;
}
#if defined(IPSEC)
Index: src/sys/netinet/tcp_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.228 src/sys/netinet/tcp_usrreq.c:1.229
--- src/sys/netinet/tcp_usrreq.c:1.228 Sun Nov 22 19:52:53 2020
+++ src/sys/netinet/tcp_usrreq.c Mon Mar 8 13:17:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_usrreq.c,v 1.228 2020/11/23 00:52:53 chs Exp $ */
+/* $NetBSD: tcp_usrreq.c,v 1.229 2021/03/08 18:17:27 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.228 2020/11/23 00:52:53 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.229 2021/03/08 18:17:27 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -826,7 +826,7 @@ tcp_connect(struct socket *so, struct so
TCP_STATINC(TCP_STAT_CONNATTEMPT);
tp->t_state = TCPS_SYN_SENT;
TCP_TIMER_ARM(tp, TCPT_KEEP, tp->t_keepinit);
- tp->iss = tcp_new_iss(tp, 0);
+ tp->iss = tcp_new_iss(tp);
tcp_sendseqinit(tp);
error = tcp_output(tp);
Index: src/sys/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.194 src/sys/netinet/tcp_var.h:1.195
--- src/sys/netinet/tcp_var.h:1.194 Wed Feb 3 06:53:43 2021
+++ src/sys/netinet/tcp_var.h Mon Mar 8 13:17:27 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_var.h,v 1.194 2021/02/03 11:53:43 roy Exp $ */
+/* $NetBSD: tcp_var.h,v 1.195 2021/03/08 18:17:27 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -923,9 +923,8 @@ struct tcpcb *
tcp_usrclosed(struct tcpcb *);
void tcp_usrreq_init(void);
void tcp_xmit_timer(struct tcpcb *, uint32_t);
-tcp_seq tcp_new_iss(struct tcpcb *, tcp_seq);
-tcp_seq tcp_new_iss1(void *, void *, u_int16_t, u_int16_t, size_t,
- tcp_seq);
+tcp_seq tcp_new_iss(struct tcpcb *);
+tcp_seq tcp_new_iss1(void *, void *, u_int16_t, u_int16_t, size_t);
void tcp_sack_init(void);
void tcp_new_dsack(struct tcpcb *, tcp_seq, u_int32_t);