diff options
author | asomers <asomers@FreeBSD.org> | 2014-03-06 20:24:15 +0000 |
---|---|---|
committer | asomers <asomers@FreeBSD.org> | 2014-03-06 20:24:15 +0000 |
commit | 2a6c6c59a2bd000579e69fe123a3022f07278c34 (patch) | |
tree | 222368e66b92459a7ce463a6953d49270babd8b9 /sys/sys/sockbuf.h | |
parent | 6272e5df18e34fa2ce3f46ccc10735ac4310e4c0 (diff) | |
download | FreeBSD-src-2a6c6c59a2bd000579e69fe123a3022f07278c34.zip FreeBSD-src-2a6c6c59a2bd000579e69fe123a3022f07278c34.tar.gz |
Fix PR kern/185813 "SOCK_SEQPACKET AF_UNIX sockets with asymmetrical
buffers drop packets". It was caused by a check for the space available
in a sockbuf, but it was checking the wrong sockbuf.
sys/sys/sockbuf.h
sys/kern/uipc_sockbuf.c
Add sbappendaddr_nospacecheck_locked(), which is just like
sbappendaddr_locked but doesn't validate the receiving socket's
space. Factor out common code into sbappendaddr_locked_internal().
We shouldn't simply make sbappendaddr_locked check the space and
then call sbappendaddr_nospacecheck_locked, because that would cause
the O(n) function m_length to be called twice.
sys/kern/uipc_usrreq.c
Use sbappendaddr_nospacecheck_locked for SOCK_SEQPACKET sockets,
because the receiving sockbuf's size limit is irrelevant.
tests/sys/kern/unix_seqpacket_test.c
Now that 185813 is fixed, pipe_128k_8k fails intermittently due to
185812. Make it fail every time by adding a usleep after starting
the writer thread and before starting the reader thread in
test_pipe. That gives the writer time to fill up its send buffer.
Also, clear the expected failure message due to 185813. It actually
said "185812", but that was a typo.
PR: kern/185813
Reviewed by: silence from freebsd-net@ and rwatson@
MFC after: 3 weeks
Sponsored by: Spectra Logic Corporation
Diffstat (limited to 'sys/sys/sockbuf.h')
-rw-r--r-- | sys/sys/sockbuf.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index e716241..6994fd3 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -127,6 +127,8 @@ int sbappendaddr(struct sockbuf *sb, const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control); int sbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control); +int sbappendaddr_nospacecheck_locked(struct sockbuf *sb, + const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control); int sbappendcontrol(struct sockbuf *sb, struct mbuf *m0, struct mbuf *control); int sbappendcontrol_locked(struct sockbuf *sb, struct mbuf *m0, |