-
Notifications
You must be signed in to change notification settings - Fork 52
Remove bpfilter daemon and consolidate every feature in libbpfilter #467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
78d24fb
af1b97b
3521acd
f330a4b
31553a8
ed7cc06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,15 +6,12 @@ Usage | |
| :maxdepth: 2 | ||
| :caption: Usage | ||
|
|
||
| daemon | ||
| bfcli | ||
|
|
||
|
|
||
| ``bpfilter`` is composed of two main parts that work together: the client used by the users to define the filtering rules and send them to the **daemon** that performs the heavy lifting of generating the BPF bytecode. | ||
| ``bpfilter`` is composed of two main parts: ``libbpfilter``, the core library that generates and manages BPF programs, and ``bfcli``, the CLI used to define filtering rules. ``bfcli`` calls ``libbpfilter`` directly to translate rules into BPF programs and load them into the kernel. | ||
|
|
||
| Before anything, you will have to run the daemon on your system, see :doc:`daemon` for more details. | ||
|
|
||
| Then, use ``bfcli`` to create, update, or read chains. | ||
| See :doc:`bfcli` for the full command reference and filter syntax. | ||
|
|
||
| Install | ||
| ------- | ||
|
|
@@ -31,7 +28,7 @@ If you use a different distribution, you can still build and use **bpfilter** if | |
| Example usage | ||
| ------------- | ||
|
|
||
| From here on, we assume **bpfilter** has been installed on your system. If you build it locally, you will need to substitute the ``bpfilter`` command with ``$BUILD_DIR/output/sbin/bpfilter``, same for ``bfcli``. The example below is meant to familiarize you with **bpfilter**, more in-depth information can be found throughout the documentation. | ||
| From here on, we assume **bpfilter** has been installed on your system. If you build it locally, you will need to substitute the ``bfcli`` command with ``$BUILD_DIR/output/bin/bfcli``. The example below is meant to familiarize you with **bpfilter**, more in-depth information can be found throughout the documentation. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Claude: Wrong binary path (must-fix)
|
||
|
|
||
| This example will block ``ping`` requests sent going out of the local host to a remote server. | ||
|
|
||
|
|
@@ -53,19 +50,9 @@ Let's check if we can ping ``facebook.com`` before we do anything: | |
| rtt min/avg/max/mdev = 23.596/25.493/28.622/1.880 ms | ||
|
|
||
|
|
||
| **Start the daemon** | ||
|
|
||
| The daemon is responsible for receiving the user-defined filtering rules, and translating them into BPF programs. We will start it in ``--transient`` mode, so all the filtering programs defined will be discarded when we stop it, preventing any mistake on our side! | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| $ sudo bpfilter --transient | ||
| info : waiting for requests... | ||
|
|
||
|
|
||
| **Create a new filtering rule** | ||
|
|
||
| Now that the daemon is up and running, we will use ``bfcli`` to send a filtering chain. A chain is a set of rules to filter packets on: | ||
| Use ``bfcli`` to create a filtering chain. A chain is a set of rules to filter packets on: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude: "Environment variables" section is inaccurate (must-fix)
BF_BPFFS_PATH,BF_WITH_BPF_TOKEN, andBF_VERBOSEare not environment variables -- they are command-line options (--bpffs-path,--with-bpf-token,--verbose) parsed viaargpinsrc/bfcli/opts.c. There are nogetenv()calls insrc/bfcli/orsrc/libbpfilter/.The e2e test harness does
export BF_BPFFS_PATH=...but only uses it as a shell variable to construct the--bpffs-pathCLI argument ine2e_test_util.sh.This section should be renamed (e.g. "Configuration options") and rewritten to document the actual CLI flags (
--bpffs-path PATH,--with-bpf-token,--verbose FLAG).Additionally,
BF_VERBOSEis described as a "comma-separated list", but the code inopts.c(lines 362-374) parses each--verboseinvocation as a single enum value. Users must pass--verbosemultiple times (e.g.,--verbose debug --verbose bpf).