-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add support for Flow Dissector programs #1222
Conversation
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hey @alessandrod, this pull request changes the Aya Public API and requires your review. |
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.
Reviewed 14 of 14 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @alessandrod)
aya/src/programs/flow_dissector.rs
line 95 at r2 (raw file):
.insert(FlowDissectorLink::new(FdLink::new(link_fd))) } else { todo!("support attachment via BPF_PROG_ATTACH")
rather than marking TODO, can we add the implementation here? ISTR linking to one that could be basically copy/pasted from another program type with similar attach semantics - you'd just need to change a couple of constants.
test/integration-ebpf/src/test.rs
line 51 at r2 (raw file):
#[flow_dissector] pub fn test_flow(_ctx: FlowDissectorContext) -> u32 { // TODO: write an actual flow dissector. See tools/testing/selftests/bpf/progs/bpf_flow.c in the
I'm torn, I'd prefer a program here vs. a TODO.
Without a program written to exercise the aya-ebpf API it's hard to know if we have enough implemented to support a trivial example. For Aya userspace, this doesn't matter so much since you could bring a program written in C.
That said I can see value in merging what we have to encourage others to contribute or give us feedback on what's missing.
aya-ebpf-macros/src/lib.rs
line 571 at r2 (raw file):
/// pub fn dissect(_ctx: FlowDissectorContext) -> u32 { /// // TODO: do something useful here. /// return 0
perhaps return one of the constants described in the doc here instead?
BPF_FLOW_DISSECTOR_CONTINUE?
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.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @alessandrod and @dave-tucker)
aya/src/programs/flow_dissector.rs
line 95 at r2 (raw file):
Previously, dave-tucker (Dave Tucker) wrote…
rather than marking TODO, can we add the implementation here? ISTR linking to one that could be basically copy/pasted from another program type with similar attach semantics - you'd just need to change a couple of constants.
Ok, done, I think.
aya-ebpf-macros/src/lib.rs
line 571 at r2 (raw file):
Previously, dave-tucker (Dave Tucker) wrote…
perhaps return one of the constants described in the doc here instead?
BPF_FLOW_DISSECTOR_CONTINUE?
Done.
test/integration-ebpf/src/test.rs
line 51 at r2 (raw file):
Previously, dave-tucker (Dave Tucker) wrote…
I'm torn, I'd prefer a program here vs. a TODO.
Without a program written to exercise the aya-ebpf API it's hard to know if we have enough implemented to support a trivial example. For Aya userspace, this doesn't matter so much since you could bring a program written in C.That said I can see value in merging what we have to encourage others to contribute or give us feedback on what's missing.
That's basically where I am with it :/
2168292
to
401edc1
Compare
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.
one small nit, but happy for this to merge either way.
Reviewable status: 8 of 14 files reviewed, 3 unresolved discussions (waiting on @alessandrod)
aya/src/programs/flow_dissector.rs
line 104 at r4 (raw file):
netns_fd, BPF_FLOW_DISSECTOR, CgroupAttachMode::Single,
nit. This could be CgroupAttachMode::default()
which I think better captures the intent - we don't actually care about the value here.
Closes aya-rs#216. Co-authored-by: Zenna Allwein <[email protected]> Signed-off-by: Tamir Duberstein <[email protected]>
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.
Reviewable status: 8 of 14 files reviewed, 2 unresolved discussions (waiting on @alessandrod and @dave-tucker)
aya/src/programs/flow_dissector.rs
line 104 at r4 (raw file):
Previously, dave-tucker (Dave Tucker) wrote…
nit. This could be
CgroupAttachMode::default()
which I think better captures the intent - we don't actually care about the value here.
Done!
This picks up from #802.
I've addressed comments in a separate commit to somwhat ease review; this will
be squashed before merging.
This change is