<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmed Abir</title>
    <description>The latest articles on DEV Community by Ahmed Abir (@ahmed_abir).</description>
    <link>https://dev.to/ahmed_abir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1686113%2F5a866049-9a69-401f-b962-3157a647b95a.jpeg</url>
      <title>DEV Community: Ahmed Abir</title>
      <link>https://dev.to/ahmed_abir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmed_abir"/>
    <language>en</language>
    <item>
      <title>Install GO in UBUNTU machines</title>
      <dc:creator>Ahmed Abir</dc:creator>
      <pubDate>Fri, 05 Jul 2024 19:23:36 +0000</pubDate>
      <link>https://dev.to/ahmed_abir/install-go-in-ubuntu-machines-4a5m</link>
      <guid>https://dev.to/ahmed_abir/install-go-in-ubuntu-machines-4a5m</guid>
      <description>&lt;h2&gt;
  
  
  Download Source
&lt;/h2&gt;

&lt;p&gt;Download source from this link  &lt;a href="https://go.dev/dl/" rel="noopener noreferrer"&gt;Go Binaries&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Unpack Packages
&lt;/h2&gt;

&lt;p&gt;After downloading the binary file may be in your &lt;code&gt;~/Downloads&lt;/code&gt; folder from terminal&lt;br&gt;
use this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd Downloads
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then list the items in the directory by this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l | grep go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgmpuosioe0ju97xqpubo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgmpuosioe0ju97xqpubo.png" alt="go-binary-find" width="800" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Extract the binary files from the &lt;code&gt;go1.22.2.linux-amd64.tar.gz&lt;/code&gt; file in the download folder (you may have download the another version) use this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will extract the file into &lt;code&gt;/usr/local&lt;/code&gt; folder&lt;/p&gt;

&lt;h2&gt;
  
  
  Add to PATH variable
&lt;/h2&gt;

&lt;p&gt;Where the &lt;code&gt;go binaries&lt;/code&gt; are you need to find it and then the path should be added to you path variable otherwise you will encounter some problems like &lt;code&gt;go command not found&lt;/code&gt; by this command will be able to locate the &lt;code&gt;go binary&lt;/code&gt; where it is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;whereis go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdta72y62mg6n58433xa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdta72y62mg6n58433xa.png" alt="whereis-go" width="800" height="198"&gt;&lt;/a&gt;&lt;br&gt;
Now copy the path and use below command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export PATH=$PATH:{your_copied_path_here}/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Verify Installation
&lt;/h2&gt;

&lt;p&gt;Now use below command to verify your Installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F59e2upgoaintn8reoz2x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F59e2upgoaintn8reoz2x.png" alt="verify-installation" width="800" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>installgo</category>
      <category>setupgo</category>
      <category>goforebpf</category>
      <category>go</category>
    </item>
    <item>
      <title>How to setup Host for learning eBPF and XDP</title>
      <dc:creator>Ahmed Abir</dc:creator>
      <pubDate>Fri, 05 Jul 2024 19:15:22 +0000</pubDate>
      <link>https://dev.to/ahmed_abir/how-to-setup-host-for-learning-ebpf-and-xdp-150</link>
      <guid>https://dev.to/ahmed_abir/how-to-setup-host-for-learning-ebpf-and-xdp-150</guid>
      <description>&lt;h2&gt;
  
  
  Install Necessary Packages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First update your linux package index
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then install the following packages :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;clang&lt;/code&gt; compiler for compiling eBPF programs
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y clang
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;llvm&lt;/code&gt; provides libraries and tools for manipulating intermediate code, used by clang.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y llvm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;libelf-dev&lt;/code&gt; helps in working with &lt;strong&gt;ELF&lt;/strong&gt; (Executable and Linkable Format) files, which are used for eBPF bytecode.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y libelf-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;libbpf-dev&lt;/code&gt; library for loading and interacting with eBPF programs.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y libbpf-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;libpcap-dev&lt;/code&gt; provides functions for network packet capture, useful for testing and debugging.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y libpcap-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;gcc-multilib&lt;/code&gt; allows compiling programs for both 32-bits and 64-bits architechtures.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y gcc-multilib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;build-essential&lt;/code&gt; package that includes essential tools for compiling software (like gcc,make).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y build-essential
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;linux-tools-common&lt;/code&gt; provides common tools for kernel developers.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y linux-tools-common
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;linux-headers-$(uname -r)&lt;/code&gt; kernel headers specific to your sudoning kernel version, needed for compiling kernel modules.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y linux-headers-$(uname -r)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;linux-tools-$(uname -r)&lt;/code&gt; tools specific to your sudoning kernel version, useful for performance monitoring.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y linux-tools-$(uname -r)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;linux-headers-generic&lt;/code&gt; generic kernel headers, useful for compiling kernel modules across different kernel versions.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y linux-headers-generic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;linux-tools-generic&lt;/code&gt; generic tools for various kernel versions, useful for performance and debugging.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y linux-tools-generic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;iproute2&lt;/code&gt; collection of utilities for network configuration and management.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y iproute2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;iputils-ping&lt;/code&gt; provides the ping utility for testing network connectivity.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y iputils-ping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;dwarves&lt;/code&gt; contains tools like &lt;code&gt;pahole&lt;/code&gt; to inspect the structure of compiled programs.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y dwarves
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;tcpdump&lt;/code&gt; a packet analyzer that allows you to capture and display network packets.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y tcpdump
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;bind9-dnsutils&lt;/code&gt; provides tools for &lt;strong&gt;DNS&lt;/strong&gt; querying and testing. (nslookup, dig like tools)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get install -y bind9-dnsutils
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install All
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get update 

