- 论坛徽章:
- 0
|
下面是我写的一小段代码
/*#define _KERNEL_*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netfilter.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/netfilter_arp.h>
unsigned int arp(unsigned int hooknum,
struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
printk("<0>com\n");
return NF_ACCEPT;
}
int init_module()
{
nfho.hook = arp;
nfho.hooknum = NF_ARP_IN;
nfho.pf = NF_ARP;
nfho.priority = NF_IP_PRI_FIRST;
nf_register_hook(&nfho);
return 0;
}
void cleanup_module()
{
nf_unregister_hook(&nfho);
}
运行后不能捕获到任何的arp报文。希望大家多多指教,谢谢了。 |
|