tcp_bpf.c (7b50ecfcc6cdfe87488576bc3ed443dc8d083b90) | tcp_bpf.c (fb4e0a5e73d4bb5ab69b7905abd2ec3b580e9b59) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2017 - 2018 Covalent IO, Inc. http://covalent.io */ 3 4#include <linux/skmsg.h> 5#include <linux/filter.h> 6#include <linux/bpf.h> 7#include <linux/init.h> 8#include <linux/wait.h> --- 136 unchanged lines hidden (view full) --- 145 ret = ingress ? bpf_tcp_ingress(sk, psock, msg, bytes, flags) : 146 tcp_bpf_push_locked(sk, msg, bytes, flags, false); 147 sk_psock_put(sk, psock); 148 return ret; 149} 150EXPORT_SYMBOL_GPL(tcp_bpf_sendmsg_redir); 151 152#ifdef CONFIG_BPF_SYSCALL | 1// SPDX-License-Identifier: GPL-2.0 2/* Copyright (c) 2017 - 2018 Covalent IO, Inc. http://covalent.io */ 3 4#include <linux/skmsg.h> 5#include <linux/filter.h> 6#include <linux/bpf.h> 7#include <linux/init.h> 8#include <linux/wait.h> --- 136 unchanged lines hidden (view full) --- 145 ret = ingress ? bpf_tcp_ingress(sk, psock, msg, bytes, flags) : 146 tcp_bpf_push_locked(sk, msg, bytes, flags, false); 147 sk_psock_put(sk, psock); 148 return ret; 149} 150EXPORT_SYMBOL_GPL(tcp_bpf_sendmsg_redir); 151 152#ifdef CONFIG_BPF_SYSCALL |
153static bool tcp_bpf_sock_is_readable(struct sock *sk) 154{ 155 struct sk_psock *psock; 156 bool empty = true; 157 158 rcu_read_lock(); 159 psock = sk_psock(sk); 160 if (likely(psock)) 161 empty = list_empty(&psock->ingress_msg); 162 rcu_read_unlock(); 163 return !empty; 164} 165 | |
166static int tcp_msg_wait_data(struct sock *sk, struct sk_psock *psock, 167 long timeo) 168{ 169 DEFINE_WAIT_FUNC(wait, woken_wake_function); 170 int ret = 0; 171 172 if (sk->sk_shutdown & RCV_SHUTDOWN) 173 return 1; --- 312 unchanged lines hidden (view full) --- 486 487static void tcp_bpf_rebuild_protos(struct proto prot[TCP_BPF_NUM_CFGS], 488 struct proto *base) 489{ 490 prot[TCP_BPF_BASE] = *base; 491 prot[TCP_BPF_BASE].unhash = sock_map_unhash; 492 prot[TCP_BPF_BASE].close = sock_map_close; 493 prot[TCP_BPF_BASE].recvmsg = tcp_bpf_recvmsg; | 153static int tcp_msg_wait_data(struct sock *sk, struct sk_psock *psock, 154 long timeo) 155{ 156 DEFINE_WAIT_FUNC(wait, woken_wake_function); 157 int ret = 0; 158 159 if (sk->sk_shutdown & RCV_SHUTDOWN) 160 return 1; --- 312 unchanged lines hidden (view full) --- 473 474static void tcp_bpf_rebuild_protos(struct proto prot[TCP_BPF_NUM_CFGS], 475 struct proto *base) 476{ 477 prot[TCP_BPF_BASE] = *base; 478 prot[TCP_BPF_BASE].unhash = sock_map_unhash; 479 prot[TCP_BPF_BASE].close = sock_map_close; 480 prot[TCP_BPF_BASE].recvmsg = tcp_bpf_recvmsg; |
494 prot[TCP_BPF_BASE].sock_is_readable = tcp_bpf_sock_is_readable; | 481 prot[TCP_BPF_BASE].sock_is_readable = sk_msg_is_readable; |
495 496 prot[TCP_BPF_TX] = prot[TCP_BPF_BASE]; 497 prot[TCP_BPF_TX].sendmsg = tcp_bpf_sendmsg; 498 prot[TCP_BPF_TX].sendpage = tcp_bpf_sendpage; 499} 500 501static void tcp_bpf_check_v6_needs_rebuild(struct proto *ops) 502{ --- 80 unchanged lines hidden --- | 482 483 prot[TCP_BPF_TX] = prot[TCP_BPF_BASE]; 484 prot[TCP_BPF_TX].sendmsg = tcp_bpf_sendmsg; 485 prot[TCP_BPF_TX].sendpage = tcp_bpf_sendpage; 486} 487 488static void tcp_bpf_check_v6_needs_rebuild(struct proto *ops) 489{ --- 80 unchanged lines hidden --- |