Code Monkey home page Code Monkey logo

redbpf's Introduction

RedBPF

LICENSE CircleCI

A Rust eBPF toolchain.

Overview

The RedBPF project is a collection of Rust libraries to work with eBPF programs. It includes:

  • redbpf-probes - an idiomatic Rust API to write programs that can be compiled to eBPF bytecode and executed by the linux in-kernel eBPF virtual machine.

    Documentation

  • redbpf-macros - companion crate to redbpf-probes which provides procedural macros to reduce the amount of boilerplate needed to produce eBPF programs.

    Documentation

  • redbpf - a user space library that can be used to parse and load eBPF programs written using redbpf-probes and redbpf-macros.

    Documentation

  • cargo-bpf - a cargo subcommand for creating, developing and building eBPF programs in Rust using the RedBPF APIs.

    Documentation

Usage

The easiest way to get started is to install cargo-bpf, see the cargo bpf documentation for more info.

The rust-tools directory also contains examples of using redbpf in real life.

To see how and what RedBPF can be used for, check out the ingraind project.

Requirements

In order to build some of the code here, you will need the following:

  • Linux 4.19+, with a build tree. The build tree is picked up from standard locations, or the KERNEL_SOURCE environment variable.
  • LLVM 10
  • The latest stable Rust compiler. We only promise to build with the latest stable and nightly compilers.

Getting started

It's easiest to get started by installing cargo-bpf using cargo.

cargo install cargo-bpf
cargo bpf --help

If you would like to go the git way, clone this repository then make sure you sync the git submodules necessary to build redbpf:

git submodule sync
git submodule update --init

Then install the dependencies for your distro before running the usual ritual.

cargo install --path cargo-bpf

Ubuntu

Install the following dependencies:

apt-get install -y curl \
	wget \
	gnupg2 \
	software-properties-common \
	build-essential \
	clang-10 \
	llvm-10 \
	libelf-dev \
	linux-headers-$(uname -r) \
	zlib1g \
	ca-certificates

Fedora

yum install -y clang-10.0.0 \
	llvm-10.0.0 \
	llvm-libs-10.0.0 \
	llvm-devel-10.0.0 \
	llvm-static-10.0.0 \
	kernel \
	kernel-devel \
	elfutils-libelf-devel \
	ca-certificates

License

This repository contains code from other software in the following directories, licensed under their own particular licenses:

  • bpf-sys/libelf/*: GPL2 + LGPL3
  • bpf-sys/bcc/*: Apache2, public domain
  • include/bpf_helpers.h LGPL2 + BSD-2
  • include/bpf_helper_defs.h: LGPL2 + BSD-2
  • bpf-sys/libbpf: LGPL2 + BSD-2

Where '+' means they are dual licensed.

RedBPF and its components, unless otherwise stated, are licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

redbpf's People

Contributors

alessandrod avatar andrejtokarcik avatar aquarhead avatar badboy avatar geal avatar heroickatora avatar rsdy avatar rtkaratekid avatar trinity-1686a avatar

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.