★ wanayoo — archive 1999 https://github.com/kti/python-netfilterqueue/issues/28Nouvelle recherche | Portail wanayoo
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

Cannot bind multiple queues #28

Open
fripSide opened this issue Mar 9, 2017 · 2 comments
Open

Cannot bind multiple queues #28

fripSide opened this issue Mar 9, 2017 · 2 comments

Comments

@fripSide
Copy link

@fripSide fripSide commented Mar 9, 2017

When I try to use netfilter to bind two queue with different queue num, and I add two callbacks methods to bind with the two number.
nfqueue.bind(1, self.in_modify)
nfqueue.bind(2, self.out_modify)

However, the two queues are all bind to the second callback method.
https://github.com/kti/python-netfilterqueue/blob/master/netfilterqueue.pyx#L178

In this line, it's obvious that the pointer user_callback are overwrite when bind another queue. I think here should use a map to support different callbacks for each queue num.

@strictlymike
Copy link

@strictlymike strictlymike commented Apr 21, 2017

It doesn't look like the NetfilterQueue class is intended to bind() to more than one queue at a time. I am working on a project that requires multiple callbacks and I made it work by creating an instance of the NetfilterQueue class for each queue I wanted to bind to.

@Kkevsterrr
Copy link

@Kkevsterrr Kkevsterrr commented Jan 26, 2018

Can confirm running into the same problem as @fripSide. Running multiple queues works (per @strictlymike's suggestion), but note that the nfqueue.run() call is blocking (and I don't see a way in the API to signal an exit), so each queue would need to run out of its own thread/process and be killed on exit. Not the cleanest solution unfortunately, but works for now.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.