I'm trying to write a go program that write something in the terminal each time a new network interface is created. To do that I'm using the Go library Cilium ebpf-go (https://github.com/cilium/ebpf). I'm new to ebpf so I need a help. For the moment what I understood is that I have to use a kprobe or fentry program, since I have to attach the ebpf program to a function which not have a defined tracepoint to use. I looked in the linux kernel and I'm pretty sure that I should attach the program to dev_alloc_name or rtnl_create_link but please let me know if I'm wrong. Also, since it's the first time I write something using this library as first thing I tried to take examples from the repository and modify them. I tried with the kprobe one (https://github.com/cilium/ebpf/tree/main/examples/kprobe) and the fentry one (https://github.com/cilium/ebpf/tree/main/examples/fentry) but I'm facing some difficulties to understand how they work.
Track network interfaces with cilium ebpf-go
162 Views Asked by Vincenzo Cosi At
1
There are 1 best solutions below
Related Questions in GO
- How do I get all the attributes of an XML element using Go?
- Type cast custom types to base types
- Why are Revel optional func parameters in controller not working? CRUD code redundancy
- Streaming commands output progress
- single ampersand between 2 expressions
- golang goroutine use SSHAgent auth doesn't work well and throw some unexpect panic
- How do I do a literal *int64 in Go?
- Emulating `docker run` using the golang docker API
- How to print contents of channel without changing it
- Golang time zone parsing not returning the correct zone on ubuntu server
- Is os.File's Write() threadsafe?
- How to get the pointer of return value from function call?
- How do I represent an Optional String in Go?
- Fibonacci in Go using channels
- Boltdb-key-Value Data Store purely in Go
Related Questions in LINUX-KERNEL
- kernel module does not print packet info
- android linux kernel communicate with user space about NETLINK_USER
- How to offload NAPI poll function to workqueue
- Why Device Tree Structure (DTS) file is needed both in bootloader and kernel source code?
- Bootloader in Assembly with Linux kernel
- pktgen not sending packets more than 1kb big
- Use static analysis tools to check null pointers and memory leaks in Linux device drivers
- How to build Linux kernel to support SO_ATTACH_BPF socket option?
- How do I know the last sched time of a process
- linux kernel compile error....udevd[63]: error getting socket
- Process in background mode trying to read from stdin
- board firmware update through uefi capsule feature from Linux
- spin_lock before writing status register
- Kernel module configuration locked built in?
- Install Subversion 1.7 on Debian jessie
Related Questions in EBPF
- How to build Linux kernel to support SO_ATTACH_BPF socket option?
- Tc bpf packet forward to other device by updating the Checksum
- What causes `bpf_perf_event_output` to return -22?
- How to cross compile bpf targets for linux arm on Mac M-series laptop?
- Tracing with eBPF tracepoint "netif_receive_skb" for multiple NICs
- Extracting UDP packet payload with eBPF tracepoints using libbpf
- XDP get packet payload
- How to get request/response body with uprobe?
- EBPF Route Table Addition or Modification
- How to access user space function argument (struct pointer) in bpf?
- How to unload bpd program using bpftool?
- How to design eBPF map for large data structures without exceeding jump complexity?
- What is the recommended way to unit test eBPF/XDP program?
- libbpf: failed to guess program from ELF section 'filter'
- I was unble to load my compiled bpf source code in to the kernel
Related Questions in CILIUM
- Track network interfaces with cilium ebpf-go
- How does Cilium get Pod info when creating a new Pod for setting up labels for endpoints?
- cilium/ebpf came across a problem with ```PT_REGS_PARM3_CORE``` and ```PT_REGS_PARM3``` function
- eBPF uprobe Go function argument wrong output
- Program to pull the network logs from Cilium to Hubble
- Monitor or log dropped network traffic for Kubernetes NetworkPolicy
- Intermittent failure of K8S DNS resolver / dial udp / Operation cancelled
- Cert-manager ClusterIssuer undefined on EKS cluster with Cilium installed as CNI. Error: Post \"": Address is not allowed" "key"="clusterissuername"
- how to get goroutine id with ebpf
- How to see the rule, when error: didn't match pod anti-affinity rules
- Cilium topologyKey: kubernetes.io/hostname: pending pod, didn't match pod anti-affinity rules
- Select all pods running on a K8s node for Cilium Policy
- Cilium Cluster Mesh at Azure
- Failure Err: Not able to connect to any etcd endpoints - etcd: 0/1 connected: kubeadm
- Cilium pods crashing due to invalid range ip of node
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Did you consider just using
LinkSubscribefrom the Golang netlink library, as follows?See how Cilium uses it for a more complete examples:
pkg/datapath/loader/netlink.go#L480.