Skip to content

Investigate better eBPF approach(s) #2

Description

@ariasmn

Right now, the approach that strait follows is:

  • Create a main cgroup called strait, which has multiple child cgroups with the PID, which are the ones that the BPF programs handle.
  • Two BPF programs of type BPF_PROG_TYPE_CGROUP_SKB, one for ingress and another for egress. These two attach to each cgroup and handle the limiting.

This approach has a problem which is (if I understood correctly by reading the docs) that whenever we limit a PID, it create a new instance/maps to be attached to each cgroup. I also started with the idea of having a single cgroup under strait using a lookup shared BPF map, which should be easy, but kept on getting problems, and also saw that the bpf_get_current_pid_tgid is only from kernel 6.10 onwards, which doesn't work for me since I still have a Bookworm machine with kernel 6.1 (that I need to update, I know 🥲 ).

There's a better approach for sure, but since I'm still learning about eBPF I need to investigate lots of stuff, like BPF_PROG_TYPE_NETFILTER and BPF_PROG_TYPE_SCHED_CLS.

The only thing that I need to do is:

  • Per PID limits
  • Interface agnostic (for now I don't want to mess with different limits per interface)
  • Different values for egress/ingress

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions