bpf_sock
struct bpf_sock, struct sock)
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk); /* current socket */
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, migrating_sk);
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */
case offsetof(struct bpf_sock, bound_dev_if):
case offsetof(struct bpf_sock, mark):
case offsetof(struct bpf_sock, priority):
case offsetof(struct bpf_sock, family):
case offsetof(struct bpf_sock, type):
case offsetof(struct bpf_sock, protocol):
case offsetof(struct bpf_sock, src_ip4):
case offsetof(struct bpf_sock, dst_ip4):
case bpf_ctx_range_till(struct bpf_sock, src_ip6[0], src_ip6[3]):
off -= offsetof(struct bpf_sock, src_ip6[0]);
case bpf_ctx_range_till(struct bpf_sock, dst_ip6[0], dst_ip6[3]):
off -= offsetof(struct bpf_sock, dst_ip6[0]);
case offsetof(struct bpf_sock, src_port):
case offsetof(struct bpf_sock, dst_port):
case offsetof(struct bpf_sock, state):
case offsetof(struct bpf_sock, rx_queue_mapping):
static bool is_locked_tcp_sock_ops(struct bpf_sock_ops_kern *bpf_sock)
return bpf_sock->op <= BPF_SOCK_OPS_WRITE_HDR_OPT_CB;
BPF_CALL_5(bpf_sock_ops_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
if (!is_locked_tcp_sock_ops(bpf_sock))
if ((bpf_sock->op == BPF_SOCK_OPS_HDR_OPT_LEN_CB ||
bpf_sock->op == BPF_SOCK_OPS_WRITE_HDR_OPT_CB) &&
return _bpf_setsockopt(bpf_sock->sk, level, optname, optval, optlen);
static int bpf_sock_ops_get_syn(struct bpf_sock_ops_kern *bpf_sock,
struct sk_buff *syn_skb = bpf_sock->syn_skb;
struct sock *sk = bpf_sock->sk;
BPF_CALL_5(bpf_sock_ops_getsockopt, struct bpf_sock_ops_kern *, bpf_sock,
if (!is_locked_tcp_sock_ops(bpf_sock))
ret = bpf_sock_ops_get_syn(bpf_sock, optname, &start);
return _bpf_getsockopt(bpf_sock->sk, level, optname, optval, optlen);
BPF_CALL_2(bpf_sock_ops_cb_flags_set, struct bpf_sock_ops_kern *, bpf_sock,
struct sock *sk = bpf_sock->sk;
if (!is_locked_tcp_sock_ops(bpf_sock))
BPF_CALL_4(bpf_sock_ops_load_hdr_opt, struct bpf_sock_ops_kern *, bpf_sock,
if (!is_locked_tcp_sock_ops(bpf_sock))
ret = bpf_sock_ops_get_syn(bpf_sock, TCP_BPF_SYN, &op);
if (!bpf_sock->skb ||
bpf_sock->op == BPF_SOCK_OPS_HDR_OPT_LEN_CB)
opend = bpf_sock->skb_data_end;
op = bpf_sock->skb->data + sizeof(struct tcphdr);
BPF_CALL_4(bpf_sock_ops_store_hdr_opt, struct bpf_sock_ops_kern *, bpf_sock,
if (bpf_sock->op != BPF_SOCK_OPS_WRITE_HDR_OPT_CB)
if (new_kind_len > bpf_sock->remaining_opt_len)
skb = bpf_sock->skb;
opend = bpf_sock->skb_data_end;
bpf_sock->remaining_opt_len -= new_kind_len;
bpf_sock->skb_data_end += new_kind_len;
BPF_CALL_3(bpf_sock_ops_reserve_hdr_opt, struct bpf_sock_ops_kern *, bpf_sock,
if (bpf_sock->op != BPF_SOCK_OPS_HDR_OPT_LEN_CB)
if (len > bpf_sock->remaining_opt_len)
bpf_sock->remaining_opt_len -= len;
case offsetof(struct bpf_sock, bound_dev_if):
case offsetof(struct bpf_sock, mark):
case offsetof(struct bpf_sock, priority):
case bpf_ctx_range(struct bpf_sock, src_ip4):
case bpf_ctx_range_till(struct bpf_sock, src_ip6[0], src_ip6[3]):
case bpf_ctx_range(struct bpf_sock, src_port):
case bpf_ctx_range_till(struct bpf_sock, type, priority):
if (off < 0 || off >= sizeof(struct bpf_sock))
case offsetof(struct bpf_sock, state):
case offsetof(struct bpf_sock, family):
case offsetof(struct bpf_sock, type):
case offsetof(struct bpf_sock, protocol):
case offsetof(struct bpf_sock, src_port):
case offsetof(struct bpf_sock, rx_queue_mapping):
case bpf_ctx_range(struct bpf_sock, src_ip4):
case bpf_ctx_range_till(struct bpf_sock, src_ip6[0], src_ip6[3]):
case bpf_ctx_range(struct bpf_sock, dst_ip4):
case bpf_ctx_range_till(struct bpf_sock, dst_ip6[0], dst_ip6[3]):
case bpf_ctx_range(struct bpf_sock, dst_port):
size_default : sizeof_field(struct bpf_sock, dst_port);
case offsetofend(struct bpf_sock, dst_port) ...
offsetof(struct bpf_sock, dst_ip4) - 1:
struct bpf_sock *sk;
struct bpf_sock *sk;
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk); /* current socket */
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, migrating_sk);
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk);
__bpf_md_ptr(struct bpf_sock *, sk); /* Selected socket */
BPF_RETVAL_HOOK(sock_release, "cgroup/sock_release", bpf_sock, 0)
BPF_RETVAL_HOOK(sock_create, "cgroup/sock_create", bpf_sock, 0)
N(CGROUP_SOCK, struct bpf_sock, bound_dev_if),
N(CGROUP_SOCK, struct bpf_sock, mark),
N(CGROUP_SOCK, struct bpf_sock, priority),
skb.sk = (struct bpf_sock *)1;
offsetof(struct bpf_sock, mark)),
offsetof(struct bpf_sock, bound_dev_if)),
offsetof(struct bpf_sock, bound_dev_if)),
offsetof(struct bpf_sock, family)),
offsetof(struct bpf_sock, type)),
offsetof(struct bpf_sock, protocol)),
offsetof(struct bpf_sock, family)),
offsetof(struct bpf_sock, type)),
offsetof(struct bpf_sock, protocol)),
offsetof(struct bpf_sock, priority)),
offsetof(struct bpf_sock, priority)),
offsetof(struct bpf_sock, mark)),
struct bpf_sock srv_sk, cli_sk, listen_sk;
static void print_sk(const struct bpf_sock *sk, const char *prefix)
offsetof(struct bpf_sock, src_ip6[3])),
offsetof(struct bpf_sock, src_port)),
offsetof(struct bpf_sock, src_ip4)),
offsetof(struct bpf_sock, src_port)),
offsetof(struct bpf_sock, src_ip4)),
offsetof(struct bpf_sock, src_port)),
offsetof(struct bpf_sock, src_ip4)),
offsetof(struct bpf_sock, src_port)),
offsetof(struct bpf_sock, src_ip6[3])),
offsetof(struct bpf_sock, src_port)),
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *peer_sk;
int trigger_oob(struct bpf_sock *sk)
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk = ctx->sk;
struct bpf_sock *sk = ctx->sk;
struct bpf_sock *sk;
struct bpf_sock *sk = skb->sk;
struct bpf_sock *sk = skb->sk;
struct bpf_sock *sk = skb->sk;
struct bpf_sock *sk = skb->sk;
struct bpf_sock *sk = skb->sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk = ctx->sk;
struct bpf_sock *sk;
struct bpf_sock *bpf_sk = skops->sk;
struct bpf_sock *sk = ctx->sk;
struct bpf_sock *sk = msg->sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk = ctx->sk;
struct bpf_sock *bpf_sk = skops->sk;
int sock_create(struct bpf_sock *ctx)
struct bpf_sock *sk = ctx->sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *bpf_skc;
struct bpf_sock *sk =
struct bpf_sock *sk =
struct bpf_sock *sk =
struct bpf_sock *sk =
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk = NULL;
struct bpf_sock *sk1 = NULL, *sk2 = NULL;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk;
struct bpf_sock *sk, *sk_ret;
struct bpf_sock *sk;
static __noinline bool sk_dst_port__load_word(struct bpf_sock *sk)
static __noinline bool sk_dst_port__load_half(struct bpf_sock *sk)
static __noinline bool sk_dst_port__load_byte(struct bpf_sock *sk)
struct bpf_sock *sk;
struct bpf_sock listen_sk = {};
struct bpf_sock srv_sk = {};
struct bpf_sock cli_sk = {};
static void skcpy(struct bpf_sock *dst,
const struct bpf_sock *src)
struct bpf_sock *sk;
struct bpf_sock *skc;
struct bpf_sock *sk;
int sock(struct bpf_sock *ctx)
int sock_release(struct bpf_sock *ctx)
padding_access("cgroup/post_bind4", bpf_sock, dst_port, 2);
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
offsetof(struct bpf_sock, family)))
__imm_const(bpf_sock_mark, offsetof(struct bpf_sock, mark)),
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type)),
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type)),
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type)),
__imm_const(bpf_sock_src_port, offsetof(struct bpf_sock, src_port)),
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type)),
: __imm_const(bpf_sock_mark, offsetof(struct bpf_sock, mark))
: __imm_const(bpf_sock_src_ip4, offsetof(struct bpf_sock, src_ip4))
: __imm_const(bpf_sock_src_port, offsetof(struct bpf_sock, src_port))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_family, offsetof(struct bpf_sock, family))
__imm_const(bpf_sock_state, offsetof(struct bpf_sock, state))
__imm_const(bpf_sock_dst_port, offsetof(struct bpf_sock, dst_port))
__imm_const(bpf_sock_dst_port, offsetof(struct bpf_sock, dst_port))
__imm_const(__imm_0, offsetof(struct bpf_sock, dst_port) + 2),
__imm_const(__imm_0, offsetof(struct bpf_sock, dst_port) + 1),
__imm_const(bpf_sock_dst_port, offsetof(struct bpf_sock, dst_port))
__imm_const(__imm_0, offsetof(struct bpf_sock, dst_port) + 2),
__imm_const(bpf_sock_dst_port__end, offsetofend(struct bpf_sock, dst_port))
__imm_const(__imm_0, offsetof(struct bpf_sock, dst_ip6[0]) + 1),
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_protocol, offsetof(struct bpf_sock, protocol))
__imm_const(bpf_sock_rx_queue_mapping__end, offsetofend(struct bpf_sock, rx_queue_mapping))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
__imm_const(bpf_sock_family, offsetof(struct bpf_sock, family))
__imm_const(bpf_sock_type, offsetof(struct bpf_sock, type))
: __imm_const(bpf_sock_src_ip6_0, offsetof(struct bpf_sock, src_ip6[0]))
struct bpf_sock *sk = bpf_map_lookup_elem(&sockmap, &zero);
__imm_const(bpf_sock_mark, offsetof(struct bpf_sock, mark)),
__imm_const(bpf_sock_mark, offsetof(struct bpf_sock, mark)),
struct bpf_sock *sk;