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