inet: Local group index is not assigned in jail.
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 10 May 2017 10:47:25 +0000 (18:47 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 10 May 2017 10:47:25 +0000 (18:47 +0800)
Dragonfly-bug: https://bugs.dragonflybsd.org/issues/3035

sys/netinet/tcp_usrreq.c
sys/netinet/udp_usrreq.c

index 3b832b3..de9de07 100644 (file)
@@ -1495,8 +1495,11 @@ tcp_ctloutput(netmsg_t msg)
                         * Listen sockets owner cpuid is always 0,
                         * which does not make sense if SO_REUSEPORT
                         * is not set.
+                        *
+                        * NOTE: inp_lgrpindex is _not_ assigned in jail.
                         */
-                       if (so->so_options & SO_REUSEPORT)
+                       if ((so->so_options & SO_REUSEPORT) &&
+                           inp->inp_lgrpindex >= 0)
                                optval = inp->inp_lgrpindex % netisr_ncpus;
                        else
                                optval = -1; /* no hint */
index 9d61b53..48f6e05 100644 (file)
@@ -1292,7 +1292,9 @@ udp_inswildcardhash_oncpu(struct inpcb *inp, struct netmsg_base *msg)
                in_pcbinswildcardhash_oncpu(inp, &udbinfo[cpu]);
        }
 
-       if (inp->inp_socket->so_options & SO_REUSEPORT) {
+       /* NOTE: inp_lgrpindex is _not_ assigned in jail. */
+       if ((inp->inp_socket->so_options & SO_REUSEPORT) &&
+           inp->inp_lgrpindex >= 0) {
                /*
                 * For SO_REUSEPORT socket, redistribute it based on its
                 * local group index.