diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-13 19:11:52 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-13 19:11:52 +0200 |
| commit | 6c1335b3538dabc82b4931d4bf13a36f86c4666e (patch) | |
| tree | 3f8971f8b3d81ba09637ee39c9f5e238072edb51 /internal | |
| parent | ef80f577771e95c0843658d65ced3dd069634471 (diff) | |
can pass flags to BPF
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/ioriotng.go | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/internal/ioriotng.go b/internal/ioriotng.go index b34a5cf..94c8030 100644 --- a/internal/ioriotng.go +++ b/internal/ioriotng.go @@ -10,9 +10,9 @@ import ( "log" "runtime" "sync" - "unsafe" "ioriotng/internal/debugfs" + "ioriotng/internal/flags" "ioriotng/internal/tracepoints" bpf "github.com/aquasecurity/libbpfgo" @@ -70,23 +70,7 @@ func resizeMap(module *bpf.Module, name string, size uint32) error { return nil } -func config(bpfModule *bpf.Module) error { - configMap, err := bpfModule.GetMap("config_map") - if err != nil { - return err - } - - config := struct { - UidFilter int32 - }{ - UidFilter: 1001, // TODO: Make configurable via flag, - } - - key := uint32(1) - return configMap.Update(unsafe.Pointer(&key), unsafe.Pointer(&config)) -} - -func Run() { +func Run(flags flags.Flags) { // To consider for implementation! log.Println(debugfs.TracepointsWithFd()) @@ -108,7 +92,7 @@ func Run() { log.Fatal(err) } - if err := config(bpfModule); err != nil { + if err := flags.SetBPF(bpfModule); err != nil { log.Fatal(err) } |
