netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Jeremy/starcraft.man" <starcraft.man@ubuntu.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Make nfct_catch return control to original thread
Date: Thu, 1 Mar 2012 00:26:02 +0100	[thread overview]
Message-ID: <20120229232602.GA3817@1984> (raw)
In-Reply-To: <CA+DcbdcTggNHJS3rCbnVNHejU5Zdb3+fukK_03qB+Y30K7XhxA@mail.gmail.com>

On Wed, Feb 29, 2012 at 09:38:00AM -0500, Jeremy/starcraft.man wrote:
> Hi,
> 
> I'm a developer currently working at a company using libnetfilter, I
> came in late in development of the product and the code is pretty much
> complete. Due to debugging checks recently enabled, they want to be
> able to unblock and gracefully stop all threads before terminating the
> process. The problem then is that the thread which invokes nfct_catch
> never returns and blocks the thread from cleanly terminating.
>
> pthread_cancel is not an option since we develop on android and that
> platform doesn't stopping threads that way.
> 
> I'm not that familiar with netfilter and am still reading up, from
> what I've read it doesn't seem like I can. Please correct me if I'm
> wrong, but the events that trigger the registered handlers are all
> tied to interfaces being new/updated/down and thus I can't just use a
> handler that returns NFNL_CB_STOP when it next gets an event (at least
> not unless I trigger an event artificially say after setting a boolean
> flag in the registered handler to force it to stop). Is there any sort
> of signal mechanism I'm missing that could be used to force a return
> from the loop of nfnl_catch?

You can set the non-blocking socket via nfct_fd(...) and setsockopt.

Then, check if nfct_catch returns -1 and errno == EAGAIN.

  reply	other threads:[~2012-02-29 23:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29 14:38 Make nfct_catch return control to original thread Jeremy/starcraft.man
2012-02-29 23:26 ` Pablo Neira Ayuso [this message]
2012-05-02 18:34 ` Jeremy/starcraft.man

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120229232602.GA3817@1984 \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=starcraft.man@ubuntu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).