网站建设资讯

NEWS

网站建设资讯

NetFilter

NetFilter

为伽师等地区用户提供了全套网页设计制作服务,及伽师网站建设行业解决方案。主营业务为网站设计、成都做网站、伽师网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

  1. typedef unsigned int nf_hookfn(unsigned int hooknum,  

  2.                                struct sk_buff *skb,  

  3.                                const struct net_device *in,  

  4.                                const struct net_device *out,  

  5.                                int (*okfn) (struct sk_buff *));  

  6.   

  7. /* 处理函数返回值 */  

  8. #define NF_DROP 0 /* drop the packet, don't continue traversal */  

  9. #define NF_ACCEPT 1 /* continue traversal as normal */  

  10. #define NF_STOLEN 2 /* I've taken over the packet, don't continue traversal */  

  11. #define NF_QUEUE 3 /* queue the packet (usually for userspace handling) */  

  12. #define NF_REPEAT 4 /* call this hook again */  

  13. #define NF_STOP 5  

  14. #define NF_MAX_VERDICT NF_STOP  

在使用Netfilter时,需要定义一个nf_hook_ops实例。

  1. struct nf_hook_ops {  

  2.     struct list_head list;  

  3.     /* User fills in from here down. */  

  4.     nf_hookfn *hook; /* 要注册的钩子函数 */  

  5.     struct module *owner;  

  6.     u_int8_t pf; /* 协议类型 */  

  7.     unsigned int hooknum; /* 哪个钓鱼台 */  

  8.     /* Hooks are ordered in asending priority. */  

  9.     int priority; /* 数值越小,优先级越高 */  

  10. };  

  11. typedef __u8 u_int8_t;  


分享标题:NetFilter
文章链接:http://cdweb.net/article/gppsoi.html