Remove unnecessary splsoftnet()/splx() dances.  Routing sockets do not
need the NET_LOCK() and in the code below the SPL has been raised to
shut up an assert, so they are no longer needed.

ok?

Index: net/rtsock.c
===================================================================
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.232
diff -u -p -r1.232 rtsock.c
--- net/rtsock.c        7 Mar 2017 09:23:27 -0000       1.232
+++ net/rtsock.c        7 Mar 2017 09:43:05 -0000
@@ -306,7 +306,6 @@ route_senddesync(void *data)
        struct rawcb    *rp;
        struct routecb  *rop;
        struct mbuf     *desync_mbuf;
-       int              s;
 
        rp = (struct rawcb *)data;
        rop = (struct routecb *)rp;
@@ -321,15 +320,12 @@ route_senddesync(void *data)
         */
        desync_mbuf = rtm_msg1(RTM_DESYNC, NULL);
        if (desync_mbuf != NULL) {
-               s = splsoftnet();
                if (sbappendaddr(&rp->rcb_socket->so_rcv, &route_src,
                    desync_mbuf, NULL) != 0) {
                        rop->flags &= ~ROUTECB_FLAG_DESYNC;
                        sorwakeup(rp->rcb_socket);
-                       splx(s);
                        return;
                }
-               splx(s);
                m_freem(desync_mbuf);
        }
        /* Re-add timeout to try sending msg again */
@@ -343,7 +339,7 @@ route_input(struct mbuf *m0, struct sock
        struct routecb *rop;
        struct rt_msghdr *rtm;
        struct mbuf *m = m0;
-       int s, sockets = 0;
+       int sockets = 0;
        struct socket *last = NULL;
        struct sockaddr *sosrc, *sodst;
 
@@ -430,7 +426,6 @@ route_input(struct mbuf *m0, struct sock
                if (last) {
                        struct mbuf *n;
                        if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) != NULL) {
-                               s = splsoftnet();
                                if (sbspace(&last->so_rcv) < (2 * MSIZE) ||
                                    sbappendaddr(&last->so_rcv, sosrc,
                                    n, (struct mbuf *)NULL) == 0) {
@@ -447,13 +442,11 @@ route_input(struct mbuf *m0, struct sock
                                        sorwakeup(last);
                                        sockets++;
                                }
-                               splx(s);
                        }
                }
                last = rp->rcb_socket;
        }
        if (last) {
-               s = splsoftnet();
                if (sbspace(&last->so_rcv) < (2 * MSIZE) ||
                    sbappendaddr(&last->so_rcv, sosrc,
                    m, (struct mbuf *)NULL) == 0) {
@@ -466,7 +459,6 @@ route_input(struct mbuf *m0, struct sock
                        sorwakeup(last);
                        sockets++;
                }
-               splx(s);
        } else
                m_freem(m);
 }

Reply via email to