Skip to content

Commit

Permalink
features: implement feature probe for StructOps program
Browse files Browse the repository at this point in the history
ENOTSUPP means the program type is available.

Signed-off-by: Timo Beckers <timo@isovalent.com>
  • Loading branch information
ti-mo committed Aug 1, 2022
1 parent ceb1b94 commit 7fb0b56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion features/prog.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ func haveProgramType(pt ebpf.ProgramType) error {
// to support the given prog type.
case errors.Is(err, unix.EINVAL), errors.Is(err, unix.E2BIG):
err = ebpf.ErrNotSupported

// ENOTSUPP means the program type is at least known to the kernel.
case errors.Is(err, sys.ENOTSUPP):
if pt == ebpf.StructOps {
err = nil
}
}

pc.types[pt] = err
Expand Down Expand Up @@ -241,7 +247,7 @@ func haveProgramHelper(pt ebpf.ProgramType, helper asm.BuiltinFunc) error {

func progLoadProbeNotImplemented(pt ebpf.ProgramType) bool {
switch pt {
case ebpf.Tracing, ebpf.StructOps, ebpf.Extension, ebpf.LSM:
case ebpf.Tracing, ebpf.Extension, ebpf.LSM:
return true
}
return false
Expand Down

0 comments on commit 7fb0b56

Please sign in to comment.