All of lore.kernel.org
 help / color / mirror / Atom feed
* write a new simple target for netfilter
@ 2010-08-30 13:22 Nicola Padovano
  2010-08-30 13:25 ` Nicola Padovano
  2010-08-30 17:51 ` Elmar Stellnberger
  0 siblings, 2 replies; 24+ messages in thread
From: Nicola Padovano @ 2010-08-30 13:22 UTC (permalink / raw)
  To: netfilter-devel

Hi all!
I've write the following  (and dummy) module that drops all packet...
but...now? after i write the module i can use it?
for example: i want digit:
iptables -A INPUT -s 127.0.0.1 -p icmp -j DROP
but i don't know how create this new target...
I've modified the netfilter makefile e Kbuild file (in net/netfilter),
and then i've do 'make' 'make modules' 'make modules_install' but
after i digit iptables i have this message

"iptables v1.4.2: Couldn't load target `TAR':/lib/xtables/libipt_TAR.
so: cannot open shared object file: No such file or directory"

what's my problem?


code:
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter/x_tables.h>

static unsigned int xt_tar_target(unsigned int hook,
                                                 struct sk_buff **skb,
                                                 const struct net_device *in,
                                                 const struct net_device *out,
                                                 int (*okfn)(struct sk_buff*))
{
    printk(KERN_INFO "ciaociao");
    return NF_DROP;
}

static struct xt_target xt_tar_reg = {
    .name       = "TAR",
    .family     = AF_INET,
    .proto      = IPPROTO_TCP,
    .target     = xt_tar_target,
    .me         = THIS_MODULE,
};

static int __init xt_tar_init(void)
{
    return xt_register_target(&xt_tar_reg);
}

static void __exit xt_tar_exit(void)
{
    xt_unregister_target(&xt_tar_reg);
}

module_init(xt_tar_init);
module_exit(xt_tar_exit);

MODULE_DESCRIPTION("np des");
MODULE_LICENSE("GPL");
MODULE_ALIAS("xt_TAR");

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2010-08-30 23:53 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30 13:22 write a new simple target for netfilter Nicola Padovano
2010-08-30 13:25 ` Nicola Padovano
2010-08-30 13:34   ` Luciano Coelho
2010-08-30 13:46     ` Nicola Padovano
2010-08-30 13:53       ` Luciano Coelho
2010-08-30 13:57   ` Justin Kamerman
2010-08-30 14:21     ` Nicola Padovano
2010-08-30 14:34       ` Justin Kamerman
2010-08-30 14:59       ` Jan Engelhardt
2010-08-30 15:15         ` Nicola Padovano
2010-08-30 18:35         ` Nicola Padovano
2010-08-30 18:45           ` Jan Engelhardt
2010-08-30 19:00             ` Nicola Padovano
2010-08-30 19:07               ` Jan Engelhardt
2010-08-30 21:47                 ` Nicola Padovano
2010-08-30 22:25                   ` Jan Engelhardt
2010-08-30 22:30                     ` Nicola Padovano
2010-08-30 23:02                       ` Nicola Padovano
2010-08-30 23:09                         ` Jan Engelhardt
2010-08-30 23:17                           ` Nicola Padovano
2010-08-30 23:53                             ` Jan Engelhardt
2010-08-30 17:51 ` Elmar Stellnberger
2010-08-30 18:30   ` Justin Kamerman
2010-08-30 18:34   ` Jan Engelhardt

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.