Documentation ¶
Overview ¶
Package sys contains bindings for the BPF syscall.
Index ¶
- Constants
- Variables
- func BPF(cmd Cmd, attr unsafe.Pointer, size uintptr) (uintptr, error)
- func BtfGetNextId(attr *BtfGetNextIdAttr) error
- func Error(err error, errno syscall.Errno) error
- func FormatFrames(fs *runtime.Frames) string
- func LinkGetNextId(attr *LinkGetNextIdAttr) error
- func LinkUpdate(attr *LinkUpdateAttr) error
- func MapDeleteBatch(attr *MapDeleteBatchAttr) error
- func MapDeleteElem(attr *MapDeleteElemAttr) error
- func MapFreeze(attr *MapFreezeAttr) error
- func MapGetNextId(attr *MapGetNextIdAttr) error
- func MapGetNextKey(attr *MapGetNextKeyAttr) error
- func MapLookupAndDeleteBatch(attr *MapLookupAndDeleteBatchAttr) error
- func MapLookupAndDeleteElem(attr *MapLookupAndDeleteElemAttr) error
- func MapLookupBatch(attr *MapLookupBatchAttr) error
- func MapLookupElem(attr *MapLookupElemAttr) error
- func MapUpdateBatch(attr *MapUpdateBatchAttr) error
- func MapUpdateElem(attr *MapUpdateElemAttr) error
- func ObjGetInfoByFd(attr *ObjGetInfoByFdAttr) error
- func ObjInfo(fd *FD, info Info) error
- func ObjPin(attr *ObjPinAttr) error
- func OnLeakFD(fn func(*runtime.Frames))
- func ProgAttach(attr *ProgAttachAttr) error
- func ProgBindMap(attr *ProgBindMapAttr) error
- func ProgDetach(attr *ProgDetachAttr) error
- func ProgGetNextId(attr *ProgGetNextIdAttr) error
- func ProgQuery(attr *ProgQueryAttr) error
- func ProgRun(attr *ProgRunAttr) error
- type AdjRoomMode
- type AttachType
- type BTFID
- type BtfGetFdByIdAttr
- type BtfGetNextIdAttr
- type BtfInfo
- type BtfLoadAttr
- type CgroupLinkInfo
- type Cmd
- type EnableStatsAttr
- type FD
- func BtfGetFdById(attr *BtfGetFdByIdAttr) (*FD, error)
- func BtfLoad(attr *BtfLoadAttr) (*FD, error)
- func EnableStats(attr *EnableStatsAttr) (*FD, error)
- func IterCreate(attr *IterCreateAttr) (*FD, error)
- func LinkCreate(attr *LinkCreateAttr) (*FD, error)
- func LinkCreateIter(attr *LinkCreateIterAttr) (*FD, error)
- func LinkCreateKprobeMulti(attr *LinkCreateKprobeMultiAttr) (*FD, error)
- func LinkCreateNetfilter(attr *LinkCreateNetfilterAttr) (*FD, error)
- func LinkCreateNetkit(attr *LinkCreateNetkitAttr) (*FD, error)
- func LinkCreatePerfEvent(attr *LinkCreatePerfEventAttr) (*FD, error)
- func LinkCreateTcx(attr *LinkCreateTcxAttr) (*FD, error)
- func LinkCreateTracing(attr *LinkCreateTracingAttr) (*FD, error)
- func LinkCreateUprobeMulti(attr *LinkCreateUprobeMultiAttr) (*FD, error)
- func LinkGetFdById(attr *LinkGetFdByIdAttr) (*FD, error)
- func MapCreate(attr *MapCreateAttr) (*FD, error)
- func MapGetFdById(attr *MapGetFdByIdAttr) (*FD, error)
- func NewFD(value int) (*FD, error)
- func ObjGet(attr *ObjGetAttr) (*FD, error)
- func ProgGetFdById(attr *ProgGetFdByIdAttr) (*FD, error)
- func ProgLoad(attr *ProgLoadAttr) (*FD, error)
- func RawTracepointOpen(attr *RawTracepointOpenAttr) (*FD, error)
- type FuncInfo
- type FunctionId
- type HdrStartOff
- type Info
- type IterCreateAttr
- type IterLinkInfo
- type KprobeLinkInfo
- type KprobeMultiLinkInfo
- type LineInfo
- type LinkCreateAttr
- type LinkCreateIterAttr
- type LinkCreateKprobeMultiAttr
- type LinkCreateNetfilterAttr
- type LinkCreateNetkitAttr
- type LinkCreatePerfEventAttr
- type LinkCreateTcxAttr
- type LinkCreateTracingAttr
- type LinkCreateUprobeMultiAttr
- type LinkGetFdByIdAttr
- type LinkGetNextIdAttr
- type LinkID
- type LinkInfo
- type LinkType
- type LinkUpdateAttr
- type LogLevel
- type MapCreateAttr
- type MapDeleteBatchAttr
- type MapDeleteElemAttr
- type MapFlags
- type MapFreezeAttr
- type MapGetFdByIdAttr
- type MapGetNextIdAttr
- type MapGetNextKeyAttr
- type MapInfo
- type MapLookupAndDeleteBatchAttr
- type MapLookupAndDeleteElemAttr
- type MapLookupBatchAttr
- type MapLookupElemAttr
- type MapType
- type MapUpdateBatchAttr
- type MapUpdateElemAttr
- type NetNsLinkInfo
- type NetfilterLinkInfo
- type NetkitLinkInfo
- type ObjGetAttr
- type ObjGetInfoByFdAttr
- type ObjName
- type ObjPinAttr
- type PerfEventLinkInfo
- type PerfEventType
- type Pointer
- type ProgAttachAttr
- type ProgBindMapAttr
- type ProgDetachAttr
- type ProgGetFdByIdAttr
- type ProgGetNextIdAttr
- type ProgInfo
- type ProgLoadAttr
- type ProgQueryAttr
- type ProgRunAttr
- type ProgType
- type RawTracepointLinkInfo
- type RawTracepointOpenAttr
- type RetCode
- type SkAction
- type SkLookup
- type StackBuildIdStatus
- type StatsType
- type TcxActionBase
- type TcxLinkInfo
- type TracingLinkInfo
- type TypeID
- type XDPLinkInfo
- type XdpAction
- type XdpMd
Constants ¶
const ( BPF_F_REPLACE = 1 << (iota + 2) BPF_F_BEFORE BPF_F_AFTER BPF_F_ID BPF_F_LINK_MPROG = 1 << 13 // aka BPF_F_LINK )
Flags used by bpf_mprog.
const ENOTSUPP = syscall.Errno(524)
ENOTSUPP is a Linux internal error code that has leaked into UAPI.
It is not the same as ENOTSUP or EOPNOTSUPP.
Variables ¶
var ErrClosedFd = unix.EBADF
Functions ¶
func BPF ¶
BPF wraps SYS_BPF.
Any pointers contained in attr must use the Pointer type from this package.
func BtfGetNextId ¶ added in v0.9.1
func BtfGetNextId(attr *BtfGetNextIdAttr) error
func FormatFrames ¶ added in v0.11.0
FormatFrames formats a runtime.Frames as a human-readable string.
func LinkGetNextId ¶ added in v0.14.0
func LinkGetNextId(attr *LinkGetNextIdAttr) error
func LinkUpdate ¶
func LinkUpdate(attr *LinkUpdateAttr) error
func MapDeleteBatch ¶
func MapDeleteBatch(attr *MapDeleteBatchAttr) error
func MapDeleteElem ¶
func MapDeleteElem(attr *MapDeleteElemAttr) error
func MapFreeze ¶
func MapFreeze(attr *MapFreezeAttr) error
func MapGetNextId ¶
func MapGetNextId(attr *MapGetNextIdAttr) error
func MapGetNextKey ¶
func MapGetNextKey(attr *MapGetNextKeyAttr) error
func MapLookupAndDeleteBatch ¶
func MapLookupAndDeleteBatch(attr *MapLookupAndDeleteBatchAttr) error
func MapLookupAndDeleteElem ¶
func MapLookupAndDeleteElem(attr *MapLookupAndDeleteElemAttr) error
func MapLookupBatch ¶
func MapLookupBatch(attr *MapLookupBatchAttr) error
func MapLookupElem ¶
func MapLookupElem(attr *MapLookupElemAttr) error
func MapUpdateBatch ¶
func MapUpdateBatch(attr *MapUpdateBatchAttr) error
func MapUpdateElem ¶
func MapUpdateElem(attr *MapUpdateElemAttr) error
func ObjGetInfoByFd ¶
func ObjGetInfoByFd(attr *ObjGetInfoByFdAttr) error
func ObjInfo ¶
ObjInfo retrieves information about a BPF Fd.
info may be one of MapInfo, ProgInfo, LinkInfo and BtfInfo.
func ObjPin ¶
func ObjPin(attr *ObjPinAttr) error
func OnLeakFD ¶ added in v0.11.0
OnLeakFD controls tracing FD lifetime to detect resources that are not closed by Close().
If fn is not nil, tracing is enabled for all FDs created going forward. fn is invoked for all FDs that are closed by the garbage collector instead of an explicit Close() by a caller. Calling OnLeakFD twice with a non-nil fn (without disabling tracing in the meantime) will cause a panic.
If fn is nil, tracing will be disabled. Any FDs that have not been closed are considered to be leaked, fn will be invoked for them, and the process will be terminated.
fn will be invoked at most once for every unique sys.FD allocation since a runtime.Frames can only be unwound once.
func ProgAttach ¶
func ProgAttach(attr *ProgAttachAttr) error
func ProgBindMap ¶
func ProgBindMap(attr *ProgBindMapAttr) error
func ProgDetach ¶
func ProgDetach(attr *ProgDetachAttr) error
func ProgGetNextId ¶
func ProgGetNextId(attr *ProgGetNextIdAttr) error
func ProgQuery ¶ added in v0.10.0
func ProgQuery(attr *ProgQueryAttr) error
func ProgRun ¶
func ProgRun(attr *ProgRunAttr) error
Types ¶
type AdjRoomMode ¶
type AdjRoomMode uint32
const ( BPF_ADJ_ROOM_NET AdjRoomMode = 0 BPF_ADJ_ROOM_MAC AdjRoomMode = 1 )
type AttachType ¶
type AttachType uint32
const ( BPF_CGROUP_INET_INGRESS AttachType = 0 BPF_CGROUP_INET_EGRESS AttachType = 1 BPF_CGROUP_INET_SOCK_CREATE AttachType = 2 BPF_CGROUP_SOCK_OPS AttachType = 3 BPF_SK_SKB_STREAM_PARSER AttachType = 4 BPF_SK_SKB_STREAM_VERDICT AttachType = 5 BPF_CGROUP_DEVICE AttachType = 6 BPF_SK_MSG_VERDICT AttachType = 7 BPF_CGROUP_INET4_BIND AttachType = 8 BPF_CGROUP_INET6_BIND AttachType = 9 BPF_CGROUP_INET4_CONNECT AttachType = 10 BPF_CGROUP_INET6_CONNECT AttachType = 11 BPF_CGROUP_INET4_POST_BIND AttachType = 12 BPF_CGROUP_INET6_POST_BIND AttachType = 13 BPF_CGROUP_UDP4_SENDMSG AttachType = 14 BPF_CGROUP_UDP6_SENDMSG AttachType = 15 BPF_LIRC_MODE2 AttachType = 16 BPF_FLOW_DISSECTOR AttachType = 17 BPF_CGROUP_SYSCTL AttachType = 18 BPF_CGROUP_UDP4_RECVMSG AttachType = 19 BPF_CGROUP_UDP6_RECVMSG AttachType = 20 BPF_CGROUP_GETSOCKOPT AttachType = 21 BPF_CGROUP_SETSOCKOPT AttachType = 22 BPF_TRACE_RAW_TP AttachType = 23 BPF_TRACE_FENTRY AttachType = 24 BPF_TRACE_FEXIT AttachType = 25 BPF_MODIFY_RETURN AttachType = 26 BPF_LSM_MAC AttachType = 27 BPF_TRACE_ITER AttachType = 28 BPF_CGROUP_INET4_GETPEERNAME AttachType = 29 BPF_CGROUP_INET6_GETPEERNAME AttachType = 30 BPF_CGROUP_INET4_GETSOCKNAME AttachType = 31 BPF_CGROUP_INET6_GETSOCKNAME AttachType = 32 BPF_XDP_DEVMAP AttachType = 33 BPF_CGROUP_INET_SOCK_RELEASE AttachType = 34 BPF_XDP_CPUMAP AttachType = 35 BPF_SK_LOOKUP AttachType = 36 BPF_XDP AttachType = 37 BPF_SK_SKB_VERDICT AttachType = 38 BPF_SK_REUSEPORT_SELECT AttachType = 39 BPF_SK_REUSEPORT_SELECT_OR_MIGRATE AttachType = 40 BPF_PERF_EVENT AttachType = 41 BPF_TRACE_KPROBE_MULTI AttachType = 42 BPF_LSM_CGROUP AttachType = 43 BPF_STRUCT_OPS AttachType = 44 BPF_NETFILTER AttachType = 45 BPF_TCX_INGRESS AttachType = 46 BPF_TCX_EGRESS AttachType = 47 BPF_TRACE_UPROBE_MULTI AttachType = 48 BPF_CGROUP_UNIX_CONNECT AttachType = 49 BPF_CGROUP_UNIX_SENDMSG AttachType = 50 BPF_CGROUP_UNIX_RECVMSG AttachType = 51 BPF_CGROUP_UNIX_GETPEERNAME AttachType = 52 BPF_CGROUP_UNIX_GETSOCKNAME AttachType = 53 BPF_NETKIT_PRIMARY AttachType = 54 BPF_NETKIT_PEER AttachType = 55 )
type BTFID ¶ added in v0.9.1
type BTFID uint32
BTFID uniquely identifies a BTF blob loaded into the kernel.
type BtfGetFdByIdAttr ¶
type BtfGetFdByIdAttr struct{ Id uint32 }
type BtfGetNextIdAttr ¶ added in v0.9.1
type BtfLoadAttr ¶
type CgroupLinkInfo ¶
type CgroupLinkInfo struct { Type LinkType Id LinkID ProgId uint32 CgroupId uint64 AttachType AttachType // contains filtered or unexported fields }
type Cmd ¶
type Cmd uint32
const ( BPF_MAP_CREATE Cmd = 0 BPF_MAP_LOOKUP_ELEM Cmd = 1 BPF_MAP_UPDATE_ELEM Cmd = 2 BPF_MAP_DELETE_ELEM Cmd = 3 BPF_MAP_GET_NEXT_KEY Cmd = 4 BPF_PROG_LOAD Cmd = 5 BPF_OBJ_PIN Cmd = 6 BPF_OBJ_GET Cmd = 7 BPF_PROG_ATTACH Cmd = 8 BPF_PROG_DETACH Cmd = 9 BPF_PROG_TEST_RUN Cmd = 10 BPF_PROG_RUN Cmd = 10 BPF_PROG_GET_NEXT_ID Cmd = 11 BPF_MAP_GET_NEXT_ID Cmd = 12 BPF_PROG_GET_FD_BY_ID Cmd = 13 BPF_MAP_GET_FD_BY_ID Cmd = 14 BPF_OBJ_GET_INFO_BY_FD Cmd = 15 BPF_PROG_QUERY Cmd = 16 BPF_RAW_TRACEPOINT_OPEN Cmd = 17 BPF_BTF_LOAD Cmd = 18 BPF_BTF_GET_FD_BY_ID Cmd = 19 BPF_TASK_FD_QUERY Cmd = 20 BPF_MAP_LOOKUP_AND_DELETE_ELEM Cmd = 21 BPF_MAP_FREEZE Cmd = 22 BPF_BTF_GET_NEXT_ID Cmd = 23 BPF_MAP_LOOKUP_BATCH Cmd = 24 BPF_MAP_LOOKUP_AND_DELETE_BATCH Cmd = 25 BPF_MAP_UPDATE_BATCH Cmd = 26 BPF_MAP_DELETE_BATCH Cmd = 27 BPF_LINK_CREATE Cmd = 28 BPF_LINK_UPDATE Cmd = 29 BPF_LINK_GET_FD_BY_ID Cmd = 30 BPF_LINK_GET_NEXT_ID Cmd = 31 BPF_ENABLE_STATS Cmd = 32 BPF_ITER_CREATE Cmd = 33 BPF_LINK_DETACH Cmd = 34 BPF_PROG_BIND_MAP Cmd = 35 )
type EnableStatsAttr ¶
type EnableStatsAttr struct{ Type uint32 }
type FD ¶
type FD struct {
// contains filtered or unexported fields
}
func BtfGetFdById ¶
func BtfGetFdById(attr *BtfGetFdByIdAttr) (*FD, error)
func BtfLoad ¶
func BtfLoad(attr *BtfLoadAttr) (*FD, error)
func EnableStats ¶
func EnableStats(attr *EnableStatsAttr) (*FD, error)
func IterCreate ¶
func IterCreate(attr *IterCreateAttr) (*FD, error)
func LinkCreate ¶
func LinkCreate(attr *LinkCreateAttr) (*FD, error)
func LinkCreateIter ¶
func LinkCreateIter(attr *LinkCreateIterAttr) (*FD, error)
func LinkCreateKprobeMulti ¶ added in v0.9.2
func LinkCreateKprobeMulti(attr *LinkCreateKprobeMultiAttr) (*FD, error)
func LinkCreateNetfilter ¶ added in v0.13.0
func LinkCreateNetfilter(attr *LinkCreateNetfilterAttr) (*FD, error)
func LinkCreateNetkit ¶ added in v0.14.0
func LinkCreateNetkit(attr *LinkCreateNetkitAttr) (*FD, error)
func LinkCreatePerfEvent ¶ added in v0.9.0
func LinkCreatePerfEvent(attr *LinkCreatePerfEventAttr) (*FD, error)
func LinkCreateTcx ¶ added in v0.13.0
func LinkCreateTcx(attr *LinkCreateTcxAttr) (*FD, error)
func LinkCreateTracing ¶ added in v0.11.0
func LinkCreateTracing(attr *LinkCreateTracingAttr) (*FD, error)
func LinkCreateUprobeMulti ¶ added in v0.13.0
func LinkCreateUprobeMulti(attr *LinkCreateUprobeMultiAttr) (*FD, error)
func LinkGetFdById ¶ added in v0.14.0
func LinkGetFdById(attr *LinkGetFdByIdAttr) (*FD, error)
func MapCreate ¶
func MapCreate(attr *MapCreateAttr) (*FD, error)
func MapGetFdById ¶
func MapGetFdById(attr *MapGetFdByIdAttr) (*FD, error)
func NewFD ¶
NewFD wraps a raw fd with a finalizer.
You must not use the raw fd after calling this function, since the underlying file descriptor number may change. This is because the BPF UAPI assumes that zero is not a valid fd value.
func ObjGet ¶
func ObjGet(attr *ObjGetAttr) (*FD, error)
func ProgGetFdById ¶
func ProgGetFdById(attr *ProgGetFdByIdAttr) (*FD, error)
func ProgLoad ¶
func ProgLoad(attr *ProgLoadAttr) (*FD, error)
func RawTracepointOpen ¶
func RawTracepointOpen(attr *RawTracepointOpenAttr) (*FD, error)
type FunctionId ¶
type FunctionId uint32
const ( BPF_FUNC_unspec FunctionId = 0 BPF_FUNC_map_lookup_elem FunctionId = 1 BPF_FUNC_map_update_elem FunctionId = 2 BPF_FUNC_map_delete_elem FunctionId = 3 BPF_FUNC_probe_read FunctionId = 4 BPF_FUNC_ktime_get_ns FunctionId = 5 BPF_FUNC_trace_printk FunctionId = 6 BPF_FUNC_get_prandom_u32 FunctionId = 7 BPF_FUNC_get_smp_processor_id FunctionId = 8 BPF_FUNC_skb_store_bytes FunctionId = 9 BPF_FUNC_l3_csum_replace FunctionId = 10 BPF_FUNC_l4_csum_replace FunctionId = 11 BPF_FUNC_tail_call FunctionId = 12 BPF_FUNC_clone_redirect FunctionId = 13 BPF_FUNC_get_current_pid_tgid FunctionId = 14 BPF_FUNC_get_current_uid_gid FunctionId = 15 BPF_FUNC_get_current_comm FunctionId = 16 BPF_FUNC_get_cgroup_classid FunctionId = 17 BPF_FUNC_skb_vlan_push FunctionId = 18 BPF_FUNC_skb_vlan_pop FunctionId = 19 BPF_FUNC_skb_get_tunnel_key FunctionId = 20 BPF_FUNC_skb_set_tunnel_key FunctionId = 21 BPF_FUNC_perf_event_read FunctionId = 22 BPF_FUNC_redirect FunctionId = 23 BPF_FUNC_get_route_realm FunctionId = 24 BPF_FUNC_perf_event_output FunctionId = 25 BPF_FUNC_skb_load_bytes FunctionId = 26 BPF_FUNC_get_stackid FunctionId = 27 BPF_FUNC_csum_diff FunctionId = 28 BPF_FUNC_skb_get_tunnel_opt FunctionId = 29 BPF_FUNC_skb_set_tunnel_opt FunctionId = 30 BPF_FUNC_skb_change_proto FunctionId = 31 BPF_FUNC_skb_change_type FunctionId = 32 BPF_FUNC_skb_under_cgroup FunctionId = 33 BPF_FUNC_get_hash_recalc FunctionId = 34 BPF_FUNC_get_current_task FunctionId = 35 BPF_FUNC_probe_write_user FunctionId = 36 BPF_FUNC_current_task_under_cgroup FunctionId = 37 BPF_FUNC_skb_change_tail FunctionId = 38 BPF_FUNC_skb_pull_data FunctionId = 39 BPF_FUNC_csum_update FunctionId = 40 BPF_FUNC_set_hash_invalid FunctionId = 41 BPF_FUNC_get_numa_node_id FunctionId = 42 BPF_FUNC_skb_change_head FunctionId = 43 BPF_FUNC_xdp_adjust_head FunctionId = 44 BPF_FUNC_probe_read_str FunctionId = 45 BPF_FUNC_get_socket_uid FunctionId = 47 BPF_FUNC_set_hash FunctionId = 48 BPF_FUNC_setsockopt FunctionId = 49 BPF_FUNC_skb_adjust_room FunctionId = 50 BPF_FUNC_redirect_map FunctionId = 51 BPF_FUNC_sk_redirect_map FunctionId = 52 BPF_FUNC_sock_map_update FunctionId = 53 BPF_FUNC_xdp_adjust_meta FunctionId = 54 BPF_FUNC_perf_event_read_value FunctionId = 55 BPF_FUNC_perf_prog_read_value FunctionId = 56 BPF_FUNC_getsockopt FunctionId = 57 BPF_FUNC_override_return FunctionId = 58 BPF_FUNC_sock_ops_cb_flags_set FunctionId = 59 BPF_FUNC_msg_redirect_map FunctionId = 60 BPF_FUNC_msg_apply_bytes FunctionId = 61 BPF_FUNC_msg_cork_bytes FunctionId = 62 BPF_FUNC_msg_pull_data FunctionId = 63 BPF_FUNC_bind FunctionId = 64 BPF_FUNC_xdp_adjust_tail FunctionId = 65 BPF_FUNC_skb_get_xfrm_state FunctionId = 66 BPF_FUNC_get_stack FunctionId = 67 BPF_FUNC_skb_load_bytes_relative FunctionId = 68 BPF_FUNC_fib_lookup FunctionId = 69 BPF_FUNC_sock_hash_update FunctionId = 70 BPF_FUNC_msg_redirect_hash FunctionId = 71 BPF_FUNC_sk_redirect_hash FunctionId = 72 BPF_FUNC_lwt_push_encap FunctionId = 73 BPF_FUNC_lwt_seg6_store_bytes FunctionId = 74 BPF_FUNC_lwt_seg6_adjust_srh FunctionId = 75 BPF_FUNC_lwt_seg6_action FunctionId = 76 BPF_FUNC_rc_repeat FunctionId = 77 BPF_FUNC_rc_keydown FunctionId = 78 BPF_FUNC_skb_cgroup_id FunctionId = 79 BPF_FUNC_get_current_cgroup_id FunctionId = 80 BPF_FUNC_get_local_storage FunctionId = 81 BPF_FUNC_sk_select_reuseport FunctionId = 82 BPF_FUNC_skb_ancestor_cgroup_id FunctionId = 83 BPF_FUNC_sk_lookup_tcp FunctionId = 84 BPF_FUNC_sk_lookup_udp FunctionId = 85 BPF_FUNC_sk_release FunctionId = 86 BPF_FUNC_map_push_elem FunctionId = 87 BPF_FUNC_map_pop_elem FunctionId = 88 BPF_FUNC_map_peek_elem FunctionId = 89 BPF_FUNC_msg_push_data FunctionId = 90 BPF_FUNC_msg_pop_data FunctionId = 91 BPF_FUNC_rc_pointer_rel FunctionId = 92 BPF_FUNC_spin_lock FunctionId = 93 BPF_FUNC_spin_unlock FunctionId = 94 BPF_FUNC_sk_fullsock FunctionId = 95 BPF_FUNC_tcp_sock FunctionId = 96 BPF_FUNC_skb_ecn_set_ce FunctionId = 97 BPF_FUNC_get_listener_sock FunctionId = 98 BPF_FUNC_skc_lookup_tcp FunctionId = 99 BPF_FUNC_sysctl_get_name FunctionId = 101 BPF_FUNC_sysctl_get_current_value FunctionId = 102 BPF_FUNC_sysctl_get_new_value FunctionId = 103 BPF_FUNC_sysctl_set_new_value FunctionId = 104 BPF_FUNC_strtol FunctionId = 105 BPF_FUNC_strtoul FunctionId = 106 BPF_FUNC_sk_storage_get FunctionId = 107 BPF_FUNC_sk_storage_delete FunctionId = 108 BPF_FUNC_send_signal FunctionId = 109 BPF_FUNC_skb_output FunctionId = 111 BPF_FUNC_probe_read_user FunctionId = 112 BPF_FUNC_probe_read_kernel FunctionId = 113 BPF_FUNC_probe_read_user_str FunctionId = 114 BPF_FUNC_probe_read_kernel_str FunctionId = 115 BPF_FUNC_tcp_send_ack FunctionId = 116 BPF_FUNC_send_signal_thread FunctionId = 117 BPF_FUNC_jiffies64 FunctionId = 118 BPF_FUNC_read_branch_records FunctionId = 119 BPF_FUNC_get_ns_current_pid_tgid FunctionId = 120 BPF_FUNC_xdp_output FunctionId = 121 BPF_FUNC_get_current_ancestor_cgroup_id FunctionId = 123 BPF_FUNC_sk_assign FunctionId = 124 BPF_FUNC_ktime_get_boot_ns FunctionId = 125 BPF_FUNC_seq_printf FunctionId = 126 BPF_FUNC_seq_write FunctionId = 127 BPF_FUNC_sk_cgroup_id FunctionId = 128 BPF_FUNC_sk_ancestor_cgroup_id FunctionId = 129 BPF_FUNC_ringbuf_output FunctionId = 130 BPF_FUNC_ringbuf_reserve FunctionId = 131 BPF_FUNC_ringbuf_submit FunctionId = 132 BPF_FUNC_ringbuf_discard FunctionId = 133 BPF_FUNC_ringbuf_query FunctionId = 134 BPF_FUNC_csum_level FunctionId = 135 BPF_FUNC_skc_to_tcp6_sock FunctionId = 136 BPF_FUNC_skc_to_tcp_sock FunctionId = 137 BPF_FUNC_skc_to_tcp_timewait_sock FunctionId = 138 BPF_FUNC_skc_to_tcp_request_sock FunctionId = 139 BPF_FUNC_skc_to_udp6_sock FunctionId = 140 BPF_FUNC_get_task_stack FunctionId = 141 BPF_FUNC_load_hdr_opt FunctionId = 142 BPF_FUNC_store_hdr_opt FunctionId = 143 BPF_FUNC_reserve_hdr_opt FunctionId = 144 BPF_FUNC_inode_storage_get FunctionId = 145 BPF_FUNC_inode_storage_delete FunctionId = 146 BPF_FUNC_d_path FunctionId = 147 BPF_FUNC_copy_from_user FunctionId = 148 BPF_FUNC_snprintf_btf FunctionId = 149 BPF_FUNC_seq_printf_btf FunctionId = 150 BPF_FUNC_skb_cgroup_classid FunctionId = 151 BPF_FUNC_redirect_neigh FunctionId = 152 BPF_FUNC_per_cpu_ptr FunctionId = 153 BPF_FUNC_this_cpu_ptr FunctionId = 154 BPF_FUNC_redirect_peer FunctionId = 155 BPF_FUNC_task_storage_get FunctionId = 156 BPF_FUNC_task_storage_delete FunctionId = 157 BPF_FUNC_get_current_task_btf FunctionId = 158 BPF_FUNC_bprm_opts_set FunctionId = 159 BPF_FUNC_ktime_get_coarse_ns FunctionId = 160 BPF_FUNC_ima_inode_hash FunctionId = 161 BPF_FUNC_sock_from_file FunctionId = 162 BPF_FUNC_check_mtu FunctionId = 163 BPF_FUNC_for_each_map_elem FunctionId = 164 BPF_FUNC_snprintf FunctionId = 165 BPF_FUNC_sys_bpf FunctionId = 166 BPF_FUNC_btf_find_by_name_kind FunctionId = 167 BPF_FUNC_sys_close FunctionId = 168 BPF_FUNC_timer_init FunctionId = 169 BPF_FUNC_timer_set_callback FunctionId = 170 BPF_FUNC_timer_start FunctionId = 171 BPF_FUNC_timer_cancel FunctionId = 172 BPF_FUNC_get_func_ip FunctionId = 173 BPF_FUNC_task_pt_regs FunctionId = 175 BPF_FUNC_get_branch_snapshot FunctionId = 176 BPF_FUNC_trace_vprintk FunctionId = 177 BPF_FUNC_skc_to_unix_sock FunctionId = 178 BPF_FUNC_kallsyms_lookup_name FunctionId = 179 BPF_FUNC_find_vma FunctionId = 180 BPF_FUNC_loop FunctionId = 181 BPF_FUNC_strncmp FunctionId = 182 BPF_FUNC_get_func_arg FunctionId = 183 BPF_FUNC_get_func_ret FunctionId = 184 BPF_FUNC_get_func_arg_cnt FunctionId = 185 BPF_FUNC_get_retval FunctionId = 186 BPF_FUNC_set_retval FunctionId = 187 BPF_FUNC_xdp_get_buff_len FunctionId = 188 BPF_FUNC_xdp_load_bytes FunctionId = 189 BPF_FUNC_xdp_store_bytes FunctionId = 190 BPF_FUNC_copy_from_user_task FunctionId = 191 BPF_FUNC_skb_set_tstamp FunctionId = 192 BPF_FUNC_ima_file_hash FunctionId = 193 BPF_FUNC_kptr_xchg FunctionId = 194 BPF_FUNC_map_lookup_percpu_elem FunctionId = 195 BPF_FUNC_skc_to_mptcp_sock FunctionId = 196 BPF_FUNC_dynptr_from_mem FunctionId = 197 BPF_FUNC_ringbuf_reserve_dynptr FunctionId = 198 BPF_FUNC_ringbuf_submit_dynptr FunctionId = 199 BPF_FUNC_ringbuf_discard_dynptr FunctionId = 200 BPF_FUNC_dynptr_read FunctionId = 201 BPF_FUNC_dynptr_write FunctionId = 202 BPF_FUNC_dynptr_data FunctionId = 203 BPF_FUNC_ktime_get_tai_ns FunctionId = 208 BPF_FUNC_user_ringbuf_drain FunctionId = 209 BPF_FUNC_cgrp_storage_get FunctionId = 210 BPF_FUNC_cgrp_storage_delete FunctionId = 211 )
type HdrStartOff ¶
type HdrStartOff uint32
const ( BPF_HDR_START_MAC HdrStartOff = 0 BPF_HDR_START_NET HdrStartOff = 1 )
type Info ¶
type Info interface {
// contains filtered or unexported methods
}
Info is implemented by all structs that can be passed to the ObjInfo syscall.
MapInfo ProgInfo LinkInfo BtfInfo
type IterCreateAttr ¶
type IterLinkInfo ¶
type KprobeLinkInfo ¶ added in v0.15.0
type KprobeMultiLinkInfo ¶ added in v0.15.0
type LinkCreateAttr ¶
type LinkCreateAttr struct { ProgFd uint32 TargetFd uint32 AttachType AttachType Flags uint32 TargetBtfId TypeID // contains filtered or unexported fields }
type LinkCreateIterAttr ¶
type LinkCreateKprobeMultiAttr ¶ added in v0.9.2
type LinkCreateNetfilterAttr ¶ added in v0.13.0
type LinkCreateNetkitAttr ¶ added in v0.14.0
type LinkCreatePerfEventAttr ¶ added in v0.9.0
type LinkCreatePerfEventAttr struct { ProgFd uint32 TargetFd uint32 AttachType AttachType Flags uint32 BpfCookie uint64 // contains filtered or unexported fields }
type LinkCreateTcxAttr ¶ added in v0.13.0
type LinkCreateTracingAttr ¶ added in v0.11.0
type LinkCreateUprobeMultiAttr ¶ added in v0.13.0
type LinkGetFdByIdAttr ¶ added in v0.14.0
type LinkGetFdByIdAttr struct{ Id LinkID }
type LinkGetNextIdAttr ¶ added in v0.14.0
type LinkType ¶
type LinkType uint32
const ( BPF_LINK_TYPE_UNSPEC LinkType = 0 BPF_LINK_TYPE_RAW_TRACEPOINT LinkType = 1 BPF_LINK_TYPE_TRACING LinkType = 2 BPF_LINK_TYPE_CGROUP LinkType = 3 BPF_LINK_TYPE_ITER LinkType = 4 BPF_LINK_TYPE_NETNS LinkType = 5 BPF_LINK_TYPE_XDP LinkType = 6 BPF_LINK_TYPE_PERF_EVENT LinkType = 7 BPF_LINK_TYPE_KPROBE_MULTI LinkType = 8 BPF_LINK_TYPE_STRUCT_OPS LinkType = 9 BPF_LINK_TYPE_NETFILTER LinkType = 10 BPF_LINK_TYPE_TCX LinkType = 11 BPF_LINK_TYPE_UPROBE_MULTI LinkType = 12 BPF_LINK_TYPE_NETKIT LinkType = 13 )
type LinkUpdateAttr ¶
type LogLevel ¶ added in v0.9.2
type LogLevel uint32
LogLevel controls the verbosity of the kernel's eBPF program verifier.
type MapCreateAttr ¶
type MapDeleteBatchAttr ¶
type MapDeleteElemAttr ¶
type MapFreezeAttr ¶
type MapFreezeAttr struct{ MapFd uint32 }
type MapGetFdByIdAttr ¶
type MapGetFdByIdAttr struct{ Id uint32 }
type MapGetNextIdAttr ¶
type MapGetNextKeyAttr ¶
type MapInfo ¶
type MapInfo struct { Type uint32 Id uint32 KeySize uint32 ValueSize uint32 MaxEntries uint32 MapFlags MapFlags Name ObjName Ifindex uint32 BtfVmlinuxValueTypeId TypeID NetnsDev uint64 NetnsIno uint64 BtfId uint32 BtfKeyTypeId TypeID BtfValueTypeId TypeID MapExtra uint64 // contains filtered or unexported fields }
type MapLookupBatchAttr ¶
type MapLookupElemAttr ¶
type MapType ¶
type MapType uint32
const ( BPF_MAP_TYPE_UNSPEC MapType = 0 BPF_MAP_TYPE_HASH MapType = 1 BPF_MAP_TYPE_ARRAY MapType = 2 BPF_MAP_TYPE_PROG_ARRAY MapType = 3 BPF_MAP_TYPE_PERF_EVENT_ARRAY MapType = 4 BPF_MAP_TYPE_PERCPU_HASH MapType = 5 BPF_MAP_TYPE_PERCPU_ARRAY MapType = 6 BPF_MAP_TYPE_STACK_TRACE MapType = 7 BPF_MAP_TYPE_CGROUP_ARRAY MapType = 8 BPF_MAP_TYPE_LRU_HASH MapType = 9 BPF_MAP_TYPE_LRU_PERCPU_HASH MapType = 10 BPF_MAP_TYPE_LPM_TRIE MapType = 11 BPF_MAP_TYPE_ARRAY_OF_MAPS MapType = 12 BPF_MAP_TYPE_HASH_OF_MAPS MapType = 13 BPF_MAP_TYPE_DEVMAP MapType = 14 BPF_MAP_TYPE_SOCKMAP MapType = 15 BPF_MAP_TYPE_CPUMAP MapType = 16 BPF_MAP_TYPE_XSKMAP MapType = 17 BPF_MAP_TYPE_SOCKHASH MapType = 18 BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED MapType = 19 BPF_MAP_TYPE_CGROUP_STORAGE MapType = 19 BPF_MAP_TYPE_REUSEPORT_SOCKARRAY MapType = 20 BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE_DEPRECATED MapType = 21 BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE MapType = 21 BPF_MAP_TYPE_QUEUE MapType = 22 BPF_MAP_TYPE_STACK MapType = 23 BPF_MAP_TYPE_SK_STORAGE MapType = 24 BPF_MAP_TYPE_DEVMAP_HASH MapType = 25 BPF_MAP_TYPE_STRUCT_OPS MapType = 26 BPF_MAP_TYPE_RINGBUF MapType = 27 BPF_MAP_TYPE_INODE_STORAGE MapType = 28 BPF_MAP_TYPE_TASK_STORAGE MapType = 29 BPF_MAP_TYPE_BLOOM_FILTER MapType = 30 BPF_MAP_TYPE_USER_RINGBUF MapType = 31 BPF_MAP_TYPE_CGRP_STORAGE MapType = 32 )
type MapUpdateBatchAttr ¶
type MapUpdateElemAttr ¶
type NetNsLinkInfo ¶
type NetNsLinkInfo struct { Type LinkType Id LinkID ProgId uint32 NetnsIno uint32 AttachType AttachType // contains filtered or unexported fields }
type NetfilterLinkInfo ¶ added in v0.13.0
type NetkitLinkInfo ¶ added in v0.14.0
type NetkitLinkInfo struct { Type LinkType Id LinkID ProgId uint32 Ifindex uint32 AttachType AttachType // contains filtered or unexported fields }
type ObjGetAttr ¶
type ObjGetInfoByFdAttr ¶
type ObjName ¶
type ObjName [unix.BPF_OBJ_NAME_LEN]byte
BPFObjName is a null-terminated string made up of 'A-Za-z0-9_' characters.
func NewObjName ¶
NewObjName truncates the result if it is too long.
type ObjPinAttr ¶
type PerfEventLinkInfo ¶ added in v0.15.0
type PerfEventLinkInfo struct { Type LinkType Id LinkID ProgId uint32 PerfEventType PerfEventType // contains filtered or unexported fields }
type PerfEventType ¶ added in v0.15.0
type PerfEventType uint32
const ( BPF_PERF_EVENT_UNSPEC PerfEventType = 0 BPF_PERF_EVENT_UPROBE PerfEventType = 1 BPF_PERF_EVENT_URETPROBE PerfEventType = 2 BPF_PERF_EVENT_KPROBE PerfEventType = 3 BPF_PERF_EVENT_KRETPROBE PerfEventType = 4 BPF_PERF_EVENT_TRACEPOINT PerfEventType = 5 BPF_PERF_EVENT_EVENT PerfEventType = 6 )
type Pointer ¶
type Pointer struct {
// contains filtered or unexported fields
}
Pointer wraps an unsafe.Pointer to be 64bit to conform to the syscall specification.
func NewPointer ¶
NewPointer creates a 64-bit pointer from an unsafe Pointer.
func NewSlicePointer ¶
NewSlicePointer creates a 64-bit pointer from a byte slice.
func NewSlicePointerLen ¶
NewSlicePointerLen creates a 64-bit pointer from a byte slice.
Useful to assign both the pointer and the length in one go.
func NewStringPointer ¶
NewStringPointer creates a 64-bit pointer from a string.
func NewStringSlicePointer ¶ added in v0.9.2
NewStringSlicePointer allocates an array of Pointers to each string in the given slice of strings and returns a 64-bit pointer to the start of the resulting array.
Use this function to pass arrays of strings as syscall arguments.
type ProgAttachAttr ¶
type ProgBindMapAttr ¶
type ProgDetachAttr ¶
type ProgGetFdByIdAttr ¶
type ProgGetFdByIdAttr struct{ Id uint32 }
type ProgGetNextIdAttr ¶
type ProgInfo ¶
type ProgInfo struct { Type uint32 Id uint32 Tag [8]uint8 JitedProgLen uint32 XlatedProgLen uint32 JitedProgInsns uint64 XlatedProgInsns Pointer LoadTime uint64 CreatedByUid uint32 NrMapIds uint32 MapIds Pointer Name ObjName Ifindex uint32 NetnsDev uint64 NetnsIno uint64 NrJitedKsyms uint32 NrJitedFuncLens uint32 JitedKsyms uint64 JitedFuncLens uint64 BtfId BTFID FuncInfoRecSize uint32 FuncInfo Pointer NrFuncInfo uint32 NrLineInfo uint32 LineInfo Pointer JitedLineInfo uint64 NrJitedLineInfo uint32 LineInfoRecSize uint32 JitedLineInfoRecSize uint32 NrProgTags uint32 ProgTags uint64 RunTimeNs uint64 RunCnt uint64 RecursionMisses uint64 VerifiedInsns uint32 AttachBtfObjId BTFID AttachBtfId TypeID // contains filtered or unexported fields }
type ProgLoadAttr ¶
type ProgLoadAttr struct { ProgType ProgType InsnCnt uint32 Insns Pointer License Pointer LogLevel LogLevel LogSize uint32 LogBuf Pointer KernVersion uint32 ProgFlags uint32 ProgName ObjName ProgIfindex uint32 ExpectedAttachType AttachType ProgBtfFd uint32 FuncInfoRecSize uint32 FuncInfo Pointer FuncInfoCnt uint32 LineInfoRecSize uint32 LineInfo Pointer LineInfoCnt uint32 AttachBtfId TypeID AttachBtfObjFd uint32 CoreReloCnt uint32 FdArray Pointer CoreRelos Pointer CoreReloRecSize uint32 LogTrueSize uint32 }
type ProgQueryAttr ¶ added in v0.10.0
type ProgRunAttr ¶
type ProgRunAttr struct { ProgFd uint32 Retval uint32 DataSizeIn uint32 DataSizeOut uint32 DataIn Pointer DataOut Pointer Repeat uint32 Duration uint32 CtxSizeIn uint32 CtxSizeOut uint32 CtxIn Pointer CtxOut Pointer Flags uint32 Cpu uint32 BatchSize uint32 // contains filtered or unexported fields }
type ProgType ¶
type ProgType uint32
const ( BPF_PROG_TYPE_UNSPEC ProgType = 0 BPF_PROG_TYPE_SOCKET_FILTER ProgType = 1 BPF_PROG_TYPE_KPROBE ProgType = 2 BPF_PROG_TYPE_SCHED_CLS ProgType = 3 BPF_PROG_TYPE_SCHED_ACT ProgType = 4 BPF_PROG_TYPE_TRACEPOINT ProgType = 5 BPF_PROG_TYPE_XDP ProgType = 6 BPF_PROG_TYPE_PERF_EVENT ProgType = 7 BPF_PROG_TYPE_CGROUP_SKB ProgType = 8 BPF_PROG_TYPE_CGROUP_SOCK ProgType = 9 BPF_PROG_TYPE_LWT_IN ProgType = 10 BPF_PROG_TYPE_LWT_OUT ProgType = 11 BPF_PROG_TYPE_LWT_XMIT ProgType = 12 BPF_PROG_TYPE_SOCK_OPS ProgType = 13 BPF_PROG_TYPE_SK_SKB ProgType = 14 BPF_PROG_TYPE_CGROUP_DEVICE ProgType = 15 BPF_PROG_TYPE_SK_MSG ProgType = 16 BPF_PROG_TYPE_RAW_TRACEPOINT ProgType = 17 BPF_PROG_TYPE_CGROUP_SOCK_ADDR ProgType = 18 BPF_PROG_TYPE_LWT_SEG6LOCAL ProgType = 19 BPF_PROG_TYPE_LIRC_MODE2 ProgType = 20 BPF_PROG_TYPE_SK_REUSEPORT ProgType = 21 BPF_PROG_TYPE_FLOW_DISSECTOR ProgType = 22 BPF_PROG_TYPE_CGROUP_SYSCTL ProgType = 23 BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE ProgType = 24 BPF_PROG_TYPE_CGROUP_SOCKOPT ProgType = 25 BPF_PROG_TYPE_TRACING ProgType = 26 BPF_PROG_TYPE_STRUCT_OPS ProgType = 27 BPF_PROG_TYPE_EXT ProgType = 28 BPF_PROG_TYPE_LSM ProgType = 29 BPF_PROG_TYPE_SK_LOOKUP ProgType = 30 BPF_PROG_TYPE_SYSCALL ProgType = 31 BPF_PROG_TYPE_NETFILTER ProgType = 32 )
type RawTracepointLinkInfo ¶
type RawTracepointOpenAttr ¶
type StackBuildIdStatus ¶
type StackBuildIdStatus uint32
const ( BPF_STACK_BUILD_ID_EMPTY StackBuildIdStatus = 0 BPF_STACK_BUILD_ID_VALID StackBuildIdStatus = 1 BPF_STACK_BUILD_ID_IP StackBuildIdStatus = 2 )
type TcxActionBase ¶ added in v0.13.0
type TcxActionBase int32
const ( TCX_NEXT TcxActionBase = -1 TCX_PASS TcxActionBase = 0 TCX_DROP TcxActionBase = 2 TCX_REDIRECT TcxActionBase = 7 )
type TcxLinkInfo ¶ added in v0.13.0
type TcxLinkInfo struct { Type LinkType Id LinkID ProgId uint32 Ifindex uint32 AttachType AttachType // contains filtered or unexported fields }