Skip to content

Commit 3ade126

Browse files
alan-maguireqmonnet
authored andcommitted
bpf/bpf_get,set_sockopt: add option to set TCP-BPF sock ops flags
Currently the only opportunity to set sock ops flags dictating which callbacks fire for a socket is from within a TCP-BPF sockops program. This is problematic if the connection is already set up as there is no further chance to specify callbacks for that socket. Add TCP_BPF_SOCK_OPS_CB_FLAGS to bpf_setsockopt() and bpf_getsockopt() to allow users to specify callbacks later, either via an iterator over sockets or via a socket-specific program triggered by a setsockopt() on the socket. Previous discussion on this here [1]. [1] https://lore.kernel.org/bpf/[email protected]/ Signed-off-by: Alan Maguire <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent b9db291 commit 3ade126

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/uapi/linux/bpf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2851,7 +2851,7 @@ union bpf_attr {
28512851
* **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**,
28522852
* **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**,
28532853
* **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**,
2854-
* **TCP_BPF_RTO_MIN**.
2854+
* **TCP_BPF_RTO_MIN**, **TCP_BPF_SOCK_OPS_CB_FLAGS**.
28552855
* * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
28562856
* * **IPPROTO_IPV6**, which supports the following *optname*\ s:
28572857
* **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**.
@@ -7080,6 +7080,7 @@ enum {
70807080
TCP_BPF_SYN = 1005, /* Copy the TCP header */
70817081
TCP_BPF_SYN_IP = 1006, /* Copy the IP[46] and TCP header */
70827082
TCP_BPF_SYN_MAC = 1007, /* Copy the MAC, IP[46], and TCP header */
7083+
TCP_BPF_SOCK_OPS_CB_FLAGS = 1008, /* Get or Set TCP sock ops flags */
70837084
};
70847085

70857086
enum {

0 commit comments

Comments
 (0)