Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet make sure that the reset label is defined withou...



details:   https://anonhg.NetBSD.org/src/rev/2d8342fa24ad
branches:  trunk
changeset: 350015:2d8342fa24ad
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 02 02:38:54 2017 +0000

description:
make sure that the reset label is defined without TCP_SIGNATURE.

diffstat:

 sys/netinet/tcp_output.c |  33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diffs (61 lines):

diff -r 5d2d7bdf5bdd -r 2d8342fa24ad sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c  Mon Jan 02 02:08:05 2017 +0000
+++ b/sys/netinet/tcp_output.c  Mon Jan 02 02:38:54 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_output.c,v 1.188 2017/01/02 01:18:42 christos Exp $        */
+/*     $NetBSD: tcp_output.c,v 1.189 2017/01/02 02:38:54 christos Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.188 2017/01/02 01:18:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.189 2017/01/02 02:38:54 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1225,19 +1225,15 @@
                /*
                 * Initialize TCP-MD5 option (RFC2385)
                 */
-               if (OPT_FITS(TCPOLEN_SIGNATURE)) {
-                       *optp++ = TCPOPT_SIGNATURE;
-                       *optp++ = TCPOLEN_SIGNATURE;
-                       sigoff = optlen + 2;
-                       memset(optp, 0, TCP_SIGLEN);
-                       optlen += TCPOLEN_SIGNATURE;
-                       optp += TCP_SIGLEN;
-               } else {
-reset:
-                       TCP_REASS_UNLOCK(tp);
-                       error = ECONNABORTED;
-                       goto out;
-               }
+               if (!OPT_FITS(TCPOLEN_SIGNATURE))
+                       goto reset;
+               
+               *optp++ = TCPOPT_SIGNATURE;
+               *optp++ = TCPOLEN_SIGNATURE;
+               sigoff = optlen + 2;
+               memset(optp, 0, TCP_SIGLEN);
+               optlen += TCPOLEN_SIGNATURE;
+               optp += TCP_SIGLEN;
        }
 #endif /* TCP_SIGNATURE */
 
@@ -1282,8 +1278,11 @@
 
        /* Terminate and pad TCP options to a 4 byte boundary. */
        if (optlen % 4) {
-               if (!OPT_FITS(1))
-                       goto reset;
+               if (!OPT_FITS(1)) {
+reset:                  TCP_REASS_UNLOCK(tp);
+                       error = ECONNABORTED;
+                       goto out;
+               }
                optlen += TCPOLEN_EOL;
                *optp++ = TCPOPT_EOL;
        }



Home | Main Index | Thread Index | Old Index