• John Fastabend's avatar
    bpf: tls_sw, init TLS ULP removes BPF proto hooks · 28cb6f1e
    John Fastabend authored
    The existing code did not expect users would initialize the TLS ULP
    without subsequently calling the TLS TX enabling socket option.
    If the application tries to send data after the TLS ULP enable op
    but before the TLS TX enable op the BPF sk_msg verdict program is
    skipped. This patch resolves this by converting the ipv4 sock ops
    to be calculated at init time the same way ipv6 ops are done. This
    pulls in any changes to the sock ops structure that have been made
    after the socket was created including the changes from adding the
    socket to a sock{map|hash}.
    
    This was discovered by running OpenSSL master branch which calls
    the TLS ULP setsockopt early in TLS handshake but only enables
    the TLS TX path once the handshake has completed. As a result the
    datapath missed the initial handshake messages.
    
    Fixes: 02c558b2 ("bpf: sockmap, support for msg_peek in sk_msg with redirect ingress")
    Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    28cb6f1e
tls_main.c 17.3 KB