From: Pablo Neira <pablo@eurodev.net>
To: spanishmack@mchsi.com,
Netfilter Development Mailinglist
<netfilter-devel@lists.netfilter.org>
Subject: Re: libipq question
Date: Fri, 25 Jun 2004 22:38:14 +0200 [thread overview]
Message-ID: <40DC8D36.2000209@eurodev.net> (raw)
In-Reply-To: <A516FD6F11040F4E881C92EDA23F31A802ACF8AE@mx1.bsafeonline.com>
Hi Steve,
Steve Ashley wrote:
>I'm using libipq to do some user-space filter stuff. Everything is
>working great and for my application, I'm not taking a significant
>enough speed hit to warrant making a new target, iptables kernel module.
>However, I am getting one problem. If my application runs for a long
>time ( i.e. several hours or overnight ) with no activity, then filters
>packets. I'm getting the following error messages:
>
>Error in recv().
>Broken pipe.
>
>
If I'm not missing anything, I think that you could set the handler of
the broken pipe signal to an empty function, this way the application
won't exit.
>Currently I'm using the blocking version of the ipq_read() function,
>with no timeout. Would putting a timeout here, and checking on the
>netlink socket every so often be a good idea? Any thoughts or ideas
>would be helpful.
>
>
Well, you could even use select() to check when the descriptor has new
data ready to be read. I was told (Richard Steven's books) that
polling+non blocking sockets are always faster than blocking sockets.
>Also, just for information sake. At some point, if I add more features
>into my application, I fear using a userspace application may not be
>sufficient. Where can I find a good example of a new netfilter target
>kernel module code?
>
you want to program a match/target, you can have a look at the
netfilter-hacking howto:
http://www.netfilter.org/documentation/index.html#documentation-howto
and also you can have a look at source code in kernel and iptables
trees, there are simple matches/targets.
On the other hand, I suppose that you meant that you wanted to know how
to add a hook to netfilter, in that case have a look at:
http://www.linuxjournal.com/article.php?sid=7184
I passed that linuxjournal to a friend and he didn't have big problems
to program a simple hook.
regards,
Pablo
next prev parent reply other threads:[~2004-06-25 20:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-25 20:12 libipq question Steve Ashley
2004-06-25 20:38 ` Pablo Neira [this message]
2004-06-25 23:56 ` Henrik Nordstrom
-- strict thread matches above, loose matches on Subject: below --
2004-04-22 9:04 Moshe Ashkenazi
2003-05-15 4:42 Shirshanka Das
2003-05-23 8:22 ` Philip Ho
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=40DC8D36.2000209@eurodev.net \
--to=pablo@eurodev.net \
--cc=netfilter-devel@lists.netfilter.org \
--cc=spanishmack@mchsi.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 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.