• Martin KaFai Lau's avatar
    bpf: tcp: Add bpf_skops_established() · 72be0fe6
    Martin KaFai Lau authored
    In tcp_init_transfer(), it currently calls the bpf prog to give it a
    chance to handle the just "ESTABLISHED" event (e.g. do setsockopt
    on the newly established sk).  Right now, it is done by calling the
    general purpose tcp_call_bpf().
    
    In the later patch, it also needs to pass the just-received skb which
    concludes the 3 way handshake. E.g. the SYNACK received at the active side.
    The bpf prog can then learn some specific header options written by the
    peer's bpf-prog and potentially do setsockopt on the newly established sk.
    Thus, instead of reusing the general purpose tcp_call_bpf(), a new function
    bpf_skops_established() is added to allow passing the "skb" to the bpf
    prog.  The actual skb passing from bpf_skops_established() to the bpf prog
    will happen together in a later patch which has the necessary bpf pieces.
    
    A "skb" arg is also added to tcp_init_transfer() such that
    it can then be passed to bpf_skops_established().
    
    Calling the new bpf_skops_established() instead of tcp_call_bpf()
    should be a noop in this patch.
    Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
    Link: https://lore.kernel.org/bpf/20200820190039.2884750-1-kafai@fb.com
    72be0fe6
tcp_fastopen.c 16.5 KB