]> git.baikalelectronics.ru Git - kernel.git/commit
espintcp: recv() should return 0 when the peer socket is closed
authorSabrina Dubroca <sd@queasysnail.net>
Thu, 16 Jul 2020 08:09:02 +0000 (10:09 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 17 Jul 2020 08:21:54 +0000 (10:21 +0200)
commit0ea218528f0fcd30a41754ee2faabc140272786e
treec466baa45f43aa5b1497257a8d8617f3368dedab
parent683d4d7163396efb104c4a24240dcf275d4ce0ef
espintcp: recv() should return 0 when the peer socket is closed

man 2 recv says:

    RETURN VALUE

    When a stream socket peer has performed an orderly shutdown, the
    return value will be 0 (the traditional "end-of-file" return).

Currently, this works for blocking reads, but non-blocking reads will
return -EAGAIN. This patch overwrites that return value when the peer
won't send us any more data.

Fixes: a601325e92f9 ("xfrm: add espintcp (RFC 8229)")
Reported-by: Andrew Cagney <cagney@libreswan.org>
Tested-by: Andrew Cagney <cagney@libreswan.org>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/espintcp.c