10 #define EBPF_HELPER(return_type, name, args) typedef return_type(*const name##_t) args
57 #define BPF_SOCK_ADDR_VERDICT_REJECT 0
58 #define BPF_SOCK_ADDR_VERDICT_PROCEED 1
62 #pragma warning(disable : 4201)
100 #define SOCK_ADDR_EXT_HELPER_FN_BASE 0xFFFF
123 #define bpf_sock_addr_get_current_pid_tgid \
124 ((bpf_sock_addr_get_current_pid_tgid_t)BPF_FUNC_sock_addr_get_current_pid_tgid)
140 #define bpf_sock_addr_set_redirect_context \
141 ((bpf_sock_addr_set_redirect_context_t)BPF_FUNC_sock_addr_set_redirect_context)
enum _bind_operation bind_operation_t
#define SOCK_ADDR_EXT_HELPER_FN_BASE
Definition: ebpf_nethooks.h:100
uint64_t bpf_sock_addr_get_current_pid_tgid(bpf_sock_addr_t *ctx)
Get current pid and tgid (sock_addr specific only).
ebpf_sock_addr_helper_id_t
Definition: ebpf_nethooks.h:103
@ BPF_FUNC_sock_addr_set_redirect_context
Definition: ebpf_nethooks.h:105
@ BPF_FUNC_sock_addr_get_current_pid_tgid
Definition: ebpf_nethooks.h:104
enum _bpf_sock_op_type bpf_sock_op_type_t
int sock_addr_hook_t(bpf_sock_addr_t *context)
Handle socket operation. Currently supports ingress/egress connection initialization.
Definition: ebpf_nethooks.h:162
int sock_ops_hook_t(bpf_sock_ops_t *context)
Handle socket event notification. Currently notifies ingress/egress connection establishment and tear...
Definition: ebpf_nethooks.h:214
int bpf_sock_addr_set_redirect_context(bpf_sock_addr_t *ctx, void *data, uint32_t data_size)
Set a context for consumption by a user-mode application (sock_addr specific only)....
_bind_operation
Definition: ebpf_nethooks.h:16
@ BIND_OPERATION_BIND
Entry to bind.
Definition: ebpf_nethooks.h:17
@ BIND_OPERATION_UNBIND
Release port.
Definition: ebpf_nethooks.h:19
@ BIND_OPERATION_POST_BIND
After port allocation.
Definition: ebpf_nethooks.h:18
_bind_action
Definition: ebpf_nethooks.h:34
@ BIND_REDIRECT
Change the bind endpoint.
Definition: ebpf_nethooks.h:37
@ BIND_PERMIT
Permit the bind operation.
Definition: ebpf_nethooks.h:35
@ BIND_DENY
Deny the bind operation.
Definition: ebpf_nethooks.h:36
_bpf_sock_op_type
Definition: ebpf_nethooks.h:165
@ BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB
Indicates when a passive (inbound) connection is established.
Definition: ebpf_nethooks.h:169
@ BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB
Indicates when an active (outbound) connection is established.
Definition: ebpf_nethooks.h:167
@ BPF_SOCK_OPS_CONNECTION_DELETED_CB
Indicates when a connection is deleted.
Definition: ebpf_nethooks.h:171
bind_action_t bind_hook_t(bind_md_t *context)
Handle an AF_INET socket bind() request.
Definition: ebpf_nethooks.h:51
struct bpf_sock_addr bpf_sock_addr_t
Data structure used as context for BPF_PROG_TYPE_CGROUP_SOCK_ADDR program type.
enum _bind_action bind_action_t
struct _bind_md bind_md_t
struct _bpf_sock_ops bpf_sock_ops_t
Definition: ebpf_nethooks.h:23
uint8_t protocol
Protocol number (e.g., IPPROTO_TCP).
Definition: ebpf_nethooks.h:30
bind_operation_t operation
Operation to do.
Definition: ebpf_nethooks.h:29
uint8_t * app_id_end
Pointer to end of App ID.
Definition: ebpf_nethooks.h:25
uint8_t socket_address[16]
Socket address to bind to.
Definition: ebpf_nethooks.h:27
uint64_t process_id
Process ID.
Definition: ebpf_nethooks.h:26
uint8_t * app_id_start
Pointer to start of App ID.
Definition: ebpf_nethooks.h:24
uint8_t socket_address_length
Length in bytes of the socket address.
Definition: ebpf_nethooks.h:28
Definition: ebpf_nethooks.h:175
uint32_t local_ip4
Definition: ebpf_nethooks.h:182
uint32_t family
IP address family.
Definition: ebpf_nethooks.h:177
uint32_t remote_ip4
Definition: ebpf_nethooks.h:191
uint32_t compartment_id
Network compartment Id.
Definition: ebpf_nethooks.h:197
uint8_t protocol
IP protocol.
Definition: ebpf_nethooks.h:196
uint32_t remote_port
Definition: ebpf_nethooks.h:194
uint64_t interface_luid
Interface LUID.
Definition: ebpf_nethooks.h:198
uint32_t local_ip6[4]
Definition: ebpf_nethooks.h:183
bpf_sock_op_type_t op
Definition: ebpf_nethooks.h:176
uint32_t remote_ip6[4]
Definition: ebpf_nethooks.h:192
uint32_t local_port
Definition: ebpf_nethooks.h:185
Data structure used as context for BPF_PROG_TYPE_CGROUP_SOCK_ADDR program type.
Definition: ebpf_nethooks.h:68
uint32_t protocol
IP protocol.
Definition: ebpf_nethooks.h:95
uint16_t user_port
Destination port in network byte order.
Definition: ebpf_nethooks.h:93
uint16_t msg_src_port
Source port in network byte order.
Definition: ebpf_nethooks.h:81
uint32_t user_ip4
Definition: ebpf_nethooks.h:90
uint32_t user_ip6[4]
Definition: ebpf_nethooks.h:91
uint32_t compartment_id
Network compartment Id.
Definition: ebpf_nethooks.h:96
uint32_t msg_src_ip6[4]
Definition: ebpf_nethooks.h:79
uint64_t interface_luid
Interface LUID.
Definition: ebpf_nethooks.h:97
uint32_t msg_src_ip4
Definition: ebpf_nethooks.h:78
uint32_t family
IP address family.
Definition: ebpf_nethooks.h:69