rust-bpf / rust-bcc

user-friendly rust bindings for the bpf compiler collection
MIT License
475 stars 54 forks source link

Add support for attaching a BPF program to a socket #191

Closed jrester closed 2 years ago

jrester commented 2 years ago

This adds support for attach_raw_socket. The changes are similiar to the one from #180 but this time in a more usable manner by only exposing the underlying sockets via socket2::Socket.

One BPF program can be attached to multiple interfaces. For each interface a raw socket is created, which is returned to the user so it can be used for reading/sending/etc.

As in my other PR I also included the port_filter example.