netfilter捕获arp报文,求解
时间:2010-08-08
来源:互联网
下面是我写的一小段代码
/*#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报文。希望大家多多指教,谢谢了。
/*#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报文。希望大家多多指教,谢谢了。
作者: jhl19880722 发布时间: 2010-08-08
不知道到的话可以加 打印呀 ,报文途经的地方。
作者: C.J 发布时间: 2010-08-08
回复 C.J
请问,怎样打印,我不是很清楚。我不知道在其他什么地方能够获得这个报文。谢谢啦
请问,怎样打印,我不是很清楚。我不知道在其他什么地方能够获得这个报文。谢谢啦
作者: jhl19880722 发布时间: 2010-08-08
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28