Author name: Anamika

kprobe

connect() Table of Contents The connect() system call is a crucial function in Linux that enables processes to establish connections between sockets. By initiating a connection request to a remote host, connect() plays a pivotal role in network communication, allowing programs to connect and exchange data over various types of connections, such as TCP/IP. Understanding the connect() system call is essential …

kprobe Read More »

Tools and libraries

Table of Contents Interacting with Linux BPF Ring Buffer using Package ringbuf in libbpfgo Introduction Linux BPF (Berkeley Packet Filter) ring buffer is a powerful mechanism that allows userspace programs to interact with custom events submitted by BPF programs. These events can be essential for tasks such as pushing packet samples from BPF to user …

Tools and libraries Read More »

eBPF Program

Table of Contents Writing an eBPF Program Using Ringbuf Map with libbpfgo   In this blog post, we will explore how to write an eBPF (extended Berkeley Packet Filter) program that utilizes a ringbuf map to transfer data. We will also learn how to process the data stored in the ringbuf map using libbpfgo, a …

eBPF Program Read More »

Repository Structure with ebpf maps

Table of Contents xdp_prog_func The main function in the program is xdp_prog_func, which is the actual XDP hook function. This function is executed whenever a packet passes through the XDP hook. The function first retrieves the data record associated with the XDP_PASS action from the xdp_stats_map using the bpf_map_lookup_elem() function. If the lookup is successful, the function increments …

Repository Structure with ebpf maps Read More »

Interacting With Maps

Table of Contents Interacting with eBPF maps happens through lookup/update/delete primitives. Userspace The userspace API map helpers for eBPF are defined in tools/lib/bpf/bpf.h and include the following functions: /* Userspace helpers */ int bpf_map_lookup_elem(int fd, void *key, void *value); int bpf_map_update_elem(int fd, void *key, void *value, __u64 flags); int bpf_map_delete_elem(int fd, void *key); /* Only userspace: */ int bpf_map_get_next_key(int …

Interacting With Maps Read More »

BPF Maps

Table of Contents The program is designed to be attached to an XDP (eXpress Data Path) hook, which is a high-performance data path in the Linux kernel for fast packet processing. The goal of this program is to count the number of packets that pass through the XDP hook and store the statistics in a BPF hash map. …

BPF Maps Read More »

Scroll to Top