Source-Changes-HG archive

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

[src/trunk]: src/sys Restore correct functioning of SIOCATMARK by removing th...



details:   https://anonhg.NetBSD.org/src/rev/aaed0d84547c
branches:  trunk
changeset: 957276:aaed0d84547c
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Nov 23 00:52:53 2020 +0000

description:
Restore correct functioning of SIOCATMARK by removing the previous
change that was done to fix poll(POLLPRI | POLLRDBAND) and instead
add a separate flag to track when poll() should indicate that a
MSG_OOB byte is available.  Re-fixes PR 54435 properly.

diffstat:

 sys/kern/uipc_socket.c   |  12 ++++++------
 sys/netinet/tcp_usrreq.c |   8 +++++---
 sys/sys/socketvar.h      |   6 +++---
 3 files changed, 14 insertions(+), 12 deletions(-)

diffs (108 lines):

diff -r e2da49c9c186 -r aaed0d84547c sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Sun Nov 22 23:45:20 2020 +0000
+++ b/sys/kern/uipc_socket.c    Mon Nov 23 00:52:53 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.292 2020/10/17 09:06:15 mlelstv Exp $        */
+/*     $NetBSD: uipc_socket.c,v 1.293 2020/11/23 00:52:53 chs Exp $    */
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.292 2020/10/17 09:06:15 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.293 2020/11/23 00:52:53 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1186,9 +1186,6 @@
                            MIN(uio->uio_resid, m->m_len), uio);
                        m = m_free(m);
                } while (uio->uio_resid > 0 && error == 0 && m);
-               /* We consumed the oob data, no more oobmark.  */
-               so->so_oobmark = 0;
-               so->so_state &= ~SS_RCVATMARK;
 bad:
                if (m != NULL)
                        m_freem(m);
@@ -1565,6 +1562,8 @@
                                if (offset == so->so_oobmark)
                                        break;
                        }
+               } else {
+                       so->so_state &= ~SS_POLLRDBAND;
                }
                if (flags & MSG_EOR)
                        break;
@@ -2214,6 +2213,7 @@
 sohasoutofband(struct socket *so)
 {
 
+       so->so_state |= SS_POLLRDBAND;
        fownsignal(so->so_pgid, SIGURG, POLL_PRI, POLLPRI|POLLRDBAND, so);
        selnotify(&so->so_rcv.sb_sel, POLLPRI | POLLRDBAND, NOTE_SUBMIT);
 }
@@ -2388,7 +2388,7 @@
                        revents |= events & (POLLOUT | POLLWRNORM);
 
        if (events & (POLLPRI | POLLRDBAND))
-               if (so->so_oobmark || (so->so_state & SS_RCVATMARK))
+               if (so->so_state & SS_POLLRDBAND)
                        revents |= events & (POLLPRI | POLLRDBAND);
 
        return revents;
diff -r e2da49c9c186 -r aaed0d84547c sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Sun Nov 22 23:45:20 2020 +0000
+++ b/sys/netinet/tcp_usrreq.c  Mon Nov 23 00:52:53 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.227 2020/10/17 08:50:38 mlelstv Exp $ */
+/*     $NetBSD: tcp_usrreq.c,v 1.228 2020/11/23 00:52:53 chs 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.227 2020/10/17 08:50:38 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.228 2020/11/23 00:52:53 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1095,8 +1095,10 @@
 
        m->m_len = 1;
        *mtod(m, char *) = tp->t_iobc;
-       if ((flags & MSG_PEEK) == 0)
+       if ((flags & MSG_PEEK) == 0) {
                tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
+               so->so_state &= ~SS_POLLRDBAND;
+       }
 
        tcp_debug_trace(so, tp, ostate, PRU_RCVOOB);
        splx(s);
diff -r e2da49c9c186 -r aaed0d84547c sys/sys/socketvar.h
--- a/sys/sys/socketvar.h       Sun Nov 22 23:45:20 2020 +0000
+++ b/sys/sys/socketvar.h       Mon Nov 23 00:52:53 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: socketvar.h,v 1.162 2020/11/17 03:22:33 chs Exp $      */
+/*     $NetBSD: socketvar.h,v 1.163 2020/11/23 00:52:53 chs Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -197,12 +197,12 @@
 #define        SS_RCVATMARK            0x040   /* at mark on input */
 #define        SS_ISABORTING           0x080   /* aborting fd references - close() */
 #define        SS_RESTARTSYS           0x100   /* restart blocked system calls */
-#define        SS_ISDISCONNECTED       0x800   /* socket disconnected from peer */
-
+#define        SS_POLLRDBAND           0x200   /* poll should return POLLRDBAND */
 #define        SS_MORETOCOME           0x400   /*
                                         * hint from sosend to lower layer;
                                         * more data coming
                                         */
+#define        SS_ISDISCONNECTED       0x800   /* socket disconnected from peer */
 #define        SS_ISAPIPE              0x1000  /* socket is implementing a pipe */
 #define        SS_NBIO                 0x2000  /* socket is in non blocking I/O */
 



Home | Main Index | Thread Index | Old Index