Linux Netfilter development
 help / color / mirror / Atom feed
From: Fabian Hugelshofer <hugelshofer2006@gmx.ch>
To: netfilter-devel@vger.kernel.org
Subject: Re: Conntrack Events Performance - Multipart Messages?
Date: Thu, 17 Jul 2008 16:15:10 +0100	[thread overview]
Message-ID: <487F61FE.1050508@gmx.ch> (raw)
In-Reply-To: <487F5874.3000905@gmx.ch>

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

Fabian Hugelshofer wrote:
> To reduce any side effects I wrote a small test application which just 
> reads the ctevent socket and does nothing else. You find it attached to 
> this email.

Forgot to attach, you find it in this email...

[-- Attachment #2: ctevtest.c --]
[-- Type: text/x-csrc, Size: 1201 bytes --]

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>

#include <libnfnetlink/libnfnetlink.h>
#include <libnetfilter_conntrack/libnetfilter_conntrack.h>


volatile sig_atomic_t terminate;


static void __sig_handler(int sig)
{
	switch (sig) {
		case SIGTERM:
		case SIGINT:
			terminate = 1;
			break;
	}
}

int main(int argc, char* argv[])
{
	struct nfct_handle *h;
	struct sigaction sigact;
	char buf[NFNL_BUFFSIZE] __attribute__ ((aligned));
	int len;
	int events = 0;
	int overflows = 0;

	terminate = 0;
	sigact.sa_handler = &__sig_handler;
	sigaction(SIGINT, &sigact, NULL);
	sigaction(SIGTERM, &sigact, NULL);

	h = nfct_open(NFNL_SUBSYS_CTNETLINK,
			NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY);
	if (h == NULL) {
		perror("opening ctnetlink failed");
		exit(EXIT_FAILURE);
	}
	
	while (!terminate) {
		len = recv(nfct_fd(h), buf, sizeof(buf), 0);
		if (len < 0) {
			if (errno == ENOBUFS) {
				overflows++;
			} else if (errno != EINTR) {
				perror("recv failed");
				nfct_close(h);
				exit(EXIT_FAILURE);
			}
		} else {
			events++;
		}
	}

	printf("%d events received (%d overflows)\n", events, overflows);

	nfct_close(h);

	exit(EXIT_SUCCESS);
}

  reply	other threads:[~2008-07-17 15:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 16:42 Conntrack Events Performance - Multipart Messages? Fabian Hugelshofer
2008-07-17  9:16 ` Patrick McHardy
2008-07-17 10:03 ` Pablo Neira Ayuso
2008-07-17 14:34   ` Fabian Hugelshofer
2008-07-17 15:15     ` Fabian Hugelshofer [this message]
2008-07-18 15:56     ` Fabian Hugelshofer
2008-07-18  2:11   ` Patrick McHardy
2008-07-21 15:51     ` Fabian Hugelshofer
2008-07-21 15:59       ` Patrick McHardy
2008-07-21 17:49         ` Fabian Hugelshofer
2008-07-23 14:32           ` Fabian Hugelshofer
2008-07-23 14:38             ` Patrick McHardy
2008-07-23 16:12               ` Fabian Hugelshofer
2008-07-23 17:01                 ` Patrick McHardy
2008-07-23 17:07                   ` Patrick McHardy
2008-07-23 17:30                     ` Fabian Hugelshofer
2008-07-23 17:32                       ` Patrick McHardy
2008-07-23 17:38                         ` Fabian Hugelshofer
2008-07-23 17:40                           ` Patrick McHardy
2008-07-23 17:15                   ` Fabian Hugelshofer
2008-07-23 17:20                     ` Patrick McHardy
2008-07-24 13:21                       ` Fabian Hugelshofer
2008-07-25  8:51                         ` Fabian Hugelshofer
2008-07-25  9:32                         ` Pablo Neira Ayuso
2008-07-25 11:15                           ` Pablo Neira Ayuso
2008-07-27 17:23                             ` Fabian Hugelshofer
2008-07-28 18:31                             ` Pablo Neira Ayuso
2008-07-28 23:12                               ` Fabian Hugelshofer
2008-07-29 17:11                                 ` Pablo Neira Ayuso
2008-07-25  8:44                 ` Fabian Hugelshofer

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=487F61FE.1050508@gmx.ch \
    --to=hugelshofer2006@gmx.ch \
    --cc=netfilter-devel@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