Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet restore splsoftnet() in various usrreqs that wer...



details:   https://anonhg.NetBSD.org/src/rev/6729519a645e
branches:  trunk
changeset: 331122:6729519a645e
user:      rtr <rtr%NetBSD.org@localhost>
date:      Sat Aug 02 03:55:26 2014 +0000

description:
restore splsoftnet() in various usrreqs that were removed during the PRU
splits.  we will properly review removal after the PRU split work is
complete.

diffstat:

 sys/netinet/raw_ip.c     |  25 ++++++++++++++++++++++---
 sys/netinet/tcp_usrreq.c |  43 +++++++++++++++++++++++++++++--------------
 sys/netinet/udp_usrreq.c |  14 ++++++++++++--
 3 files changed, 63 insertions(+), 19 deletions(-)

diffs (truncated from 372 to 300 lines):

diff -r ec50815f7080 -r 6729519a645e sys/netinet/raw_ip.c
--- a/sys/netinet/raw_ip.c      Fri Aug 01 21:57:22 2014 +0000
+++ b/sys/netinet/raw_ip.c      Sat Aug 02 03:55:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raw_ip.c,v 1.139 2014/07/31 03:39:35 rtr Exp $ */
+/*     $NetBSD: raw_ip.c,v 1.140 2014/08/02 03:55:26 rtr Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.139 2014/07/31 03:39:35 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.140 2014/08/02 03:55:26 rtr Exp $");
 
 #include "opt_inet.h"
 #include "opt_compat_netbsd.h"
@@ -618,8 +618,8 @@
        error = rip_connect_pcb(inp, nam);
        if (! error)
                soisconnected(so);
+       splx(s);
 
-       splx(s);
        return error;
 }
 
@@ -627,24 +627,33 @@
 rip_disconnect(struct socket *so)
 {
        struct inpcb *inp = sotoinpcb(so);
+       int s;
 
        KASSERT(solocked(so));
        KASSERT(inp != NULL);
 
+       s = splsoftnet();
        soisdisconnected(so);
        rip_disconnect1(inp);
+       splx(s);
+
        return 0;
 }
 
 static int
 rip_shutdown(struct socket *so)
 {
+       int s;
+
        KASSERT(solocked(so));
 
        /*
         * Mark the connection as being incapable of further input.
         */
+       s = splsoftnet();
        socantsendmore(so);
+       splx(s);
+
        return 0;
 }
 
@@ -676,22 +685,32 @@
 static int
 rip_peeraddr(struct socket *so, struct mbuf *nam)
 {
+       int s;
+
        KASSERT(solocked(so));
        KASSERT(sotoinpcb(so) != NULL);
        KASSERT(nam != NULL);
 
+       s = splsoftnet();
        in_setpeeraddr(sotoinpcb(so), nam);
+       splx(s);
+
        return 0;
 }
 
 static int
 rip_sockaddr(struct socket *so, struct mbuf *nam)
 {
+       int s;
+
        KASSERT(solocked(so));
        KASSERT(sotoinpcb(so) != NULL);
        KASSERT(nam != NULL);
 
+       s = splsoftnet();
        in_setsockaddr(sotoinpcb(so), nam);
+       splx(s);
+
        return 0;
 }
 
diff -r ec50815f7080 -r 6729519a645e sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Fri Aug 01 21:57:22 2014 +0000
+++ b/sys/netinet/tcp_usrreq.c  Sat Aug 02 03:55:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.194 2014/07/31 03:39:35 rtr Exp $     */
+/*     $NetBSD: tcp_usrreq.c,v 1.195 2014/08/02 03:55:26 rtr 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.194 2014/07/31 03:39:35 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.195 2014/08/02 03:55:26 rtr Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -705,6 +705,7 @@
        struct tcpcb *tp = NULL;
        int ostate = 0;
        int error = 0;
+       int s;
 
        KASSERT(solocked(so));
 
@@ -718,6 +719,7 @@
         * done at higher levels; just return the address
         * of the peer, storing through addr.
         */
+       s = splsoftnet();
 #ifdef INET
        if (inp) {
                in_setpeeraddr(inp, nam);
@@ -729,6 +731,7 @@
        }
 #endif
        tcp_debug_trace(so, tp, ostate, PRU_ACCEPT);
+       splx(s);
 
        return 0;
 }
