Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Remove the unused "addin" argument (it was alway...



details:   https://anonhg.NetBSD.org/src/rev/9ba091dcd2ea
branches:  trunk
changeset: 953419:9ba091dcd2ea
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 08 18:17:27 2021 +0000

description:
Remove the unused "addin" argument (it was always 0) and go back using
a random iss by default (instead of rfc1948)

diffstat:

 sys/netinet/tcp_input.c  |   8 +++---
 sys/netinet/tcp_subr.c   |  62 ++++++++++++-----------------------------------
 sys/netinet/tcp_usrreq.c |   6 ++--
 sys/netinet/tcp_var.h    |   7 ++---
 4 files changed, 26 insertions(+), 57 deletions(-)

diffs (210 lines):

diff -r dae8639642d2 -r 9ba091dcd2ea sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Mon Mar 08 18:03:25 2021 +0000
+++ b/sys/netinet/tcp_input.c   Mon Mar 08 18:17:27 2021 +0000
@@ -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 @@
 
                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 @@
 
                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
diff -r dae8639642d2 -r 9ba091dcd2ea sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Mon Mar 08 18:03:25 2021 +0000
+++ b/sys/netinet/tcp_subr.c    Mon Mar 08 18:17:27 2021 +0000
@@ -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_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 @@
  * 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_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 @@
 
                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)
diff -r dae8639642d2 -r 9ba091dcd2ea sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Mon Mar 08 18:03:25 2021 +0000
+++ b/sys/netinet/tcp_usrreq.c  Mon Mar 08 18:17:27 2021 +0000
@@ -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_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);
 
diff -r dae8639642d2 -r 9ba091dcd2ea sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h     Mon Mar 08 18:03:25 2021 +0000
+++ b/sys/netinet/tcp_var.h     Mon Mar 08 18:17:27 2021 +0000
@@ -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 @@
         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);



Home | Main Index | Thread Index | Old Index