All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Dibowitz <phil@ipom.com>
To: netfilter-devel@lists.netfilter.org, pablo@netfilter.org
Subject: NFCT_Q_DUMP problem
Date: Wed, 14 Mar 2007 00:19:38 -0700	[thread overview]
Message-ID: <45F7A20A.5050302@ipom.com> (raw)
In-Reply-To: <45F671CA.6010401@netfilter.org>

[-- Attachment #1: Type: text/plain, Size: 2477 bytes --]

Pablo Neira Ayuso wrote:
> BTW, I suggest you to have a look a new_api_test.c under utils/ to get
> quick look on the new API. The old API is deprecated and will vanish
> sooner or later, new apps must use the new API.

So I sat down to write some test code today on the new API, and I found all
the nice getter functions, which are awesome... but I can't seem to make the
new API work with NFCT_Q_DUMP. I shrunk down my test the bare minimum and
nfct_query *always* returns errno for "Address family not supported by
protocol" :(

new_api_test.c doesn't test the NFCT_Q_DUMP query, so I'm wondering if it's
perhaps a problem in the NFCT_Q_DUMP query type.

Here's some sample code:

[phil@rider nftest]$ cat minitest.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <libnetfilter_conntrack/libnetfilter_conntrack.h>
#include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h>

static int conntrack_addcon_hook(enum nf_conntrack_msg_type type,
                        struct nf_conntrack *ct,
                        void *data)
{
        return NFCT_CB_CONTINUE;
}

int main(int argc, char *argv[])
{
        struct nfct_handle *cth;
        struct nf_conntrack *ct;
        int res;

        ct = nfct_new();
        if (!ct) {
                printf("Error, couldn't create and nfct\n");
                exit(1);
        }
        cth = nfct_open(CONNTRACK, 0);
        if (!cth) {
                printf("Error, couldn't open conntrack table\n");
                exit(1);
        }
        nfct_callback_register(cth, NFCT_T_ALL, conntrack_addcon_hook,
				NULL);
        res = nfct_query(cth, NFCT_Q_DUMP, ct);
        if (res < 0) {
                printf("dump failed(%d): %s\n", res, strerror(errno));
        }
        nfct_close(cth);
        return 1;
}


When I run this I get:
  [phil@rider nftest]$ sudo ./minitest
  dump failed(-1): Address family not supported by protocol

-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

  parent reply	other threads:[~2007-03-14  7:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-12  1:56 libnetfilter_conntrack question Phil Dibowitz
2007-03-12  6:40 ` Phil Dibowitz
2007-03-12 10:14 ` Pablo Neira Ayuso
2007-03-13  7:40   ` Phil Dibowitz
2007-03-13  9:41     ` Pablo Neira Ayuso
2007-03-13 18:34       ` Phil Dibowitz
2007-03-14  7:19       ` Phil Dibowitz [this message]
2007-03-14 13:17         ` NFCT_Q_DUMP problem Pablo Neira Ayuso
2007-03-14 16:11           ` Phil Dibowitz
2007-03-15 11:50             ` Pablo Neira Ayuso
2007-03-15  0:45         ` Patrick McHardy
2007-03-15  0:54           ` Phil Dibowitz
2007-03-15  5:21       ` libnetfilter_conntrack question Phil Dibowitz
2007-03-15 11:36         ` Pablo Neira Ayuso
2007-03-16  8:44           ` Phil Dibowitz
2007-03-16  8:58             ` Patrick McHardy

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=45F7A20A.5050302@ipom.com \
    --to=phil@ipom.com \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.