温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

NetFilter

发布时间:2020-06-19 01:00:20 来源:网络 阅读:536 作者:wilber1202 栏目:网络安全

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;  


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI