From: Mark Ryden <markryde@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: netfilter module and shared libraries
Date: Thu, 1 Apr 2010 14:46:57 +0300 [thread overview]
Message-ID: <m2zdac45061004010446o99e12733m645008caac88873c@mail.gmail.com> (raw)
Hello,
I wrote a simple, short (35 lines) netfilter module (XTable target)
The code is below.
I build it and insmoded it.
When I try to add this iptables rule:
iptables -A OUTPUT -p UDP --dport 9998 -j ECHO
I get this error:
iptables v1.4.5: Couldn't load target `ECHO':/lib64/xtables/libipt_ECHO.so:
cannot open shared object file: No such file or directory
My question is: for a simple netfilter module like this ("ECHO"), must
I create a
corresponding shared library (libipt_ECHO.so)?
Is there a way to avoid this when adding such a rule,
using some default mechansim ?
here is the code for the kernel module I wrote:
// echoTarget.c
#include "linux/netfilter/x_tables.h"
static unsigned int echo_tg4(struct sk_buff *skb,
const struct xt_target_param *par)
{
printk("in %s %s\n",__FUNCTION__,__FILE__);
return NF_DROP;
}
static struct xt_target echo_tg_reg = {
.name = "ECHO",
.revision = 0,
.family = NFPROTO_IPV4,
.proto = IPPROTO_UDP,
.target = echo_tg4,
.me = THIS_MODULE,
};
static int __init echo_tg_init(void)
{
return xt_register_target(&echo_tg_reg);
}
static void __exit echo_tg_exit(void)
{
xt_unregister_target(&echo_tg_reg);
}
module_init(echo_tg_init);
module_exit(echo_tg_exit);
MODULE_AUTHOR ("test");
MODULE_DESCRIPTION ("tartet");
MODULE_LICENSE("GPL");
next reply other threads:[~2010-04-01 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 11:46 Mark Ryden [this message]
2010-04-01 12:01 ` netfilter module and shared libraries Jan Engelhardt
2010-04-01 12:05 ` 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=m2zdac45061004010446o99e12733m645008caac88873c@mail.gmail.com \
--to=markryde@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).