diff options
author | 2016-11-23 13:05:53 +0000 | |
---|---|---|
committer | 2016-11-23 13:05:53 +0000 | |
commit | 5decb8999422c2aa9e79043cffef00bd1445409e (patch) | |
tree | b46860ab34bc03d867508d82cb6e095134e269d4 /sys/kern/uipc_socket.c | |
parent | Move as much code out of a startup hook as possible (diff) | |
download | wireguard-openbsd-5decb8999422c2aa9e79043cffef00bd1445409e.tar.xz wireguard-openbsd-5decb8999422c2aa9e79043cffef00bd1445409e.zip |
Some socket splicing tests on loopback hang with large mbufs and
reduced buffer size. If the send buffer size is less than the size
of a single mbuf, it will never fit. So if the send buffer is
empty, split the large mbuf and move only a part.
OK claudio@
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 552b555c164..691ae2fb4f0 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.166 2016/11/22 10:29:39 mpi Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.167 2016/11/23 13:05:53 bluhm Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -1367,8 +1367,16 @@ somove(struct socket *so, int wait) "m_type %d", so, so->so_type, *mp, (*mp)->m_type); #endif if ((*mp)->m_len > size) { - if (!maxreached || (*mp = m_copym( - so->so_rcv.sb_mb, 0, size, wait)) == NULL) { + /* + * Move only a partial mbuf at maximum splice length or + * if the drain buffer is too small for this large mbuf. + */ + if (!maxreached && so->so_snd.sb_datacc > 0) { + len -= size; + break; + } + *mp = m_copym(so->so_rcv.sb_mb, 0, size, wait); + if (*mp == NULL) { len -= size; break; } |