Skip to content

Commit

Permalink
feat: export netkit and tcx probes
Browse files Browse the repository at this point in the history
Export the two feature probes for users. These are quite useful and in
particular the one for netkit is needed for Cilium to throw an error
earlier.

Signed-off-by: Daniel Borkmann <[email protected]>
Link: cilium/cilium#33878
  • Loading branch information
borkmann committed Oct 25, 2024
1 parent 4434f86 commit 7597c39
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions link/syscalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ var haveProgQuery = internal.NewFeatureTest("BPF_PROG_QUERY", func() error {
return errors.New("syscall succeeded unexpectedly")
}, "4.15")

// HaveTCX probes the running kernel for the availability of the tcx layer.
//
// Upstream commit e420bed0250 ("bpf: Add fd-based tcx multi-prog infra with link support")
//
// See the package documentation for the meaning of the error return value.
func HaveTCX() error {
return haveTCX()
}

var haveTCX = internal.NewFeatureTest("tcx", func() error {
prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{
Type: ebpf.SchedCLS,
Expand Down Expand Up @@ -164,6 +173,15 @@ var haveTCX = internal.NewFeatureTest("tcx", func() error {
return errors.New("syscall succeeded unexpectedly")
}, "6.6")

// HaveNetkit probes the running kernel for the availability of netkit devices.
//
// Upstream commit 35dfaad7188c ("netkit, bpf: Add bpf programmable net device")
//
// See the package documentation for the meaning of the error return value.
func HaveNetkit() error {
return haveNetkit()
}

var haveNetkit = internal.NewFeatureTest("netkit", func() error {
prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{
Type: ebpf.SchedCLS,
Expand Down

0 comments on commit 7597c39

Please sign in to comment.