sudo apt-get install -y clang llvm libelf-dev libbpf-dev libpcap-dev gcc-multilib build-essential linux-tools-common

sudo apt-get install -y linux-headers-$(uname -r) linux-tools-$(uname -r) linux-headers-generic linux-tools-generic

sudo apt-get install -y iproute2 iputils-ping dwarves tcpdump bind9-dnsutils
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ebpfsetup</category>
      <category>xdpsetup</category>
      <category>bpftool</category>
    </item>
    <item>
      <title>Get Started With XDP e-BPF</title>
      <dc:creator>Ahmed Abir</dc:creator>
      <pubDate>Wed, 26 Jun 2024 08:28:00 +0000</pubDate>
      <link>https://dev.to/ahmed_abir/get-started-with-xdp-e-bpf-1a</link>
      <guid>https://dev.to/ahmed_abir/get-started-with-xdp-e-bpf-1a</guid>
      <description>&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;Why XDP and What problems does it solves&lt;/li&gt;
&lt;li&gt;Attaching Approaches of XDP&lt;/li&gt;
&lt;li&gt;Operation of XDP&lt;/li&gt;
&lt;li&gt;References&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I'm beginning a series on packet processing and the basics of XDP. In this post, you'll be introduced to the use cases and benefits of XDP, as well as its various operations. This guide aims to provide a clear and professional understanding of how XDP can enhance network performance and security.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;eBPF&lt;/strong&gt; (Extended Berkeley Packet Filter)
&lt;/h3&gt;

&lt;p&gt;It is a technology in the linux kernel that allows running custom code in response to various system events.&lt;/p&gt;

&lt;p&gt;Some of the applications of this tech &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Network Monitoring&lt;/strong&gt; 
Analyze network traffic without delay in processing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt;
Implement custom security policies to detect anomalies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Profiling&lt;/strong&gt;
Collect performance metrics and trace system calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It allows deep inspection and modification of the system behaviour with minimal overhead, enhancing security, performance, and observability.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;XDP&lt;/strong&gt; (eXpress Data Path)
&lt;/h3&gt;

&lt;p&gt;A feature of &lt;code&gt;eBPF&lt;/code&gt; focused on high-performance packet processing at the network interface level.&lt;/p&gt;

&lt;p&gt;Some of the applications of this feature&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DDOS Protection&lt;/strong&gt;
Drop malicious traffic before it reaches the operating system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Balancing&lt;/strong&gt;
Distribute network traffic efficiently across multiple servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Packet Filtering&lt;/strong&gt;
Apply custom filtering rules at the earliest point in the network stack.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It offers extremely fast packet processing capabilities, reducing latency and improving throughput.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why XDP and What problems does it solves
&lt;/h2&gt;

&lt;p&gt;In traditional way to packet processing is to &lt;strong&gt;kernel bypass&lt;/strong&gt;. This technique allows applications to directly access hardware resources, such as network interface cards (NICs), without involving the operating system kernel. &lt;/p&gt;

