You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On trying to run my go user space code the following error logs are generated:
CGO_ENABLED=1 go run drop.go
# github.com/aquasecurity/libbpfgo
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:30:9: could not determine kind of name for C.LIBBPF_MAJOR_VERSION
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:35:9: could not determine kind of name for C.LIBBPF_MINOR_VERSION
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:188:55: could not determine kind of name for C.LIBBPF_STRICT_AUTO_RLIMIT_MEMLOCK
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:189:55: could not determine kind of name for C.LIBBPF_STRICT_MAP_DEFINITIONS
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:187:55: could not determine kind of name for C.LIBBPF_STRICT_NO_OBJECT_LIST
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:186:55: could not determine kind of name for C.LIBBPF_STRICT_SEC_NAME
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:477:7: could not determine kind of name for C.bpf_object__next_map
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:517:7: could not determine kind of name for C.bpf_object__next_program
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:770:21: could not determine kind of name for C.bpf_program__type
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:1565:16: could not determine kind of name for C.libbpf_probe_bpf_map_type
../go/pkg/mod/github.com/aquasecurity/[email protected]/libbpfgo.go:1573:16: could not determine kind of name for C.libbpf_probe_bpf_prog_type
my go.mod file configurations:
module github.com/VedRatan/ebpf
go 1.21.2
require github.com/aquasecurity/libbpfgo v0.5.1-libbpf-1.2
my go file:
package main
import (
"C"
"fmt"
bpf "github.com/aquasecurity/libbpfgo"
)
import (
"os"
"os/signal"
"syscall"
)
func main() {
sig := make(chan os.Signal, 1)
signal.Notify(sig, os.Interrupt)
b, err := bpf.NewModuleFromFile("dropipv4.o")
if err != nil {
panic(err)
}
defer b.Close()
err = b.BPFLoadObject()
if err != nil {
panic(err)
}
prog, err := b.GetProgram("capture_packets")
if err != nil {
panic(err)
}
// Specify the network interface name to attach the XDP program to
ifaceName := "wlo1" // Replace with your network interface name
link, err := prog.AttachXDP(ifaceName)
if err != nil {
fmt.Fprintf(os.Stderr, "Error attaching XDP program: %v\n", err)
os.Exit(1)
}
fmt.Printf("XDP program attached to wlo1\n")
// mapName := "rxcnt"
// mp, err := b.GetMap(mapName)
// if err != nil {
// fmt.Fprintf(os.Stderr, "Error getting map: %v\n", err)
// os.Exit(1)
// }
// Wait for a signal to keep the program running
sig = make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
<-sig
// Detach the XDP program when the program exits
if err := link.Destroy(); err != nil {
fmt.Fprintf(os.Stderr, "Error detaching XDP program: %v\n", err)
}
}
The text was updated successfully, but these errors were encountered:
On trying to run my go user space code the following error logs are generated:
my go.mod file configurations:
my go file:
The text was updated successfully, but these errors were encountered: