netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* MSG_ZEROCOPY doesn't work on half-open TCP sockets
@ 2019-01-09 12:01 Marek Majkowski
  2019-01-09 12:48 ` Marek Majkowski
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Majkowski @ 2019-01-09 12:01 UTC (permalink / raw)
  To: Willem de Bruijn, netdev

Hi,

Current implementation of MSG_ZEROCOPY for TCP requires the socket to
be ESTABLISHED:
https://elixir.bootlin.com/linux/v5.0-rc1/source/net/ipv4/tcp.c#L1188

if (sk->sk_state != TCP_ESTABLISHED) {
    err = -EINVAL;
    goto out_err;
}

In TCP it's totally fine to have half-open sockets, for example:

shutdown(5, SHUT_RD)

Moves the socket from ESTABLISHED to CLOSE_WAIT. In such TCP state
it's possible to continue sending data. This is not supported by
MSG_ZEROCOPY, which will fail with EINVAL in such case. I think it's a
bug.

Marek

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-09 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-09 12:01 MSG_ZEROCOPY doesn't work on half-open TCP sockets Marek Majkowski
2019-01-09 12:48 ` Marek Majkowski
2019-01-09 13:55   ` Willem de Bruijn
2019-01-09 14:29     ` Willy Tarreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).