GithubHelp home page GithubHelp logo

ebpf-icmp-ping's Introduction

Send ICMP Echo Replies using eBPF

The code parses the passed network packet into its Ethernet, IP and ICMP header, swaps addresses (MAC and IP addresses), changes the ICMP type to ICMP Echo Reply, re-calculates the ICMP checksum and sends the modified packet back out over the same interface.

Requirements

  • A recent kernel. Tested with 4.8 and 4.9
  • iproute2 v4.9. v4.10 has a bug makig it unusable. If your system does not provide it, compile it from git. Installation is not needed, the tc binary is enough.
  • Clang >= 3.8. eBPF backend required.

Code was tested on Ubuntu 16.10 with self-compiled iproute2 v4.9 and clang 4.0.

Run

First create a qdisc, then attach the classification and action, and at last show logging information:

make bpf.o
make qdisc
make run
make show exec

Delete filters and qdiscs afterwards:

make delete
make qdisc-delete

The code

The code in bpf.c is commented to explain each step.

Resources

ebpf-icmp-ping's People

Contributors

badboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ebpf-icmp-ping's Issues

2 Network-Interfaces Scenario

I have 2 interfaces enp2s0 and enp2s1
I want to make a demo switch out of this system.
I am trying to send packets to enp2s0 and forward them to enp2s1. But the order in which i am attaching bpf-0.o and bpf-1.o to these interfaces is affecting which bpf code takes control of my packet.

Can you suggest any thing.
Thanks a lot !

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.