net/tls: Implement getsockopt SOL_TLS TLS_RX
authorYutaro Hayakawa <yhayakawa3720@gmail.com>
Tue, 1 Sep 2020 13:59:45 +0000 (22:59 +0900)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Sep 2020 18:47:12 +0000 (11:47 -0700)
commitffa81fa46e2de4563350c89fae0c879ed77330d6
treeb67a48fd6ccbaf0e35f1066450070eaa11656a95
parentc70ed3f77ca646c6e57bee54d570d9dab1246589
net/tls: Implement getsockopt SOL_TLS TLS_RX

Implement the getsockopt SOL_TLS TLS_RX which is currently missing. The
primary usecase is to use it in conjunction with TCP_REPAIR to
checkpoint/restore the TLS record layer state.

TLS connection state usually exists on the user space library. So
basically we can easily extract it from there, but when the TLS
connections are delegated to the kTLS, it is not the case. We need to
have a way to extract the TLS state from the kernel for both of TX and
RX side.

The new TLS_RX getsockopt copies the crypto_info to user in the same
way as TLS_TX does.

We have described use cases in our research work in Netdev 0x14
Transport Workshop [1].

Also, there is an TLS implementation called tlse [2] which supports
TLS connection migration. They have support of kTLS and their code
shows that they are expecting the future support of this option.

[1] https://speakerdeck.com/yutarohayakawa/prism-proxies-without-the-pain
[2] https://github.com/eduardsui/tlse

Signed-off-by: Yutaro Hayakawa <yhayakawa3720@gmail.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_main.c