diff options
author | Willem de Bruijn <willemb@google.com> | 2019-11-18 10:40:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-29 10:07:37 +0100 |
commit | be2c083142071be095ab1b22326fbb415f0f0e2f (patch) | |
tree | 42da7e8fa81a19b4b6febe3fe0c41cc9ebdedc74 /net/tls | |
parent | 19be80b786bb11321668a22b47d8beffebd20709 (diff) | |
download | linux-stable-be2c083142071be095ab1b22326fbb415f0f0e2f.tar.gz linux-stable-be2c083142071be095ab1b22326fbb415f0f0e2f.tar.bz2 linux-stable-be2c083142071be095ab1b22326fbb415f0f0e2f.zip |
net/tls: enable sk_msg redirect to tls socket egress
[ Upstream commit d4ffb02dee2fcb20e0c8086a8d1305bf885820bb ]
Bring back tls_sw_sendpage_locked. sk_msg redirection into a socket
with TLS_TX takes the following path:
tcp_bpf_sendmsg_redir
tcp_bpf_push_locked
tcp_bpf_push
kernel_sendpage_locked
sock->ops->sendpage_locked
Also update the flags test in tls_sw_sendpage_locked to allow flag
MSG_NO_SHARED_FRAGS. bpf_tcp_sendmsg sets this.
Link: https://lore.kernel.org/netdev/CA+FuTSdaAawmZ2N8nfDDKu3XLpXBbMtcCT0q4FntDD2gn8ASUw@mail.gmail.com/T/#t
Link: https://github.com/wdebruij/kerneltools/commits/icept.2
Fixes: 0608c69c9a80 ("bpf: sk_msg, sock{map|hash} redirect through ULP")
Fixes: f3de19af0f5b ("Revert \"net/tls: remove unused function tls_sw_sendpage_locked\"")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/tls')
-rw-r--r-- | net/tls/tls_main.c | 1 | ||||
-rw-r--r-- | net/tls/tls_sw.c | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 9313dd51023a..ac2dfe36022d 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -852,6 +852,7 @@ static int __init tls_register(void) { tls_sw_proto_ops = inet_stream_ops; tls_sw_proto_ops.splice_read = tls_sw_splice_read; + tls_sw_proto_ops.sendpage_locked = tls_sw_sendpage_locked, #ifdef CONFIG_TLS_DEVICE tls_device_init(); diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 881f06f465f8..41b2bdc05ba3 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -1204,6 +1204,17 @@ sendpage_end: return copied ? copied : ret; } +int tls_sw_sendpage_locked(struct sock *sk, struct page *page, + int offset, size_t size, int flags) +{ + if (flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | + MSG_SENDPAGE_NOTLAST | MSG_SENDPAGE_NOPOLICY | + MSG_NO_SHARED_FRAGS)) + return -ENOTSUPP; + + return tls_sw_do_sendpage(sk, page, offset, size, flags); +} + int tls_sw_sendpage(struct sock *sk, struct page *page, int offset, size_t size, int flags) { |