Skip to content
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

Undocumented contract between l3afd and ebpf programs #15

Open
dthaler opened this issue Jan 25, 2022 · 1 comment
Open

Undocumented contract between l3afd and ebpf programs #15

dthaler opened this issue Jan 25, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@dthaler
Copy link
Collaborator

dthaler commented Jan 25, 2022

bpf.go implements

func (b *BPF) Start(ifaceName, direction string, chain bool) error

which appears to require that the command implement a specific set of command line options (iface, direction, map-name, log-dir, rules-file, etc). However these do not seem to be documented anywhere I can find.

@sanfern sanfern added the documentation Improvements or additions to documentation label Feb 23, 2022
@Aryanryn09
Copy link

hey !! can we implement these changes,

The Start function in bpf.go is part of the BPF struct, which is a higher-level interface for managing eBPF programs, maps, and events in Go.

The Start function starts a BPF program on a specified network interface and direction (incoming or outgoing). The chain parameter is a boolean that indicates whether the program should be chained with any existing program on the interface.

To use this function, the caller needs to pass in the required parameters as command line arguments when running their Go program. The documentation for these command line arguments can be found in the flag package in the standard Go library. Here is a brief summary of the command line arguments that are relevant to Start:

iface: The name of the network interface on which to attach the program.
direction: The direction in which the program should run, either "in" for incoming or "out" for outgoing traffic.
map-name: The name of the map to use for the BPF program.
log-dir: The directory where log files should be written.
rules-file: The path to the file containing the BPF program code.
The Start function also returns an error if the BPF program fails to start or if any of the required parameters are missing or invalid.

It's worth noting that the BPF struct is part of the ebpf package in the ebpf-go library. The ebpf package provides a set of low-level APIs for interacting with eBPF programs and maps in Go, while the BPF struct provides a higher-level interface for managing these components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants