tcp: add support of half closed tcp sockets

Submitted by Andrei Vagin on Nov. 11, 2016, 7:10 a.m.


Reviewer None
Submitted Nov. 11, 2016, 7:10 a.m.
Last Updated Nov. 11, 2016, 6:57 p.m.
Revision 1

Cover Letter

From: Andrei Vagin <>

A socket is in one of half-closed states, if it sent a fin packet
or it received a fin packet.

CRIU plays with fin packets to restore half-closed states too.

When we need to sent a fin packet from a socket, we can call
shutdown(SHUT_WR). When a fin packet has to be restore in
a received queue, criu generate a fin packet and send it via
a raw ip socket.

A raw packet is sent with the SOCCR_MARK mark to be able
to not block it.