mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00

- don't require kernel headers to build the module: https://nakryiko.com/posts/bpf-portability-and-co-re/#getting-rid-of-kernel-header-dependency - use CO:RE BTF file: https://nakryiko.com/posts/bpf-portability-and-co-re/#btf
39 lines
874 B
C
39 lines
874 B
C
#ifndef OPENSNITCH_COMMON_DEFS_H
|
|
#define OPENSNITCH_COMMON_DEFS_H
|
|
|
|
#include "vmlinux-6.1.0-8.h"
|
|
|
|
#include "bpf_headers/bpf_helpers.h"
|
|
#include "bpf_headers/bpf_tracing.h"
|
|
#include "bpf_headers/bpf_core_read.h"
|
|
|
|
#define BUF_SIZE_MAP_NS 256
|
|
#define MAPSIZE 12000
|
|
|
|
// even though we only need 32 bits of pid, on x86_32 ebpf verifier complained when pid type was set to u32
|
|
typedef u64 pid_size_t;
|
|
typedef u64 uid_size_t;
|
|
|
|
|
|
//-------------------------------map definitions
|
|
// which github.com/iovisor/gobpf/elf expects
|
|
typedef struct bpf_map_def {
|
|
unsigned int type;
|
|
unsigned int key_size;
|
|
unsigned int value_size;
|
|
unsigned int max_entries;
|
|
unsigned int map_flags;
|
|
unsigned int pinning;
|
|
char namespace[BUF_SIZE_MAP_NS];
|
|
} bpf_map_def;
|
|
|
|
enum bpf_pin_type {
|
|
PIN_NONE = 0,
|
|
PIN_OBJECT_NS,
|
|
PIN_GLOBAL_NS,
|
|
PIN_CUSTOM_NS,
|
|
};
|
|
//-----------------------------------
|
|
|
|
#endif
|
|
|