
{
    "version": "https://jsonfeed.org/version/1.1",
    "title": "Make the Web Fun Again on Erich's Site",
    "description": "Recent content in Make the Web Fun Again on Erich's Site",
    "home_page_url": "https://hanserich.com/",
    "feed_url": "https://hanserich.com/index.json",
    "language": "en-us",
    "icon": "https://hanserich.com/images/logo.png",
    "favicon": "https://hanserich.com/img/logo.png",
    "authors": [
        {
            "name": "Erich",
            "avatar": "https://hanserich.com/images/avatar.jpeg"
        }
    ],
    "items": [
        {
            "title": "eBPF, XDP and Kernel Bypass",
            "date_published": "2025-06-14T00:00:00Z",
            "date_modified": "2025-06-14T00:00:00Z",
            "id": "https://hanserich.com/blog/ebpf_xdp_and_kernel_bypass/",
            "url": "https://hanserich.com/blog/ebpf_xdp_and_kernel_bypass/",
            "authors": [
                {
                  "name": "Erich"
                }
            ],
            "content_html": "\u003cp\u003e🧠 Is eBPF a Kernel Bypass? Clearing the Confusion\u003c/p\u003e\n\u003cp\u003eeBPF (extended Berkeley Packet Filter) has exploded in popularity for observability, security, and networking on Linux. But if you’ve browsed Reddit or Hacker News, you’ve probably seen people claim:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e“eBPF runs in userspace.”\n“eBPF is a kernel bypass.”\n“eBPF replaces DPDK!”\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eLet’s clear the fog. In this post, we’ll walk through what eBPF really is, where it runs, and whether it qualifies as a “kernel bypass.”\n🔍 What Is eBPF?\u003c/p\u003e\n\u003cp\u003eAt its core, eBPF is a virtual machine inside the Linux kernel that allows you to attach tiny programs to key parts of the system — like syscalls, network packet processing, or tracing events.\u003c/p\u003e\n\u003cp\u003eYou write these eBPF programs in userspace, typically in C, and then load them into the kernel via a syscall (bpf()), where they are verified and JIT-compiled to native code.\u003c/p\u003e\n\u003cp\u003eSo:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e📦 Written in userspace\n\n🚀 Executed in kernel space\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e🤔 So… Is eBPF a Kernel Bypass?\u003c/p\u003e\n\u003cp\u003eNo. eBPF is not a kernel bypass. In fact, it’s the opposite.\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003eeBPF runs inside the kernel and operates with kernel cooperation.\n\nIt extends the kernel's capabilities safely and dynamically.\n\nIt is sandboxed, verified, and runs in specific hook points (e.g., network ingress, syscall entry, kprobes, tracepoints, etc.).\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e✅ eBPF Enhances Kernel Behavior\n❌ eBPF Does Not Bypass the Kernel\n🧵 Why Do People Say eBPF “Runs in Userspace”?\u003c/p\u003e\n\u003cp\u003eThere’s a grain of truth, but it’s misleading.\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003eeBPF code is developed and compiled in userspace.\n\nYou use userspace tools like clang, bpftool, bcc, libbpf, or bpftool prog load to load programs into the kernel.\n\nBut once loaded, eBPF programs run in kernel context, not in userspace.\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eSaying “eBPF runs in userspace” is like saying \u0026ldquo;drivers run in Notepad because you wrote them there.\u0026rdquo; It’s true that you write them in userspace, but they run in kernelspace.\n⚡ But What About XDP or AF_XDP?\u003c/p\u003e\n\u003cp\u003eGood question!\u003c/p\u003e\n\u003cp\u003eThese are part of the eBPF ecosystem, especially in networking.\nTechnology\tRuns In\tDescription\nXDP\tKernel (very early)\tProcesses packets in the driver before the kernel stack. Used for fast packet filtering and redirection.\nAF_XDP\tUserspace\tA socket type that allows zero-copy packet I/O between NIC and userspace. Can act as a true kernel bypass.\nDPDK\tUserspace\tFull kernel bypass. Userland packet processing with direct NIC access via UIO or VFIO.\u003c/p\u003e\n\u003cp\u003eSo if you want true kernel bypass, you’ll use DPDK or AF_XDP in zero-copy mode. eBPF + XDP can drop or redirect packets before they hit the TCP/IP stack, but it’s still happening inside the kernel.\n🧠 Summary\nStatement\t✅ / ❌\tClarification\neBPF runs in kernel space\t✅\tAfter loading, eBPF executes in the kernel\neBPF is a kernel bypass\t❌\tIt extends the kernel, not bypasses it\nYou write eBPF in userspace\t✅\tThen it’s loaded into kernel\nXDP can avoid the kernel network stack\t⚠️\tPartially true — it avoids the full stack but is still in kernel\nAF_XDP and DPDK bypass the kernel\t✅\tThese give userland access to NICs\n🛠️ Want to Go Deeper?\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003eBuild an XDP program to drop or redirect packets\n\nCompare DPDK vs AF_XDP vs XDP in real benchmarks\n\nTrace syscalls with eBPF using tools like bcc or bpftrace\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e🔚 Conclusion\u003c/p\u003e\n\u003cp\u003eeBPF is a powerful in-kernel extension mechanism, not a bypass. If you\u0026rsquo;re aiming for extreme packet throughput or latency reduction in userland, consider AF_XDP or DPDK. But for safety, flexibility, and observability — eBPF is unmatched.\u003c/p\u003e\n\u003cp\u003eIf you\u0026rsquo;re confused by what runs where, just remember:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003eYou write in userspace, but eBPF thinks in kernelspace.\n\u003c/code\u003e\u003c/pre\u003e\n"
        },
        {
            "title": "Open Source as an Ideology",
            "date_published": "2025-04-24T00:00:00Z",
            "date_modified": "2025-04-24T00:00:00Z",
            "id": "https://hanserich.com/blog/oss_as_an_ideology/",
            "url": "https://hanserich.com/blog/oss_as_an_ideology/",
            "authors": [
                {
                  "name": "Erich"
                }
            ],
            "content_html": "\u003cp\u003eAs a tech enthusiast or IT engineer, we are already familiar with Open Source Software (OSS). Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Open source is a concept of accessible code base and we can modify the code by every one, also we can contribute to the development of the prject as a community (with some license of course). This concept was spread after linux was introduced to the world. As an IT concept open source was proven to accelerate the development for new technology by its opennes concept.\u003c/p\u003e\n\u003ch2 id=\"open-source-as-an-ideology\"\u003eOpen Source as an Ideology\u003c/h2\u003e\n\u003cp\u003eAs I explained earlier, open source is about transparancy, collaboration and freedom. Let\u0026rsquo;s think about it, if we contemplate this idea and then remove the code or software development concept, it becomes a powerful philosophical approach.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eTransparancy:\u003c/strong\u003e Everyone can see how something works.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eCollaboration:\u003c/strong\u003e Everyone can contribute to make it better or bigger, not just expert but anyone who have insight or ideas.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eFreedom:\u003c/strong\u003e Anyone can modify or adopt the system to suit their needs.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThis models contrasts sharply with many traditional system-corporate, governemental, also educational that often operate under hierarchy, secrecy and control.\u003c/p\u003e\n\u003ch2 id=\"open-source-as-a-social-movement\"\u003eOpen Source as a Social Movement\u003c/h2\u003e\n\u003cp\u003eWhen treated as a movement, open source embodies principles that align closely with decentralization, community-driven action and equity. This movement pushes back the centralized and monopolization of knowledge and power, against the monopolar hegemony and encourage the uni-polar system to distributed ownership.\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eEducation: Open Knowledge for All\nThe rise of Open Educational Resources (OER) is democratizing access to learning. Free textbooks, courses (like MIT OpenCourseWare or Khan Academy), and community-driven teaching platforms embody open-source ideals. Education becomes a shared responsibility—not a commodity.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eGovernment: Open Data and Civic Tech\nIn the public sector, movements for open data and open governance allow citizens to access and interpret information, hold institutions accountable, and even co-develop policies. Projects like Code for America apply open-source approaches to civic engagement.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eScience and Research: Collaborative Discovery\nThe traditional academic publishing model is being disrupted by open-access journals and platforms like arXiv and Sci-Hub. Researchers are increasingly sharing methods, data, and results in real-time, accelerating the pace of innovation.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eArt and Culture: Creative Commons\nPlatforms like Creative Commons allow artists to license their work in ways that encourage remixing, reuse, and collaboration. The idea of rigid copyright is softened, and creativity becomes more communal.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"open-source-in-daily-life-even-if-youre-not-a-developer\"\u003eOpen Source in Daily Life (Even if You’re Not a Developer)\u003c/h2\u003e\n\u003cp\u003eMany people are already living \u0026ldquo;open source\u0026rdquo; lives—they just don’t call it that.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eA gardener who shares plant cuttings and cultivation tips.\u003c/li\u003e\n\u003cli\u003eA teacher uploading free worksheets online.\u003c/li\u003e\n\u003cli\u003eAn activist creating a toolkit for organizing that others can use and adapt.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThe open-source ideology empowers individuals and communities to own their tools, their knowledge, and their future.\u003c/p\u003e\n\u003ch2 id=\"governemnt-and-geopolotics-with-open-source-principles\"\u003eGovernemnt and Geopolotics with Open Source Principles\u003c/h2\u003e\n\u003cp\u003eWe have several governement system that applied to the nations. On a bigger picture there are 2 systems that widely used, Republic and Monarchy. Those systems have its inheritance, but mostly it is republic and monarchy. If we saw the open source principle, it is closely to the republic idea but is it republic decentralized? community-driven? The republican enthusiast would say \u0026ldquo;yes!!!\u0026rdquo;, but is it really true? I don\u0026rsquo;t think so. As Socrates critics to the republic, it will only produce the demagog. I saw in some countries that Socrates\u0026rsquo;s words come true. No community words taken, centralized system and disrepancy that occured.\u003c/p\u003e\n\u003cp\u003eFor me, open source priciple as an ideology is a \u003cstrong\u003e\u0026ldquo;patch\u0026rdquo;\u003c/strong\u003e for current republic idea. If we can apply the open source principle combined with republic idea, I think it will be a game changer for current governement system. As world growing, and world become monopolar that means only one super power country that acts as a world governmet (reminds me on one piece btw). This situation already predicted by Socrates, that even democratic system at some point would be worst as another system if a power lays on a single subject. Another block from east try to against this mono-polar like system with idea of collaboration, decentralization and transparancy. This head-to-head ideas brings by a powerful countries worth to wait, prepare the pop corn and cola to watch what look like this world ended up.\u003c/p\u003e\n\u003ch2 id=\"but-there-are-challenges\"\u003eBut There Are Challenges…\u003c/h2\u003e\n\u003cp\u003eOpen source isn’t perfect. Whether in software or society, it comes with tough questions:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eWho maintains and moderates open systems?\u003c/li\u003e\n\u003cli\u003eHow do we fund contributions in a world driven by profit?\u003c/li\u003e\n\u003cli\u003eHow do we prevent exploitation of free labor and ideas?\u003c/li\u003e\n\u003cli\u003eHow do we ensure open doesn’t mean “lawless” or “unstructured”?\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThese are ongoing debates—even within the software world—and they become even more complex when applied to broader societal models. Yeah there are no perfect or ideal concept o ideology, we just need to rethink and patch our ideology to fit our necesities.\u003c/p\u003e\n\u003ch2 id=\"references\"\u003eReferences\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003e\u003ca href=\"https://en.wikipedia.org/wiki/Open_source\"\u003ehttps://en.wikipedia.org/wiki/Open_source\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://en.wikipedia.org/wiki/Open-source_software\"\u003ehttps://en.wikipedia.org/wiki/Open-source_software\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://codeforamerica.org/\"\u003ehttps://codeforamerica.org/\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n"
        },
        {
            "title": "jBPF for RIC with srsRAN",
            "date_published": "2025-04-10T00:00:00Z",
            "date_modified": "2025-04-10T00:00:00Z",
            "id": "https://hanserich.com/documentation/jbpf-srsran/",
            "url": "https://hanserich.com/documentation/jbpf-srsran/",
            "authors": [
                {
                  "name": "Erich"
                }
            ],
            "content_html": "\u003ch1 id=\"what-is-jbpf\"\u003eWhat is jBPF?\u003c/h1\u003e\n\u003cp\u003ejBPF stands for Janus BPF, an eBPF like program as part of janus project provided by microsoft. jBPF runs in user space mode unlike eBPF that runs in kernel stack, it is based on userspace BPF (uBPF). just like the developer said:\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eUserspace eBPF instrumentation and control framework for deploying control and monitoring functions in a secure manner. It is part of Project Janus and provides probes for eBPF-like functionality outside of the Linux kernel.\u003c/p\u003e\n\u003c/blockquote\u003e\n\u003cp\u003eAs Telecom technology require low latency in such manner, eBPF comes for accomplish this requirement. eBPF already implemented in several usecases that require low latency and take control or modify metadata without interupt the process. In this telecom scenario also require this manner, and eBPF already proven to resolve this requirements, such as linux scheduler modification without interupt the entire process or kernel.\u003c/p\u003e\n\u003cp\u003ejBPF that part of janus project provided by microsoft already gives us the way to use eBPF instrumentation for Radio Access Network monitor and control utilization. The project you can find at here:\n\u003ca href=\"https://github.com/microsoft/jbpf.git\"\u003ehttps://github.com/microsoft/jbpf.git\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eThe jbpf instrumentation and control library provides a flexible and safe user-mode instrumentation framework built on eBPF technology. It splits responsibilities between the core application developers and a potentially broader community of developers who want safe access to instrumentation and control, similar to eBPF in Linux kernel. However, jbpf operates entirely in user mode and makes no calls to Linux kernel.\u003c/p\u003e\n\u003cp\u003eThe core application developers define common instrumentation points with access to important internal application structures and APIs, but without prescribing how these will be consumed. Other developers can deploy their own code, inlined, at the instrumentation points. It allows them to efficiently process internal application data in an arbitrary way to extract particular information without needing to copy it elsewhere. The instrumentation code is statically verified before executed to enforce safety.\u003c/p\u003e\n\u003ch2 id=\"jbpf-architecture\"\u003ejBPF Architecture\u003c/h2\u003e\n\u003cp\u003ejBPF literaly same with BPF workflow, there are metadatas that we can receive and also can be modify by the bpf prog. If you\u0026rsquo;re familiar with eBPF or uBPF, that eBPF code will be compiled into bpf object file and could be load using bpftool or something else. In jBPF we don\u0026rsquo;t use bppftool to load the program, and the bpf object will called codelet in jBPF.\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"post/jbpf_oss_architecture.png\" alt=\"jbpf Architecture\"\u003e\u003c/p\u003e\n\u003cp\u003eThese are the basic terms used in the project:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eHook\u003c/strong\u003e: An instrumentation point at which we call user-provided code (see here for more on hooks).\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eCodelet\u003c/strong\u003e: A piece of user-provided code that gets executed once a hook point is called in the application (see here for mo**re * on codelets).\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eCodelet set\u003c/strong\u003e: A set of codelets that share maps or other things and have to be deployed together.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMap\u003c/strong\u003e: A shared memory location that is accessible to one or more codelets, typically used to store data between in** vocaions, * share across codelets, or communicate with the rest of the system (see here for more on maps).\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eHelper function\u003c/strong\u003e: A function implemented by the application and exposed to the codelet, typically used to affect the application behaviour or perform complex operations that are hard to verify (see here for more on helper functions).\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"srsran-integration\"\u003esrsRAN integration\u003c/h2\u003e\n\u003cp\u003eThere is project for srsran integration with jbpf, you can go to jbpf repository and find the repo at there. Otherwise, I just create my integration by my self with reference by that repo. In my integration, I focuse on retrieve CU_CP telemetry, such as du_index, plmn and ue_index.\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eModify the gnb.cpp\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eWe need to include jbpf headers file and our custom headers. Also we need to initialize the jbpf process. And the important part is you need to register the jbpf thread to srsran thread process, because jbpf is running inside it\u0026rsquo;s own thread.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;srsran/jbpf/inc/jbpf.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;srsran/jbpf/inc/jbpf_hook.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;srsran/jbpf/inc/jbpf_defs.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;srsran/jbpf/jbpf_context.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;srsran/jbpf/common.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;srsran/jbpf/jbpf_srsran_hooks.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;srsran/jbpf/inc/jbpf.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e#define IPC_NAME \u0026#34;example_ipc_app\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003ejbpf_io_stream_id_t\u003c/span\u003e control_input_stream_id \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      .id \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e,    \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e}};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003ejbpf_io_stream_id_t\u003c/span\u003e output_data_stream_id \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      .id \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\u003cspan style=\"color:#ae81ff\"\u003e0x00\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x11\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x22\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x33\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x44\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x55\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x66\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x77\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x88\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0x99\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0xAA\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0xBB\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0xCC\u003c/span\u003e,    \u003cspan style=\"color:#ae81ff\"\u003e0xDD\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0xEE\u003c/span\u003e, \u003cspan style=\"color:#ae81ff\"\u003e0xFF\u003c/span\u003e}};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e// Used to covert data of type Packet to JSON format\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  boost\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eproperty_tree\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eptree\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6e22e\"\u003etoPtree\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003econst\u003c/span\u003e jbpf_cucp_uemgr_ctx_info\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003e packet)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      boost\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eproperty_tree\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eptree pt;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      pt.\u003cspan style=\"color:#a6e22e\"\u003eput\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;ctx_id\u0026#34;\u003c/span\u003e, packet.ctx_id);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      pt.\u003cspan style=\"color:#a6e22e\"\u003eput\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;du_index\u0026#34;\u003c/span\u003e, packet.du_index);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      pt.\u003cspan style=\"color:#a6e22e\"\u003eput\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;plmn\u0026#34;\u003c/span\u003e, packet.plmn);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      pt.\u003cspan style=\"color:#a6e22e\"\u003eput\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;ue_index\u0026#34;\u003c/span\u003e, packet.ue_index);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e pt;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  std\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003estring\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6e22e\"\u003etoJson\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003econst\u003c/span\u003e boost\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eproperty_tree\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eptree\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003e pt)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      std\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eostringstream oss;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      boost\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eproperty_tree\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003e\u003cspan style=\"color:#a6e22e\"\u003ewrite_json\u003c/span\u003e(oss, pt);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e oss.\u003cspan style=\"color:#a6e22e\"\u003estr\u003c/span\u003e();\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  };\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003estatic\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6e22e\"\u003eio_channel_print_output\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003ejbpf_io_stream_id_t\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e stream_id, \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e**\u003c/span\u003e bufs, \u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e num_bufs, \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e    ctx)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (stream_id \u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u0026amp;\u003c/span\u003e num_bufs \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#75715e\"\u003e// Check that the data corresponds to a known output channel\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (\u003cspan style=\"color:#a6e22e\"\u003ememcmp\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eoutput_data_stream_id, stream_id, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003ejbpf_io_stream_id_t\u003c/span\u003e)) \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e)    {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              std\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003ecout \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;ERROR: Unknown stream_id\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e std\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eendl;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e              \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#75715e\"\u003e// Fetch the data and print in JSON format\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003efor\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003eauto\u003c/span\u003e i \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e; i \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u003c/span\u003e num_bufs; i\u003cspan style=\"color:#f92672\"\u003e++\u003c/span\u003e) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          jbpf_cucp_uemgr_ctx_info p \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003estatic_cast\u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u003c/span\u003ejbpf_cucp_uemgr_ctx_info\u003cspan style=\"color:#f92672\"\u003e*\u0026gt;\u003c/span\u003e(bufs[i])   ;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          boost\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eproperty_tree\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eptree pt \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003etoPtree\u003c/span\u003e(p);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          std\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003estring json \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003etoJson\u003c/span\u003e(pt);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          std\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003ecout \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e json \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e std\u003cspan style=\"color:#f92672\"\u003e::\u003c/span\u003eendl;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          \u003cspan style=\"color:#75715e\"\u003e// Send an acknowledgement message back to the codelet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          PacketResp resp \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          \u003cspan style=\"color:#a6e22e\"\u003ejbpf_send_input_msg\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003econtrol_input_stream_id, \u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eresp, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(resp));\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e// ======== START JBPF ========= //\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_config jbpf_config \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003ejbpf_set_default_config_options\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003ejbpf_config);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Enable LCM IPC interface using UNIX socket at the default socket path (the default is through C API)\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    jbpf_config.lcm_ipc_config.has_lcm_ipc_thread \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e true;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003esnprintf\u003c/span\u003e(\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        jbpf_config.lcm_ipc_config.lcm_ipc_name,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(jbpf_config.lcm_ipc_config.lcm_ipc_name) \u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;%s\u0026#34;\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        JBPF_DEFAULT_LCM_SOCKET);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Initialize jbpf\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (\u003cspan style=\"color:#a6e22e\"\u003ejbpf_init\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003ejbpf_config) \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#a6e22e\"\u003eexit\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Any thread that calls a hook must be registered\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003ejbpf_register_thread\u003c/span\u003e();\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003ejbpf_register_io_output_cb\u003c/span\u003e(io_channel_print_output);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e// ======== END JBPF ========= //\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start=\"2\"\u003e\n\u003cli\u003eWrite custom hook macro\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eAs the documentation guide, to working with jBPF we need hook point. A hook function is a process to tell the codelet which process will be used by the codelet.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#75715e\"\u003e/* CUCP UE Manager */\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6e22e\"\u003eDECLARE_JBPF_HOOK\u003c/span\u003e(cucp_uemgr_ue_add,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_ran_generic_ctx ctx,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      ctx,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#a6e22e\"\u003eHOOK_PROTO\u003c/span\u003e(\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          jbpf_cucp_uemgr_ctx_info \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003einfo,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          \u003cspan style=\"color:#66d9ef\"\u003ebool\u003c/span\u003e pci_set,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          \u003cspan style=\"color:#66d9ef\"\u003euint16_t\u003c/span\u003e pci,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          \u003cspan style=\"color:#66d9ef\"\u003ebool\u003c/span\u003e rnti_set,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          \u003cspan style=\"color:#66d9ef\"\u003euint16_t\u003c/span\u003e rnti),\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#a6e22e\"\u003eHOOK_ASSIGN\u003c/span\u003e(\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          ctx.data \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003euint64_t\u003c/span\u003e)info;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          ctx.data_end \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003euint64_t\u003c/span\u003e) ((\u003cspan style=\"color:#66d9ef\"\u003euint8_t\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)info \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e   jbpf_cucp_uemgr_ctx_info));\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          ctx.srs_meta_data1 \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003euint64_t\u003c/span\u003e)pci_set) \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e16\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e|\u003c/span\u003e pci;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e          ctx.srs_meta_data2 \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003euint64_t\u003c/span\u003e)rnti_set \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u0026lt;\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e16\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e|\u003c/span\u003e rnti;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      )\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  )\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start=\"3\"\u003e\n\u003cli\u003emodify the file\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003ethen because in this docs, I will retrive data from cu_cp, I need to modify ue_manager_impl.cpp. You can modify anywhere, depends on what data we want to retrieve.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6e22e\"\u003eDEFINE_JBPF_HOOK\u003c/span\u003e(cucp_uemgr_ue_add);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_cucp_uemgr_ctx_info ctx_info \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e, (\u003cspan style=\"color:#66d9ef\"\u003euint16_t\u003c/span\u003e)du_index, plmn.\u003cspan style=\"color:#a6e22e\"\u003eto_bcd\u003c/span\u003e(),   (\u003cspan style=\"color:#66d9ef\"\u003euint64_t\u003c/span\u003e)new_ue_index};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6e22e\"\u003ehook_cucp_uemgr_ue_add\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003ectx_info, pci.\u003cspan style=\"color:#a6e22e\"\u003ehas_value\u003c/span\u003e(), pci.\u003cspan style=\"color:#a6e22e\"\u003evalue\u003c/span\u003e(), rnti.\u003cspan style=\"color:#a6e22e\"\u003ehas_value\u003c/span\u003e(), \u003cspan style=\"color:#a6e22e\"\u003eto_value\u003c/span\u003e(rnti.\u003cspan style=\"color:#a6e22e\"\u003evalue\u003c/span\u003e()));\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start=\"4\"\u003e\n\u003cli\u003eCreate Codelet\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eAs I mentioned before, codelet is bascially eBPF prog.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;string.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;jbpf_defs.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;jbpf_helper.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;common.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003ejbpf_ringbuf_map\u003c/span\u003e(outmap, \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_cucp_uemgr_ctx_info, \u003cspan style=\"color:#ae81ff\"\u003e100\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003ejbpf_control_input_map\u003c/span\u003e(inmap, \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e PacketResp, \u003cspan style=\"color:#ae81ff\"\u003e100\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e// A map of type JBPF_MAP_TYPE_ARRAY, which is used\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e// to store internal codelet state.\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_load_map_def \u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;maps\u0026#34;\u003c/span\u003e) counter \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .type \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e JBPF_MAP_TYPE_ARRAY,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .key_size \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e),\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .value_size \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e),\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  .max_entries \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e4\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;jbpf_generic\u0026#34;\u003c/span\u003e)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003euint64_t\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003ejbpf_main\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e state)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e{\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_ran_generic_ctx\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e ctx;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  ctx \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_ran_generic_ctx\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)state;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_cucp_uemgr_ctx_info \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003ep, \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003ep_end;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e jbpf_cucp_uemgr_ctx_info echo;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e PacketResp resp \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {\u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#a6e22e\"\u003ejbpf_printf_debug\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;\u0026gt;\u0026gt;\u0026gt; UE ADD called: ctx_id=%u, d_index=%lu, plmn=%u\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e\\n\u003c/span\u003e\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;\u003c/span\u003e, echo.ctx_id, echo.du_index, echo.plmn);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e c;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e cnt;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003euint64_t\u003c/span\u003e index \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  c \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003ejbpf_map_lookup_elem\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003ecounter, \u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eindex);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (\u003cspan style=\"color:#f92672\"\u003e!\u003c/span\u003ec)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  cnt \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)c;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  cnt\u003cspan style=\"color:#f92672\"\u003e++\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003euint32_t\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)c \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e cnt;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  p \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  p_end \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata_end;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (p \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e p_end)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  echo \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003ep;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (\u003cspan style=\"color:#a6e22e\"\u003ejbpf_ringbuf_output\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eoutmap, \u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eecho, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(echo)) \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003ewhile\u003c/span\u003e(\u003cspan style=\"color:#a6e22e\"\u003ejbpf_control_input_receive\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003einmap, \u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eecho, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(echo)) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \techo.du_index \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \t\u003cspan style=\"color:#a6e22e\"\u003ejbpf_printf_debug\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;Got aggregate value %u\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e\\n\u003c/span\u003e\u003cspan style=\"color:#e6db74\"\u003eh\u0026#34;\u003c/span\u003e, echo.du_index);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003ea;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch2 id=\"run-the-program\"\u003eRun the program\u003c/h2\u003e\n\u003cp\u003eIf the code modification already done, we can compile it and run it. First run the srsRAN gnb, try to load the codelet and finally, try to start UE and see what\u0026rsquo;s happen. If it shows the parameters we set, it indicates we successfully create our first RIC using jBPF.\u003c/p\u003e\n\u003cp\u003ethe output should be like this.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-shell\" data-lang=\"shell\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#f92672\"\u003e====\u003c/span\u003e gNB started \u003cspan style=\"color:#f92672\"\u003e===\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  Type \u0026lt;h\u0026gt; to view help\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.825696Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eIO\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Received \u003cspan style=\"color:#ae81ff\"\u003e79640\u003c/span\u003e bytes\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.844989Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Creating codelet   cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845051Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_map_lookup\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845057Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_map_lookup_reset\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845060Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_map_update\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845065Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_map_delete\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845069Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_map_clear\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845073Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_map_dump\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845077Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_time_get_ns\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845082Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_get_sys_time\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845086Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_get_sys_time_diff_ns\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845091Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e jbpf_hash\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845094Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e jbpf_printf\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845098Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_ringbuf_output\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845102Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_mark_runtime_init\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845107Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_runtime_limit_exceeded\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845110Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e jbpf_rand\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845113Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_control_input_receive\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845117Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_get_output_buf\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845121Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registering helper \u003cspan style=\"color:#66d9ef\"\u003efunction\u003c/span\u003e  jbpf_send_output\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845746Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Map counter registered successfully \u003cspan style=\"color:#66d9ef\"\u003efor\u003c/span\u003e  codelet cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.845765Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registered map counter to codelet   cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847736Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eIO\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Creating channel  00112233445566778899aabbccddeeff\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847781Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eMEM_MGMT\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Added \u003cspan style=\"color:#ae81ff\"\u003e63\u003c/span\u003e elements to the ringbuf\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847786Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eMEM_MGMT\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: The size of the mempool is \u003cspan style=\"color:#ae81ff\"\u003e63\u003c/span\u003e and   the capacity is \u003cspan style=\"color:#ae81ff\"\u003e63\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847795Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Map outmap registered successfully \u003cspan style=\"color:#66d9ef\"\u003efor\u003c/span\u003e   codelet cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847802Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registered map outmap to codelet  cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847808Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eIO\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Creating channel  \u003cspan style=\"color:#ae81ff\"\u003e11111111111111111111111111111111\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847827Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eMEM_MGMT\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Added \u003cspan style=\"color:#ae81ff\"\u003e63\u003c/span\u003e elements to the ringbuf\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847831Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eMEM_MGMT\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: The size of the mempool is \u003cspan style=\"color:#ae81ff\"\u003e63\u003c/span\u003e and   the capacity is \u003cspan style=\"color:#ae81ff\"\u003e63\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847837Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Map inmap registered successfully \u003cspan style=\"color:#66d9ef\"\u003efor\u003c/span\u003e  codelet cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847840Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registered map inmap to codelet   cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.847844Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Map inmap is already registered!\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.848432Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Created codelet  cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.848442Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Registered codelet  cucp_uemgr_ue_add_codelet to hook cucp_uemgr_ue_add\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.848446Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: ----------------- cucp_uemgr_ue_add:  cucp_uemgr_ue_add_codelet ----------------------\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.848450Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: hook_name \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e cucp_uemgr_ue_add, priority   \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e 1, runtime_threshold \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.848454Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eINFO\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Codelet created and loaded successfully:  cucp_uemgr_ue_add_codelet\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.848459Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Codeletset is loaded OK \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:21.848470Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eIO\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Sent \u003cspan style=\"color:#ae81ff\"\u003e516\u003c/span\u003e bytes\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:25.520540Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: \u0026gt;\u0026gt;\u0026gt; UE ADD called: ctx_id\u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e0, d_index\u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e0,  plmn\u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e4\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#f92672\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;ctx_id\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;0\u0026#34;\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;du_index\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;1\u0026#34;\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;plmn\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;61712\u0026#34;\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;ue_index\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;0\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#f92672\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:25.735163Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: \u0026gt;\u0026gt;\u0026gt; UE ADD called: ctx_id\u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e0, d_index\u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e0,  plmn\u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e4\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  2025-04-24T06:54:25.735179Z \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003eJBPF\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eCORE\u003cspan style=\"color:#f92672\"\u003e][\u003c/span\u003eDEBUG\u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e: Got aggregate value \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#f92672\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;ctx_id\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;0\u0026#34;\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;du_index\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;1\u0026#34;\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;plmn\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;61712\u0026#34;\u003c/span\u003e,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e      \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;ue_index\u0026#34;\u003c/span\u003e: \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;1\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  \u003cspan style=\"color:#f92672\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e"
        },
        {
            "title": "Self Employed",
            "date_published": "2025-04-02T00:00:00Z",
            "date_modified": "2025-04-02T00:00:00Z",
            "id": "https://hanserich.com/blog/self-employed/",
            "url": "https://hanserich.com/blog/self-employed/",
            "authors": [
                {
                  "name": "Erich"
                }
            ],
            "content_html": "\u003cp\u003eMaybe some of you have same issue like me, have a job but also have side project for fun. If you are like me, it means we are not alone. There are several people who like us, don\u0026rsquo;t worry :) \u0026ldquo;at first I thought I was alone LOL\u0026rdquo;. It is normal for a person who are incapable to do \u0026ldquo;a doing nothing\u0026rdquo; work. In this page, I would like to sharing my \u0026ldquo;Self Employed\u0026rdquo; work with you.\u003c/p\u003e\n\u003cp\u003eIt\u0026rsquo;s began while I was studying my Diploma degree, or maybe when I was highschool student. I was a person that loves learning a new thing, especially strategy game. So despite I was going to school for study, sometimes I just go to school\u0026rsquo;s hall to play board game or became football tactic maker. And then this behavior continued until college. I\u0026rsquo;m very passionate in learning new thing and finally start my first self project, that I called \u0026ldquo;A Computer that can See\u0026rdquo;. It is basically just a computer vision.\u003c/p\u003e\n\u003cp\u003eFor honest doing programming or computer science is just a hobby, actually my passion lay on pure science. But the universe guide me to join telecommunication engineering, and I decided to focused on computer science as the project reference. For me, it is fun to worked in this field and I became passionate with this field. Until I got my first job in Telecom industry, I still working on my project for pure science and computer science. Fortunately, those fields are related each other so I can work on those project together. Yeas every knowledge must be related each other in some ways.\u003c/p\u003e\n"
        },
        {
            "title": "eBPF GTP Packet Filtering",
            "date_published": "2024-11-21T00:00:00Z",
            "date_modified": "2024-11-21T00:00:00Z",
            "id": "https://hanserich.com/documentation/ebpf-gtp-packet-filtering/",
            "url": "https://hanserich.com/documentation/ebpf-gtp-packet-filtering/",
            "authors": [
                {
                  "name": "Erich"
                }
            ],
            "content_html": "\u003ch2 id=\"what-is-gtp\"\u003eWhat is GTP?\u003c/h2\u003e\n\u003cp\u003eAs wikipedia explanation, GPRS Tunnelling Protocol (GTP) is a group of IP-based communications protocols used to carry general packet radio service (GPRS) within GSM, UMTS, LTE and 5G NR radio networks. In 3GPP architectures, GTP and Proxy Mobile IPv6 based interfaces are specified on various interface points. GTP is a tunneling protocol is used for telecom technology for user plane, it means the users will access the Data Network (DN) using GTP Tunnel. This protocol similiar to VPN that create tunnel for each users, same with GTP, each user that already pass the registration by control plane will have user plane that allocate tunnel using GTP protocol.\u003c/p\u003e\n\u003ch2 id=\"gtp-packet-filtering-with-ebpf\"\u003eGTP Packet Filtering with eBPF\u003c/h2\u003e\n\u003cp\u003eWe will continue the progress from previous documentation of eBPF Trace SCTP Socket. We will continue to filter the GTP Protocol. Here is the architecture I used to setup the development and testing.\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"post/arch.png\" alt=\"image.png\"\u003e\u003c/p\u003e\n\u003ch2 id=\"sniff-gtp-packet\"\u003eSniff GTP Packet\u003c/h2\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/bpf.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/if_ether.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/ip.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/udp.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/gtp.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/in.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;bpf/bpf_helpers.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#define GTP_PORT 2152\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;xdp_gtp_sniff\u0026#34;\u003c/span\u003e)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003exdp_gtp_sniff\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e xdp_md \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003ectx) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Pointers for accessing packet data\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata_end \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata_end;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Ethernet header\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e ethhdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eeth \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e data;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(eth \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Check if the packet is an IPv4 packet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (eth\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eh_proto \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003e__constant_htons\u003c/span\u003e(ETH_P_IP)) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// IP header\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e iphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eip \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e iphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(eth \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(ip \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Check if it\u0026#39;s a UDP packet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (ip\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eprotocol \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e IPPROTO_UDP) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// UDP header\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e udphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eudp \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e udphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)ip \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e ip\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eihl \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e4\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(udp \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Check if the destination port is GTP-U (2152)\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (udp\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edest \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003e__constant_htons\u003c/span\u003e(GTP_PORT)) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// GTP header\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e gtpuhdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003egtp \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e gtpuhdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(udp \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(gtp \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Verify that this is a valid GTP-U packet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (gtp\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eflags \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0x30\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e||\u003c/span\u003e gtp\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003emessage_type \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0xff\u003c/span\u003e) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Here you can add logic to process the GTP packet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Example: Dropping the packet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_DROP; \u003cspan style=\"color:#75715e\"\u003e// Drop the packet after sniffing\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Otherwise, allow the packet to pass through\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003echar\u003c/span\u003e _license[] \u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;license\u0026#34;\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;GPL\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch2 id=\"udp-trace-from-gtp\"\u003eUDP Trace from GTP\u003c/h2\u003e\n\u003cp\u003eGTP-U is basically based on UDP packet. So to sniff packet of GTP, first and the foremost we need to parse UDP packet and decapsulate the GTP header to process the packet.\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"post/gtp_stack.png\" alt=\"image.png\"\u003e\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/bpf.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/if_ether.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/ip.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/udp.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/gtp.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/in.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;stddef.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;linux/tcp.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;bpf/bpf_endian.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;bpf/bpf_helpers.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#define GTP_PORT 2152\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e// GTP-U header definition (simplified)\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e gtpuhdr {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u8 flags;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u8 message_type;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u16 length;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u32 tid;  \u003cspan style=\"color:#75715e\"\u003e// Tunnel Endpoint Identifier (TEID)\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;xdp_gtp\u0026#34;\u003c/span\u003e)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003exdp_gtp_sniff\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e xdp_md \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003ectx) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Pointers for accessing packet data\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata_end \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata_end;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Ethernet header\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e ethhdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eeth \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e data;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(eth \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Check if the packet is an IPv4 packet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (eth\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eh_proto \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003e__constant_htons\u003c/span\u003e(ETH_P_IP)) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// IP header\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e iphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eip \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e iphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(eth \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(ip \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#75715e\"\u003e// Check if it\u0026#39;s a UDP packet\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (ip\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eprotocol \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e IPPROTO_UDP) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e udphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eudpdata \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)ip \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eip);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)udpdata \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eudpdata) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (udpdata\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edest \u003cspan style=\"color:#f92672\"\u003e!=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003e__constant_htons\u003c/span\u003e(GTP_PORT)) \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __be32 dst_ip \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e udpdata\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edest;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#66d9ef\"\u003eunsigned\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003echar\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edst \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003eunsigned\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003echar\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)\u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003edst_ip;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estatic\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003econst\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003echar\u003c/span\u003e fmt[] \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;DST: %lld . \u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#66d9ef\"\u003efor\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e i \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e; i \u003cspan style=\"color:#f92672\"\u003e\u0026lt;\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(dst) \u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(dst[\u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e]); i\u003cspan style=\"color:#f92672\"\u003e++\u003c/span\u003e) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\t\u003cspan style=\"color:#a6e22e\"\u003ebpf_trace_printk\u003c/span\u003e(fmt, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(fmt), dst[i]);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003echar\u003c/span\u003e _license[] \u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;license\u0026#34;\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;GPL\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e\u003cimg src=\"post/test.png\" alt=\"image.png\"\u003e\u003c/p\u003e\n\u003ch2 id=\"gtp-u-ip-ue-and-ip-destination\"\u003eGTP-U [IP UE and IP Destination]\u003c/h2\u003e\n\u003cp\u003eIn this scenario I have successfully sniff GTP-U packet from CU. As we can see as below, that eBPF already sniff UE IP and Destination IP, in example UE want to send ICMP packet(ping) to 8.8.8.8 IP.\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"post/result.png\" alt=\"image.png\"\u003e\u003c/p\u003e\n"
        },
        {
            "title": "eBPF Trace SCTP Socket",
            "date_published": "2024-08-21T00:00:00Z",
            "date_modified": "2024-08-21T00:00:00Z",
            "id": "https://hanserich.com/documentation/ebpf-sctp-tracing/",
            "url": "https://hanserich.com/documentation/ebpf-sctp-tracing/",
            "authors": [
                {
                  "name": "Erich"
                }
            ],
            "content_html": "\u003ch1 id=\"ebpf-sctp-trace\"\u003eeBPF SCTP Trace\u003c/h1\u003e\n\u003cp\u003e\u003cimg src=\"post/image.png\" alt=\"architectured\"\u003e\u003c/p\u003e\n\u003ch2 id=\"trace-the-protocol-id-and-print-it-in-kernel\"\u003eTrace the Protocol ID and print it in kernel\u003c/h2\u003e\n\u003cp\u003e\u003cimg src=\"post/image1.png\" alt=\"image.png\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"post/image2.png\" alt=\"image.png\"\u003e\u003c/p\u003e\n\u003cp\u003eProtocol ID for \u003cstrong\u003eSCTP is 132\u003c/strong\u003e and the program was successfully trace data that contain SCTP packet from CU to AMF.\u003c/p\u003e\n\u003cp\u003eAlmost all telco protocols are SCTP based, like NGAP, F1AP, nFAPI, E1AP, E2AP, etc. With this filtering process using eBPF, I argue (hypothetically) that the filtering process is much faster because the process is not involve kernel. With this approach I also argue that this filtering process is useful in telco technology, it can be used for security in RAN, observable the packet to get data for Traffic Control, handover and for RIC use cases.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;vmlinux.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;bpf/bpf_endian.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;bpf/bpf_helpers.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#define ETH_P_IP 0x0800\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;xdp\u0026#34;\u003c/span\u003e)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003exdp_prog\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e xdp_md \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003ectx) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata_end \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata_end;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e ethhdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eeth \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e data;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(eth \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (eth\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eh_proto \u003cspan style=\"color:#f92672\"\u003e==\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003ebpf_htons\u003c/span\u003e(ETH_P_IP)) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e iphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eipv4 \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e data \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eeth);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(ipv4 \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#75715e\"\u003e// Print the protocol number\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#a6e22e\"\u003ebpf_printk\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;protocol: %u\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e\\n\u003c/span\u003e\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;\u003c/span\u003e, ipv4\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eprotocol);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003echar\u003c/span\u003e _license[] \u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;license\u0026#34;\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;GPL\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis code will check the protocol, if protocol is SCTP, kernel will print sctp protocol id and the packet will PASS.\u003c/p\u003e\n\u003ch2 id=\"trace-source-ip-and-destination-ip-and-store-the-data-in-perf-event\"\u003eTrace Source IP and Destination IP and store the data in perf event\u003c/h2\u003e\n\u003cp\u003eWith some modification, we could filter tha packet like IP Src and IP Dst like below:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026#34;vmlinux.h\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;bpf/bpf_endian.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#include\u003c/span\u003e \u003cspan style=\"color:#75715e\"\u003e\u0026lt;bpf/bpf_helpers.h\u0026gt;\u003c/span\u003e\u003cspan style=\"color:#75715e\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#define ETH_P_IP 0x0800\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e flow_info {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u32 src_ip;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u32 dst_ip;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u16 src_port;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u16 dst_port;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    __u8 proto;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e   \u003cspan style=\"color:#a6e22e\"\u003e__uint\u003c/span\u003e(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e   \u003cspan style=\"color:#a6e22e\"\u003e__uint\u003c/span\u003e(key_size, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(__u32));\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e   \u003cspan style=\"color:#a6e22e\"\u003e__uint\u003c/span\u003e(value_size, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(__u32));\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e} events \u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;.maps\u0026#34;\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;xdp\u0026#34;\u003c/span\u003e)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003exdp_prog\u003c/span\u003e(\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e xdp_md \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003ectx) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata_end \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata_end;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003edata \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e (\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(\u003cspan style=\"color:#66d9ef\"\u003elong\u003c/span\u003e)ctx\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edata;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e ethhdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eeth \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e data;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(eth \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e (eth\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eh_proto \u003cspan style=\"color:#f92672\"\u003e==\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003ebpf_htons\u003c/span\u003e(ETH_P_IP)) {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e iphdr \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eipv4 \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e data \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(\u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003eeth);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e ((\u003cspan style=\"color:#66d9ef\"\u003evoid\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e*\u003c/span\u003e)(ipv4 \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e \u003cspan style=\"color:#ae81ff\"\u003e1\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e\u0026gt;\u003c/span\u003e data_end)\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#75715e\"\u003e// Print the protocol number\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#75715e\"\u003e// bpf_printk(\u0026#34;protocol: %u\\n\u0026#34;, ipv4-\u0026gt;protocol);\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#75715e\"\u003e// bpf_printk(\u0026#34;IP Src: %d\\n\u0026#34;, bpf_ntohl(ipv4-\u0026gt;saddr));\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e        \u003cspan style=\"color:#75715e\"\u003e// bpf_printk(\u0026#34;IP Dst: %d\\n\u0026#34;, bpf_ntohl(ipv4-\u0026gt;daddr));\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e flow_info flow \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e {};\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\tflow.src_ip \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e ipv4\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003esaddr;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\tflow.dst_ip \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e ipv4\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003edaddr;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\tflow.proto \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e ipv4\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003eprotocol;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#a6e22e\"\u003ebpf_perf_event_output\u003c/span\u003e(ctx, \u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eevents, BPF_F_CURRENT_CPU, \u003cspan style=\"color:#f92672\"\u003e\u0026amp;\u003c/span\u003eflow, \u003cspan style=\"color:#66d9ef\"\u003esizeof\u003c/span\u003e(flow));\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    }\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#66d9ef\"\u003ereturn\u003c/span\u003e XDP_PASS;\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e}\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003echar\u003c/span\u003e _license[] \u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;license\u0026#34;\u003c/span\u003e) \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;GPL\u0026#34;\u003c/span\u003e;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e\u003cimg src=\"post/image3.png\" alt=\"image.png\"\u003e\u003c/p\u003e\n\u003cp\u003eThe data of the output will store in events file, to open the oytput or view the output we need the userspace application to view BPF_MAP_TYPE_PERF_EVENT_ARRAY like perf buffer in linux.\u003c/p\u003e\n\u003cp\u003eFirst thing to do before running the userspace program, we need to specify where the events of our bpf maps will store. To do this we need to do some commands like below:\u003c/p\u003e\n\u003cp\u003eThe error \u003ccode\u003ebpf_obj_get: No such file or directory\u003c/code\u003e indicates that the BPF map at the specified path (\u003ccode\u003e/sys/fs/bpf/events\u003c/code\u003e) doesn\u0026rsquo;t exist or wasn\u0026rsquo;t created correctly.\u003c/p\u003e\n\u003cp\u003eTo fix this issue, you need to ensure the following:\u003c/p\u003e\n\u003ch3 id=\"1-ensure-your-bpf-program-creates-the-map\"\u003e1. Ensure Your BPF Program Creates the Map\u003c/h3\u003e\n\u003cp\u003eMake sure that your BPF program creates a BPF map and pins it to the BPF filesystem (usually mounted at \u003ccode\u003e/sys/fs/bpf/\u003c/code\u003e).\u003c/p\u003e\n\u003cp\u003eIn your BPF program, you should define the map like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003estruct\u003c/span\u003e {\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003e__uint\u003c/span\u003e(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003e__uint\u003c/span\u003e(max_entries, \u003cspan style=\"color:#ae81ff\"\u003e128\u003c/span\u003e);  \u003cspan style=\"color:#75715e\"\u003e// Number of CPUs\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003e__type\u003c/span\u003e(key, u32);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    \u003cspan style=\"color:#a6e22e\"\u003e__type\u003c/span\u003e(value, u32);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e} events \u003cspan style=\"color:#a6e22e\"\u003eSEC\u003c/span\u003e(\u003cspan style=\"color:#e6db74\"\u003e\u0026#34;.maps\u0026#34;\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eTo pin the map to the BPF filesystem, you can use the following code in the user-space program that loads your BPF program:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-c\" data-lang=\"c\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003eint\u003c/span\u003e map_fd \u003cspan style=\"color:#f92672\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#a6e22e\"\u003ebpf_map__fd\u003c/span\u003e(skel\u003cspan style=\"color:#f92672\"\u003e-\u0026gt;\u003c/span\u003emaps.events);\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#a6e22e\"\u003ebpf_obj_pin\u003c/span\u003e(map_fd, \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;/sys/fs/bpf/events\u0026#34;\u003c/span\u003e);\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eOr, if you\u0026rsquo;re manually loading the BPF program and pinning the map:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebpftool prog load my_bpf_program.o /sys/fs/bpf/my_bpf_prog\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ebpftool map pin id \u0026lt;map_id\u0026gt; /sys/fs/bpf/events\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"2-mount-the-bpf-filesystem-if-not-already-mounted\"\u003e2. Mount the BPF Filesystem (if not already mounted)\u003c/h3\u003e\n\u003cp\u003eEnsure that the BPF filesystem is mounted:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo mount -t bpf bpf /sys/fs/bpf/\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis step may be required if you don\u0026rsquo;t have the BPF filesystem mounted on your system.\u003c/p\u003e\n\u003ch3 id=\"3-load-and-pin-the-map-correctly\"\u003e3. Load and Pin the Map Correctly\u003c/h3\u003e\n\u003cp\u003eMake sure your user-space program or manual commands correctly load and pin the map in the BPF filesystem.\u003c/p\u003e\n\u003cp\u003eIf you load the program manually and want to pin the map, you can use the \u003ccode\u003ebpftool\u003c/code\u003e utility:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003e\n\u003cp\u003eLoad the BPF program:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo bpftool prog load my_bpf_program.o /sys/fs/bpf/my_bpf_prog\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003ePin the map:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo bpftool map pin id \u0026lt;map_id\u0026gt; /sys/fs/bpf/events\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eReplace \u003ccode\u003e\u0026lt;map_id\u0026gt;\u003c/code\u003e with the ID of your map, which you can find using:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo bpftool map show\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id=\"4-verify-the-map-exists\"\u003e4. Verify the Map Exists\u003c/h3\u003e\n\u003cp\u003eOnce you\u0026rsquo;ve pinned the map, verify that it exists in the expected location:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003els /sys/fs/bpf/events\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eIf the file exists, your program should be able to access it without the \u003ccode\u003ebpf_obj_get\u003c/code\u003e error.\u003c/p\u003e\n\u003ch3 id=\"recap\"\u003eRecap\u003c/h3\u003e\n\u003col\u003e\n\u003cli\u003eEnsure your BPF program creates and pins the map.\u003c/li\u003e\n\u003cli\u003eEnsure the BPF filesystem is mounted.\u003c/li\u003e\n\u003cli\u003eLoad and pin the map correctly.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eAfter following these steps, your user-space program should be able to access the BPF map without errors. If you still encounter issues, please provide more details about your BPF program setup.\u003c/p\u003e\n"
        },
        {
            "title": "Books",
            "date_published": "0001-01-01T00:00:00Z",
            "date_modified": "0001-01-01T00:00:00Z",
            "id": "https://hanserich.com/books/",
            "url": "https://hanserich.com/books/",
            "content_html": "\u003cp\u003e\u003cimg src=\"/images/library.png\" alt=\"library\"\u003e\u003c/p\u003e\n\u003cp\u003eThe lists of my books recommendations from time to time, which I\u0026rsquo;ve beed sharing on this page. This pages list the books that I ret and in my opinion it is good if I share it to you. I will keep this page up to date, so you can see my reference for the knowledge that I\u0026rsquo;ve learnt.\u003c/p\u003e\n\u003ch3 id=\"math\"\u003eMath\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eCalculus-Brooks Cole (2002)\u003c/strong\u003e - James Stewart\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"science\"\u003eScience\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"programming\"\u003eProgramming\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003ePractical C Programming 3rd Ed.\u003c/strong\u003e - Steve Oualline\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"unix-and-linux-system\"\u003eUNIX and Linux System\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eUNIX Network Programming Vol.1 3rd Ed.\u003c/strong\u003e - W. Richard Stevens, Bill Fenner, Andrew M. Rudoff\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eSystems Performance 2nd edition\u003c/strong\u003e - Brendan Gregg (Addison-Wesley, 2021)\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eBPF Performance Tools\u003c/strong\u003e - Brendan Gregg (Addison-Wesley, 2019)\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eLinux System Programming 2nd Ed.\u003c/strong\u003e - Robert Love\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eOracle Solaris 11.3 Programming Interfaces Guide\u003c/strong\u003e - Oracle Solaris\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"telecom\"\u003eTelecom\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eOpen Radio Access Network (O-RAN) Systems Architecture and Design-Academic Press (2022)\u003c/strong\u003e - Wim Rouwet\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"phillosophy\"\u003ePhillosophy\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eThe Art of War\u003c/strong\u003e - Sun Tzu\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eDigital Minimalism\u003c/strong\u003e - Cal Newport\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eFihi Ma Fihi\u003c/strong\u003e - Jalalludin Rumi\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eThe Triple Deminism\u003c/strong\u003e - Sun Yat Sen\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eThe Moral and Sentiment\u003c/strong\u003e - Adam Smith\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eDas Kapital\u003c/strong\u003e - Karl marx\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eIhya\u0026rsquo; Ulumuddin\u003c/strong\u003e - Al-Ghazali\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMuqadimah\u003c/strong\u003e - Ibn Khaldun\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eEthics\u003c/strong\u003e - Aristotle\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eRepublic\u003c/strong\u003e - Plato\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMeditations on First Phillosophy\u003c/strong\u003e - Rene Descartes\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"security\"\u003eSecurity\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"shell-scripting\"\u003eShell Scripting\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"finance-and-management\"\u003eFinance and Management\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"comics-and-novels\"\u003eComics and Novels\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003e1984\u003c/strong\u003e - George Orwell\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eFahrenheit\u003c/strong\u003e- Ray Bradburry\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eTaiko\u003c/strong\u003e - Eiji Yoshikawa\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMusashi\u003c/strong\u003e - Eiji Yosikawa\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eOne Piece\u003c/strong\u003e - Eichiro Oda [Comic]\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eVagabond\u003c/strong\u003e - Takehiko Inoe [Comic]\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eNemesis\u003c/strong\u003e - Agatha Christie\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eThe Brothers Karamazov\u003c/strong\u003e - Fyodor Dostoyevsky\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eMetamorphosis\u003c/strong\u003e - Franz Kafka\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eThe Sinking of the Van der Wijck\u003c/strong\u003e - Hamka\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eThus Spoke Zarathustra\u003c/strong\u003e - Nietzsche\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eAttack on Titan\u003c/strong\u003e - Hajime Isayama [Comic]\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eNaruto\u003c/strong\u003e - Masashi Kisimoto [Comic]\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eEvil under the Sun\u003c/strong\u003e - Agatha Christie\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eTowards Zero\u003c/strong\u003e - Agatha Christie\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eHercule Poirot\u0026rsquo;s Christmas\u003c/strong\u003e - Agatha Christie\u003c/li\u003e\n\u003c/ul\u003e\n"
        },
        {
            "title": "Contact",
            "date_published": "0001-01-01T00:00:00Z",
            "date_modified": "0001-01-01T00:00:00Z",
            "id": "https://hanserich.com/contact/",
            "url": "https://hanserich.com/contact/",
            "content_html": ""
        },
        {
            "title": "Sched-Ext a Game Changer for Linux Scheduler",
            "date_published": "0001-01-01T00:00:00Z",
            "date_modified": "0001-01-01T00:00:00Z",
            "id": "https://hanserich.com/documentation/sched-ext/",
            "url": "https://hanserich.com/documentation/sched-ext/",
            "authors": [
                {
                  "name": "Erich"
                }
            ],
            "content_html": ""
        },
        {
            "title": "Search",
            "date_published": "0001-01-01T00:00:00Z",
            "date_modified": "0001-01-01T00:00:00Z",
            "id": "https://hanserich.com/search/",
            "url": "https://hanserich.com/search/",
            "content_html": "\u003cp class=\"error message js-hidden\"\u003eYou must have Javascript enabled to use this function.\u003c/p\u003e\n\u003cp class=\"info message hidden\" data-search-loading\u003eLoading search index…\u003c/p\u003e\n\n\u003cdiv data-search-input class=\"hidden\"\u003e\n  \u003cform data-search-form id=\"search-form\" action=\"#\" method=\"post\" accept-charset=\"UTF-8\" role=\"search\"\u003e\n    \u003clabel for=\"query\" class=\"visually-hidden\"\u003eSearch\u003c/label\u003e\n    \u003cinput data-search-text type=\"search\" id=\"query\" name=\"query\" placeholder=\"Enter the terms you wish to search for.\" maxlength=\"128\"\u003e\n  \u003c/form\u003e\n\u003c/div\u003e\n\n\u003cdiv data-search-results aria-live=\"polite\"\u003e\u003c/div\u003e\n\n\u003ctemplate\u003e\n  \u003carticle data-search-result class=\"list-view\"\u003e\n    \u003cheader\u003e\n      \u003ch2 class=\"title mt--s mb--xxs\"\u003e\u003ca href=\"#\"\u003eTitle here\u003c/a\u003e\u003c/h2\u003e\n      \u003cdiv class=\"submitted\"\u003e\u003ctime class=\"created-date\"\u003eDate here\u003c/time\u003e\u003c/div\u003e\n    \u003c/header\u003e\n    \u003cp class=\"content\"\u003eSummary here\u003c/p\u003e\n  \u003c/article\u003e\n\u003c/template\u003e\n\n"
        }
        ]
}
