Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet tcp_accept: simplify a little.



details:   https://anonhg.NetBSD.org/src/rev/aa7b36b40c72
branches:  trunk
changeset: 330468:aa7b36b40c72
user:      rmind <rmind%NetBSD.org@localhost>
date:      Thu Jul 10 14:05:19 2014 +0000

description:
tcp_accept: simplify a little.

diffstat:

 sys/netinet/tcp_usrreq.c |  32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)

diffs (66 lines):

diff -r d23707e10bb6 -r aa7b36b40c72 sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Thu Jul 10 08:17:43 2014 +0000
+++ b/sys/netinet/tcp_usrreq.c  Thu Jul 10 14:05:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.186 2014/07/09 14:41:42 rtr Exp $     */
+/*     $NetBSD: tcp_usrreq.c,v 1.187 2014/07/10 14:05:19 rmind 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.186 2014/07/09 14:41:42 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.187 2014/07/10 14:05:19 rmind Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -948,20 +948,6 @@
        {
                return EINVAL;
        }
-#ifdef INET
-       if (inp) {
-               tp = intotcpcb(inp);
-               /* WHAT IF TP IS 0? */
-               ostate = tcp_debug_capture(tp, PRU_ACCEPT);
-       }
-#endif
-#ifdef INET6
-       if (in6p) {
-               tp = in6totcpcb(in6p);
-               /* WHAT IF TP IS 0? */
-               ostate = tcp_debug_capture(tp, PRU_ACCEPT);
-       }
-#endif
 
        /*
         * Accept a connection.  Essentially all the work is
@@ -969,16 +955,22 @@
         * of the peer, storing through addr.
         */
 #ifdef INET
-       if (inp)
+       if (inp) {
+               tp = intotcpcb(inp);
+               KASSERT(tp != NULL);
+               ostate = tcp_debug_capture(tp, PRU_ACCEPT);
                in_setpeeraddr(inp, nam);
+       }
 #endif
 #ifdef INET6
-       if (in6p)
+       if (in6p) {
+               tp = in6totcpcb(in6p);
+               KASSERT(tp != NULL);
+               ostate = tcp_debug_capture(tp, PRU_ACCEPT);
                in6_setpeeraddr(in6p, nam);
+       }
 #endif
-
        tcp_debug_trace(so, tp, ostate, PRU_ACCEPT);
-
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index