資源簡介
實現linux下防火墻的應用,可以添加相應規則對網絡數據包進行相應過濾。
代碼片段和文件信息
#ifndef?__KERNEL__
#define?__KERNEL__
#endif
#ifndef?MODULE
#define?MODULE
#endif
#include?
#include?
#include?
#include?
#include?
#include?
#include?
/*struct?that?is?used?for?register?hook*/
static?struct?nf_hook_ops?nfho;
/*?definition?of?hook?function?*/
unsigned?int?hook_func(unsigned?int?hooknum
???????????????????????struct?sk_buff?**skb
???????????????????????const?struct?net_device?*in
???????????????????????const?struct?net_device?*out
???????????????????????int?(*okfn)(struct?sk_buff?*))
{
????struct?sk_buff?*pskb=*skb;
????if((pskb->nh.iph->saddr)==in_aton(“192.168.1.27“))
????{
printk(“<0>““A?Packet?from?192.168.1.27:?DRO
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1352??2008-07-23?13:34??11\filter_ip.c
?????文件???????1819??2008-07-23?11:07??11\filter_port.c
?????文件???????1577??2008-07-23?13:31??11\filter_prot.c
?????文件????????211??2008-07-23?13:28??11\Makefile
?????文件??????????0??2010-03-24?16:02??11\Module.symvers
?????目錄??????????0??2013-12-16?13:15??11
-----------?---------??----------?-----??----
?????????????????4959????????????????????6
評論
共有 條評論