Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Morgon J. Kanter" <morgon.j.kanter@dartmouth.edu>
Cc: netfilter@vger.kernel.org
Subject: Re: Polling for conntrack events
Date: Tue, 27 Apr 2010 20:11:38 +0200	[thread overview]
Message-ID: <4BD728DA.1010004@netfilter.org> (raw)
In-Reply-To: <201004261120.55513.morgon.j.kanter@dartmouth.edu>

Morgon J. Kanter wrote:
> Hi,
> 
> I'm developing an application that uses libnetfilter_conntrack to note when 
> connections start and end as part of what it does. So far I've been able to do 
> just fine is use nfct_filter with nfct_catch and have a function called 
> whenever the appropriately filtered conntrack events happen. This works well, 
> but my program doesn't *just* look for conntrack events and act on them. To 
> keep it single-threaded what I'd like to do is just be able to poll for 
> conntrack events, with poll() or select() or whatever.

IRC, you can use nfct_fd() to get the netlink file descriptor.

> What I attempted was extracting the netlink fd with the filter applied, and 
> running select() on a set containing just that, and then using nfct_query().

nfct_query() is not of any use to listen to events.

> This didn't work at all though -- when filtered conntrack events do happen, 
> apparently nothing is pushed down that file descriptor. Is there any way to do 
> what I want? I didn't see anything that was using this sort of functionality 
> in the utils directory.

You can look at the conntrack-tools, specifically conntrackd, it does 
more or less what you seem to need.

  reply	other threads:[~2010-04-27 18:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 15:20 Polling for conntrack events Morgon J. Kanter
2010-04-27 18:11 ` Pablo Neira Ayuso [this message]
2010-04-28  8:03   ` Eric Leblond

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=4BD728DA.1010004@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=morgon.j.kanter@dartmouth.edu \
    --cc=netfilter@vger.kernel.org \
    /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