Updated documentation

Signed-off-by: Github Action <ubpf@users.noreply.github.com>
43 files changed
tree: f349e748e43efb8d61b9dc266756a827f4188ed3
  1. .github/
  2. aarch64_test/
  3. bin/
  4. cmake/
  5. external/
  6. search/
  7. test_framework/
  8. tests/
  9. ubpf/
  10. ubpf_plugin/
  11. vm/
  12. .gitignore
  13. .gitmodules
  14. .travis.yml
  15. bc_s.png
  16. bc_sd.png
  17. bdwn.png
  18. closed.png
  19. CMakeLists.txt
  20. dir_93effe02d2e8dd09437fb49d0adaddf7.html
  21. dir_cf6c78462b393272f91793a3a49557d3.html
  22. doc.png
  23. doc.svg
  24. docd.svg
  25. doxygen.css
  26. doxygen.png
  27. doxygen.svg
  28. dynsections.js
  29. files.html
  30. folderclosed.png
  31. folderclosed.svg
  32. folderclosedd.svg
  33. folderopen.png
  34. folderopen.svg
  35. folderopend.svg
  36. globals.html
  37. globals_defs.html
  38. globals_enum.html
  39. globals_eval.html
  40. globals_func.html
  41. globals_type.html
  42. index.html
  43. jquery.js
  44. LICENSE.txt
  45. mainpage_8dox.html
  46. menu.js
  47. menudata.js
  48. minus.svg
  49. minusd.svg
  50. nav_f.png
  51. nav_fd.png
  52. nav_g.png
  53. nav_h.png
  54. nav_hd.png
  55. open.png
  56. plus.svg
  57. plusd.svg
  58. README.md
  59. requirements.txt
  60. splitbar.png
  61. splitbard.png
  62. sync_off.png
  63. sync_on.png
  64. tab_a.png
  65. tab_ad.png
  66. tab_b.png
  67. tab_bd.png
  68. tab_h.png
  69. tab_hd.png
  70. tab_s.png
  71. tab_sd.png
  72. tabs.css
  73. ubpf_8h.html
  74. ubpf_8h_source.html
README.md

uBPF

Userspace eBPF VM

Build Status Coverage Status

About

This project aims to create an Apache-licensed library for executing eBPF programs. The primary implementation of eBPF lives in the Linux kernel, but due to its GPL license it can't be used in many projects.

Linux documentation for the eBPF instruction set

Instruction set reference

This project includes an eBPF assembler, disassembler, interpreter (for all platforms), and JIT compiler (for x86-64 and Arm64 targets).

Building with CMake

Note: This works on Windows, Linux, and MacOS, provided the prerequisites are installed.

cmake -S . -B build -DUBPF_ENABLE_TESTS=true
cmake --build build --config Debug

Running the tests

Linux and MacOS

cmake --build build --target test --

Windows

ctest --test-dir build

Building with make (Linux)

Run make -C vm to build the VM. This produces a static library libubpf.a and a simple executable used by the testsuite. After building the library you can install using make -C vm install via either root or sudo.

Running the tests (Linux)

To run the tests, you first need to build the vm code then use nosetests to execute the tests. Note: The tests have some dependencies that need to be present. See the .travis.yml for details.

Before running the test (assuming Debian derived distro)

sudo apt-get update
sudo apt-get -y install python python-pip python-setuptools python-wheel python-nose
python2 -m pip install --upgrade "pip<21.0"
python2 -m pip install -r requirements.txt
python2 -m pip install cpp-coveralls

Running the test

make -C vm COVERAGE=1
nosetests -v   # run tests

After running the test

coveralls --gcov-options '\-lp' -i $PWD/vm/ubpf_vm.c -i $PWD/vm/ubpf_jit_x86_64.c -i $PWD/vm/ubpf_loader.c

Compiling C to eBPF

You'll need Clang 3.7.

clang-3.7 -O2 -target bpf -c prog.c -o prog.o

You can then pass the contents of prog.o to ubpf_load_elf, or to the stdin of the vm/test binary.

Contributing

Please fork the project on GitHub and open a pull request. You can run all the tests with nosetests.

License

Copyright 2015, Big Switch Networks, Inc. Licensed under the Apache License, Version 2.0 <LICENSE.txt or http://www.apache.org/licenses/LICENSE-2.0>.