]> git.baikalelectronics.ru Git - kernel.git/commit
tls: rx: don't store the record type in socket context
authorJakub Kicinski <kuba@kernel.org>
Fri, 8 Apr 2022 03:38:16 +0000 (20:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Apr 2022 10:49:08 +0000 (11:49 +0100)
commit758e91c6855a0613160d8b0fb97f84ce2accb94e
treecdef4b7bf334b0e5c3c99d49a65fcf88682b832f
parent12b2e14a8d438cc4058484a461cc1e722153ca70
tls: rx: don't store the record type in socket context

Original TLS implementation was handling one record at a time.
It stashed the type of the record inside tls context (per socket
structure) for convenience. When async crypto support was added
[1] the author had to use skb->cb to store the type per-message.

The use of skb->cb overlaps with strparser, however, so a hybrid
approach was taken where type is stored in context while parsing
(since we parse a message at a time) but once parsed its copied
to skb->cb.

Recently a workaround for sockmaps [2] exposed the previously
private struct _strp_msg and started a trend of adding user
fields directly in strparser's header. This is cleaner than
storing information about an skb in the context.

This change is not strictly necessary, but IMHO the ownership
of the context field is confusing. Information naturally
belongs to the skb.

[1] commit 236f08bdb433 ("net/tls: Add support for async decryption of tls records")
[2] commit c305047f725d ("bpf, sockmap: sk_skb data_end access incorrect when src_reg = dst_reg")

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/strparser.h
include/net/tls.h
net/tls/tls_sw.c