一、Netfiter简介 ---From netfilter.samba.org/what is netfilter 从Linux Kernel 2.4开始,一个新的网络包过滤框架替代了原来的ipchains/ipfwadm系统,那就是netfilter和iptables。作为内核网络协议 堆的一个扩展子集,netfilter可以在内核空间非常高效的进行包过滤,网络地址转换(NAT)和包重组。同时,新的 netfilter/Iptables框架设计采取了更优的软件设计策略,让全世界的网络程序员可以针对各自的应用的开发各种不同的...
netfilter中那个文件是内核和,用户接口的?(我的意思是说.当用户写一个iptables -t mangle 策略时候,内核中那个文件负责读取用户空间发来的策略设置到表里面去的?)
我的程序如下:
#define __KERNEL__
#define MODULE
#include
static unsigned nfhkfun(int hooknum,struct sk_buff **skb,const struct net_device *in,const struct net_device *out,int (*okfn)(struct sk_buff *)) { printk("I'm watch_out\n");//问题在此处 return NF_ACCEPT; } static int init(void) { nfhk.hook=nfhkfun; nfhk.hooknum=NF_IP_PRE_ROUTING; nfhk.pf=PF_INET; nfhk.priority=NF_IP_PRI_FIRST; nf_register_hook(&nfhk); return 0; } 这样是正常的。 但把上面...
这些人应该是开发Linux内核的 http://people.netfilter.org 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/34831/showart_270135.html
netfilter的连接跟踪表,是通过一个hash表来维护的,其首先把一个数据包根据来源/端口/协议转换成一个"tuple",然后根据这个"tuple"来计算hash值: [code]static u_int32_t hash_conntrack(const struct ip_conntrack_tuple *tuple) { #if 0 dump_tuple(tuple); #endif return (jhash_3words(tuple->src.ip, (tuple->dst.ip ^ tuple->dst.protonum), (tuple->src.u.all | (tuple->d...