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

Enforce freeing Queue::qh by implementing Drop #16

Merged
merged 2 commits into from
Apr 2, 2020
Merged

Enforce freeing Queue::qh by implementing Drop #16

merged 2 commits into from
Apr 2, 2020

Conversation

steven-joruk
Copy link
Contributor

@steven-joruk steven-joruk commented Mar 28, 2020

It's possible to leak the handle by not calling Queue::close. Queue::open must have been called before it's valid to call any of its instance functions. It may as well be enforced through opening the handle during construction, and then we can be certain it can be deallocated in Drop.

A similar problem exists with create_queue and destroy_queue, but I'm trying to think of how to solve it in the right way to allow for multiple open queues and maybe supporting an async stream to read from all of them.

Copy link
Owner

@chifflier chifflier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I agree with the proposed changes. I need to re-think the API of this crate, so other changes will happen. I'd be happy to merge this, so please rebase and resubmit, and I'll work on the API after.
Thanks!

src/lib.rs Outdated Show resolved Hide resolved
src/message.rs Show resolved Hide resolved
@steven-joruk
Copy link
Contributor Author

Regarding reworking the API - the netfilter_queue docs have a few modules marked as deprecated that are used in this crate, it might be good to switch away from them at the same time.

@chifflier
Copy link
Owner

chifflier commented Mar 31, 2020

For reference, this email describing the API changes and replacement. It seems nfqueue (and nflog) now directly use and expose nfnetlink and mnl.
I'll open a separate issue to track the API upgrade (rewrite).
Edit: this is #17

@chifflier chifflier merged commit d26cc5e into chifflier:master Apr 2, 2020
@chifflier
Copy link
Owner

Merged, thanks!

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

Successfully merging this pull request may close these issues.

2 participants