&lt;p&gt;How kernel bypass works?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Traditional networking involves multiple steps through the kernel (e.g., &lt;strong&gt;context switches&lt;/strong&gt;, &lt;strong&gt;network stack&lt;/strong&gt; processing, and &lt;strong&gt;interrupts&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;With kernel bypass, applications or eBPF programs interact directly with the &lt;code&gt;NIC&lt;/code&gt;, skipping these kernel steps.
This kernel bypass technique has some drawbacks. &lt;/li&gt;
&lt;li&gt;eBPF programs need to write their own drivers and handle low-level hardware interactions. This creates extra works for the developers.&lt;/li&gt;
&lt;li&gt;Applications must implement network functions typically handled by the kernel, increasing development effort.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;XDP can solve the upper drawbacks. XDP provides following advantages over the traditional technique :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simplifies&lt;/strong&gt; high-performance networking with &lt;code&gt;eBPF&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Allows &lt;strong&gt;direct&lt;/strong&gt; reading and writing of &lt;code&gt;network packet&lt;/code&gt; data.&lt;/li&gt;
&lt;li&gt;Enables decision-making on packet processing before &lt;strong&gt;kernel involvement&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;XDP provides a framework that simplifies packet-processing, allowing developers to focus on the core functionality of their eBPF programs without dealing with &lt;strong&gt;low-level&lt;/strong&gt; driver details.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Attaching Approaches of XDP programs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;XDP&lt;/strong&gt; (eXpress Data Path) can be attached at specific points in the network stack to enable high-performance packet processing. Here are the places where you can attach &lt;strong&gt;XDP&lt;/strong&gt; programs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Network Interface Cards (NICs)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Driver Mode&lt;/strong&gt;: Attaches directly to the network driver, allowing packet processing at the earliest point possible, right after the packet is received by the NIC. In this approach it is called &lt;strong&gt;native XDP&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hardware Offload&lt;/strong&gt;: Some NICs support offloading XDP programs to the hardware, which can further reduce latency and CPU usage. In this approach it is called &lt;strong&gt;offloaded XDP&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Virtual Network Devices&lt;/strong&gt;
XDP can be attached to virtual network interfaces like &lt;code&gt;veth&lt;/code&gt; pairs, &lt;code&gt;tap&lt;/code&gt; devices, which are often used in container networking setups.
This allows for efficient packet processing in virtualized environments.&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;General Networking Stack&lt;/strong&gt;
XDP can be attached at the general network stack level, providing flexibility for packet processing without requiring specific hardware support. In this approach it is called &lt;strong&gt;generic XDP&lt;/strong&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21pwzfelucexggc8bo2b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21pwzfelucexggc8bo2b.png" alt="xdp-attach" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Operations of XDP programs
&lt;/h2&gt;

&lt;p&gt;XDP programs processes network packets. So, it performs some operations on the packets. Here are the fundamental operations of XDP program can perform with the packets it recieves, once it is connected to a network interface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;XDP_DROP&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Drops the packet and does not process it further.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: Analyzing traffic patterns and using filters to drop specific types of packets, such as malicious traffic.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;XDP_PASS&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Forwards the packet to the normal network stack for further processing.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: The XDP program can modify the content of the packet before it is processed by the normal network stack.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;XDP_TX&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Forwards the packet, possibly modified, to the same network interface that received it.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: Immediate retransmission or forwarding on the same interface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;XDP_REDIRECT&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Bypasses the normal network stack and redirects the packet to another network interface.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: Directing traffic to a different NIC without passing through the kernel’s network stack.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fljh4u5s6oiveqyvx4rrc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fljh4u5s6oiveqyvx4rrc.png" alt="xdp-operations" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/xdp-project/xdp-tutorial" rel="noopener noreferrer"&gt;xdp-project/xdp-tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/xdp-project/xdp-paper/blob/master/xdp-the-express-data-path.pdf" rel="noopener noreferrer"&gt;Academic Paper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.cilium.io/en/latest/bpf/" rel="noopener noreferrer"&gt;Cilium BPF&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.netdevconf.org/0x13/session.html?tutorial-XDP-hands-on" rel="noopener noreferrer"&gt;Netdev Conference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://isovalent.com/books/learning-ebpf/" rel="noopener noreferrer"&gt;Learning eBPF by Liz Rice&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>xdp</category>
      <category>go</category>
      <category>learningebpf</category>
      <category>kernelmodule</category>
    </item>
  </channel>
</rss>
