Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
ShohamBit committed Dec 24, 2024
1 parent 3deac7d commit 4056acf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/events/parse_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func ParseArgs(event *trace.Event) error {
case Socketcall:
if callArg := GetArg(event, "call"); callArg != nil {
if call, isInt32 := callArg.Value.(int32); isInt32 {
parseSocketCall(callArg, uint64(call))
parseSocketcallCall(callArg, uint64(call))
}
}
case Socket:
Expand Down
11 changes: 5 additions & 6 deletions pkg/events/parse_args_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ func parsePrctlOption(arg *trace.Argument, opt uint64) {
arg.Value = prctlOptionArgument.String()
}

func parseSocketCall(arg *trace.Argument, call uint64) {
func parseSocketcallCall(arg *trace.Argument, call uint64) {
arg.Type = "string"
socketCallArgument, err := parsers.ParseSocketCall(call)
socketCallArgument, err := parsers.ParseSocketcallCall(call)
if err != nil {
arg.Value = fmt.Sprint(call)
return
Expand Down Expand Up @@ -215,7 +215,7 @@ func parseBpfHelpersUsage(arg *trace.Argument, helpersList []uint64) {
}

arg.Type = "const char**"
arg.Value = fmt.Sprint(usedHelpers)
arg.Value = usedHelpers
}

func parseBpfAttachType(arg *trace.Argument, attachType int32) {
Expand All @@ -237,10 +237,9 @@ func parseBpfAttachType(arg *trace.Argument, attachType int32) {
case 5:
attTypeName = "uretprobe"
default:
arg.Value = fmt.Sprint(attachType)
attTypeName = fmt.Sprint(attachType)
logger.Errorw("Unknown attach_type got from bpf_attach event")
return
}

arg.Value = fmt.Sprint(attTypeName)
arg.Value = attTypeName
}
4 changes: 2 additions & 2 deletions pkg/events/parsers/data_parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1094,10 +1094,10 @@ var socketcallCallMap = map[uint64]SocketcallCallArgument{
SYS_SENDMMSG.Value(): SYS_SENDMMSG,
}

// ParseSocketCall parses the `call` argument of the `socketcall` syscall
// ParseSocketcallCall parses the `call` argument of the `socketcall` syscall
// http://man7.org/linux/man-pages/man2/socketcall.2.html
// https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net.h
func ParseSocketCall(rawValue uint64) (SocketcallCallArgument, error) {
func ParseSocketcallCall(rawValue uint64) (SocketcallCallArgument, error) {
if v, ok := socketcallCallMap[rawValue]; ok {
return v, nil
}
Expand Down

0 comments on commit 4056acf

Please sign in to comment.