Blame include/uapi/linux/bpf.h

Packit Service 3880ab
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
Packit Service 3880ab
/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
Packit Service 3880ab
 *
Packit Service 3880ab
 * This program is free software; you can redistribute it and/or
Packit Service 3880ab
 * modify it under the terms of version 2 of the GNU General Public
Packit Service 3880ab
 * License as published by the Free Software Foundation.
Packit Service 3880ab
 */
Packit Service 3880ab
#ifndef __LINUX_BPF_H__
Packit Service 3880ab
#define __LINUX_BPF_H__
Packit Service 3880ab
Packit Service 3880ab
#include <linux/types.h>
Packit Service 3880ab
#include <linux/bpf_common.h>
Packit Service 3880ab
Packit Service 3880ab
/* Extended instruction set based on top of classic BPF */
Packit Service 3880ab
Packit Service 3880ab
/* instruction classes */
Packit Service 3880ab
#define BPF_JMP32	0x06	/* jmp mode in word width */
Packit Service 3880ab
#define BPF_ALU64	0x07	/* alu mode in double word width */
Packit Service 3880ab
Packit Service 3880ab
/* ld/ldx fields */
Packit Service 3880ab
#define BPF_DW		0x18	/* double word (64-bit) */
Packit Service 3880ab
#define BPF_XADD	0xc0	/* exclusive add */
Packit Service 3880ab
Packit Service 3880ab
/* alu/jmp fields */
Packit Service 3880ab
#define BPF_MOV		0xb0	/* mov reg to reg */
Packit Service 3880ab
#define BPF_ARSH	0xc0	/* sign extending arithmetic shift right */
Packit Service 3880ab
Packit Service 3880ab
/* change endianness of a register */
Packit Service 3880ab
#define BPF_END		0xd0	/* flags for endianness conversion: */
Packit Service 3880ab
#define BPF_TO_LE	0x00	/* convert to little-endian */
Packit Service 3880ab
#define BPF_TO_BE	0x08	/* convert to big-endian */
Packit Service 3880ab
#define BPF_FROM_LE	BPF_TO_LE
Packit Service 3880ab
#define BPF_FROM_BE	BPF_TO_BE
Packit Service 3880ab
Packit Service 3880ab
/* jmp encodings */
Packit Service 3880ab
#define BPF_JNE		0x50	/* jump != */
Packit Service 3880ab
#define BPF_JLT		0xa0	/* LT is unsigned, '<' */
Packit Service 3880ab
#define BPF_JLE		0xb0	/* LE is unsigned, '<=' */
Packit Service 3880ab
#define BPF_JSGT	0x60	/* SGT is signed '>', GT in x86 */
Packit Service 3880ab
#define BPF_JSGE	0x70	/* SGE is signed '>=', GE in x86 */
Packit Service 3880ab
#define BPF_JSLT	0xc0	/* SLT is signed, '<' */
Packit Service 3880ab
#define BPF_JSLE	0xd0	/* SLE is signed, '<=' */
Packit Service 3880ab
#define BPF_CALL	0x80	/* function call */
Packit Service 3880ab
#define BPF_EXIT	0x90	/* function return */
Packit Service 3880ab
Packit Service 3880ab
/* Register numbers */
Packit Service 3880ab
enum {
Packit Service 3880ab
	BPF_REG_0 = 0,
Packit Service 3880ab
	BPF_REG_1,
Packit Service 3880ab
	BPF_REG_2,
Packit Service 3880ab
	BPF_REG_3,
Packit Service 3880ab
	BPF_REG_4,
Packit Service 3880ab
	BPF_REG_5,
Packit Service 3880ab
	BPF_REG_6,
Packit Service 3880ab
	BPF_REG_7,
Packit Service 3880ab
	BPF_REG_8,
Packit Service 3880ab
	BPF_REG_9,
Packit Service 3880ab
	BPF_REG_10,
Packit Service 3880ab
	__MAX_BPF_REG,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
/* BPF has 10 general purpose 64-bit registers and stack frame. */
Packit Service 3880ab
#define MAX_BPF_REG	__MAX_BPF_REG
Packit Service 3880ab
Packit Service 3880ab
struct bpf_insn {
Packit Service 3880ab
	__u8	code;		/* opcode */
Packit Service 3880ab
	__u8	dst_reg:4;	/* dest register */
Packit Service 3880ab
	__u8	src_reg:4;	/* source register */
Packit Service 3880ab
	__s16	off;		/* signed offset */
Packit Service 3880ab
	__s32	imm;		/* signed immediate constant */
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
Packit Service 3880ab
struct bpf_lpm_trie_key {
Packit Service 3880ab
	__u32	prefixlen;	/* up to 32 for AF_INET, 128 for AF_INET6 */
Packit Service 3880ab
	__u8	data[0];	/* Arbitrary size */
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
struct bpf_cgroup_storage_key {
Packit Service 3880ab
	__u64	cgroup_inode_id;	/* cgroup inode id */
Packit Service 3880ab
	__u32	attach_type;		/* program attach type */
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
union bpf_iter_link_info {
Packit Service 3880ab
	struct {
Packit Service 3880ab
		__u32	map_fd;
Packit Service 3880ab
	} map;
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
/* BPF syscall commands, see bpf(2) man-page for details. */
Packit Service 3880ab
enum bpf_cmd {
Packit Service 3880ab
	BPF_MAP_CREATE,
Packit Service 3880ab
	BPF_MAP_LOOKUP_ELEM,
Packit Service 3880ab
	BPF_MAP_UPDATE_ELEM,
Packit Service 3880ab
	BPF_MAP_DELETE_ELEM,
Packit Service 3880ab
	BPF_MAP_GET_NEXT_KEY,
Packit Service 3880ab
	BPF_PROG_LOAD,
Packit Service 3880ab
	BPF_OBJ_PIN,
Packit Service 3880ab
	BPF_OBJ_GET,
Packit Service 3880ab
	BPF_PROG_ATTACH,
Packit Service 3880ab
	BPF_PROG_DETACH,
Packit Service 3880ab
	BPF_PROG_TEST_RUN,
Packit Service 3880ab
	BPF_PROG_GET_NEXT_ID,
Packit Service 3880ab
	BPF_MAP_GET_NEXT_ID,
Packit Service 3880ab
	BPF_PROG_GET_FD_BY_ID,
Packit Service 3880ab
	BPF_MAP_GET_FD_BY_ID,
Packit Service 3880ab
	BPF_OBJ_GET_INFO_BY_FD,
Packit Service 3880ab
	BPF_PROG_QUERY,
Packit Service 3880ab
	BPF_RAW_TRACEPOINT_OPEN,
Packit Service 3880ab
	BPF_BTF_LOAD,
Packit Service 3880ab
	BPF_BTF_GET_FD_BY_ID,
Packit Service 3880ab
	BPF_TASK_FD_QUERY,
Packit Service 3880ab
	BPF_MAP_LOOKUP_AND_DELETE_ELEM,
Packit Service 3880ab
	BPF_MAP_FREEZE,
Packit Service 3880ab
	BPF_BTF_GET_NEXT_ID,
Packit Service 3880ab
	BPF_MAP_LOOKUP_BATCH,
Packit Service 3880ab
	BPF_MAP_LOOKUP_AND_DELETE_BATCH,
Packit Service 3880ab
	BPF_MAP_UPDATE_BATCH,
Packit Service 3880ab
	BPF_MAP_DELETE_BATCH,
Packit Service 3880ab
	BPF_LINK_CREATE,
Packit Service 3880ab
	BPF_LINK_UPDATE,
Packit Service 3880ab
	BPF_LINK_GET_FD_BY_ID,
Packit Service 3880ab
	BPF_LINK_GET_NEXT_ID,
Packit Service 3880ab
	BPF_ENABLE_STATS,
Packit Service 3880ab
	BPF_ITER_CREATE,
Packit Service 3880ab
	BPF_LINK_DETACH,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
enum bpf_map_type {
Packit Service 3880ab
	BPF_MAP_TYPE_UNSPEC,
Packit Service 3880ab
	BPF_MAP_TYPE_HASH,
Packit Service 3880ab
	BPF_MAP_TYPE_ARRAY,
Packit Service 3880ab
	BPF_MAP_TYPE_PROG_ARRAY,
Packit Service 3880ab
	BPF_MAP_TYPE_PERF_EVENT_ARRAY,
Packit Service 3880ab
	BPF_MAP_TYPE_PERCPU_HASH,
Packit Service 3880ab
	BPF_MAP_TYPE_PERCPU_ARRAY,
Packit Service 3880ab
	BPF_MAP_TYPE_STACK_TRACE,
Packit Service 3880ab
	BPF_MAP_TYPE_CGROUP_ARRAY,
Packit Service 3880ab
	BPF_MAP_TYPE_LRU_HASH,
Packit Service 3880ab
	BPF_MAP_TYPE_LRU_PERCPU_HASH,
Packit Service 3880ab
	BPF_MAP_TYPE_LPM_TRIE,
Packit Service 3880ab
	BPF_MAP_TYPE_ARRAY_OF_MAPS,
Packit Service 3880ab
	BPF_MAP_TYPE_HASH_OF_MAPS,
Packit Service 3880ab
	BPF_MAP_TYPE_DEVMAP,
Packit Service 3880ab
	BPF_MAP_TYPE_SOCKMAP,
Packit Service 3880ab
	BPF_MAP_TYPE_CPUMAP,
Packit Service 3880ab
	BPF_MAP_TYPE_XSKMAP,
Packit Service 3880ab
	BPF_MAP_TYPE_SOCKHASH,
Packit Service 3880ab
	BPF_MAP_TYPE_CGROUP_STORAGE,
Packit Service 3880ab
	BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
Packit Service 3880ab
	BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
Packit Service 3880ab
	BPF_MAP_TYPE_QUEUE,
Packit Service 3880ab
	BPF_MAP_TYPE_STACK,
Packit Service 3880ab
	BPF_MAP_TYPE_SK_STORAGE,
Packit Service 3880ab
	BPF_MAP_TYPE_DEVMAP_HASH,
Packit Service 3880ab
	BPF_MAP_TYPE_STRUCT_OPS,
Packit Service 3880ab
	BPF_MAP_TYPE_RINGBUF,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
/* Note that tracing related programs such as
Packit Service 3880ab
 * BPF_PROG_TYPE_{KPROBE,TRACEPOINT,PERF_EVENT,RAW_TRACEPOINT}
Packit Service 3880ab
 * are not subject to a stable API since kernel internal data
Packit Service 3880ab
 * structures can change from release to release and may
Packit Service 3880ab
 * therefore break existing tracing BPF programs. Tracing BPF
Packit Service 3880ab
 * programs correspond to /a/ specific kernel which is to be
Packit Service 3880ab
 * analyzed, and not /a/ specific kernel /and/ all future ones.
Packit Service 3880ab
 */
Packit Service 3880ab
enum bpf_prog_type {
Packit Service 3880ab
	BPF_PROG_TYPE_UNSPEC,
Packit Service 3880ab
	BPF_PROG_TYPE_SOCKET_FILTER,
Packit Service 3880ab
	BPF_PROG_TYPE_KPROBE,
Packit Service 3880ab
	BPF_PROG_TYPE_SCHED_CLS,
Packit Service 3880ab
	BPF_PROG_TYPE_SCHED_ACT,
Packit Service 3880ab
	BPF_PROG_TYPE_TRACEPOINT,
Packit Service 3880ab
	BPF_PROG_TYPE_XDP,
Packit Service 3880ab
	BPF_PROG_TYPE_PERF_EVENT,
Packit Service 3880ab
	BPF_PROG_TYPE_CGROUP_SKB,
Packit Service 3880ab
	BPF_PROG_TYPE_CGROUP_SOCK,
Packit Service 3880ab
	BPF_PROG_TYPE_LWT_IN,
Packit Service 3880ab
	BPF_PROG_TYPE_LWT_OUT,
Packit Service 3880ab
	BPF_PROG_TYPE_LWT_XMIT,
Packit Service 3880ab
	BPF_PROG_TYPE_SOCK_OPS,
Packit Service 3880ab
	BPF_PROG_TYPE_SK_SKB,
Packit Service 3880ab
	BPF_PROG_TYPE_CGROUP_DEVICE,
Packit Service 3880ab
	BPF_PROG_TYPE_SK_MSG,
Packit Service 3880ab
	BPF_PROG_TYPE_RAW_TRACEPOINT,
Packit Service 3880ab
	BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
Packit Service 3880ab
	BPF_PROG_TYPE_LWT_SEG6LOCAL,
Packit Service 3880ab
	BPF_PROG_TYPE_LIRC_MODE2,
Packit Service 3880ab
	BPF_PROG_TYPE_SK_REUSEPORT,
Packit Service 3880ab
	BPF_PROG_TYPE_FLOW_DISSECTOR,
Packit Service 3880ab
	BPF_PROG_TYPE_CGROUP_SYSCTL,
Packit Service 3880ab
	BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
Packit Service 3880ab
	BPF_PROG_TYPE_CGROUP_SOCKOPT,
Packit Service 3880ab
	BPF_PROG_TYPE_TRACING,
Packit Service 3880ab
	BPF_PROG_TYPE_STRUCT_OPS,
Packit Service 3880ab
	BPF_PROG_TYPE_EXT,
Packit Service 3880ab
	BPF_PROG_TYPE_LSM,
Packit Service 3880ab
	BPF_PROG_TYPE_SK_LOOKUP,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
enum bpf_attach_type {
Packit Service 3880ab
	BPF_CGROUP_INET_INGRESS,
Packit Service 3880ab
	BPF_CGROUP_INET_EGRESS,
Packit Service 3880ab
	BPF_CGROUP_INET_SOCK_CREATE,
Packit Service 3880ab
	BPF_CGROUP_SOCK_OPS,
Packit Service 3880ab
	BPF_SK_SKB_STREAM_PARSER,
Packit Service 3880ab
	BPF_SK_SKB_STREAM_VERDICT,
Packit Service 3880ab
	BPF_CGROUP_DEVICE,
Packit Service 3880ab
	BPF_SK_MSG_VERDICT,
Packit Service 3880ab
	BPF_CGROUP_INET4_BIND,
Packit Service 3880ab
	BPF_CGROUP_INET6_BIND,
Packit Service 3880ab
	BPF_CGROUP_INET4_CONNECT,
Packit Service 3880ab
	BPF_CGROUP_INET6_CONNECT,
Packit Service 3880ab
	BPF_CGROUP_INET4_POST_BIND,
Packit Service 3880ab
	BPF_CGROUP_INET6_POST_BIND,
Packit Service 3880ab
	BPF_CGROUP_UDP4_SENDMSG,
Packit Service 3880ab
	BPF_CGROUP_UDP6_SENDMSG,
Packit Service 3880ab
	BPF_LIRC_MODE2,
Packit Service 3880ab
	BPF_FLOW_DISSECTOR,
Packit Service 3880ab
	BPF_CGROUP_SYSCTL,
Packit Service 3880ab
	BPF_CGROUP_UDP4_RECVMSG,
Packit Service 3880ab
	BPF_CGROUP_UDP6_RECVMSG,
Packit Service 3880ab
	BPF_CGROUP_GETSOCKOPT,
Packit Service 3880ab
	BPF_CGROUP_SETSOCKOPT,
Packit Service 3880ab
	BPF_TRACE_RAW_TP,
Packit Service 3880ab
	BPF_TRACE_FENTRY,
Packit Service 3880ab
	BPF_TRACE_FEXIT,
Packit Service 3880ab
	BPF_MODIFY_RETURN,
Packit Service 3880ab
	BPF_LSM_MAC,
Packit Service 3880ab
	BPF_TRACE_ITER,
Packit Service 3880ab
	BPF_CGROUP_INET4_GETPEERNAME,
Packit Service 3880ab
	BPF_CGROUP_INET6_GETPEERNAME,
Packit Service 3880ab
	BPF_CGROUP_INET4_GETSOCKNAME,
Packit Service 3880ab
	BPF_CGROUP_INET6_GETSOCKNAME,
Packit Service 3880ab
	BPF_XDP_DEVMAP,
Packit Service 3880ab
	BPF_CGROUP_INET_SOCK_RELEASE,
Packit Service 3880ab
	BPF_XDP_CPUMAP,
Packit Service 3880ab
	BPF_SK_LOOKUP,
Packit Service 3880ab
	BPF_XDP,
Packit Service 3880ab
	__MAX_BPF_ATTACH_TYPE
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE
Packit Service 3880ab
Packit Service 3880ab
enum bpf_link_type {
Packit Service 3880ab
	BPF_LINK_TYPE_UNSPEC = 0,
Packit Service 3880ab
	BPF_LINK_TYPE_RAW_TRACEPOINT = 1,
Packit Service 3880ab
	BPF_LINK_TYPE_TRACING = 2,
Packit Service 3880ab
	BPF_LINK_TYPE_CGROUP = 3,
Packit Service 3880ab
	BPF_LINK_TYPE_ITER = 4,
Packit Service 3880ab
	BPF_LINK_TYPE_NETNS = 5,
Packit Service 3880ab
	BPF_LINK_TYPE_XDP = 6,
Packit Service 3880ab
Packit Service 3880ab
	MAX_BPF_LINK_TYPE,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
/* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
Packit Service 3880ab
 *
Packit Service 3880ab
 * NONE(default): No further bpf programs allowed in the subtree.
Packit Service 3880ab
 *
Packit Service 3880ab
 * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program,
Packit Service 3880ab
 * the program in this cgroup yields to sub-cgroup program.
Packit Service 3880ab
 *
Packit Service 3880ab
 * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program,
Packit Service 3880ab
 * that cgroup program gets run in addition to the program in this cgroup.
Packit Service 3880ab
 *
Packit Service 3880ab
 * Only one program is allowed to be attached to a cgroup with
Packit Service 3880ab
 * NONE or BPF_F_ALLOW_OVERRIDE flag.
Packit Service 3880ab
 * Attaching another program on top of NONE or BPF_F_ALLOW_OVERRIDE will
Packit Service 3880ab
 * release old program and attach the new one. Attach flags has to match.
Packit Service 3880ab
 *
Packit Service 3880ab
 * Multiple programs are allowed to be attached to a cgroup with
Packit Service 3880ab
 * BPF_F_ALLOW_MULTI flag. They are executed in FIFO order
Packit Service 3880ab
 * (those that were attached first, run first)
Packit Service 3880ab
 * The programs of sub-cgroup are executed first, then programs of
Packit Service 3880ab
 * this cgroup and then programs of parent cgroup.
Packit Service 3880ab
 * When children program makes decision (like picking TCP CA or sock bind)
Packit Service 3880ab
 * parent program has a chance to override it.
Packit Service 3880ab
 *
Packit Service 3880ab
 * With BPF_F_ALLOW_MULTI a new program is added to the end of the list of
Packit Service 3880ab
 * programs for a cgroup. Though it's possible to replace an old program at
Packit Service 3880ab
 * any position by also specifying BPF_F_REPLACE flag and position itself in
Packit Service 3880ab
 * replace_bpf_fd attribute. Old program at this position will be released.
Packit Service 3880ab
 *
Packit Service 3880ab
 * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups.
Packit Service 3880ab
 * A cgroup with NONE doesn't allow any programs in sub-cgroups.
Packit Service 3880ab
 * Ex1:
Packit Service 3880ab
 * cgrp1 (MULTI progs A, B) ->
Packit Service 3880ab
 *    cgrp2 (OVERRIDE prog C) ->
Packit Service 3880ab
 *      cgrp3 (MULTI prog D) ->
Packit Service 3880ab
 *        cgrp4 (OVERRIDE prog E) ->
Packit Service 3880ab
 *          cgrp5 (NONE prog F)
Packit Service 3880ab
 * the event in cgrp5 triggers execution of F,D,A,B in that order.
Packit Service 3880ab
 * if prog F is detached, the execution is E,D,A,B
Packit Service 3880ab
 * if prog F and D are detached, the execution is E,A,B
Packit Service 3880ab
 * if prog F, E and D are detached, the execution is C,A,B
Packit Service 3880ab
 *
Packit Service 3880ab
 * All eligible programs are executed regardless of return code from
Packit Service 3880ab
 * earlier programs.
Packit Service 3880ab
 */
Packit Service 3880ab
#define BPF_F_ALLOW_OVERRIDE	(1U << 0)
Packit Service 3880ab
#define BPF_F_ALLOW_MULTI	(1U << 1)
Packit Service 3880ab
#define BPF_F_REPLACE		(1U << 2)
Packit Service 3880ab
Packit Service 3880ab
/* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
Packit Service 3880ab
 * verifier will perform strict alignment checking as if the kernel
Packit Service 3880ab
 * has been built with CONFIG_EFFICIENT_UNALIGNED_ACCESS not set,
Packit Service 3880ab
 * and NET_IP_ALIGN defined to 2.
Packit Service 3880ab
 */
Packit Service 3880ab
#define BPF_F_STRICT_ALIGNMENT	(1U << 0)
Packit Service 3880ab
Packit Service 3880ab
/* If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the
Packit Service 3880ab
 * verifier will allow any alignment whatsoever.  On platforms
Packit Service 3880ab
 * with strict alignment requirements for loads ands stores (such
Packit Service 3880ab
 * as sparc and mips) the verifier validates that all loads and
Packit Service 3880ab
 * stores provably follow this requirement.  This flag turns that
Packit Service 3880ab
 * checking and enforcement off.
Packit Service 3880ab
 *
Packit Service 3880ab
 * It is mostly used for testing when we want to validate the
Packit Service 3880ab
 * context and memory access aspects of the verifier, but because
Packit Service 3880ab
 * of an unaligned access the alignment check would trigger before
Packit Service 3880ab
 * the one we are interested in.
Packit Service 3880ab
 */
Packit Service 3880ab
#define BPF_F_ANY_ALIGNMENT	(1U << 1)
Packit Service 3880ab
Packit Service 3880ab
/* BPF_F_TEST_RND_HI32 is used in BPF_PROG_LOAD command for testing purpose.
Packit Service 3880ab
 * Verifier does sub-register def/use analysis and identifies instructions whose
Packit Service 3880ab
 * def only matters for low 32-bit, high 32-bit is never referenced later
Packit Service 3880ab
 * through implicit zero extension. Therefore verifier notifies JIT back-ends
Packit Service 3880ab
 * that it is safe to ignore clearing high 32-bit for these instructions. This
Packit Service 3880ab
 * saves some back-ends a lot of code-gen. However such optimization is not
Packit Service 3880ab
 * necessary on some arches, for example x86_64, arm64 etc, whose JIT back-ends
Packit Service 3880ab
 * hence hasn't used verifier's analysis result. But, we really want to have a
Packit Service 3880ab
 * way to be able to verify the correctness of the described optimization on
Packit Service 3880ab
 * x86_64 on which testsuites are frequently exercised.
Packit Service 3880ab
 *
Packit Service 3880ab
 * So, this flag is introduced. Once it is set, verifier will randomize high
Packit Service 3880ab
 * 32-bit for those instructions who has been identified as safe to ignore them.
Packit Service 3880ab
 * Then, if verifier is not doing correct analysis, such randomization will
Packit Service 3880ab
 * regress tests to expose bugs.
Packit Service 3880ab
 */
Packit Service 3880ab
#define BPF_F_TEST_RND_HI32	(1U << 2)
Packit Service 3880ab
Packit Service 3880ab
/* The verifier internal test flag. Behavior is undefined */
Packit Service 3880ab
#define BPF_F_TEST_STATE_FREQ	(1U << 3)
Packit Service 3880ab
Packit Service 3880ab
/* When BPF ldimm64's insn[0].src_reg != 0 then this can have
Packit Service 3880ab
 * two extensions:
Packit Service 3880ab
 *
Packit Service 3880ab
 * insn[0].src_reg:  BPF_PSEUDO_MAP_FD   BPF_PSEUDO_MAP_VALUE
Packit Service 3880ab
 * insn[0].imm:      map fd              map fd
Packit Service 3880ab
 * insn[1].imm:      0                   offset into value
Packit Service 3880ab
 * insn[0].off:      0                   0
Packit Service 3880ab
 * insn[1].off:      0                   0
Packit Service 3880ab
 * ldimm64 rewrite:  address of map      address of map[0]+offset
Packit Service 3880ab
 * verifier type:    CONST_PTR_TO_MAP    PTR_TO_MAP_VALUE
Packit Service 3880ab
 */
Packit Service 3880ab
#define BPF_PSEUDO_MAP_FD	1
Packit Service 3880ab
#define BPF_PSEUDO_MAP_VALUE	2
Packit Service 3880ab
Packit Service 3880ab
/* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
Packit Service 3880ab
 * offset to another bpf function
Packit Service 3880ab
 */
Packit Service 3880ab
#define BPF_PSEUDO_CALL		1
Packit Service 3880ab
Packit Service 3880ab
/* flags for BPF_MAP_UPDATE_ELEM command */
Packit Service 3880ab
enum {
Packit Service 3880ab
	BPF_ANY		= 0, /* create new element or update existing */
Packit Service 3880ab
	BPF_NOEXIST	= 1, /* create new element if it didn't exist */
Packit Service 3880ab
	BPF_EXIST	= 2, /* update existing element */
Packit Service 3880ab
	BPF_F_LOCK	= 4, /* spin_lock-ed map_lookup/map_update */
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
/* flags for BPF_MAP_CREATE command */
Packit Service 3880ab
enum {
Packit Service 3880ab
	BPF_F_NO_PREALLOC	= (1U << 0),
Packit Service 3880ab
/* Instead of having one common LRU list in the
Packit Service 3880ab
 * BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list
Packit Service 3880ab
 * which can scale and perform better.
Packit Service 3880ab
 * Note, the LRU nodes (including free nodes) cannot be moved
Packit Service 3880ab
 * across different LRU lists.
Packit Service 3880ab
 */
Packit Service 3880ab
	BPF_F_NO_COMMON_LRU	= (1U << 1),
Packit Service 3880ab
/* Specify numa node during map creation */
Packit Service 3880ab
	BPF_F_NUMA_NODE		= (1U << 2),
Packit Service 3880ab
Packit Service 3880ab
/* Flags for accessing BPF object from syscall side. */
Packit Service 3880ab
	BPF_F_RDONLY		= (1U << 3),
Packit Service 3880ab
	BPF_F_WRONLY		= (1U << 4),
Packit Service 3880ab
Packit Service 3880ab
/* Flag for stack_map, store build_id+offset instead of pointer */
Packit Service 3880ab
	BPF_F_STACK_BUILD_ID	= (1U << 5),
Packit Service 3880ab
Packit Service 3880ab
/* Zero-initialize hash function seed. This should only be used for testing. */
Packit Service 3880ab
	BPF_F_ZERO_SEED		= (1U << 6),
Packit Service 3880ab
Packit Service 3880ab
/* Flags for accessing BPF object from program side. */
Packit Service 3880ab
	BPF_F_RDONLY_PROG	= (1U << 7),
Packit Service 3880ab
	BPF_F_WRONLY_PROG	= (1U << 8),
Packit Service 3880ab
Packit Service 3880ab
/* Clone map from listener for newly accepted socket */
Packit Service 3880ab
	BPF_F_CLONE		= (1U << 9),
Packit Service 3880ab
Packit Service 3880ab
/* Enable memory-mapping BPF map */
Packit Service 3880ab
	BPF_F_MMAPABLE		= (1U << 10),
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
/* Flags for BPF_PROG_QUERY. */
Packit Service 3880ab
Packit Service 3880ab
/* Query effective (directly attached + inherited from ancestor cgroups)
Packit Service 3880ab
 * programs that will be executed for events within a cgroup.
Packit Service 3880ab
 * attach_flags with this flag are returned only for directly attached programs.
Packit Service 3880ab
 */
Packit Service 3880ab
#define BPF_F_QUERY_EFFECTIVE	(1U << 0)
Packit Service 3880ab
Packit Service 3880ab
/* type for BPF_ENABLE_STATS */
Packit Service 3880ab
enum bpf_stats_type {
Packit Service 3880ab
	/* enabled run_time_ns and run_cnt */
Packit Service 3880ab
	BPF_STATS_RUN_TIME = 0,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
enum bpf_stack_build_id_status {
Packit Service 3880ab
	/* user space need an empty entry to identify end of a trace */
Packit Service 3880ab
	BPF_STACK_BUILD_ID_EMPTY = 0,
Packit Service 3880ab
	/* with valid build_id and offset */
Packit Service 3880ab
	BPF_STACK_BUILD_ID_VALID = 1,
Packit Service 3880ab
	/* couldn't get build_id, fallback to ip */
Packit Service 3880ab
	BPF_STACK_BUILD_ID_IP = 2,
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
#define BPF_BUILD_ID_SIZE 20
Packit Service 3880ab
struct bpf_stack_build_id {
Packit Service 3880ab
	__s32		status;
Packit Service 3880ab
	unsigned char	build_id[BPF_BUILD_ID_SIZE];
Packit Service 3880ab
	union {
Packit Service 3880ab
		__u64	offset;
Packit Service 3880ab
		__u64	ip;
Packit Service 3880ab
	};
Packit Service 3880ab
};
Packit Service 3880ab
Packit Service 3880ab
#define BPF_OBJ_NAME_LEN 16U
Packit Service 3880ab
Packit Service 3880ab
union bpf_attr {
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_MAP_CREATE command */
Packit Service 3880ab
		__u32	map_type;	/* one of enum bpf_map_type */
Packit Service 3880ab
		__u32	key_size;	/* size of key in bytes */
Packit Service 3880ab
		__u32	value_size;	/* size of value in bytes */
Packit Service 3880ab
		__u32	max_entries;	/* max number of entries in a map */
Packit Service 3880ab
		__u32	map_flags;	/* BPF_MAP_CREATE related
Packit Service 3880ab
					 * flags defined above.
Packit Service 3880ab
					 */
Packit Service 3880ab
		__u32	inner_map_fd;	/* fd pointing to the inner map */
Packit Service 3880ab
		__u32	numa_node;	/* numa node (effective only if
Packit Service 3880ab
					 * BPF_F_NUMA_NODE is set).
Packit Service 3880ab
					 */
Packit Service 3880ab
		char	map_name[BPF_OBJ_NAME_LEN];
Packit Service 3880ab
		__u32	map_ifindex;	/* ifindex of netdev to create on */
Packit Service 3880ab
		__u32	btf_fd;		/* fd pointing to a BTF type data */
Packit Service 3880ab
		__u32	btf_key_type_id;	/* BTF type_id of the key */
Packit Service 3880ab
		__u32	btf_value_type_id;	/* BTF type_id of the value */
Packit Service 3880ab
		__u32	btf_vmlinux_value_type_id;/* BTF type_id of a kernel-
Packit Service 3880ab
						   * struct stored as the
Packit Service 3880ab
						   * map value
Packit Service 3880ab
						   */
Packit Service 3880ab
	};
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
Packit Service 3880ab
		__u32		map_fd;
Packit Service 3880ab
		__aligned_u64	key;
Packit Service 3880ab
		union {
Packit Service 3880ab
			__aligned_u64 value;
Packit Service 3880ab
			__aligned_u64 next_key;
Packit Service 3880ab
		};
Packit Service 3880ab
		__u64		flags;
Packit Service 3880ab
	};
Packit Service 3880ab
Packit Service 3880ab
	struct { /* struct used by BPF_MAP_*_BATCH commands */
Packit Service 3880ab
		__aligned_u64	in_batch;	/* start batch,
Packit Service 3880ab
						 * NULL to start from beginning
Packit Service 3880ab
						 */
Packit Service 3880ab
		__aligned_u64	out_batch;	/* output: next start batch */
Packit Service 3880ab
		__aligned_u64	keys;
Packit Service 3880ab
		__aligned_u64	values;
Packit Service 3880ab
		__u32		count;		/* input/output:
Packit Service 3880ab
						 * input: # of key/value
Packit Service 3880ab
						 * elements
Packit Service 3880ab
						 * output: # of filled elements
Packit Service 3880ab
						 */
Packit Service 3880ab
		__u32		map_fd;
Packit Service 3880ab
		__u64		elem_flags;
Packit Service 3880ab
		__u64		flags;
Packit Service 3880ab
	} batch;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_PROG_LOAD command */
Packit Service 3880ab
		__u32		prog_type;	/* one of enum bpf_prog_type */
Packit Service 3880ab
		__u32		insn_cnt;
Packit Service 3880ab
		__aligned_u64	insns;
Packit Service 3880ab
		__aligned_u64	license;
Packit Service 3880ab
		__u32		log_level;	/* verbosity level of verifier */
Packit Service 3880ab
		__u32		log_size;	/* size of user buffer */
Packit Service 3880ab
		__aligned_u64	log_buf;	/* user supplied buffer */
Packit Service 3880ab
		__u32		kern_version;	/* not used */
Packit Service 3880ab
		__u32		prog_flags;
Packit Service 3880ab
		char		prog_name[BPF_OBJ_NAME_LEN];
Packit Service 3880ab
		__u32		prog_ifindex;	/* ifindex of netdev to prep for */
Packit Service 3880ab
		/* For some prog types expected attach type must be known at
Packit Service 3880ab
		 * load time to verify attach type specific parts of prog
Packit Service 3880ab
		 * (context accesses, allowed helpers, etc).
Packit Service 3880ab
		 */
Packit Service 3880ab
		__u32		expected_attach_type;
Packit Service 3880ab
		__u32		prog_btf_fd;	/* fd pointing to BTF type data */
Packit Service 3880ab
		__u32		func_info_rec_size;	/* userspace bpf_func_info size */
Packit Service 3880ab
		__aligned_u64	func_info;	/* func info */
Packit Service 3880ab
		__u32		func_info_cnt;	/* number of bpf_func_info records */
Packit Service 3880ab
		__u32		line_info_rec_size;	/* userspace bpf_line_info size */
Packit Service 3880ab
		__aligned_u64	line_info;	/* line info */
Packit Service 3880ab
		__u32		line_info_cnt;	/* number of bpf_line_info records */
Packit Service 3880ab
		__u32		attach_btf_id;	/* in-kernel BTF type id to attach to */
Packit Service 3880ab
		__u32		attach_prog_fd; /* 0 to attach to vmlinux */
Packit Service 3880ab
	};
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_OBJ_* commands */
Packit Service 3880ab
		__aligned_u64	pathname;
Packit Service 3880ab
		__u32		bpf_fd;
Packit Service 3880ab
		__u32		file_flags;
Packit Service 3880ab
	};
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
Packit Service 3880ab
		__u32		target_fd;	/* container object to attach to */
Packit Service 3880ab
		__u32		attach_bpf_fd;	/* eBPF program to attach */
Packit Service 3880ab
		__u32		attach_type;
Packit Service 3880ab
		__u32		attach_flags;
Packit Service 3880ab
		__u32		replace_bpf_fd;	/* previously attached eBPF
Packit Service 3880ab
						 * program to replace if
Packit Service 3880ab
						 * BPF_F_REPLACE is used
Packit Service 3880ab
						 */
Packit Service 3880ab
	};
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
Packit Service 3880ab
		__u32		prog_fd;
Packit Service 3880ab
		__u32		retval;
Packit Service 3880ab
		__u32		data_size_in;	/* input: len of data_in */
Packit Service 3880ab
		__u32		data_size_out;	/* input/output: len of data_out
Packit Service 3880ab
						 *   returns ENOSPC if data_out
Packit Service 3880ab
						 *   is too small.
Packit Service 3880ab
						 */
Packit Service 3880ab
		__aligned_u64	data_in;
Packit Service 3880ab
		__aligned_u64	data_out;
Packit Service 3880ab
		__u32		repeat;
Packit Service 3880ab
		__u32		duration;
Packit Service 3880ab
		__u32		ctx_size_in;	/* input: len of ctx_in */
Packit Service 3880ab
		__u32		ctx_size_out;	/* input/output: len of ctx_out
Packit Service 3880ab
						 *   returns ENOSPC if ctx_out
Packit Service 3880ab
						 *   is too small.
Packit Service 3880ab
						 */
Packit Service 3880ab
		__aligned_u64	ctx_in;
Packit Service 3880ab
		__aligned_u64	ctx_out;
Packit Service 3880ab
	} test;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_*_GET_*_ID */
Packit Service 3880ab
		union {
Packit Service 3880ab
			__u32		start_id;
Packit Service 3880ab
			__u32		prog_id;
Packit Service 3880ab
			__u32		map_id;
Packit Service 3880ab
			__u32		btf_id;
Packit Service 3880ab
			__u32		link_id;
Packit Service 3880ab
		};
Packit Service 3880ab
		__u32		next_id;
Packit Service 3880ab
		__u32		open_flags;
Packit Service 3880ab
	};
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */
Packit Service 3880ab
		__u32		bpf_fd;
Packit Service 3880ab
		__u32		info_len;
Packit Service 3880ab
		__aligned_u64	info;
Packit Service 3880ab
	} info;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_PROG_QUERY command */
Packit Service 3880ab
		__u32		target_fd;	/* container object to query */
Packit Service 3880ab
		__u32		attach_type;
Packit Service 3880ab
		__u32		query_flags;
Packit Service 3880ab
		__u32		attach_flags;
Packit Service 3880ab
		__aligned_u64	prog_ids;
Packit Service 3880ab
		__u32		prog_cnt;
Packit Service 3880ab
	} query;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
Packit Service 3880ab
		__u64 name;
Packit Service 3880ab
		__u32 prog_fd;
Packit Service 3880ab
	} raw_tracepoint;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* anonymous struct for BPF_BTF_LOAD */
Packit Service 3880ab
		__aligned_u64	btf;
Packit Service 3880ab
		__aligned_u64	btf_log_buf;
Packit Service 3880ab
		__u32		btf_size;
Packit Service 3880ab
		__u32		btf_log_size;
Packit Service 3880ab
		__u32		btf_log_level;
Packit Service 3880ab
	};
Packit Service 3880ab
Packit Service 3880ab
	struct {
Packit Service 3880ab
		__u32		pid;		/* input: pid */
Packit Service 3880ab
		__u32		fd;		/* input: fd */
Packit Service 3880ab
		__u32		flags;		/* input: flags */
Packit Service 3880ab
		__u32		buf_len;	/* input/output: buf len */
Packit Service 3880ab
		__aligned_u64	buf;		/* input/output:
Packit Service 3880ab
						 *   tp_name for tracepoint
Packit Service 3880ab
						 *   symbol for kprobe
Packit Service 3880ab
						 *   filename for uprobe
Packit Service 3880ab
						 */
Packit Service 3880ab
		__u32		prog_id;	/* output: prod_id */
Packit Service 3880ab
		__u32		fd_type;	/* output: BPF_FD_TYPE_* */
Packit Service 3880ab
		__u64		probe_offset;	/* output: probe_offset */
Packit Service 3880ab
		__u64		probe_addr;	/* output: probe_addr */
Packit Service 3880ab
	} task_fd_query;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* struct used by BPF_LINK_CREATE command */
Packit Service 3880ab
		__u32		prog_fd;	/* eBPF program to attach */
Packit Service 3880ab
		union {
Packit Service 3880ab
			__u32		target_fd;	/* object to attach to */
Packit Service 3880ab
			__u32		target_ifindex; /* target ifindex */
Packit Service 3880ab
		};
Packit Service 3880ab
		__u32		attach_type;	/* attach type */
Packit Service 3880ab
		__u32		flags;		/* extra flags */
Packit Service bd02ce
		__aligned_u64	iter_info;	/* extra bpf_iter_link_info */
Packit Service bd02ce
		__u32		iter_info_len;	/* iter_info length */
Packit Service 3880ab
	} link_create;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* struct used by BPF_LINK_UPDATE command */
Packit Service 3880ab
		__u32		link_fd;	/* link fd */
Packit Service 3880ab
		/* new program fd to update link with */
Packit Service 3880ab
		__u32		new_prog_fd;
Packit Service 3880ab
		__u32		flags;		/* extra flags */
Packit Service 3880ab
		/* expected link's program fd; is specified only if
Packit Service 3880ab
		 * BPF_F_REPLACE flag is set in flags */
Packit Service 3880ab
		__u32		old_prog_fd;
Packit Service 3880ab
	} link_update;
Packit Service 3880ab
Packit Service 3880ab
	struct {
Packit Service 3880ab
		__u32		link_fd;
Packit Service 3880ab
	} link_detach;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* struct used by BPF_ENABLE_STATS command */
Packit Service 3880ab
		__u32		type;
Packit Service 3880ab
	} enable_stats;
Packit Service 3880ab
Packit Service 3880ab
	struct { /* struct used by BPF_ITER_CREATE command */
Packit Service 3880ab
		__u32		link_fd;
Packit Service 3880ab
		__u32		flags;
Packit Service 3880ab
	} iter_create;
Packit Service 3880ab
Packit Service 3880ab
} __attribute__((aligned(8)));
Packit Service 3880ab
Packit Service 3880ab
/* The description below is an attempt at providing documentation to eBPF
Packit Service 3880ab
 * developers about the multiple available eBPF helper functions. It can be
Packit Service 3880ab
 * parsed and used to produce a manual page. The workflow is the following,
Packit Service 3880ab
 * and requires the rst2man utility:
Packit Service 3880ab
 *
Packit Service 3880ab
 *     $ ./scripts/bpf_helpers_doc.py \
Packit Service 3880ab
 *             --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst
Packit Service 3880ab
 *     $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7
Packit Service 3880ab
 *     $ man /tmp/bpf-helpers.7
Packit Service 3880ab
 *
Packit Service 3880ab
 * Note that in order to produce this external documentation, some RST
Packit Service 3880ab
 * formatting is used in the descriptions to get "bold" and "italics" in
Packit Service 3880ab
 * manual pages. Also note that the few trailing white spaces are
Packit Service 3880ab
 * intentional, removing them would break paragraphs for rst2man.
Packit Service 3880ab
 *
Packit Service 3880ab
 * Start of BPF helper function descriptions:
Packit Service 3880ab
 *
Packit Service 3880ab
 * void *bpf_map_lookup_elem(struct bpf_map *map, const void *key)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Perform a lookup in *map* for an entry associated to *key*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		Map value associated to *key*, or **NULL** if no entry was
Packit Service 3880ab
 * 		found.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Add or update the value of the entry associated to *key* in
Packit Service 3880ab
 * 		*map* with *value*. *flags* is one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**BPF_NOEXIST**
Packit Service 3880ab
 * 			The entry for *key* must not exist in the map.
Packit Service 3880ab
 * 		**BPF_EXIST**
Packit Service 3880ab
 * 			The entry for *key* must already exist in the map.
Packit Service 3880ab
 * 		**BPF_ANY**
Packit Service 3880ab
 * 			No condition on the existence of the entry for *key*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Flag value **BPF_NOEXIST** cannot be used for maps of types
Packit Service 3880ab
 * 		**BPF_MAP_TYPE_ARRAY** or **BPF_MAP_TYPE_PERCPU_ARRAY**  (all
Packit Service 3880ab
 * 		elements always exist), the helper would return an error.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_map_delete_elem(struct bpf_map *map, const void *key)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Delete entry with *key* from *map*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_probe_read(void *dst, u32 size, const void *unsafe_ptr)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		For tracing programs, safely attempt to read *size* bytes from
Packit Service 3880ab
 * 		kernel space address *unsafe_ptr* and store the data in *dst*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Generally, use **bpf_probe_read_user**\ () or
Packit Service 3880ab
 * 		**bpf_probe_read_kernel**\ () instead.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_ktime_get_ns(void)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Return the time elapsed since system boot, in nanoseconds.
Packit Service 3880ab
 * 		Does not include time the system was suspended.
Packit Service 3880ab
 * 		See: **clock_gettime**\ (**CLOCK_MONOTONIC**)
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		Current *ktime*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_trace_printk(const char *fmt, u32 fmt_size, ...)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		This helper is a "printk()-like" facility for debugging. It
Packit Service 3880ab
 * 		prints a message defined by format *fmt* (of size *fmt_size*)
Packit Service 3880ab
 * 		to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if
Packit Service 3880ab
 * 		available. It can take up to three additional **u64**
Packit Service 3880ab
 * 		arguments (as an eBPF helpers, the total number of arguments is
Packit Service 3880ab
 * 		limited to five).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Each time the helper is called, it appends a line to the trace.
Packit Service 3880ab
 * 		Lines are discarded while *\/sys/kernel/debug/tracing/trace* is
Packit Service 3880ab
 * 		open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this.
Packit Service 3880ab
 * 		The format of the trace is customizable, and the exact output
Packit Service 3880ab
 * 		one will get depends on the options set in
Packit Service 3880ab
 * 		*\/sys/kernel/debug/tracing/trace_options* (see also the
Packit Service 3880ab
 * 		*README* file under the same directory). However, it usually
Packit Service 3880ab
 * 		defaults to something like:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		::
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			telnet-470   [001] .N.. 419421.045894: 0x00000001: <formatted msg>
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		In the above:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			* ``telnet`` is the name of the current task.
Packit Service 3880ab
 * 			* ``470`` is the PID of the current task.
Packit Service 3880ab
 * 			* ``001`` is the CPU number on which the task is
Packit Service 3880ab
 * 			  running.
Packit Service 3880ab
 * 			* In ``.N..``, each character refers to a set of
Packit Service 3880ab
 * 			  options (whether irqs are enabled, scheduling
Packit Service 3880ab
 * 			  options, whether hard/softirqs are running, level of
Packit Service 3880ab
 * 			  preempt_disabled respectively). **N** means that
Packit Service 3880ab
 * 			  **TIF_NEED_RESCHED** and **PREEMPT_NEED_RESCHED**
Packit Service 3880ab
 * 			  are set.
Packit Service 3880ab
 * 			* ``419421.045894`` is a timestamp.
Packit Service 3880ab
 * 			* ``0x00000001`` is a fake value used by BPF for the
Packit Service 3880ab
 * 			  instruction pointer register.
Packit Service 3880ab
 * 			* ``<formatted msg>`` is the message formatted with
Packit Service 3880ab
 * 			  *fmt*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The conversion specifiers supported by *fmt* are similar, but
Packit Service 3880ab
 * 		more limited than for printk(). They are **%d**, **%i**,
Packit Service 3880ab
 * 		**%u**, **%x**, **%ld**, **%li**, **%lu**, **%lx**, **%lld**,
Packit Service 3880ab
 * 		**%lli**, **%llu**, **%llx**, **%p**, **%s**. No modifier (size
Packit Service 3880ab
 * 		of field, padding with zeroes, etc.) is available, and the
Packit Service 3880ab
 * 		helper will return **-EINVAL** (but print nothing) if it
Packit Service 3880ab
 * 		encounters an unknown specifier.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Also, note that **bpf_trace_printk**\ () is slow, and should
Packit Service 3880ab
 * 		only be used for debugging purposes. For this reason, a notice
Packit Service 3880ab
 * 		block (spanning several lines) is printed to kernel logs and
Packit Service 3880ab
 * 		states that the helper should not be used "for production use"
Packit Service 3880ab
 * 		the first time this helper is used (or more precisely, when
Packit Service 3880ab
 * 		**trace_printk**\ () buffers are allocated). For passing values
Packit Service 3880ab
 * 		to user space, perf events should be preferred.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The number of bytes written to the buffer, or a negative error
Packit Service 3880ab
 * 		in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u32 bpf_get_prandom_u32(void)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Get a pseudo-random number.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		From a security point of view, this helper uses its own
Packit Service 3880ab
 * 		pseudo-random internal state, and cannot be used to infer the
Packit Service 3880ab
 * 		seed of other random functions in the kernel. However, it is
Packit Service 3880ab
 * 		essential to note that the generator used by the helper is not
Packit Service 3880ab
 * 		cryptographically secure.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A random 32-bit unsigned value.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u32 bpf_get_smp_processor_id(void)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Get the SMP (symmetric multiprocessing) processor id. Note that
Packit Service 3880ab
 * 		all programs run with preemption disabled, which means that the
Packit Service 3880ab
 * 		SMP processor id is stable during all the execution of the
Packit Service 3880ab
 * 		program.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The SMP id of the processor running the program.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Store *len* bytes from address *from* into the packet
Packit Service 3880ab
 * 		associated to *skb*, at *offset*. *flags* are a combination of
Packit Service 3880ab
 * 		**BPF_F_RECOMPUTE_CSUM** (automatically recompute the
Packit Service 3880ab
 * 		checksum for the packet after storing the bytes) and
Packit Service 3880ab
 * 		**BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\
Packit Service 3880ab
 * 		**->swhash** and *skb*\ **->l4hash** to 0).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_l3_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 size)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Recompute the layer 3 (e.g. IP) checksum for the packet
Packit Service 3880ab
 * 		associated to *skb*. Computation is incremental, so the helper
Packit Service 3880ab
 * 		must know the former value of the header field that was
Packit Service 3880ab
 * 		modified (*from*), the new value of this field (*to*), and the
Packit Service 3880ab
 * 		number of bytes (2 or 4) for this field, stored in *size*.
Packit Service 3880ab
 * 		Alternatively, it is possible to store the difference between
Packit Service 3880ab
 * 		the previous and the new values of the header field in *to*, by
Packit Service 3880ab
 * 		setting *from* and *size* to 0. For both methods, *offset*
Packit Service 3880ab
 * 		indicates the location of the IP checksum within the packet.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper works in combination with **bpf_csum_diff**\ (),
Packit Service 3880ab
 * 		which does not update the checksum in-place, but offers more
Packit Service 3880ab
 * 		flexibility and can handle sizes larger than 2 or 4 for the
Packit Service 3880ab
 * 		checksum to update.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_l4_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Recompute the layer 4 (e.g. TCP, UDP or ICMP) checksum for the
Packit Service 3880ab
 * 		packet associated to *skb*. Computation is incremental, so the
Packit Service 3880ab
 * 		helper must know the former value of the header field that was
Packit Service 3880ab
 * 		modified (*from*), the new value of this field (*to*), and the
Packit Service 3880ab
 * 		number of bytes (2 or 4) for this field, stored on the lowest
Packit Service 3880ab
 * 		four bits of *flags*. Alternatively, it is possible to store
Packit Service 3880ab
 * 		the difference between the previous and the new values of the
Packit Service 3880ab
 * 		header field in *to*, by setting *from* and the four lowest
Packit Service 3880ab
 * 		bits of *flags* to 0. For both methods, *offset* indicates the
Packit Service 3880ab
 * 		location of the IP checksum within the packet. In addition to
Packit Service 3880ab
 * 		the size of the field, *flags* can be added (bitwise OR) actual
Packit Service 3880ab
 * 		flags. With **BPF_F_MARK_MANGLED_0**, a null checksum is left
Packit Service 3880ab
 * 		untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and
Packit Service 3880ab
 * 		for updates resulting in a null checksum the value is set to
Packit Service 3880ab
 * 		**CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates
Packit Service 3880ab
 * 		the checksum is to be computed against a pseudo-header.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper works in combination with **bpf_csum_diff**\ (),
Packit Service 3880ab
 * 		which does not update the checksum in-place, but offers more
Packit Service 3880ab
 * 		flexibility and can handle sizes larger than 2 or 4 for the
Packit Service 3880ab
 * 		checksum to update.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_tail_call(void *ctx, struct bpf_map *prog_array_map, u32 index)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		This special helper is used to trigger a "tail call", or in
Packit Service 3880ab
 * 		other words, to jump into another eBPF program. The same stack
Packit Service 3880ab
 * 		frame is used (but values on stack and in registers for the
Packit Service 3880ab
 * 		caller are not accessible to the callee). This mechanism allows
Packit Service 3880ab
 * 		for program chaining, either for raising the maximum number of
Packit Service 3880ab
 * 		available eBPF instructions, or to execute given programs in
Packit Service 3880ab
 * 		conditional blocks. For security reasons, there is an upper
Packit Service 3880ab
 * 		limit to the number of successive tail calls that can be
Packit Service 3880ab
 * 		performed.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Upon call of this helper, the program attempts to jump into a
Packit Service 3880ab
 * 		program referenced at index *index* in *prog_array_map*, a
Packit Service 3880ab
 * 		special map of type **BPF_MAP_TYPE_PROG_ARRAY**, and passes
Packit Service 3880ab
 * 		*ctx*, a pointer to the context.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		If the call succeeds, the kernel immediately runs the first
Packit Service 3880ab
 * 		instruction of the new program. This is not a function call,
Packit Service 3880ab
 * 		and it never returns to the previous program. If the call
Packit Service 3880ab
 * 		fails, then the helper has no effect, and the caller continues
Packit Service 3880ab
 * 		to run its subsequent instructions. A call can fail if the
Packit Service 3880ab
 * 		destination program for the jump does not exist (i.e. *index*
Packit Service 3880ab
 * 		is superior to the number of entries in *prog_array_map*), or
Packit Service 3880ab
 * 		if the maximum number of tail calls has been reached for this
Packit Service 3880ab
 * 		chain of programs. This limit is defined in the kernel by the
Packit Service 3880ab
 * 		macro **MAX_TAIL_CALL_CNT** (not accessible to user space),
Packit Service 3880ab
 * 		which is currently set to 32.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_clone_redirect(struct sk_buff *skb, u32 ifindex, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Clone and redirect the packet associated to *skb* to another
Packit Service 3880ab
 * 		net device of index *ifindex*. Both ingress and egress
Packit Service 3880ab
 * 		interfaces can be used for redirection. The **BPF_F_INGRESS**
Packit Service 3880ab
 * 		value in *flags* is used to make the distinction (ingress path
Packit Service 3880ab
 * 		is selected if the flag is present, egress path otherwise).
Packit Service 3880ab
 * 		This is the only flag supported for now.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		In comparison with **bpf_redirect**\ () helper,
Packit Service 3880ab
 * 		**bpf_clone_redirect**\ () has the associated cost of
Packit Service 3880ab
 * 		duplicating the packet buffer, but this can be executed out of
Packit Service 3880ab
 * 		the eBPF program. Conversely, **bpf_redirect**\ () is more
Packit Service 3880ab
 * 		efficient, but it is handled through an action code where the
Packit Service 3880ab
 * 		redirection happens only after the eBPF program has returned.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_current_pid_tgid(void)
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A 64-bit integer containing the current tgid and pid, and
Packit Service 3880ab
 * 		created as such:
Packit Service 3880ab
 * 		*current_task*\ **->tgid << 32 \|**
Packit Service 3880ab
 * 		*current_task*\ **->pid**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_current_uid_gid(void)
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A 64-bit integer containing the current GID and UID, and
Packit Service 3880ab
 * 		created as such: *current_gid* **<< 32 \|** *current_uid*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_get_current_comm(void *buf, u32 size_of_buf)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Copy the **comm** attribute of the current task into *buf* of
Packit Service 3880ab
 * 		*size_of_buf*. The **comm** attribute contains the name of
Packit Service 3880ab
 * 		the executable (excluding the path) for the current task. The
Packit Service 3880ab
 * 		*size_of_buf* must be strictly positive. On success, the
Packit Service 3880ab
 * 		helper makes sure that the *buf* is NUL-terminated. On failure,
Packit Service 3880ab
 * 		it is filled with zeroes.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u32 bpf_get_cgroup_classid(struct sk_buff *skb)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Retrieve the classid for the current task, i.e. for the net_cls
Packit Service 3880ab
 * 		cgroup to which *skb* belongs.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper can be used on TC egress path, but not on ingress.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The net_cls cgroup provides an interface to tag network packets
Packit Service 3880ab
 * 		based on a user-provided identifier for all traffic coming from
Packit Service 3880ab
 * 		the tasks belonging to the related cgroup. See also the related
Packit Service 3880ab
 * 		kernel documentation, available from the Linux sources in file
Packit Service 3880ab
 * 		*Documentation/admin-guide/cgroup-v1/net_cls.rst*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The Linux kernel has two versions for cgroups: there are
Packit Service 3880ab
 * 		cgroups v1 and cgroups v2. Both are available to users, who can
Packit Service 3880ab
 * 		use a mixture of them, but note that the net_cls cgroup is for
Packit Service 3880ab
 * 		cgroup v1 only. This makes it incompatible with BPF programs
Packit Service 3880ab
 * 		run on cgroups, which is a cgroup-v2-only feature (a socket can
Packit Service 3880ab
 * 		only hold data for one version of cgroups at a time).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper is only available is the kernel was compiled with
Packit Service 3880ab
 * 		the **CONFIG_CGROUP_NET_CLASSID** configuration option set to
Packit Service 3880ab
 * 		"**y**" or to "**m**".
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The classid, or 0 for the default unconfigured classid.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Push a *vlan_tci* (VLAN tag control information) of protocol
Packit Service 3880ab
 * 		*vlan_proto* to the packet associated to *skb*, then update
Packit Service 3880ab
 * 		the checksum. Note that if *vlan_proto* is different from
Packit Service 3880ab
 * 		**ETH_P_8021Q** and **ETH_P_8021AD**, it is considered to
Packit Service 3880ab
 * 		be **ETH_P_8021Q**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_vlan_pop(struct sk_buff *skb)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Pop a VLAN header from the packet associated to *skb*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_get_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Get tunnel metadata. This helper takes a pointer *key* to an
Packit Service 3880ab
 * 		empty **struct bpf_tunnel_key** of **size**, that will be
Packit Service 3880ab
 * 		filled with tunnel metadata for the packet associated to *skb*.
Packit Service 3880ab
 * 		The *flags* can be set to **BPF_F_TUNINFO_IPV6**, which
Packit Service 3880ab
 * 		indicates that the tunnel is based on IPv6 protocol instead of
Packit Service 3880ab
 * 		IPv4.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The **struct bpf_tunnel_key** is an object that generalizes the
Packit Service 3880ab
 * 		principal parameters used by various tunneling protocols into a
Packit Service 3880ab
 * 		single struct. This way, it can be used to easily make a
Packit Service 3880ab
 * 		decision based on the contents of the encapsulation header,
Packit Service 3880ab
 * 		"summarized" in this struct. In particular, it holds the IP
Packit Service 3880ab
 * 		address of the remote end (IPv4 or IPv6, depending on the case)
Packit Service 3880ab
 * 		in *key*\ **->remote_ipv4** or *key*\ **->remote_ipv6**. Also,
Packit Service 3880ab
 * 		this struct exposes the *key*\ **->tunnel_id**, which is
Packit Service 3880ab
 * 		generally mapped to a VNI (Virtual Network Identifier), making
Packit Service 3880ab
 * 		it programmable together with the **bpf_skb_set_tunnel_key**\
Packit Service 3880ab
 * 		() helper.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Let's imagine that the following code is part of a program
Packit Service 3880ab
 * 		attached to the TC ingress interface, on one end of a GRE
Packit Service 3880ab
 * 		tunnel, and is supposed to filter out all messages coming from
Packit Service 3880ab
 * 		remote ends with IPv4 address other than 10.0.0.1:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		::
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			int ret;
Packit Service 3880ab
 * 			struct bpf_tunnel_key key = {};
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0);
Packit Service 3880ab
 * 			if (ret < 0)
Packit Service 3880ab
 * 				return TC_ACT_SHOT;	// drop packet
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			if (key.remote_ipv4 != 0x0a000001)
Packit Service 3880ab
 * 				return TC_ACT_SHOT;	// drop packet
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			return TC_ACT_OK;		// accept packet
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This interface can also be used with all encapsulation devices
Packit Service 3880ab
 * 		that can operate in "collect metadata" mode: instead of having
Packit Service 3880ab
 * 		one network device per specific configuration, the "collect
Packit Service 3880ab
 * 		metadata" mode only requires a single device where the
Packit Service 3880ab
 * 		configuration can be extracted from this helper.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This can be used together with various tunnels such as VXLan,
Packit Service 3880ab
 * 		Geneve, GRE or IP in IP (IPIP).
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_set_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Populate tunnel metadata for packet associated to *skb.* The
Packit Service 3880ab
 * 		tunnel metadata is set to the contents of *key*, of *size*. The
Packit Service 3880ab
 * 		*flags* can be set to a combination of the following values:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**BPF_F_TUNINFO_IPV6**
Packit Service 3880ab
 * 			Indicate that the tunnel is based on IPv6 protocol
Packit Service 3880ab
 * 			instead of IPv4.
Packit Service 3880ab
 * 		**BPF_F_ZERO_CSUM_TX**
Packit Service 3880ab
 * 			For IPv4 packets, add a flag to tunnel metadata
Packit Service 3880ab
 * 			indicating that checksum computation should be skipped
Packit Service 3880ab
 * 			and checksum set to zeroes.
Packit Service 3880ab
 * 		**BPF_F_DONT_FRAGMENT**
Packit Service 3880ab
 * 			Add a flag to tunnel metadata indicating that the
Packit Service 3880ab
 * 			packet should not be fragmented.
Packit Service 3880ab
 * 		**BPF_F_SEQ_NUMBER**
Packit Service 3880ab
 * 			Add a flag to tunnel metadata indicating that a
Packit Service 3880ab
 * 			sequence number should be added to tunnel header before
Packit Service 3880ab
 * 			sending the packet. This flag was added for GRE
Packit Service 3880ab
 * 			encapsulation, but might be used with other protocols
Packit Service 3880ab
 * 			as well in the future.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Here is a typical usage on the transmit path:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		::
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			struct bpf_tunnel_key key;
Packit Service 3880ab
 * 			     populate key ...
Packit Service 3880ab
 * 			bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0);
Packit Service 3880ab
 * 			bpf_clone_redirect(skb, vxlan_dev_ifindex, 0);
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		See also the description of the **bpf_skb_get_tunnel_key**\ ()
Packit Service 3880ab
 * 		helper for additional information.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_perf_event_read(struct bpf_map *map, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Read the value of a perf event counter. This helper relies on a
Packit Service 3880ab
 * 		*map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of
Packit Service 3880ab
 * 		the perf event counter is selected when *map* is updated with
Packit Service 3880ab
 * 		perf event file descriptors. The *map* is an array whose size
Packit Service 3880ab
 * 		is the number of available CPUs, and each cell contains a value
Packit Service 3880ab
 * 		relative to one CPU. The value to retrieve is indicated by
Packit Service 3880ab
 * 		*flags*, that contains the index of the CPU to look up, masked
Packit Service 3880ab
 * 		with **BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to
Packit Service 3880ab
 * 		**BPF_F_CURRENT_CPU** to indicate that the value for the
Packit Service 3880ab
 * 		current CPU should be retrieved.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Note that before Linux 4.13, only hardware perf event can be
Packit Service 3880ab
 * 		retrieved.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Also, be aware that the newer helper
Packit Service 3880ab
 * 		**bpf_perf_event_read_value**\ () is recommended over
Packit Service 3880ab
 * 		**bpf_perf_event_read**\ () in general. The latter has some ABI
Packit Service 3880ab
 * 		quirks where error and counter value are used as a return code
Packit Service 3880ab
 * 		(which is wrong to do since ranges may overlap). This issue is
Packit Service 3880ab
 * 		fixed with **bpf_perf_event_read_value**\ (), which at the same
Packit Service 3880ab
 * 		time provides more features over the **bpf_perf_event_read**\
Packit Service 3880ab
 * 		() interface. Please refer to the description of
Packit Service 3880ab
 * 		**bpf_perf_event_read_value**\ () for details.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The value of the perf event counter read from the map, or a
Packit Service 3880ab
 * 		negative error code in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_redirect(u32 ifindex, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Redirect the packet to another net device of index *ifindex*.
Packit Service 3880ab
 * 		This helper is somewhat similar to **bpf_clone_redirect**\
Packit Service 3880ab
 * 		(), except that the packet is not cloned, which provides
Packit Service 3880ab
 * 		increased performance.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Except for XDP, both ingress and egress interfaces can be used
Packit Service 3880ab
 * 		for redirection. The **BPF_F_INGRESS** value in *flags* is used
Packit Service 3880ab
 * 		to make the distinction (ingress path is selected if the flag
Packit Service 3880ab
 * 		is present, egress path otherwise). Currently, XDP only
Packit Service 3880ab
 * 		supports redirection to the egress interface, and accepts no
Packit Service 3880ab
 * 		flag at all.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The same effect can also be attained with the more generic
Packit Service 3880ab
 * 		**bpf_redirect_map**\ (), which uses a BPF map to store the
Packit Service 3880ab
 * 		redirect target instead of providing it directly to the helper.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		For XDP, the helper returns **XDP_REDIRECT** on success or
Packit Service 3880ab
 * 		**XDP_ABORTED** on error. For other program types, the values
Packit Service 3880ab
 * 		are **TC_ACT_REDIRECT** on success or **TC_ACT_SHOT** on
Packit Service 3880ab
 * 		error.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u32 bpf_get_route_realm(struct sk_buff *skb)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Retrieve the realm or the route, that is to say the
Packit Service 3880ab
 * 		**tclassid** field of the destination for the *skb*. The
Packit Service 3880ab
 * 		identifier retrieved is a user-provided tag, similar to the
Packit Service 3880ab
 * 		one used with the net_cls cgroup (see description for
Packit Service 3880ab
 * 		**bpf_get_cgroup_classid**\ () helper), but here this tag is
Packit Service 3880ab
 * 		held by a route (a destination entry), not by a task.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Retrieving this identifier works with the clsact TC egress hook
Packit Service 3880ab
 * 		(see also **tc-bpf(8)**), or alternatively on conventional
Packit Service 3880ab
 * 		classful egress qdiscs, but not on TC ingress path. In case of
Packit Service 3880ab
 * 		clsact TC egress hook, this has the advantage that, internally,
Packit Service 3880ab
 * 		the destination entry has not been dropped yet in the transmit
Packit Service 3880ab
 * 		path. Therefore, the destination entry does not need to be
Packit Service 3880ab
 * 		artificially held via **netif_keep_dst**\ () for a classful
Packit Service 3880ab
 * 		qdisc until the *skb* is freed.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper is available only if the kernel was compiled with
Packit Service 3880ab
 * 		**CONFIG_IP_ROUTE_CLASSID** configuration option.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The realm of the route for the packet associated to *skb*, or 0
Packit Service 3880ab
 * 		if none was found.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_perf_event_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Write raw *data* blob into a special BPF perf event held by
Packit Service 3880ab
 * 		*map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
Packit Service 3880ab
 * 		event must have the following attributes: **PERF_SAMPLE_RAW**
Packit Service 3880ab
 * 		as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and
Packit Service 3880ab
 * 		**PERF_COUNT_SW_BPF_OUTPUT** as **config**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The *flags* are used to indicate the index in *map* for which
Packit Service 3880ab
 * 		the value must be put, masked with **BPF_F_INDEX_MASK**.
Packit Service 3880ab
 * 		Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU**
Packit Service 3880ab
 * 		to indicate that the index of the current CPU core should be
Packit Service 3880ab
 * 		used.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The value to write, of *size*, is passed through eBPF stack and
Packit Service 3880ab
 * 		pointed by *data*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The context of the program *ctx* needs also be passed to the
Packit Service 3880ab
 * 		helper.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		On user space, a program willing to read the values needs to
Packit Service 3880ab
 * 		call **perf_event_open**\ () on the perf event (either for
Packit Service 3880ab
 * 		one or for all CPUs) and to store the file descriptor into the
Packit Service 3880ab
 * 		*map*. This must be done before the eBPF program can send data
Packit Service 3880ab
 * 		into it. An example is available in file
Packit Service 3880ab
 * 		*samples/bpf/trace_output_user.c* in the Linux kernel source
Packit Service 3880ab
 * 		tree (the eBPF program counterpart is in
Packit Service 3880ab
 * 		*samples/bpf/trace_output_kern.c*).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**bpf_perf_event_output**\ () achieves better performance
Packit Service 3880ab
 * 		than **bpf_trace_printk**\ () for sharing data with user
Packit Service 3880ab
 * 		space, and is much better suitable for streaming data from eBPF
Packit Service 3880ab
 * 		programs.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Note that this helper is not restricted to tracing use cases
Packit Service 3880ab
 * 		and can be used with programs attached to TC or XDP as well,
Packit Service 3880ab
 * 		where it allows for passing data to user space listeners. Data
Packit Service 3880ab
 * 		can be:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* Only custom structs,
Packit Service 3880ab
 * 		* Only the packet payload, or
Packit Service 3880ab
 * 		* A combination of both.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_load_bytes(const void *skb, u32 offset, void *to, u32 len)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		This helper was provided as an easy way to load data from a
Packit Service 3880ab
 * 		packet. It can be used to load *len* bytes from *offset* from
Packit Service 3880ab
 * 		the packet associated to *skb*, into the buffer pointed by
Packit Service 3880ab
 * 		*to*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Since Linux 4.7, usage of this helper has mostly been replaced
Packit Service 3880ab
 * 		by "direct packet access", enabling packet data to be
Packit Service 3880ab
 * 		manipulated with *skb*\ **->data** and *skb*\ **->data_end**
Packit Service 3880ab
 * 		pointing respectively to the first byte of packet data and to
Packit Service 3880ab
 * 		the byte after the last byte of packet data. However, it
Packit Service 3880ab
 * 		remains useful if one wishes to read large quantities of data
Packit Service 3880ab
 * 		at once from a packet into the eBPF stack.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_get_stackid(void *ctx, struct bpf_map *map, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Walk a user or a kernel stack and return its id. To achieve
Packit Service 3880ab
 * 		this, the helper needs *ctx*, which is a pointer to the context
Packit Service 3880ab
 * 		on which the tracing program is executed, and a pointer to a
Packit Service 3880ab
 * 		*map* of type **BPF_MAP_TYPE_STACK_TRACE**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The last argument, *flags*, holds the number of stack frames to
Packit Service 3880ab
 * 		skip (from 0 to 255), masked with
Packit Service 3880ab
 * 		**BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set
Packit Service 3880ab
 * 		a combination of the following flags:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**BPF_F_USER_STACK**
Packit Service 3880ab
 * 			Collect a user space stack instead of a kernel stack.
Packit Service 3880ab
 * 		**BPF_F_FAST_STACK_CMP**
Packit Service 3880ab
 * 			Compare stacks by hash only.
Packit Service 3880ab
 * 		**BPF_F_REUSE_STACKID**
Packit Service 3880ab
 * 			If two different stacks hash into the same *stackid*,
Packit Service 3880ab
 * 			discard the old one.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The stack id retrieved is a 32 bit long integer handle which
Packit Service 3880ab
 * 		can be further combined with other data (including other stack
Packit Service 3880ab
 * 		ids) and used as a key into maps. This can be useful for
Packit Service 3880ab
 * 		generating a variety of graphs (such as flame graphs or off-cpu
Packit Service 3880ab
 * 		graphs).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		For walking a stack, this helper is an improvement over
Packit Service 3880ab
 * 		**bpf_probe_read**\ (), which can be used with unrolled loops
Packit Service 3880ab
 * 		but is not efficient and consumes a lot of eBPF instructions.
Packit Service 3880ab
 * 		Instead, **bpf_get_stackid**\ () can collect up to
Packit Service 3880ab
 * 		**PERF_MAX_STACK_DEPTH** both kernel and user frames. Note that
Packit Service 3880ab
 * 		this limit can be controlled with the **sysctl** program, and
Packit Service 3880ab
 * 		that it should be manually increased in order to profile long
Packit Service 3880ab
 * 		user stacks (such as stacks for Java programs). To do so, use:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		::
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			# sysctl kernel.perf_event_max_stack=<new value>
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The positive or null stack id on success, or a negative error
Packit Service 3880ab
 * 		in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * s64 bpf_csum_diff(__be32 *from, u32 from_size, __be32 *to, u32 to_size, __wsum seed)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Compute a checksum difference, from the raw buffer pointed by
Packit Service 3880ab
 * 		*from*, of length *from_size* (that must be a multiple of 4),
Packit Service 3880ab
 * 		towards the raw buffer pointed by *to*, of size *to_size*
Packit Service 3880ab
 * 		(same remark). An optional *seed* can be added to the value
Packit Service 3880ab
 * 		(this can be cascaded, the seed may come from a previous call
Packit Service 3880ab
 * 		to the helper).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This is flexible enough to be used in several ways:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* With *from_size* == 0, *to_size* > 0 and *seed* set to
Packit Service 3880ab
 * 		  checksum, it can be used when pushing new data.
Packit Service 3880ab
 * 		* With *from_size* > 0, *to_size* == 0 and *seed* set to
Packit Service 3880ab
 * 		  checksum, it can be used when removing data from a packet.
Packit Service 3880ab
 * 		* With *from_size* > 0, *to_size* > 0 and *seed* set to 0, it
Packit Service 3880ab
 * 		  can be used to compute a diff. Note that *from_size* and
Packit Service 3880ab
 * 		  *to_size* do not need to be equal.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper can be used in combination with
Packit Service 3880ab
 * 		**bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\ (), to
Packit Service 3880ab
 * 		which one can feed in the difference computed with
Packit Service 3880ab
 * 		**bpf_csum_diff**\ ().
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The checksum result, or a negative error code in case of
Packit Service 3880ab
 * 		failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_get_tunnel_opt(struct sk_buff *skb, void *opt, u32 size)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Retrieve tunnel options metadata for the packet associated to
Packit Service 3880ab
 * 		*skb*, and store the raw tunnel option data to the buffer *opt*
Packit Service 3880ab
 * 		of *size*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper can be used with encapsulation devices that can
Packit Service 3880ab
 * 		operate in "collect metadata" mode (please refer to the related
Packit Service 3880ab
 * 		note in the description of **bpf_skb_get_tunnel_key**\ () for
Packit Service 3880ab
 * 		more details). A particular example where this can be used is
Packit Service 3880ab
 * 		in combination with the Geneve encapsulation protocol, where it
Packit Service 3880ab
 * 		allows for pushing (with **bpf_skb_get_tunnel_opt**\ () helper)
Packit Service 3880ab
 * 		and retrieving arbitrary TLVs (Type-Length-Value headers) from
Packit Service 3880ab
 * 		the eBPF program. This allows for full customization of these
Packit Service 3880ab
 * 		headers.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The size of the option data retrieved.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_set_tunnel_opt(struct sk_buff *skb, void *opt, u32 size)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Set tunnel options metadata for the packet associated to *skb*
Packit Service 3880ab
 * 		to the option data contained in the raw buffer *opt* of *size*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		See also the description of the **bpf_skb_get_tunnel_opt**\ ()
Packit Service 3880ab
 * 		helper for additional information.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_change_proto(struct sk_buff *skb, __be16 proto, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Change the protocol of the *skb* to *proto*. Currently
Packit Service 3880ab
 * 		supported are transition from IPv4 to IPv6, and from IPv6 to
Packit Service 3880ab
 * 		IPv4. The helper takes care of the groundwork for the
Packit Service 3880ab
 * 		transition, including resizing the socket buffer. The eBPF
Packit Service 3880ab
 * 		program is expected to fill the new headers, if any, via
Packit Service 3880ab
 * 		**skb_store_bytes**\ () and to recompute the checksums with
Packit Service 3880ab
 * 		**bpf_l3_csum_replace**\ () and **bpf_l4_csum_replace**\
Packit Service 3880ab
 * 		(). The main case for this helper is to perform NAT64
Packit Service 3880ab
 * 		operations out of an eBPF program.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Internally, the GSO type is marked as dodgy so that headers are
Packit Service 3880ab
 * 		checked and segments are recalculated by the GSO/GRO engine.
Packit Service 3880ab
 * 		The size for GSO target is adapted as well.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		All values for *flags* are reserved for future usage, and must
Packit Service 3880ab
 * 		be left at zero.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_change_type(struct sk_buff *skb, u32 type)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Change the packet type for the packet associated to *skb*. This
Packit Service 3880ab
 * 		comes down to setting *skb*\ **->pkt_type** to *type*, except
Packit Service 3880ab
 * 		the eBPF program does not have a write access to *skb*\
Packit Service 3880ab
 * 		**->pkt_type** beside this helper. Using a helper here allows
Packit Service 3880ab
 * 		for graceful handling of errors.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The major use case is to change incoming *skb*s to
Packit Service 3880ab
 * 		**PACKET_HOST** in a programmatic way instead of having to
Packit Service 3880ab
 * 		recirculate via **redirect**\ (..., **BPF_F_INGRESS**), for
Packit Service 3880ab
 * 		example.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Note that *type* only allows certain values. At this time, they
Packit Service 3880ab
 * 		are:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**PACKET_HOST**
Packit Service 3880ab
 * 			Packet is for us.
Packit Service 3880ab
 * 		**PACKET_BROADCAST**
Packit Service 3880ab
 * 			Send packet to all.
Packit Service 3880ab
 * 		**PACKET_MULTICAST**
Packit Service 3880ab
 * 			Send packet to group.
Packit Service 3880ab
 * 		**PACKET_OTHERHOST**
Packit Service 3880ab
 * 			Send packet to someone else.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_under_cgroup(struct sk_buff *skb, struct bpf_map *map, u32 index)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Check whether *skb* is a descendant of the cgroup2 held by
Packit Service 3880ab
 * 		*map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The return value depends on the result of the test, and can be:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* 0, if the *skb* failed the cgroup2 descendant test.
Packit Service 3880ab
 * 		* 1, if the *skb* succeeded the cgroup2 descendant test.
Packit Service 3880ab
 * 		* A negative error code, if an error occurred.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u32 bpf_get_hash_recalc(struct sk_buff *skb)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Retrieve the hash of the packet, *skb*\ **->hash**. If it is
Packit Service 3880ab
 * 		not set, in particular if the hash was cleared due to mangling,
Packit Service 3880ab
 * 		recompute this hash. Later accesses to the hash can be done
Packit Service 3880ab
 * 		directly with *skb*\ **->hash**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Calling **bpf_set_hash_invalid**\ (), changing a packet
Packit Service 3880ab
 * 		prototype with **bpf_skb_change_proto**\ (), or calling
Packit Service 3880ab
 * 		**bpf_skb_store_bytes**\ () with the
Packit Service 3880ab
 * 		**BPF_F_INVALIDATE_HASH** are actions susceptible to clear
Packit Service 3880ab
 * 		the hash and to trigger a new computation for the next call to
Packit Service 3880ab
 * 		**bpf_get_hash_recalc**\ ().
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The 32-bit hash.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_current_task(void)
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A pointer to the current task struct.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_probe_write_user(void *dst, const void *src, u32 len)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Attempt in a safe way to write *len* bytes from the buffer
Packit Service 3880ab
 * 		*src* to *dst* in memory. It only works for threads that are in
Packit Service 3880ab
 * 		user context, and *dst* must be a valid user space address.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper should not be used to implement any kind of
Packit Service 3880ab
 * 		security mechanism because of TOC-TOU attacks, but rather to
Packit Service 3880ab
 * 		debug, divert, and manipulate execution of semi-cooperative
Packit Service 3880ab
 * 		processes.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Keep in mind that this feature is meant for experiments, and it
Packit Service 3880ab
 * 		has a risk of crashing the system and running programs.
Packit Service 3880ab
 * 		Therefore, when an eBPF program using this helper is attached,
Packit Service 3880ab
 * 		a warning including PID and process name is printed to kernel
Packit Service 3880ab
 * 		logs.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_current_task_under_cgroup(struct bpf_map *map, u32 index)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Check whether the probe is being run is the context of a given
Packit Service 3880ab
 * 		subset of the cgroup2 hierarchy. The cgroup2 to test is held by
Packit Service 3880ab
 * 		*map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The return value depends on the result of the test, and can be:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* 0, if the *skb* task belongs to the cgroup2.
Packit Service 3880ab
 * 		* 1, if the *skb* task does not belong to the cgroup2.
Packit Service 3880ab
 * 		* A negative error code, if an error occurred.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Resize (trim or grow) the packet associated to *skb* to the
Packit Service 3880ab
 * 		new *len*. The *flags* are reserved for future usage, and must
Packit Service 3880ab
 * 		be left at zero.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The basic idea is that the helper performs the needed work to
Packit Service 3880ab
 * 		change the size of the packet, then the eBPF program rewrites
Packit Service 3880ab
 * 		the rest via helpers like **bpf_skb_store_bytes**\ (),
Packit Service 3880ab
 * 		**bpf_l3_csum_replace**\ (), **bpf_l3_csum_replace**\ ()
Packit Service 3880ab
 * 		and others. This helper is a slow path utility intended for
Packit Service 3880ab
 * 		replies with control messages. And because it is targeted for
Packit Service 3880ab
 * 		slow path, the helper itself can afford to be slow: it
Packit Service 3880ab
 * 		implicitly linearizes, unclones and drops offloads from the
Packit Service 3880ab
 * 		*skb*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_pull_data(struct sk_buff *skb, u32 len)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Pull in non-linear data in case the *skb* is non-linear and not
Packit Service 3880ab
 * 		all of *len* are part of the linear section. Make *len* bytes
Packit Service 3880ab
 * 		from *skb* readable and writable. If a zero value is passed for
Packit Service 3880ab
 * 		*len*, then the whole length of the *skb* is pulled.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper is only needed for reading and writing with direct
Packit Service 3880ab
 * 		packet access.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		For direct packet access, testing that offsets to access
Packit Service 3880ab
 * 		are within packet boundaries (test on *skb*\ **->data_end**) is
Packit Service 3880ab
 * 		susceptible to fail if offsets are invalid, or if the requested
Packit Service 3880ab
 * 		data is in non-linear parts of the *skb*. On failure the
Packit Service 3880ab
 * 		program can just bail out, or in the case of a non-linear
Packit Service 3880ab
 * 		buffer, use a helper to make the data available. The
Packit Service 3880ab
 * 		**bpf_skb_load_bytes**\ () helper is a first solution to access
Packit Service 3880ab
 * 		the data. Another one consists in using **bpf_skb_pull_data**
Packit Service 3880ab
 * 		to pull in once the non-linear parts, then retesting and
Packit Service 3880ab
 * 		eventually access the data.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		At the same time, this also makes sure the *skb* is uncloned,
Packit Service 3880ab
 * 		which is a necessary condition for direct write. As this needs
Packit Service 3880ab
 * 		to be an invariant for the write part only, the verifier
Packit Service 3880ab
 * 		detects writes and adds a prologue that is calling
Packit Service 3880ab
 * 		**bpf_skb_pull_data()** to effectively unclone the *skb* from
Packit Service 3880ab
 * 		the very beginning in case it is indeed cloned.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * s64 bpf_csum_update(struct sk_buff *skb, __wsum csum)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Add the checksum *csum* into *skb*\ **->csum** in case the
Packit Service 3880ab
 * 		driver has supplied a checksum for the entire packet into that
Packit Service 3880ab
 * 		field. Return an error otherwise. This helper is intended to be
Packit Service 3880ab
 * 		used in combination with **bpf_csum_diff**\ (), in particular
Packit Service 3880ab
 * 		when the checksum needs to be updated after data has been
Packit Service 3880ab
 * 		written into the packet through direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The checksum on success, or a negative error code in case of
Packit Service 3880ab
 * 		failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * void bpf_set_hash_invalid(struct sk_buff *skb)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Invalidate the current *skb*\ **->hash**. It can be used after
Packit Service 3880ab
 * 		mangling on headers through direct packet access, in order to
Packit Service 3880ab
 * 		indicate that the hash is outdated and to trigger a
Packit Service 3880ab
 * 		recalculation the next time the kernel tries to access this
Packit Service 3880ab
 * 		hash or when the **bpf_get_hash_recalc**\ () helper is called.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_get_numa_node_id(void)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Return the id of the current NUMA node. The primary use case
Packit Service 3880ab
 * 		for this helper is the selection of sockets for the local NUMA
Packit Service 3880ab
 * 		node, when the program is attached to sockets using the
Packit Service 3880ab
 * 		**SO_ATTACH_REUSEPORT_EBPF** option (see also **socket(7)**),
Packit Service 3880ab
 * 		but the helper is also available to other eBPF program types,
Packit Service 3880ab
 * 		similarly to **bpf_get_smp_processor_id**\ ().
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The id of current NUMA node.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_change_head(struct sk_buff *skb, u32 len, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Grows headroom of packet associated to *skb* and adjusts the
Packit Service 3880ab
 * 		offset of the MAC header accordingly, adding *len* bytes of
Packit Service 3880ab
 * 		space. It automatically extends and reallocates memory as
Packit Service 3880ab
 * 		required.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper can be used on a layer 3 *skb* to push a MAC header
Packit Service 3880ab
 * 		for redirection into a layer 2 device.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		All values for *flags* are reserved for future usage, and must
Packit Service 3880ab
 * 		be left at zero.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that
Packit Service 3880ab
 * 		it is possible to use a negative value for *delta*. This helper
Packit Service 3880ab
 * 		can be used to prepare the packet for pushing or popping
Packit Service 3880ab
 * 		headers.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_probe_read_str(void *dst, u32 size, const void *unsafe_ptr)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Copy a NUL terminated string from an unsafe kernel address
Packit Service 3880ab
 * 		*unsafe_ptr* to *dst*. See **bpf_probe_read_kernel_str**\ () for
Packit Service 3880ab
 * 		more details.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Generally, use **bpf_probe_read_user_str**\ () or
Packit Service 3880ab
 * 		**bpf_probe_read_kernel_str**\ () instead.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		On success, the strictly positive length of the string,
Packit Service 3880ab
 * 		including the trailing NUL character. On error, a negative
Packit Service 3880ab
 * 		value.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_socket_cookie(struct sk_buff *skb)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		If the **struct sk_buff** pointed by *skb* has a known socket,
Packit Service 3880ab
 * 		retrieve the cookie (generated by the kernel) of this socket.
Packit Service 3880ab
 * 		If no cookie has been set yet, generate a new cookie. Once
Packit Service 3880ab
 * 		generated, the socket cookie remains stable for the life of the
Packit Service 3880ab
 * 		socket. This helper can be useful for monitoring per socket
Packit Service 3880ab
 * 		networking traffic statistics as it provides a global socket
Packit Service 3880ab
 * 		identifier that can be assumed unique.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A 8-byte long non-decreasing number on success, or 0 if the
Packit Service 3880ab
 * 		socket field is missing inside *skb*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Equivalent to bpf_get_socket_cookie() helper that accepts
Packit Service 3880ab
 * 		*skb*, but gets socket from **struct bpf_sock_addr** context.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A 8-byte long non-decreasing number.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Equivalent to **bpf_get_socket_cookie**\ () helper that accepts
Packit Service 3880ab
 * 		*skb*, but gets socket from **struct bpf_sock_ops** context.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A 8-byte long non-decreasing number.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u32 bpf_get_socket_uid(struct sk_buff *skb)
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The owner UID of the socket associated to *skb*. If the socket
Packit Service 3880ab
 * 		is **NULL**, or if it is not a full socket (i.e. if it is a
Packit Service 3880ab
 * 		time-wait or a request socket instead), **overflowuid** value
Packit Service 3880ab
 * 		is returned (note that **overflowuid** might also be the actual
Packit Service 3880ab
 * 		UID value for the socket).
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_set_hash(struct sk_buff *skb, u32 hash)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Set the full hash for *skb* (set the field *skb*\ **->hash**)
Packit Service 3880ab
 * 		to value *hash*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_setsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Emulate a call to **setsockopt()** on the socket associated to
Packit Service 3880ab
 * 		*bpf_socket*, which must be a full socket. The *level* at
Packit Service 3880ab
 * 		which the option resides and the name *optname* of the option
Packit Service 3880ab
 * 		must be specified, see **setsockopt(2)** for more information.
Packit Service 3880ab
 * 		The option value of length *optlen* is pointed by *optval*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		*bpf_socket* should be one of the following:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**.
Packit Service 3880ab
 * 		* **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT**
Packit Service 3880ab
 * 		  and **BPF_CGROUP_INET6_CONNECT**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper actually implements a subset of **setsockopt()**.
Packit Service 3880ab
 * 		It supports the following *level*\ s:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* **SOL_SOCKET**, which supports the following *optname*\ s:
Packit Service 3880ab
 * 		  **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**,
Packit Service 3880ab
 * 		  **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**,
Packit Service 3880ab
 * 		  **SO_BINDTODEVICE**, **SO_KEEPALIVE**.
Packit Service 3880ab
 * 		* **IPPROTO_TCP**, which supports the following *optname*\ s:
Packit Service 3880ab
 * 		  **TCP_CONGESTION**, **TCP_BPF_IW**,
Packit Service 3880ab
 * 		  **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
Packit Service 3880ab
 * 		  **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
Packit Service 3880ab
 * 		  **TCP_SYNCNT**, **TCP_USER_TIMEOUT**.
Packit Service 3880ab
 * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
Packit Service 3880ab
 * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_adjust_room(struct sk_buff *skb, s32 len_diff, u32 mode, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Grow or shrink the room for data in the packet associated to
Packit Service 3880ab
 * 		*skb* by *len_diff*, and according to the selected *mode*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		By default, the helper will reset any offloaded checksum
Packit Service 3880ab
 * 		indicator of the skb to CHECKSUM_NONE. This can be avoided
Packit Service 3880ab
 * 		by the following flag:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* **BPF_F_ADJ_ROOM_NO_CSUM_RESET**: Do not reset offloaded
Packit Service 3880ab
 * 		  checksum data of the skb to CHECKSUM_NONE.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		There are two supported modes at this time:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **BPF_ADJ_ROOM_MAC**: Adjust room at the mac layer
Packit Service 3880ab
 *		  (room space is added or removed below the layer 2 header).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* **BPF_ADJ_ROOM_NET**: Adjust room at the network layer
Packit Service 3880ab
 * 		  (room space is added or removed below the layer 3 header).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The following flags are supported at this time:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **BPF_F_ADJ_ROOM_FIXED_GSO**: Do not adjust gso_size.
Packit Service 3880ab
 *		  Adjusting mss in this way is not allowed for datagrams.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **BPF_F_ADJ_ROOM_ENCAP_L3_IPV4**,
Packit Service 3880ab
 *		  **BPF_F_ADJ_ROOM_ENCAP_L3_IPV6**:
Packit Service 3880ab
 *		  Any new space is reserved to hold a tunnel header.
Packit Service 3880ab
 *		  Configure skb offsets and other fields accordingly.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **BPF_F_ADJ_ROOM_ENCAP_L4_GRE**,
Packit Service 3880ab
 *		  **BPF_F_ADJ_ROOM_ENCAP_L4_UDP**:
Packit Service 3880ab
 *		  Use with ENCAP_L3 flags to further specify the tunnel type.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **BPF_F_ADJ_ROOM_ENCAP_L2**\ (*len*):
Packit Service 3880ab
 *		  Use with ENCAP_L3/L4 flags to further specify the tunnel
Packit Service 3880ab
 *		  type; *len* is the length of the inner MAC header.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Redirect the packet to the endpoint referenced by *map* at
Packit Service 3880ab
 * 		index *key*. Depending on its type, this *map* can contain
Packit Service 3880ab
 * 		references to net devices (for forwarding packets through other
Packit Service 3880ab
 * 		ports), or to CPUs (for redirecting XDP frames to another CPU;
Packit Service 3880ab
 * 		but this is only implemented for native XDP (with driver
Packit Service 3880ab
 * 		support) as of this writing).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The lower two bits of *flags* are used as the return code if
Packit Service 3880ab
 * 		the map lookup fails. This is so that the return value can be
Packit Service 3880ab
 * 		one of the XDP program return codes up to **XDP_TX**, as chosen
Packit Service 3880ab
 * 		by the caller. Any higher bits in the *flags* argument must be
Packit Service 3880ab
 * 		unset.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		See also **bpf_redirect**\ (), which only supports redirecting
Packit Service 3880ab
 * 		to an ifindex, but doesn't require a map to do so.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		**XDP_REDIRECT** on success, or the value of the two lower bits
Packit Service 3880ab
 * 		of the *flags* argument on error.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Redirect the packet to the socket referenced by *map* (of type
Packit Service 3880ab
 * 		**BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and
Packit Service 3880ab
 * 		egress interfaces can be used for redirection. The
Packit Service 3880ab
 * 		**BPF_F_INGRESS** value in *flags* is used to make the
Packit Service 3880ab
 * 		distinction (ingress path is selected if the flag is present,
Packit Service 3880ab
 * 		egress path otherwise). This is the only flag supported for now.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		**SK_PASS** on success, or **SK_DROP** on error.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Add an entry to, or update a *map* referencing sockets. The
Packit Service 3880ab
 * 		*skops* is used as a new value for the entry associated to
Packit Service 3880ab
 * 		*key*. *flags* is one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**BPF_NOEXIST**
Packit Service 3880ab
 * 			The entry for *key* must not exist in the map.
Packit Service 3880ab
 * 		**BPF_EXIST**
Packit Service 3880ab
 * 			The entry for *key* must already exist in the map.
Packit Service 3880ab
 * 		**BPF_ANY**
Packit Service 3880ab
 * 			No condition on the existence of the entry for *key*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		If the *map* has eBPF programs (parser and verdict), those will
Packit Service 3880ab
 * 		be inherited by the socket being added. If the socket is
Packit Service 3880ab
 * 		already attached to eBPF programs, this results in an error.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Adjust the address pointed by *xdp_md*\ **->data_meta** by
Packit Service 3880ab
 * 		*delta* (which can be positive or negative). Note that this
Packit Service 3880ab
 * 		operation modifies the address stored in *xdp_md*\ **->data**,
Packit Service 3880ab
 * 		so the latter must be loaded only after the helper has been
Packit Service 3880ab
 * 		called.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The use of *xdp_md*\ **->data_meta** is optional and programs
Packit Service 3880ab
 * 		are not required to use it. The rationale is that when the
Packit Service 3880ab
 * 		packet is processed with XDP (e.g. as DoS filter), it is
Packit Service 3880ab
 * 		possible to push further meta data along with it before passing
Packit Service 3880ab
 * 		to the stack, and to give the guarantee that an ingress eBPF
Packit Service 3880ab
 * 		program attached as a TC classifier on the same device can pick
Packit Service 3880ab
 * 		this up for further post-processing. Since TC works with socket
Packit Service 3880ab
 * 		buffers, it remains possible to set from XDP the **mark** or
Packit Service 3880ab
 * 		**priority** pointers, or other pointers for the socket buffer.
Packit Service 3880ab
 * 		Having this scratch space generic and programmable allows for
Packit Service 3880ab
 * 		more flexibility as the user is free to store whatever meta
Packit Service 3880ab
 * 		data they need.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_perf_event_read_value(struct bpf_map *map, u64 flags, struct bpf_perf_event_value *buf, u32 buf_size)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Read the value of a perf event counter, and store it into *buf*
Packit Service 3880ab
 * 		of size *buf_size*. This helper relies on a *map* of type
Packit Service 3880ab
 * 		**BPF_MAP_TYPE_PERF_EVENT_ARRAY**. The nature of the perf event
Packit Service 3880ab
 * 		counter is selected when *map* is updated with perf event file
Packit Service 3880ab
 * 		descriptors. The *map* is an array whose size is the number of
Packit Service 3880ab
 * 		available CPUs, and each cell contains a value relative to one
Packit Service 3880ab
 * 		CPU. The value to retrieve is indicated by *flags*, that
Packit Service 3880ab
 * 		contains the index of the CPU to look up, masked with
Packit Service 3880ab
 * 		**BPF_F_INDEX_MASK**. Alternatively, *flags* can be set to
Packit Service 3880ab
 * 		**BPF_F_CURRENT_CPU** to indicate that the value for the
Packit Service 3880ab
 * 		current CPU should be retrieved.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper behaves in a way close to
Packit Service 3880ab
 * 		**bpf_perf_event_read**\ () helper, save that instead of
Packit Service 3880ab
 * 		just returning the value observed, it fills the *buf*
Packit Service 3880ab
 * 		structure. This allows for additional data to be retrieved: in
Packit Service 3880ab
 * 		particular, the enabled and running times (in *buf*\
Packit Service 3880ab
 * 		**->enabled** and *buf*\ **->running**, respectively) are
Packit Service 3880ab
 * 		copied. In general, **bpf_perf_event_read_value**\ () is
Packit Service 3880ab
 * 		recommended over **bpf_perf_event_read**\ (), which has some
Packit Service 3880ab
 * 		ABI issues and provides fewer functionalities.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		These values are interesting, because hardware PMU (Performance
Packit Service 3880ab
 * 		Monitoring Unit) counters are limited resources. When there are
Packit Service 3880ab
 * 		more PMU based perf events opened than available counters,
Packit Service 3880ab
 * 		kernel will multiplex these events so each event gets certain
Packit Service 3880ab
 * 		percentage (but not all) of the PMU time. In case that
Packit Service 3880ab
 * 		multiplexing happens, the number of samples or counter value
Packit Service 3880ab
 * 		will not reflect the case compared to when no multiplexing
Packit Service 3880ab
 * 		occurs. This makes comparison between different runs difficult.
Packit Service 3880ab
 * 		Typically, the counter value should be normalized before
Packit Service 3880ab
 * 		comparing to other experiments. The usual normalization is done
Packit Service 3880ab
 * 		as follows.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		::
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			normalized_counter = counter * t_enabled / t_running
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Where t_enabled is the time enabled for event and t_running is
Packit Service 3880ab
 * 		the time running for event since last normalization. The
Packit Service 3880ab
 * 		enabled and running times are accumulated since the perf event
Packit Service 3880ab
 * 		open. To achieve scaling factor between two invocations of an
Packit Service 3880ab
 * 		eBPF program, users can use CPU id as the key (which is
Packit Service 3880ab
 * 		typical for perf array usage model) to remember the previous
Packit Service 3880ab
 * 		value and do the calculation inside the eBPF program.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		For en eBPF program attached to a perf event, retrieve the
Packit Service 3880ab
 * 		value of the event counter associated to *ctx* and store it in
Packit Service 3880ab
 * 		the structure pointed by *buf* and of size *buf_size*. Enabled
Packit Service 3880ab
 * 		and running times are also stored in the structure (see
Packit Service 3880ab
 * 		description of helper **bpf_perf_event_read_value**\ () for
Packit Service 3880ab
 * 		more details).
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_getsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Emulate a call to **getsockopt()** on the socket associated to
Packit Service 3880ab
 * 		*bpf_socket*, which must be a full socket. The *level* at
Packit Service 3880ab
 * 		which the option resides and the name *optname* of the option
Packit Service 3880ab
 * 		must be specified, see **getsockopt(2)** for more information.
Packit Service 3880ab
 * 		The retrieved value is stored in the structure pointed by
Packit Service 3880ab
 * 		*opval* and of length *optlen*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		*bpf_socket* should be one of the following:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* **struct bpf_sock_ops** for **BPF_PROG_TYPE_SOCK_OPS**.
Packit Service 3880ab
 * 		* **struct bpf_sock_addr** for **BPF_CGROUP_INET4_CONNECT**
Packit Service 3880ab
 * 		  and **BPF_CGROUP_INET6_CONNECT**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper actually implements a subset of **getsockopt()**.
Packit Service 3880ab
 * 		It supports the following *level*\ s:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* **IPPROTO_TCP**, which supports *optname*
Packit Service 3880ab
 * 		  **TCP_CONGESTION**.
Packit Service 3880ab
 * 		* **IPPROTO_IP**, which supports *optname* **IP_TOS**.
Packit Service 3880ab
 * 		* **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_override_return(struct pt_regs *regs, u64 rc)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Used for error injection, this helper uses kprobes to override
Packit Service 3880ab
 * 		the return value of the probed function, and to set it to *rc*.
Packit Service 3880ab
 * 		The first argument is the context *regs* on which the kprobe
Packit Service 3880ab
 * 		works.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper works by setting the PC (program counter)
Packit Service 3880ab
 * 		to an override function which is run in place of the original
Packit Service 3880ab
 * 		probed function. This means the probed function is not run at
Packit Service 3880ab
 * 		all. The replacement function just returns with the required
Packit Service 3880ab
 * 		value.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper has security implications, and thus is subject to
Packit Service 3880ab
 * 		restrictions. It is only available if the kernel was compiled
Packit Service 3880ab
 * 		with the **CONFIG_BPF_KPROBE_OVERRIDE** configuration
Packit Service 3880ab
 * 		option, and in this case it only works on functions tagged with
Packit Service 3880ab
 * 		**ALLOW_ERROR_INJECTION** in the kernel code.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Also, the helper is only available for the architectures having
Packit Service 3880ab
 * 		the CONFIG_FUNCTION_ERROR_INJECTION option. As of this writing,
Packit Service 3880ab
 * 		x86 architecture is the only one to support this feature.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Attempt to set the value of the **bpf_sock_ops_cb_flags** field
Packit Service 3880ab
 * 		for the full TCP socket associated to *bpf_sock_ops* to
Packit Service 3880ab
 * 		*argval*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The primary use of this field is to determine if there should
Packit Service 3880ab
 * 		be calls to eBPF programs of type
Packit Service 3880ab
 * 		**BPF_PROG_TYPE_SOCK_OPS** at various points in the TCP
Packit Service 3880ab
 * 		code. A program of the same type can change its value, per
Packit Service 3880ab
 * 		connection and as necessary, when the connection is
Packit Service 3880ab
 * 		established. This field is directly accessible for reading, but
Packit Service 3880ab
 * 		this helper must be used for updates in order to return an
Packit Service 3880ab
 * 		error if an eBPF program tries to set a callback that is not
Packit Service 3880ab
 * 		supported in the current kernel.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		*argval* is a flag array which can combine these flags:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out)
Packit Service 3880ab
 * 		* **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission)
Packit Service 3880ab
 * 		* **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change)
Packit Service 3880ab
 * 		* **BPF_SOCK_OPS_RTT_CB_FLAG** (every RTT)
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Therefore, this function can be used to clear a callback flag by
Packit Service 3880ab
 * 		setting the appropriate bit to zero. e.g. to disable the RTO
Packit Service 3880ab
 * 		callback:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**bpf_sock_ops_cb_flags_set(bpf_sock,**
Packit Service 3880ab
 * 			**bpf_sock->bpf_sock_ops_cb_flags & ~BPF_SOCK_OPS_RTO_CB_FLAG)**
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Here are some examples of where one could call such eBPF
Packit Service 3880ab
 * 		program:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* When RTO fires.
Packit Service 3880ab
 * 		* When a packet is retransmitted.
Packit Service 3880ab
 * 		* When the connection terminates.
Packit Service 3880ab
 * 		* When a packet is sent.
Packit Service 3880ab
 * 		* When a packet is received.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		Code **-EINVAL** if the socket is not a full TCP socket;
Packit Service 3880ab
 * 		otherwise, a positive number containing the bits that could not
Packit Service 3880ab
 * 		be set is returned (which comes down to 0 if all bits were set
Packit Service 3880ab
 * 		as required).
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_msg_redirect_map(struct sk_msg_buff *msg, struct bpf_map *map, u32 key, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		This helper is used in programs implementing policies at the
Packit Service 3880ab
 * 		socket level. If the message *msg* is allowed to pass (i.e. if
Packit Service 3880ab
 * 		the verdict eBPF program returns **SK_PASS**), redirect it to
Packit Service 3880ab
 * 		the socket referenced by *map* (of type
Packit Service 3880ab
 * 		**BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and
Packit Service 3880ab
 * 		egress interfaces can be used for redirection. The
Packit Service 3880ab
 * 		**BPF_F_INGRESS** value in *flags* is used to make the
Packit Service 3880ab
 * 		distinction (ingress path is selected if the flag is present,
Packit Service 3880ab
 * 		egress path otherwise). This is the only flag supported for now.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		**SK_PASS** on success, or **SK_DROP** on error.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_msg_apply_bytes(struct sk_msg_buff *msg, u32 bytes)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		For socket policies, apply the verdict of the eBPF program to
Packit Service 3880ab
 * 		the next *bytes* (number of bytes) of message *msg*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		For example, this helper can be used in the following cases:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		* A single **sendmsg**\ () or **sendfile**\ () system call
Packit Service 3880ab
 * 		  contains multiple logical messages that the eBPF program is
Packit Service 3880ab
 * 		  supposed to read and for which it should apply a verdict.
Packit Service 3880ab
 * 		* An eBPF program only cares to read the first *bytes* of a
Packit Service 3880ab
 * 		  *msg*. If the message has a large payload, then setting up
Packit Service 3880ab
 * 		  and calling the eBPF program repeatedly for all bytes, even
Packit Service 3880ab
 * 		  though the verdict is already known, would create unnecessary
Packit Service 3880ab
 * 		  overhead.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		When called from within an eBPF program, the helper sets a
Packit Service 3880ab
 * 		counter internal to the BPF infrastructure, that is used to
Packit Service 3880ab
 * 		apply the last verdict to the next *bytes*. If *bytes* is
Packit Service 3880ab
 * 		smaller than the current data being processed from a
Packit Service 3880ab
 * 		**sendmsg**\ () or **sendfile**\ () system call, the first
Packit Service 3880ab
 * 		*bytes* will be sent and the eBPF program will be re-run with
Packit Service 3880ab
 * 		the pointer for start of data pointing to byte number *bytes*
Packit Service 3880ab
 * 		**+ 1**. If *bytes* is larger than the current data being
Packit Service 3880ab
 * 		processed, then the eBPF verdict will be applied to multiple
Packit Service 3880ab
 * 		**sendmsg**\ () or **sendfile**\ () calls until *bytes* are
Packit Service 3880ab
 * 		consumed.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Note that if a socket closes with the internal counter holding
Packit Service 3880ab
 * 		a non-zero value, this is not a problem because data is not
Packit Service 3880ab
 * 		being buffered for *bytes* and is sent as it is received.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_msg_cork_bytes(struct sk_msg_buff *msg, u32 bytes)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		For socket policies, prevent the execution of the verdict eBPF
Packit Service 3880ab
 * 		program for message *msg* until *bytes* (byte number) have been
Packit Service 3880ab
 * 		accumulated.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This can be used when one needs a specific number of bytes
Packit Service 3880ab
 * 		before a verdict can be assigned, even if the data spans
Packit Service 3880ab
 * 		multiple **sendmsg**\ () or **sendfile**\ () calls. The extreme
Packit Service 3880ab
 * 		case would be a user calling **sendmsg**\ () repeatedly with
Packit Service 3880ab
 * 		1-byte long message segments. Obviously, this is bad for
Packit Service 3880ab
 * 		performance, but it is still valid. If the eBPF program needs
Packit Service 3880ab
 * 		*bytes* bytes to validate a header, this helper can be used to
Packit Service 3880ab
 * 		prevent the eBPF program to be called again until *bytes* have
Packit Service 3880ab
 * 		been accumulated.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_msg_pull_data(struct sk_msg_buff *msg, u32 start, u32 end, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		For socket policies, pull in non-linear data from user space
Packit Service 3880ab
 * 		for *msg* and set pointers *msg*\ **->data** and *msg*\
Packit Service 3880ab
 * 		**->data_end** to *start* and *end* bytes offsets into *msg*,
Packit Service 3880ab
 * 		respectively.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a
Packit Service 3880ab
 * 		*msg* it can only parse data that the (**data**, **data_end**)
Packit Service 3880ab
 * 		pointers have already consumed. For **sendmsg**\ () hooks this
Packit Service 3880ab
 * 		is likely the first scatterlist element. But for calls relying
Packit Service 3880ab
 * 		on the **sendpage** handler (e.g. **sendfile**\ ()) this will
Packit Service 3880ab
 * 		be the range (**0**, **0**) because the data is shared with
Packit Service 3880ab
 * 		user space and by default the objective is to avoid allowing
Packit Service 3880ab
 * 		user space to modify data while (or after) eBPF verdict is
Packit Service 3880ab
 * 		being decided. This helper can be used to pull in data and to
Packit Service 3880ab
 * 		set the start and end pointer to given values. Data will be
Packit Service 3880ab
 * 		copied if necessary (i.e. if data was not linear and if start
Packit Service 3880ab
 * 		and end pointers do not point to the same chunk).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		All values for *flags* are reserved for future usage, and must
Packit Service 3880ab
 * 		be left at zero.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Bind the socket associated to *ctx* to the address pointed by
Packit Service 3880ab
 * 		*addr*, of length *addr_len*. This allows for making outgoing
Packit Service 3880ab
 * 		connection from the desired IP address, which can be useful for
Packit Service 3880ab
 * 		example when all processes inside a cgroup should use one
Packit Service 3880ab
 * 		single IP address on a host that has multiple IP configured.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper works for IPv4 and IPv6, TCP and UDP sockets. The
Packit Service 3880ab
 * 		domain (*addr*\ **->sa_family**) must be **AF_INET** (or
Packit Service 3880ab
 * 		**AF_INET6**). It's advised to pass zero port (**sin_port**
Packit Service 3880ab
 * 		or **sin6_port**) which triggers IP_BIND_ADDRESS_NO_PORT-like
Packit Service 3880ab
 * 		behavior and lets the kernel efficiently pick up an unused
Packit Service 3880ab
 * 		port as long as 4-tuple is unique. Passing non-zero port might
Packit Service 3880ab
 * 		lead to degraded performance.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
Packit Service 3880ab
 * 		possible to both shrink and grow the packet tail.
Packit Service 3880ab
 * 		Shrink done via *delta* being a negative integer.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_get_xfrm_state(struct sk_buff *skb, u32 index, struct bpf_xfrm_state *xfrm_state, u32 size, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Retrieve the XFRM state (IP transform framework, see also
Packit Service 3880ab
 * 		**ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The retrieved value is stored in the **struct bpf_xfrm_state**
Packit Service 3880ab
 * 		pointed by *xfrm_state* and of length *size*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		All values for *flags* are reserved for future usage, and must
Packit Service 3880ab
 * 		be left at zero.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper is available only if the kernel was compiled with
Packit Service 3880ab
 * 		**CONFIG_XFRM** configuration option.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_get_stack(void *ctx, void *buf, u32 size, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Return a user or a kernel stack in bpf program provided buffer.
Packit Service 3880ab
 * 		To achieve this, the helper needs *ctx*, which is a pointer
Packit Service 3880ab
 * 		to the context on which the tracing program is executed.
Packit Service 3880ab
 * 		To store the stacktrace, the bpf program provides *buf* with
Packit Service 3880ab
 * 		a nonnegative *size*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The last argument, *flags*, holds the number of stack frames to
Packit Service 3880ab
 * 		skip (from 0 to 255), masked with
Packit Service 3880ab
 * 		**BPF_F_SKIP_FIELD_MASK**. The next bits can be used to set
Packit Service 3880ab
 * 		the following flags:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**BPF_F_USER_STACK**
Packit Service 3880ab
 * 			Collect a user space stack instead of a kernel stack.
Packit Service 3880ab
 * 		**BPF_F_USER_BUILD_ID**
Packit Service 3880ab
 * 			Collect buildid+offset instead of ips for user stack,
Packit Service 3880ab
 * 			only valid if **BPF_F_USER_STACK** is also specified.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**bpf_get_stack**\ () can collect up to
Packit Service 3880ab
 * 		**PERF_MAX_STACK_DEPTH** both kernel and user frames, subject
Packit Service 3880ab
 * 		to sufficient large buffer size. Note that
Packit Service 3880ab
 * 		this limit can be controlled with the **sysctl** program, and
Packit Service 3880ab
 * 		that it should be manually increased in order to profile long
Packit Service 3880ab
 * 		user stacks (such as stacks for Java programs). To do so, use:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		::
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			# sysctl kernel.perf_event_max_stack=<new value>
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A non-negative value equal to or less than *size* on success,
Packit Service 3880ab
 * 		or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		This helper is similar to **bpf_skb_load_bytes**\ () in that
Packit Service 3880ab
 * 		it provides an easy way to load *len* bytes from *offset*
Packit Service 3880ab
 * 		from the packet associated to *skb*, into the buffer pointed
Packit Service 3880ab
 * 		by *to*. The difference to **bpf_skb_load_bytes**\ () is that
Packit Service 3880ab
 * 		a fifth argument *start_header* exists in order to select a
Packit Service 3880ab
 * 		base offset to start from. *start_header* can be one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**BPF_HDR_START_MAC**
Packit Service 3880ab
 * 			Base offset to load data from is *skb*'s mac header.
Packit Service 3880ab
 * 		**BPF_HDR_START_NET**
Packit Service 3880ab
 * 			Base offset to load data from is *skb*'s network header.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		In general, "direct packet access" is the preferred method to
Packit Service 3880ab
 * 		access packet data, however, this helper is in particular useful
Packit Service 3880ab
 * 		in socket filters where *skb*\ **->data** does not always point
Packit Service 3880ab
 * 		to the start of the mac header and where "direct packet access"
Packit Service 3880ab
 * 		is not available.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_fib_lookup(void *ctx, struct bpf_fib_lookup *params, int plen, u32 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Do FIB lookup in kernel tables using parameters in *params*.
Packit Service 3880ab
 *		If lookup is successful and result shows packet is to be
Packit Service 3880ab
 *		forwarded, the neighbor tables are searched for the nexthop.
Packit Service 3880ab
 *		If successful (ie., FIB lookup shows forwarding and nexthop
Packit Service 3880ab
 *		is resolved), the nexthop address is returned in ipv4_dst
Packit Service 3880ab
 *		or ipv6_dst based on family, smac is set to mac address of
Packit Service 3880ab
 *		egress device, dmac is set to nexthop mac address, rt_metric
Packit Service 3880ab
 *		is set to metric from route (IPv4/IPv6 only), and ifindex
Packit Service 3880ab
 *		is set to the device index of the nexthop from the FIB lookup.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*plen* argument is the size of the passed in struct.
Packit Service 3880ab
 *		*flags* argument can be a combination of one or more of the
Packit Service 3880ab
 *		following values:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**BPF_FIB_LOOKUP_DIRECT**
Packit Service 3880ab
 *			Do a direct table lookup vs full lookup using FIB
Packit Service 3880ab
 *			rules.
Packit Service 3880ab
 *		**BPF_FIB_LOOKUP_OUTPUT**
Packit Service 3880ab
 *			Perform lookup from an egress perspective (default is
Packit Service 3880ab
 *			ingress).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*ctx* is either **struct xdp_md** for XDP programs or
Packit Service 3880ab
 *		**struct sk_buff** tc cls_act programs.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		* < 0 if any input argument is invalid
Packit Service 3880ab
 *		*   0 on success (packet is forwarded, nexthop neighbor exists)
Packit Service 3880ab
 *		* > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
Packit Service 3880ab
 *		  packet is not forwarded or needs assist from full stack
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sock_hash_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Add an entry to, or update a sockhash *map* referencing sockets.
Packit Service 3880ab
 *		The *skops* is used as a new value for the entry associated to
Packit Service 3880ab
 *		*key*. *flags* is one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**BPF_NOEXIST**
Packit Service 3880ab
 *			The entry for *key* must not exist in the map.
Packit Service 3880ab
 *		**BPF_EXIST**
Packit Service 3880ab
 *			The entry for *key* must already exist in the map.
Packit Service 3880ab
 *		**BPF_ANY**
Packit Service 3880ab
 *			No condition on the existence of the entry for *key*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		If the *map* has eBPF programs (parser and verdict), those will
Packit Service 3880ab
 *		be inherited by the socket being added. If the socket is
Packit Service 3880ab
 *		already attached to eBPF programs, this results in an error.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_msg_redirect_hash(struct sk_msg_buff *msg, struct bpf_map *map, void *key, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		This helper is used in programs implementing policies at the
Packit Service 3880ab
 *		socket level. If the message *msg* is allowed to pass (i.e. if
Packit Service 3880ab
 *		the verdict eBPF program returns **SK_PASS**), redirect it to
Packit Service 3880ab
 *		the socket referenced by *map* (of type
Packit Service 3880ab
 *		**BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and
Packit Service 3880ab
 *		egress interfaces can be used for redirection. The
Packit Service 3880ab
 *		**BPF_F_INGRESS** value in *flags* is used to make the
Packit Service 3880ab
 *		distinction (ingress path is selected if the flag is present,
Packit Service 3880ab
 *		egress path otherwise). This is the only flag supported for now.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		**SK_PASS** on success, or **SK_DROP** on error.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sk_redirect_hash(struct sk_buff *skb, struct bpf_map *map, void *key, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		This helper is used in programs implementing policies at the
Packit Service 3880ab
 *		skb socket level. If the sk_buff *skb* is allowed to pass (i.e.
Packit Service 3880ab
 *		if the verdeict eBPF program returns **SK_PASS**), redirect it
Packit Service 3880ab
 *		to the socket referenced by *map* (of type
Packit Service 3880ab
 *		**BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and
Packit Service 3880ab
 *		egress interfaces can be used for redirection. The
Packit Service 3880ab
 *		**BPF_F_INGRESS** value in *flags* is used to make the
Packit Service 3880ab
 *		distinction (ingress path is selected if the flag is present,
Packit Service 3880ab
 *		egress otherwise). This is the only flag supported for now.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		**SK_PASS** on success, or **SK_DROP** on error.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Encapsulate the packet associated to *skb* within a Layer 3
Packit Service 3880ab
 *		protocol header. This header is provided in the buffer at
Packit Service 3880ab
 *		address *hdr*, with *len* its size in bytes. *type* indicates
Packit Service 3880ab
 *		the protocol of the header and can be one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**BPF_LWT_ENCAP_SEG6**
Packit Service 3880ab
 *			IPv6 encapsulation with Segment Routing Header
Packit Service 3880ab
 *			(**struct ipv6_sr_hdr**). *hdr* only contains the SRH,
Packit Service 3880ab
 *			the IPv6 header is computed by the kernel.
Packit Service 3880ab
 *		**BPF_LWT_ENCAP_SEG6_INLINE**
Packit Service 3880ab
 *			Only works if *skb* contains an IPv6 packet. Insert a
Packit Service 3880ab
 *			Segment Routing Header (**struct ipv6_sr_hdr**) inside
Packit Service 3880ab
 *			the IPv6 header.
Packit Service 3880ab
 *		**BPF_LWT_ENCAP_IP**
Packit Service 3880ab
 *			IP encapsulation (GRE/GUE/IPIP/etc). The outer header
Packit Service 3880ab
 *			must be IPv4 or IPv6, followed by zero or more
Packit Service 3880ab
 *			additional headers, up to **LWT_BPF_MAX_HEADROOM**
Packit Service 3880ab
 *			total bytes in all prepended headers. Please note that
Packit Service 3880ab
 *			if **skb_is_gso**\ (*skb*) is true, no more than two
Packit Service 3880ab
 *			headers can be prepended, and the inner header, if
Packit Service 3880ab
 *			present, should be either GRE or UDP/GUE.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**BPF_LWT_ENCAP_SEG6**\ \* types can be called by BPF programs
Packit Service 3880ab
 *		of type **BPF_PROG_TYPE_LWT_IN**; **BPF_LWT_ENCAP_IP** type can
Packit Service 3880ab
 *		be called by bpf programs of types **BPF_PROG_TYPE_LWT_IN** and
Packit Service 3880ab
 *		**BPF_PROG_TYPE_LWT_XMIT**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Store *len* bytes from address *from* into the packet
Packit Service 3880ab
 *		associated to *skb*, at *offset*. Only the flags, tag and TLVs
Packit Service 3880ab
 *		inside the outermost IPv6 Segment Routing Header can be
Packit Service 3880ab
 *		modified through this helper.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Adjust the size allocated to TLVs in the outermost IPv6
Packit Service 3880ab
 *		Segment Routing Header contained in the packet associated to
Packit Service 3880ab
 *		*skb*, at position *offset* by *delta* bytes. Only offsets
Packit Service 3880ab
 *		after the segments are accepted. *delta* can be as well
Packit Service 3880ab
 *		positive (growing) as negative (shrinking).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Apply an IPv6 Segment Routing action of type *action* to the
Packit Service 3880ab
 *		packet associated to *skb*. Each action takes a parameter
Packit Service 3880ab
 *		contained at address *param*, and of length *param_len* bytes.
Packit Service 3880ab
 *		*action* can be one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**SEG6_LOCAL_ACTION_END_X**
Packit Service 3880ab
 *			End.X action: Endpoint with Layer-3 cross-connect.
Packit Service 3880ab
 *			Type of *param*: **struct in6_addr**.
Packit Service 3880ab
 *		**SEG6_LOCAL_ACTION_END_T**
Packit Service 3880ab
 *			End.T action: Endpoint with specific IPv6 table lookup.
Packit Service 3880ab
 *			Type of *param*: **int**.
Packit Service 3880ab
 *		**SEG6_LOCAL_ACTION_END_B6**
Packit Service 3880ab
 *			End.B6 action: Endpoint bound to an SRv6 policy.
Packit Service 3880ab
 *			Type of *param*: **struct ipv6_sr_hdr**.
Packit Service 3880ab
 *		**SEG6_LOCAL_ACTION_END_B6_ENCAP**
Packit Service 3880ab
 *			End.B6.Encap action: Endpoint bound to an SRv6
Packit Service 3880ab
 *			encapsulation policy.
Packit Service 3880ab
 *			Type of *param*: **struct ipv6_sr_hdr**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		A call to this helper is susceptible to change the underlying
Packit Service 3880ab
 * 		packet buffer. Therefore, at load time, all checks on pointers
Packit Service 3880ab
 * 		previously done by the verifier are invalidated and must be
Packit Service 3880ab
 * 		performed again, if the helper is used in combination with
Packit Service 3880ab
 * 		direct packet access.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_rc_repeat(void *ctx)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		This helper is used in programs implementing IR decoding, to
Packit Service 3880ab
 *		report a successfully decoded repeat key message. This delays
Packit Service 3880ab
 *		the generation of a key up event for previously generated
Packit Service 3880ab
 *		key down event.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Some IR protocols like NEC have a special IR message for
Packit Service 3880ab
 *		repeating last button, for when a button is held down.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *ctx* should point to the lirc sample as passed into
Packit Service 3880ab
 *		the program.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper is only available is the kernel was compiled with
Packit Service 3880ab
 *		the **CONFIG_BPF_LIRC_MODE2** configuration option set to
Packit Service 3880ab
 *		"**y**".
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_rc_keydown(void *ctx, u32 protocol, u64 scancode, u32 toggle)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		This helper is used in programs implementing IR decoding, to
Packit Service 3880ab
 *		report a successfully decoded key press with *scancode*,
Packit Service 3880ab
 *		*toggle* value in the given *protocol*. The scancode will be
Packit Service 3880ab
 *		translated to a keycode using the rc keymap, and reported as
Packit Service 3880ab
 *		an input key down event. After a period a key up event is
Packit Service 3880ab
 *		generated. This period can be extended by calling either
Packit Service 3880ab
 *		**bpf_rc_keydown**\ () again with the same values, or calling
Packit Service 3880ab
 *		**bpf_rc_repeat**\ ().
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Some protocols include a toggle bit, in case the button was
Packit Service 3880ab
 *		released and pressed again between consecutive scancodes.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *ctx* should point to the lirc sample as passed into
Packit Service 3880ab
 *		the program.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *protocol* is the decoded protocol number (see
Packit Service 3880ab
 *		**enum rc_proto** for some predefined values).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper is only available is the kernel was compiled with
Packit Service 3880ab
 *		the **CONFIG_BPF_LIRC_MODE2** configuration option set to
Packit Service 3880ab
 *		"**y**".
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_skb_cgroup_id(struct sk_buff *skb)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Return the cgroup v2 id of the socket associated with the *skb*.
Packit Service 3880ab
 * 		This is roughly similar to the **bpf_get_cgroup_classid**\ ()
Packit Service 3880ab
 * 		helper for cgroup v1 by providing a tag resp. identifier that
Packit Service 3880ab
 * 		can be matched on or used for map lookups e.g. to implement
Packit Service 3880ab
 * 		policy. The cgroup v2 id of a given path in the hierarchy is
Packit Service 3880ab
 * 		exposed in user space through the f_handle API in order to get
Packit Service 3880ab
 * 		to the same 64-bit id.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper can be used on TC egress path, but not on ingress,
Packit Service 3880ab
 * 		and is available only if the kernel was compiled with the
Packit Service 3880ab
 * 		**CONFIG_SOCK_CGROUP_DATA** configuration option.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The id is returned or 0 in case the id could not be retrieved.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_current_cgroup_id(void)
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A 64-bit integer containing the current cgroup id based
Packit Service 3880ab
 * 		on the cgroup within which the current task is running.
Packit Service 3880ab
 *
Packit Service 3880ab
 * void *bpf_get_local_storage(void *map, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Get the pointer to the local storage area.
Packit Service 3880ab
 *		The type and the size of the local storage is defined
Packit Service 3880ab
 *		by the *map* argument.
Packit Service 3880ab
 *		The *flags* meaning is specific for each map type,
Packit Service 3880ab
 *		and has to be 0 for cgroup local storage.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Depending on the BPF program type, a local storage area
Packit Service 3880ab
 *		can be shared between multiple instances of the BPF program,
Packit Service 3880ab
 *		running simultaneously.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		A user should care about the synchronization by himself.
Packit Service 3880ab
 *		For example, by using the **BPF_STX_XADD** instruction to alter
Packit Service 3880ab
 *		the shared data.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		A pointer to the local storage area.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Select a **SO_REUSEPORT** socket from a
Packit Service 3880ab
 *		**BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
Packit Service 3880ab
 *		It checks the selected socket is matching the incoming
Packit Service 3880ab
 *		request in the socket buffer.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_skb_ancestor_cgroup_id(struct sk_buff *skb, int ancestor_level)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Return id of cgroup v2 that is ancestor of cgroup associated
Packit Service 3880ab
 *		with the *skb* at the *ancestor_level*.  The root cgroup is at
Packit Service 3880ab
 *		*ancestor_level* zero and each step down the hierarchy
Packit Service 3880ab
 *		increments the level. If *ancestor_level* == level of cgroup
Packit Service 3880ab
 *		associated with *skb*, then return value will be same as that
Packit Service 3880ab
 *		of **bpf_skb_cgroup_id**\ ().
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The helper is useful to implement policies based on cgroups
Packit Service 3880ab
 *		that are upper in hierarchy than immediate cgroup associated
Packit Service 3880ab
 *		with *skb*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The format of returned id and helper limitations are same as in
Packit Service 3880ab
 *		**bpf_skb_cgroup_id**\ ().
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		The id is returned or 0 in case the id could not be retrieved.
Packit Service 3880ab
 *
Packit Service 3880ab
 * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Look for TCP socket matching *tuple*, optionally in a child
Packit Service 3880ab
 *		network namespace *netns*. The return value must be checked,
Packit Service 3880ab
 *		and if non-**NULL**, released via **bpf_sk_release**\ ().
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *ctx* should point to the context of the program, such as
Packit Service 3880ab
 *		the skb or socket (depending on the hook in use). This is used
Packit Service 3880ab
 *		to determine the base network namespace for the lookup.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*tuple_size* must be one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**sizeof**\ (*tuple*\ **->ipv4**)
Packit Service 3880ab
 *			Look for an IPv4 socket.
Packit Service 3880ab
 *		**sizeof**\ (*tuple*\ **->ipv6**)
Packit Service 3880ab
 *			Look for an IPv6 socket.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		If the *netns* is a negative signed 32-bit integer, then the
Packit Service 3880ab
 *		socket lookup table in the netns associated with the *ctx*
Packit Service 3880ab
 *		will be used. For the TC hooks, this is the netns of the device
Packit Service 3880ab
 *		in the skb. For socket hooks, this is the netns of the socket.
Packit Service 3880ab
 *		If *netns* is any other signed 32-bit value greater than or
Packit Service 3880ab
 *		equal to zero then it specifies the ID of the netns relative to
Packit Service 3880ab
 *		the netns associated with the *ctx*. *netns* values beyond the
Packit Service 3880ab
 *		range of 32-bit integers are reserved for future use.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		All values for *flags* are reserved for future usage, and must
Packit Service 3880ab
 *		be left at zero.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper is available only if the kernel was compiled with
Packit Service 3880ab
 *		**CONFIG_NET** configuration option.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Pointer to **struct bpf_sock**, or **NULL** in case of failure.
Packit Service 3880ab
 *		For sockets with reuseport option, the **struct bpf_sock**
Packit Service 3880ab
 *		result is from *reuse*\ **->socks**\ [] using the hash of the
Packit Service 3880ab
 *		tuple.
Packit Service 3880ab
 *
Packit Service 3880ab
 * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Look for UDP socket matching *tuple*, optionally in a child
Packit Service 3880ab
 *		network namespace *netns*. The return value must be checked,
Packit Service 3880ab
 *		and if non-**NULL**, released via **bpf_sk_release**\ ().
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *ctx* should point to the context of the program, such as
Packit Service 3880ab
 *		the skb or socket (depending on the hook in use). This is used
Packit Service 3880ab
 *		to determine the base network namespace for the lookup.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*tuple_size* must be one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**sizeof**\ (*tuple*\ **->ipv4**)
Packit Service 3880ab
 *			Look for an IPv4 socket.
Packit Service 3880ab
 *		**sizeof**\ (*tuple*\ **->ipv6**)
Packit Service 3880ab
 *			Look for an IPv6 socket.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		If the *netns* is a negative signed 32-bit integer, then the
Packit Service 3880ab
 *		socket lookup table in the netns associated with the *ctx*
Packit Service 3880ab
 *		will be used. For the TC hooks, this is the netns of the device
Packit Service 3880ab
 *		in the skb. For socket hooks, this is the netns of the socket.
Packit Service 3880ab
 *		If *netns* is any other signed 32-bit value greater than or
Packit Service 3880ab
 *		equal to zero then it specifies the ID of the netns relative to
Packit Service 3880ab
 *		the netns associated with the *ctx*. *netns* values beyond the
Packit Service 3880ab
 *		range of 32-bit integers are reserved for future use.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		All values for *flags* are reserved for future usage, and must
Packit Service 3880ab
 *		be left at zero.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper is available only if the kernel was compiled with
Packit Service 3880ab
 *		**CONFIG_NET** configuration option.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Pointer to **struct bpf_sock**, or **NULL** in case of failure.
Packit Service 3880ab
 *		For sockets with reuseport option, the **struct bpf_sock**
Packit Service 3880ab
 *		result is from *reuse*\ **->socks**\ [] using the hash of the
Packit Service 3880ab
 *		tuple.
Packit Service 3880ab
 *
Packit Service bd02ce
 * long bpf_sk_release(struct bpf_sock *sock)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Release the reference held by *sock*. *sock* must be a
Packit Service 3880ab
 *		non-**NULL** pointer that was returned from
Packit Service 3880ab
 *		**bpf_sk_lookup_xxx**\ ().
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Push an element *value* in *map*. *flags* is one of:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		**BPF_EXIST**
Packit Service 3880ab
 * 			If the queue/stack is full, the oldest element is
Packit Service 3880ab
 * 			removed to make room for this.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_map_pop_elem(struct bpf_map *map, void *value)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Pop an element from *map*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_map_peek_elem(struct bpf_map *map, void *value)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Get an element from *map* without removing it.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_msg_push_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		For socket policies, insert *len* bytes into *msg* at offset
Packit Service 3880ab
 *		*start*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		If a program of type **BPF_PROG_TYPE_SK_MSG** is run on a
Packit Service 3880ab
 *		*msg* it may want to insert metadata or options into the *msg*.
Packit Service 3880ab
 *		This can later be read and used by any of the lower layer BPF
Packit Service 3880ab
 *		hooks.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper may fail if under memory pressure (a malloc
Packit Service 3880ab
 *		fails) in these cases BPF programs will get an appropriate
Packit Service 3880ab
 *		error and BPF programs will need to handle them.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Will remove *len* bytes from a *msg* starting at byte *start*.
Packit Service 3880ab
 *		This may result in **ENOMEM** errors under certain situations if
Packit Service 3880ab
 *		an allocation and copy are required due to a full ring buffer.
Packit Service 3880ab
 *		However, the helper will try to avoid doing the allocation
Packit Service 3880ab
 *		if possible. Other errors can occur if input parameters are
Packit Service 3880ab
 *		invalid either due to *start* byte not being valid part of *msg*
Packit Service 3880ab
 *		payload and/or *pop* value being to large.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_rc_pointer_rel(void *ctx, s32 rel_x, s32 rel_y)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		This helper is used in programs implementing IR decoding, to
Packit Service 3880ab
 *		report a successfully decoded pointer movement.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *ctx* should point to the lirc sample as passed into
Packit Service 3880ab
 *		the program.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper is only available is the kernel was compiled with
Packit Service 3880ab
 *		the **CONFIG_BPF_LIRC_MODE2** configuration option set to
Packit Service 3880ab
 *		"**y**".
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_spin_lock(struct bpf_spin_lock *lock)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Acquire a spinlock represented by the pointer *lock*, which is
Packit Service 3880ab
 *		stored as part of a value of a map. Taking the lock allows to
Packit Service 3880ab
 *		safely update the rest of the fields in that value. The
Packit Service 3880ab
 *		spinlock can (and must) later be released with a call to
Packit Service 3880ab
 *		**bpf_spin_unlock**\ (\ *lock*\ ).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Spinlocks in BPF programs come with a number of restrictions
Packit Service 3880ab
 *		and constraints:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **bpf_spin_lock** objects are only allowed inside maps of
Packit Service 3880ab
 *		  types **BPF_MAP_TYPE_HASH** and **BPF_MAP_TYPE_ARRAY** (this
Packit Service 3880ab
 *		  list could be extended in the future).
Packit Service 3880ab
 *		* BTF description of the map is mandatory.
Packit Service 3880ab
 *		* The BPF program can take ONE lock at a time, since taking two
Packit Service 3880ab
 *		  or more could cause dead locks.
Packit Service 3880ab
 *		* Only one **struct bpf_spin_lock** is allowed per map element.
Packit Service 3880ab
 *		* When the lock is taken, calls (either BPF to BPF or helpers)
Packit Service 3880ab
 *		  are not allowed.
Packit Service 3880ab
 *		* The **BPF_LD_ABS** and **BPF_LD_IND** instructions are not
Packit Service 3880ab
 *		  allowed inside a spinlock-ed region.
Packit Service 3880ab
 *		* The BPF program MUST call **bpf_spin_unlock**\ () to release
Packit Service 3880ab
 *		  the lock, on all execution paths, before it returns.
Packit Service 3880ab
 *		* The BPF program can access **struct bpf_spin_lock** only via
Packit Service 3880ab
 *		  the **bpf_spin_lock**\ () and **bpf_spin_unlock**\ ()
Packit Service 3880ab
 *		  helpers. Loading or storing data into the **struct
Packit Service 3880ab
 *		  bpf_spin_lock** *lock*\ **;** field of a map is not allowed.
Packit Service 3880ab
 *		* To use the **bpf_spin_lock**\ () helper, the BTF description
Packit Service 3880ab
 *		  of the map value must be a struct and have **struct
Packit Service 3880ab
 *		  bpf_spin_lock** *anyname*\ **;** field at the top level.
Packit Service 3880ab
 *		  Nested lock inside another struct is not allowed.
Packit Service 3880ab
 *		* The **struct bpf_spin_lock** *lock* field in a map value must
Packit Service 3880ab
 *		  be aligned on a multiple of 4 bytes in that value.
Packit Service 3880ab
 *		* Syscall with command **BPF_MAP_LOOKUP_ELEM** does not copy
Packit Service 3880ab
 *		  the **bpf_spin_lock** field to user space.
Packit Service 3880ab
 *		* Syscall with command **BPF_MAP_UPDATE_ELEM**, or update from
Packit Service 3880ab
 *		  a BPF program, do not update the **bpf_spin_lock** field.
Packit Service 3880ab
 *		* **bpf_spin_lock** cannot be on the stack or inside a
Packit Service 3880ab
 *		  networking packet (it can only be inside of a map values).
Packit Service 3880ab
 *		* **bpf_spin_lock** is available to root only.
Packit Service 3880ab
 *		* Tracing programs and socket filter programs cannot use
Packit Service 3880ab
 *		  **bpf_spin_lock**\ () due to insufficient preemption checks
Packit Service 3880ab
 *		  (but this may change in the future).
Packit Service 3880ab
 *		* **bpf_spin_lock** is not allowed in inner maps of map-in-map.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_spin_unlock(struct bpf_spin_lock *lock)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Release the *lock* previously locked by a call to
Packit Service 3880ab
 *		**bpf_spin_lock**\ (\ *lock*\ ).
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0
Packit Service 3880ab
 *
Packit Service 3880ab
 * struct bpf_sock *bpf_sk_fullsock(struct bpf_sock *sk)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		This helper gets a **struct bpf_sock** pointer such
Packit Service 3880ab
 *		that all the fields in this **bpf_sock** can be accessed.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		A **struct bpf_sock** pointer on success, or **NULL** in
Packit Service 3880ab
 *		case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * struct bpf_tcp_sock *bpf_tcp_sock(struct bpf_sock *sk)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		This helper gets a **struct bpf_tcp_sock** pointer from a
Packit Service 3880ab
 *		**struct bpf_sock** pointer.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		A **struct bpf_tcp_sock** pointer on success, or **NULL** in
Packit Service 3880ab
 *		case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_ecn_set_ce(struct sk_buff *skb)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Set ECN (Explicit Congestion Notification) field of IP header
Packit Service 3880ab
 *		to **CE** (Congestion Encountered) if current value is **ECT**
Packit Service 3880ab
 *		(ECN Capable Transport). Otherwise, do nothing. Works with IPv6
Packit Service 3880ab
 *		and IPv4.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		1 if the **CE** flag is set (either by the current helper call
Packit Service 3880ab
 *		or because it was already present), 0 if it is not set.
Packit Service 3880ab
 *
Packit Service 3880ab
 * struct bpf_sock *bpf_get_listener_sock(struct bpf_sock *sk)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Return a **struct bpf_sock** pointer in **TCP_LISTEN** state.
Packit Service 3880ab
 *		**bpf_sk_release**\ () is unnecessary and not allowed.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		A **struct bpf_sock** pointer on success, or **NULL** in
Packit Service 3880ab
 *		case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * struct bpf_sock *bpf_skc_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Look for TCP socket matching *tuple*, optionally in a child
Packit Service 3880ab
 *		network namespace *netns*. The return value must be checked,
Packit Service 3880ab
 *		and if non-**NULL**, released via **bpf_sk_release**\ ().
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This function is identical to **bpf_sk_lookup_tcp**\ (), except
Packit Service 3880ab
 *		that it also returns timewait or request sockets. Use
Packit Service 3880ab
 *		**bpf_sk_fullsock**\ () or **bpf_tcp_sock**\ () to access the
Packit Service 3880ab
 *		full structure.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper is available only if the kernel was compiled with
Packit Service 3880ab
 *		**CONFIG_NET** configuration option.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Pointer to **struct bpf_sock**, or **NULL** in case of failure.
Packit Service 3880ab
 *		For sockets with reuseport option, the **struct bpf_sock**
Packit Service 3880ab
 *		result is from *reuse*\ **->socks**\ [] using the hash of the
Packit Service 3880ab
 *		tuple.
Packit Service 3880ab
 *
Packit Service bd02ce
 * long bpf_tcp_check_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Check whether *iph* and *th* contain a valid SYN cookie ACK for
Packit Service 3880ab
 * 		the listening socket in *sk*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		*iph* points to the start of the IPv4 or IPv6 header, while
Packit Service 3880ab
 * 		*iph_len* contains **sizeof**\ (**struct iphdr**) or
Packit Service 3880ab
 * 		**sizeof**\ (**struct ip6hdr**).
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		*th* points to the start of the TCP header, while *th_len*
Packit Service 3880ab
 * 		contains **sizeof**\ (**struct tcphdr**).
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 if *iph* and *th* are a valid SYN cookie ACK, or a negative
Packit Service 3880ab
 * 		error otherwise.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sysctl_get_name(struct bpf_sysctl *ctx, char *buf, size_t buf_len, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Get name of sysctl in /proc/sys/ and copy it into provided by
Packit Service 3880ab
 *		program buffer *buf* of size *buf_len*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The buffer is always NUL terminated, unless it's zero-sized.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		If *flags* is zero, full name (e.g. "net/ipv4/tcp_mem") is
Packit Service 3880ab
 *		copied. Use **BPF_F_SYSCTL_BASE_NAME** flag to copy base name
Packit Service 3880ab
 *		only (e.g. "tcp_mem").
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Number of character copied (not including the trailing NUL).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-E2BIG** if the buffer wasn't big enough (*buf* will contain
Packit Service 3880ab
 *		truncated name in this case).
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sysctl_get_current_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Get current value of sysctl as it is presented in /proc/sys
Packit Service 3880ab
 *		(incl. newline, etc), and copy it as a string into provided
Packit Service 3880ab
 *		by program buffer *buf* of size *buf_len*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The whole value is copied, no matter what file position user
Packit Service 3880ab
 *		space issued e.g. sys_read at.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The buffer is always NUL terminated, unless it's zero-sized.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Number of character copied (not including the trailing NUL).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-E2BIG** if the buffer wasn't big enough (*buf* will contain
Packit Service 3880ab
 *		truncated name in this case).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if current value was unavailable, e.g. because
Packit Service 3880ab
 *		sysctl is uninitialized and read returns -EIO for it.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sysctl_get_new_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Get new value being written by user space to sysctl (before
Packit Service 3880ab
 *		the actual write happens) and copy it as a string into
Packit Service 3880ab
 *		provided by program buffer *buf* of size *buf_len*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		User space may write new value at file position > 0.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The buffer is always NUL terminated, unless it's zero-sized.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Number of character copied (not including the trailing NUL).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-E2BIG** if the buffer wasn't big enough (*buf* will contain
Packit Service 3880ab
 *		truncated name in this case).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if sysctl is being read.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sysctl_set_new_value(struct bpf_sysctl *ctx, const char *buf, size_t buf_len)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Override new value being written by user space to sysctl with
Packit Service 3880ab
 *		value provided by program in buffer *buf* of size *buf_len*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*buf* should contain a string in same form as provided by user
Packit Service 3880ab
 *		space on sysctl write.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		User space may write new value at file position > 0. To override
Packit Service 3880ab
 *		the whole sysctl value file position should be set to zero.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-E2BIG** if the *buf_len* is too big.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if sysctl is being read.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_strtol(const char *buf, size_t buf_len, u64 flags, long *res)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Convert the initial part of the string from buffer *buf* of
Packit Service 3880ab
 *		size *buf_len* to a long integer according to the given base
Packit Service 3880ab
 *		and save the result in *res*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The string may begin with an arbitrary amount of white space
Packit Service 3880ab
 *		(as determined by **isspace**\ (3)) followed by a single
Packit Service 3880ab
 *		optional '**-**' sign.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Five least significant bits of *flags* encode base, other bits
Packit Service 3880ab
 *		are currently unused.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Base must be either 8, 10, 16 or 0 to detect it automatically
Packit Service 3880ab
 *		similar to user space **strtol**\ (3).
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Number of characters consumed on success. Must be positive but
Packit Service 3880ab
 *		no more than *buf_len*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if no valid digits were found or unsupported base
Packit Service 3880ab
 *		was provided.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ERANGE** if resulting value was out of range.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_strtoul(const char *buf, size_t buf_len, u64 flags, unsigned long *res)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Convert the initial part of the string from buffer *buf* of
Packit Service 3880ab
 *		size *buf_len* to an unsigned long integer according to the
Packit Service 3880ab
 *		given base and save the result in *res*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The string may begin with an arbitrary amount of white space
Packit Service 3880ab
 *		(as determined by **isspace**\ (3)).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Five least significant bits of *flags* encode base, other bits
Packit Service 3880ab
 *		are currently unused.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Base must be either 8, 10, 16 or 0 to detect it automatically
Packit Service 3880ab
 *		similar to user space **strtoul**\ (3).
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		Number of characters consumed on success. Must be positive but
Packit Service 3880ab
 *		no more than *buf_len*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if no valid digits were found or unsupported base
Packit Service 3880ab
 *		was provided.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ERANGE** if resulting value was out of range.
Packit Service 3880ab
 *
Packit Service 3880ab
 * void *bpf_sk_storage_get(struct bpf_map *map, struct bpf_sock *sk, void *value, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Get a bpf-local-storage from a *sk*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Logically, it could be thought of getting the value from
Packit Service 3880ab
 *		a *map* with *sk* as the **key**.  From this
Packit Service 3880ab
 *		perspective,  the usage is not much different from
Packit Service 3880ab
 *		**bpf_map_lookup_elem**\ (*map*, **&**\ *sk*) except this
Packit Service 3880ab
 *		helper enforces the key must be a full socket and the map must
Packit Service 3880ab
 *		be a **BPF_MAP_TYPE_SK_STORAGE** also.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Underneath, the value is stored locally at *sk* instead of
Packit Service 3880ab
 *		the *map*.  The *map* is used as the bpf-local-storage
Packit Service 3880ab
 *		"type". The bpf-local-storage "type" (i.e. the *map*) is
Packit Service 3880ab
 *		searched against all bpf-local-storages residing at *sk*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		An optional *flags* (**BPF_SK_STORAGE_GET_F_CREATE**) can be
Packit Service 3880ab
 *		used such that a new bpf-local-storage will be
Packit Service 3880ab
 *		created if one does not exist.  *value* can be used
Packit Service 3880ab
 *		together with **BPF_SK_STORAGE_GET_F_CREATE** to specify
Packit Service 3880ab
 *		the initial value of a bpf-local-storage.  If *value* is
Packit Service 3880ab
 *		**NULL**, the new bpf-local-storage will be zero initialized.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		A bpf-local-storage pointer is returned on success.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**NULL** if not found or there was an error in adding
Packit Service 3880ab
 *		a new bpf-local-storage.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sk_storage_delete(struct bpf_map *map, struct bpf_sock *sk)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Delete a bpf-local-storage from a *sk*.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ENOENT** if the bpf-local-storage cannot be found.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_send_signal(u32 sig)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Send signal *sig* to the process of the current task.
Packit Service 3880ab
 *		The signal may be delivered to any of this process's threads.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success or successfully queued.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EBUSY** if work queue under nmi is full.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if *sig* is invalid.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EPERM** if no permission to send the *sig*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EAGAIN** if bpf program can try again.
Packit Service 3880ab
 *
Packit Service bd02ce
 * s64 bpf_tcp_gen_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Try to issue a SYN cookie for the packet with corresponding
Packit Service 3880ab
 *		IP/TCP headers, *iph* and *th*, on the listening socket in *sk*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*iph* points to the start of the IPv4 or IPv6 header, while
Packit Service 3880ab
 *		*iph_len* contains **sizeof**\ (**struct iphdr**) or
Packit Service 3880ab
 *		**sizeof**\ (**struct ip6hdr**).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*th* points to the start of the TCP header, while *th_len*
Packit Service 3880ab
 *		contains the length of the TCP header.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		On success, lower 32 bits hold the generated SYN cookie in
Packit Service 3880ab
 *		followed by 16 bits which hold the MSS value for that cookie,
Packit Service 3880ab
 *		and the top 16 bits are unused.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		On failure, the returned value is one of the following:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** SYN cookie cannot be issued due to error
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ENOENT** SYN cookie should not be issued (no SYN flood)
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EOPNOTSUPP** kernel configuration does not enable SYN cookies
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EPROTONOSUPPORT** IP packet version is not 4 or 6
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_skb_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Write raw *data* blob into a special BPF perf event held by
Packit Service 3880ab
 * 		*map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
Packit Service 3880ab
 * 		event must have the following attributes: **PERF_SAMPLE_RAW**
Packit Service 3880ab
 * 		as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and
Packit Service 3880ab
 * 		**PERF_COUNT_SW_BPF_OUTPUT** as **config**.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The *flags* are used to indicate the index in *map* for which
Packit Service 3880ab
 * 		the value must be put, masked with **BPF_F_INDEX_MASK**.
Packit Service 3880ab
 * 		Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU**
Packit Service 3880ab
 * 		to indicate that the index of the current CPU core should be
Packit Service 3880ab
 * 		used.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The value to write, of *size*, is passed through eBPF stack and
Packit Service 3880ab
 * 		pointed by *data*.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		*ctx* is a pointer to in-kernel struct sk_buff.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		This helper is similar to **bpf_perf_event_output**\ () but
Packit Service 3880ab
 * 		restricted to raw_tracepoint bpf programs.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_probe_read_user(void *dst, u32 size, const void *unsafe_ptr)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Safely attempt to read *size* bytes from user space address
Packit Service 3880ab
 * 		*unsafe_ptr* and store the data in *dst*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Safely attempt to read *size* bytes from kernel space address
Packit Service 3880ab
 * 		*unsafe_ptr* and store the data in *dst*.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_probe_read_user_str(void *dst, u32 size, const void *unsafe_ptr)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Copy a NUL terminated string from an unsafe user address
Packit Service 3880ab
 * 		*unsafe_ptr* to *dst*. The *size* should include the
Packit Service 3880ab
 * 		terminating NUL byte. In case the string length is smaller than
Packit Service 3880ab
 * 		*size*, the target is not padded with further NUL bytes. If the
Packit Service 3880ab
 * 		string length is larger than *size*, just *size*-1 bytes are
Packit Service 3880ab
 * 		copied and the last byte is set to NUL.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		On success, the length of the copied string is returned. This
Packit Service 3880ab
 * 		makes this helper useful in tracing programs for reading
Packit Service 3880ab
 * 		strings, and more importantly to get its length at runtime. See
Packit Service 3880ab
 * 		the following snippet:
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		::
Packit Service 3880ab
 *
Packit Service 3880ab
 * 			SEC("kprobe/sys_open")
Packit Service 3880ab
 * 			void bpf_sys_open(struct pt_regs *ctx)
Packit Service 3880ab
 * 			{
Packit Service 3880ab
 * 			        char buf[PATHLEN]; // PATHLEN is defined to 256
Packit Service 3880ab
 * 			        int res = bpf_probe_read_user_str(buf, sizeof(buf),
Packit Service 3880ab
 * 				                                  ctx->di);
Packit Service 3880ab
 *
Packit Service 3880ab
 * 				// Consume buf, for example push it to
Packit Service 3880ab
 * 				// userspace via bpf_perf_event_output(); we
Packit Service 3880ab
 * 				// can use res (the string length) as event
Packit Service 3880ab
 * 				// size, after checking its boundaries.
Packit Service 3880ab
 * 			}
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		In comparison, using **bpf_probe_read_user**\ () helper here
Packit Service 3880ab
 * 		instead to read the string would require to estimate the length
Packit Service 3880ab
 * 		at compile time, and would often result in copying more memory
Packit Service 3880ab
 * 		than necessary.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		Another useful use case is when parsing individual process
Packit Service 3880ab
 * 		arguments or individual environment variables navigating
Packit Service 3880ab
 * 		*current*\ **->mm->arg_start** and *current*\
Packit Service 3880ab
 * 		**->mm->env_start**: using this helper and the return value,
Packit Service 3880ab
 * 		one can quickly iterate at the right offset of the memory area.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		On success, the strictly positive length of the string,
Packit Service 3880ab
 * 		including the trailing NUL character. On error, a negative
Packit Service 3880ab
 * 		value.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_probe_read_kernel_str(void *dst, u32 size, const void *unsafe_ptr)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Copy a NUL terminated string from an unsafe kernel address *unsafe_ptr*
Packit Service 3880ab
 * 		to *dst*. Same semantics as with **bpf_probe_read_user_str**\ () apply.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		On success, the strictly positive length of the string, including
Packit Service 3880ab
 * 		the trailing NUL character. On error, a negative value.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_tcp_send_ack(void *tp, u32 rcv_nxt)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Send out a tcp-ack. *tp* is the in-kernel struct **tcp_sock**.
Packit Service 3880ab
 *		*rcv_nxt* is the ack_seq to be sent out.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_send_signal_thread(u32 sig)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Send signal *sig* to the thread corresponding to the current task.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success or successfully queued.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EBUSY** if work queue under nmi is full.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if *sig* is invalid.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EPERM** if no permission to send the *sig*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EAGAIN** if bpf program can try again.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_jiffies64(void)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Obtain the 64bit jiffies
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		The 64 bit jiffies
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_read_branch_records(struct bpf_perf_event_data *ctx, void *buf, u32 size, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		For an eBPF program attached to a perf event, retrieve the
Packit Service 3880ab
 *		branch records (**struct perf_branch_entry**) associated to *ctx*
Packit Service 3880ab
 *		and store it in the buffer pointed by *buf* up to size
Packit Service 3880ab
 *		*size* bytes.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		On success, number of bytes written to *buf*. On error, a
Packit Service 3880ab
 *		negative value.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *flags* can be set to **BPF_F_GET_BRANCH_RECORDS_SIZE** to
Packit Service 3880ab
 *		instead return the number of bytes required to store all the
Packit Service 3880ab
 *		branch entries. If this flag is set, *buf* may be NULL.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if arguments invalid or **size** not a multiple
Packit Service 3880ab
 *		of **sizeof**\ (**struct perf_branch_entry**\ ).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ENOENT** if architecture does not support branch records.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_get_ns_current_pid_tgid(u64 dev, u64 ino, struct bpf_pidns_info *nsdata, u32 size)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Returns 0 on success, values for *pid* and *tgid* as seen from the current
Packit Service 3880ab
 *		*namespace* will be returned in *nsdata*.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or one of the following in case of failure:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if dev and inum supplied don't match dev_t and inode number
Packit Service 3880ab
 *              with nsfs of current task, or if dev conversion to dev_t lost high bits.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ENOENT** if pidns does not exists for the current task.
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_xdp_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Write raw *data* blob into a special BPF perf event held by
Packit Service 3880ab
 *		*map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
Packit Service 3880ab
 *		event must have the following attributes: **PERF_SAMPLE_RAW**
Packit Service 3880ab
 *		as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and
Packit Service 3880ab
 *		**PERF_COUNT_SW_BPF_OUTPUT** as **config**.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *flags* are used to indicate the index in *map* for which
Packit Service 3880ab
 *		the value must be put, masked with **BPF_F_INDEX_MASK**.
Packit Service 3880ab
 *		Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU**
Packit Service 3880ab
 *		to indicate that the index of the current CPU core should be
Packit Service 3880ab
 *		used.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The value to write, of *size*, is passed through eBPF stack and
Packit Service 3880ab
 *		pointed by *data*.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*ctx* is a pointer to in-kernel struct xdp_buff.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This helper is similar to **bpf_perf_eventoutput**\ () but
Packit Service 3880ab
 *		restricted to raw_tracepoint bpf programs.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_netns_cookie(void *ctx)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Retrieve the cookie (generated by the kernel) of the network
Packit Service 3880ab
 * 		namespace the input *ctx* is associated with. The network
Packit Service 3880ab
 * 		namespace cookie remains stable for its lifetime and provides
Packit Service 3880ab
 * 		a global identifier that can be assumed unique. If *ctx* is
Packit Service 3880ab
 * 		NULL, then the helper returns the cookie for the initial
Packit Service 3880ab
 * 		network namespace. The cookie itself is very similar to that
Packit Service 3880ab
 * 		of **bpf_get_socket_cookie**\ () helper, but for network
Packit Service 3880ab
 * 		namespaces instead of sockets.
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		A 8-byte long opaque number.
Packit Service 3880ab
 *
Packit Service 3880ab
 * u64 bpf_get_current_ancestor_cgroup_id(int ancestor_level)
Packit Service 3880ab
 * 	Description
Packit Service 3880ab
 * 		Return id of cgroup v2 that is ancestor of the cgroup associated
Packit Service 3880ab
 * 		with the current task at the *ancestor_level*. The root cgroup
Packit Service 3880ab
 * 		is at *ancestor_level* zero and each step down the hierarchy
Packit Service 3880ab
 * 		increments the level. If *ancestor_level* == level of cgroup
Packit Service 3880ab
 * 		associated with the current task, then return value will be the
Packit Service 3880ab
 * 		same as that of **bpf_get_current_cgroup_id**\ ().
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The helper is useful to implement policies based on cgroups
Packit Service 3880ab
 * 		that are upper in hierarchy than immediate cgroup associated
Packit Service 3880ab
 * 		with the current task.
Packit Service 3880ab
 *
Packit Service 3880ab
 * 		The format of returned id and helper limitations are same as in
Packit Service 3880ab
 * 		**bpf_get_current_cgroup_id**\ ().
Packit Service 3880ab
 * 	Return
Packit Service 3880ab
 * 		The id is returned or 0 in case the id could not be retrieved.
Packit Service 3880ab
 *
Packit Service bd02ce
 * long bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Helper is overloaded depending on BPF program type. This
Packit Service 3880ab
 *		description applies to **BPF_PROG_TYPE_SCHED_CLS** and
Packit Service 3880ab
 *		**BPF_PROG_TYPE_SCHED_ACT** programs.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Assign the *sk* to the *skb*. When combined with appropriate
Packit Service 3880ab
 *		routing configuration to receive the packet towards the socket,
Packit Service 3880ab
 *		will cause *skb* to be delivered to the specified socket.
Packit Service 3880ab
 *		Subsequent redirection of *skb* via  **bpf_redirect**\ (),
Packit Service 3880ab
 *		**bpf_clone_redirect**\ () or other methods outside of BPF may
Packit Service 3880ab
 *		interfere with successful delivery to the socket.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		This operation is only valid from TC ingress path.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		The *flags* argument must be zero.
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative error in case of failure:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EINVAL** if specified *flags* are not supported.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ENOENT** if the socket is unavailable for assignment.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ENETUNREACH** if the socket is unreachable (wrong netns).
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-EOPNOTSUPP** if the operation is not supported, for example
Packit Service 3880ab
 *		a call from outside of TC ingress.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		**-ESOCKTNOSUPPORT** if the socket type is not supported
Packit Service 3880ab
 *		(reuseport).
Packit Service 3880ab
 *
Packit Service 3880ab
 * long bpf_sk_assign(struct bpf_sk_lookup *ctx, struct bpf_sock *sk, u64 flags)
Packit Service 3880ab
 *	Description
Packit Service 3880ab
 *		Helper is overloaded depending on BPF program type. This
Packit Service 3880ab
 *		description applies to **BPF_PROG_TYPE_SK_LOOKUP** programs.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Select the *sk* as a result of a socket lookup.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		For the operation to succeed passed socket must be compatible
Packit Service 3880ab
 *		with the packet description provided by the *ctx* object.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		L4 protocol (**IPPROTO_TCP** or **IPPROTO_UDP**) must
Packit Service 3880ab
 *		be an exact match. While IP family (**AF_INET** or
Packit Service 3880ab
 *		**AF_INET6**) must be compatible, that is IPv6 sockets
Packit Service 3880ab
 *		that are not v6-only can be selected for IPv4 packets.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		Only TCP listeners and UDP unconnected sockets can be
Packit Service 3880ab
 *		selected. *sk* can also be NULL to reset any previous
Packit Service 3880ab
 *		selection.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		*flags* argument can combination of following values:
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **BPF_SK_LOOKUP_F_REPLACE** to override the previous
Packit Service 3880ab
 *		  socket selection, potentially done by a BPF program
Packit Service 3880ab
 *		  that ran before us.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **BPF_SK_LOOKUP_F_NO_REUSEPORT** to skip
Packit Service 3880ab
 *		  load-balancing within reuseport group for the socket
Packit Service 3880ab
 *		  being selected.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		On success *ctx->sk* will point to the selected socket.
Packit Service 3880ab
 *
Packit Service 3880ab
 *	Return
Packit Service 3880ab
 *		0 on success, or a negative errno in case of failure.
Packit Service 3880ab
 *
Packit Service 3880ab
 *		* **-EAFNOSUPPORT** if socket family (*sk->family*) is
Packit Service 3880ab
 *		  not compatible with packet family (*ctx->family*).
Packit Service 3880ab
 *