diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-22 22:44:44 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-22 22:44:44 +0200 |
| commit | c1b4bee6c93265139974b1e5cf065d3f82a7154b (patch) | |
| tree | 6bffa2fdcad38aebcfa0099cd8e684ba65dbde53 /internal/c | |
| parent | 285eefb1f36e2298af30d8e3df63792204a5b85d (diff) | |
PID filter
Diffstat (limited to 'internal/c')
| -rw-r--r-- | internal/c/filter.c | 10 | ||||
| -rw-r--r-- | internal/c/flags.h | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/internal/c/filter.c b/internal/c/filter.c index a91eb84..93497c7 100644 --- a/internal/c/filter.c +++ b/internal/c/filter.c @@ -1,5 +1,13 @@ //+build ignore static __always_inline int filter() { - return (bpf_get_current_uid_gid() & 0xFFFFFFFF) != UID_FILTER; + if ((bpf_get_current_pid_tgid() >> 32) == PID_FILTER) + return 0; + + /* + if ((bpf_get_current_uid_gid() & 0xFFFFFFFF) == UID_FILTER) + return 0; + */ + + return 1; } diff --git a/internal/c/flags.h b/internal/c/flags.h index 53b9492..eb7ec83 100644 --- a/internal/c/flags.h +++ b/internal/c/flags.h @@ -1,4 +1,4 @@ //+build ignore -const volatile u32 UID_FILTER = 0; -volatile u32 DYNAMIC_UID_FILTER = 0; +// const volatile u32 UID_FILTER = -1; +const volatile u32 PID_FILTER = -1; |
