[Bug 260116] [sctp] POLLOUT/EVFILT_WRITE is always true for poll/kqueue

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 29 Nov 2021 13:35:11 UTC

            Bug ID: 260116
           Summary: [sctp] POLLOUT/EVFILT_WRITE is always true for
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: albin.hellqvist@gmail.com

It seems like POLLOUT/EVFILT_WRITE always is true for SCTP sockets even if the
socket send buffer is full.

Besides this, it should also account for SO_SNDLOWAT but it is possible that we
will get this for "free" since it looks like the functionality already is

Based on some experiments (which might be faulty), SCTP sockets doesn't use
struct sockbuf in the same way as TCP uses it. A lot of the fields in that
struct are 0 for SCTP sockets since it also has its own structs.

This seems to affect filt_sowrite() in
(https://github.com/freebsd/freebsd-src/blob/main/sys/kern/uipc_socket.c). More
specifically, this line:
kn->kn_data = sbspace(&so->so_snd);

I have tested to replace that line with:
kn->kn_data = (so->so_snd.sb_hiwat - so->so_snd.sb_acc);

Which seems to do the trick, but I expect this to have side effects.

You are receiving this mail because:
You are the assignee for the bug.