@@ -773,7 +776,6 @@
                break;
 #endif
        }
-
        tcp_debug_trace(so, tp, ostate, PRU_BIND);
        splx(s);
 
@@ -786,9 +788,9 @@
        struct inpcb *inp = NULL;
        struct in6pcb *in6p = NULL;
        struct tcpcb *tp = NULL;
-       int s;
        int error = 0;
        int ostate = 0;
+       int s;
 
        KASSERT(solocked(so));
 
@@ -841,8 +843,6 @@
 
        ostate = tcp_debug_capture(tp, PRU_CONNECT);
 
-       s = splsoftnet();
-
        /*
         * Initiate connection to peer.
         * Create a template for use in transmissions on this connection.
@@ -850,6 +850,7 @@
         * Start keep-alive timer, and seed output sequence space.
         * Send initial segment on connection.
         */
+       s = splsoftnet();
 #ifdef INET
        if (inp) {
                if (inp->inp_lport == 0) {
@@ -920,9 +921,9 @@
        struct inpcb *inp = NULL;
        struct in6pcb *in6p = NULL;
        struct tcpcb *tp = NULL;
-       int s;
        int error = 0;
        int ostate = 0;
+       int s;
 
        KASSERT(solocked(so));
 
@@ -956,9 +957,9 @@
        struct inpcb *inp = NULL;
        struct in6pcb *in6p = NULL;
        struct tcpcb *tp = NULL;
-       int s;
        int error = 0;
        int ostate = 0;
+       int s;
 
        KASSERT(solocked(so));
 
@@ -986,9 +987,9 @@
        struct inpcb *inp = NULL;
        struct in6pcb *in6p = NULL;
        struct tcpcb *tp = NULL;
-       int s;
        int error = 0;
        int ostate = 0;
+       int s;
 
        KASSERT(solocked(so));
 
@@ -1042,12 +1043,14 @@
        struct tcpcb *tp = NULL;
        int ostate = 0;
        int error = 0;
+       int s;
 
        if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0)
                return error;
 
        ostate = tcp_debug_capture(tp, PRU_PEERADDR);
 
+       s = splsoftnet();
 #ifdef INET
        if (inp)
                in_setpeeraddr(inp, nam);
@@ -1056,8 +1059,8 @@
        if (in6p)
                in6_setpeeraddr(in6p, nam);
 #endif
-
        tcp_debug_trace(so, tp, ostate, PRU_PEERADDR);
+       splx(s);
 
        return 0;
 }
@@ -1070,12 +1073,14 @@
        struct tcpcb *tp = NULL;
        int ostate = 0;
        int error = 0;
+       int s;
 
        if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0)
                return error;
 
        ostate = tcp_debug_capture(tp, PRU_SOCKADDR);
 
+       s = splsoftnet();
 #ifdef INET
        if (inp)
                in_setsockaddr(inp, nam);
@@ -1084,8 +1089,8 @@
        if (in6p)
                in6_setsockaddr(in6p, nam);
 #endif
-
        tcp_debug_trace(so, tp, ostate, PRU_SOCKADDR);
+       splx(s);
 
        return 0;
 }
@@ -1098,20 +1103,26 @@
        struct tcpcb *tp = NULL;
        int ostate = 0;
        int error = 0;
+       int s;
 
        if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0)
                return error;
 
        ostate = tcp_debug_capture(tp, PRU_RCVOOB);
 
+       s = splsoftnet();
        if ((so->so_oobmark == 0 &&
            (so->so_state & SS_RCVATMARK) == 0) ||
            so->so_options & SO_OOBINLINE ||
-           tp->t_oobflags & TCPOOB_HADDATA)
+           tp->t_oobflags & TCPOOB_HADDATA) {
+               splx(s);
                return EINVAL;
+       }
 
-       if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0)
+       if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) {
+               splx(s);
                return EWOULDBLOCK;
+       }
 
        m->m_len = 1;
        *mtod(m, char *) = tp->t_iobc;
@@ -1119,6 +1130,7 @@
                tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
 
        tcp_debug_trace(so, tp, ostate, PRU_RCVOOB);
+       splx(s);
 
        return 0;
 }
@@ -1131,14 +1143,17 @@
        struct tcpcb *tp = NULL;
        int ostate = 0;
        int error = 0;
+       int s;
 
        if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0)



Home | Main Index | Thread Index | Old Index