diff options
author | 2017-06-30 20:02:47 -0700 | |
---|---|---|
committer | 2017-07-01 16:15:14 -0700 | |
commit | 9872a4bde31b0b055448e9ac1f4c9ee62d978766 (patch) | |
tree | d335c073d98d9a96983b1e0b5a341957c8dc982d /net/ipv4/tcp_input.c | |
parent | bpf: Add setsockopt helper function to bpf (diff) | |
download | linux-9872a4bde31b0b055448e9ac1f4c9ee62d978766.tar.gz linux-9872a4bde31b0b055448e9ac1f4c9ee62d978766.tar.bz2 linux-9872a4bde31b0b055448e9ac1f4c9ee62d978766.zip |
bpf: Add TCP connection BPF callbacks
Added callbacks to BPF SOCK_OPS type program before an active
connection is intialized and after a passive or active connection is
established.
The following patch demostrates how they can be used to set send and
receive buffer sizes.
Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index bcc96654cd7e..664210e5e4a7 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5571,7 +5571,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb) icsk->icsk_af_ops->rebuild_header(sk); tcp_init_metrics(sk); - + tcp_call_bpf(sk, BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB); tcp_init_congestion_control(sk); /* Prevent spurious tcp_cwnd_restart() on first data @@ -5977,6 +5977,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) } else { /* Make sure socket is routed, for correct metrics. */ icsk->icsk_af_ops->rebuild_header(sk); + tcp_call_bpf(sk, BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB); tcp_init_congestion_control(sk); tcp_mtup_init(sk); |