Skip to content

Commit

Permalink
grpc: export BpfCmd enum type in events
Browse files Browse the repository at this point in the history
Signed-off-by: Djalal Harouni <[email protected]>
  • Loading branch information
tixxdz committed Sep 25, 2024
1 parent 338b1ed commit 3a3db1f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/grpc/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/cilium/tetragon/pkg/api/tracingapi"
api "github.com/cilium/tetragon/pkg/api/tracingapi"
"github.com/cilium/tetragon/pkg/eventcache"
gt "github.com/cilium/tetragon/pkg/generictypes"
"github.com/cilium/tetragon/pkg/ksyms"
"github.com/cilium/tetragon/pkg/ktime"
"github.com/cilium/tetragon/pkg/logger"
Expand Down Expand Up @@ -66,12 +67,20 @@ func kprobeAction(act uint64) tetragon.KprobeAction {
}
}

func getKprobeArgInt(arg api.MsgGenericKprobeArgInt, a *tetragon.KprobeArgument) {
if arg.UserSpaceType == gt.GenericUserBpfCmdType {
a.Arg = &tetragon.KprobeArgument_BpfCmdArg{BpfCmdArg: tetragon.BpfCmd(arg.Value)}
} else {
a.Arg = &tetragon.KprobeArgument_IntArg{IntArg: arg.Value}
}
a.Label = arg.Label
}

func getKprobeArgument(arg tracingapi.MsgGenericKprobeArg) *tetragon.KprobeArgument {
a := &tetragon.KprobeArgument{}
switch e := arg.(type) {
case api.MsgGenericKprobeArgInt:
a.Arg = &tetragon.KprobeArgument_IntArg{IntArg: e.Value}
a.Label = e.Label
getKprobeArgInt(e, a)
case api.MsgGenericKprobeArgUInt:
a.Arg = &tetragon.KprobeArgument_UintArg{UintArg: e.Value}
a.Label = e.Label
Expand Down

0 comments on commit 3a3db1f

Please sign in to comment.