* netfilter module and shared libraries
@ 2010-04-01 11:46 Mark Ryden
2010-04-01 12:01 ` Jan Engelhardt
0 siblings, 1 reply; 3+ messages in thread
From: Mark Ryden @ 2010-04-01 11:46 UTC (permalink / raw)
To: netfilter-devel
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");
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: netfilter module and shared libraries
2010-04-01 11:46 netfilter module and shared libraries Mark Ryden
@ 2010-04-01 12:01 ` Jan Engelhardt
2010-04-01 12:05 ` Patrick McHardy
0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2010-04-01 12:01 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Netfilter Developer Mailing List, Mark Ryden
On Thursday 2010-04-01 13:46, Mark Ryden wrote:
>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
(Note that there is already an "ECHO" target in Xtables-addons ;-))
>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)?
Yes.
>Is there a way to avoid this when adding such a rule,
>using some default mechansim ?
Let's ask Patrick:
What do you think of enabling iptables to assume targets with .size=0
(which don't have options by design) if there was no libxt_XYZ.so found?
That would make things like libxt_NOTRACK.c obsolete, too.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: netfilter module and shared libraries
2010-04-01 12:01 ` Jan Engelhardt
@ 2010-04-01 12:05 ` Patrick McHardy
0 siblings, 0 replies; 3+ messages in thread
From: Patrick McHardy @ 2010-04-01 12:05 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: Netfilter Developer Mailing List, Mark Ryden
Jan Engelhardt wrote:
> On Thursday 2010-04-01 13:46, Mark Ryden wrote:
>
>> Is there a way to avoid this when adding such a rule,
>> using some default mechansim ?
>
> Let's ask Patrick:
>
> What do you think of enabling iptables to assume targets with .size=0
> (which don't have options by design) if there was no libxt_XYZ.so found?
> That would make things like libxt_NOTRACK.c obsolete, too.
No general objections, but how many modules are there really
that don't take options? Feel free to try, if your patch doesn't
affect error reporting and stays below 15 lines, I'll apply
it :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-01 12:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-01 11:46 netfilter module and shared libraries Mark Ryden
2010-04-01 12:01 ` Jan Engelhardt
2010-04-01 12:05 ` Patrick McHardy
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).