Git Product home page Git Product logo

xdp_ipv6_filter's Introduction

XDP based IPv6 Packet filter

Prerequisites

  • Latest kernel with XDP enabled on it. This program was developed and tested on Ubuntu 22.04 OS and Linux 5.15.0-46-generic kernel.
  • iproute2

How to run

  1. Compile the program. This creates xdp_ipv6_filter.o object file.
    $ make
    clang -I. -I/lib/modules/5.15.0-46-generic/build/arch/x86/include -I/lib/modules/5.15.0-46-generic/build/arch/x86/include/generated - I/lib/modules/5.15.0-46-generic/build/include -I/lib/modules/5.15.0-46-generic/build/arch/x86/include/uapi -I/lib/modules/5.15.0-46-generic/build/include/uapi -include /lib/modules/5.15.0-46-generic/build/include/linux/kconfig.h -D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign -D__TARGET_ARCH_x86 -Wno-compare-distinct-pointer-types -Wno-gnu-variable-sized-type-not-at-end -Wno-address-of-packed-member -Wno-tautological-compare -O2 -emit-llvm -c xdp_ipv6_filter.c -o - | \
    llc -march=bpf -mcpu= -filetype=obj -o xdp_ipv6_filter.o
    
  2. Create a veth pair using iproute.
    $ sudo ip link add dev veth0 type veth peer name veth1
    $ sudo ip link set up dev veth0
    $ sudo ip link set up dev veth1
    
  3. Attach the compiled XDP program(xdp_ipv6_filter.o) to veth0.
    sudo ip link set dev veth0 xdp object xdp_ipv6_filter.o
    
  4. Run tcpdump on veth0 to monitor and capture the IPv6 packets.
    sudo tcpdump "ip6" -i veth0 -w captured.pcap -c 10
    
  5. To generate ipv6 packets we ping veth0 via veth1. Grab the IPv6 address of veth0 interface using ip a command and ping the interface.
    ping6 fe80::ec53:40ff:fe29:5d68%veth1 -c5
    

xdp_ipv6_filter's People

Contributors

ba1ajinaidu avatar

Watchers

 avatar

Forkers

orangice1997

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.