钩子注册函数nf_register_hook函数更改为nf_register_net_hook
模块注册了一个Netfilter钩子函数,卸载模块的时候,注册的钩子函数会自己删除么,还是要自己显式nf_unregister_net_hook。
桥上的钩子,
NFPROTO_NUMPROTO表示勾子关联的协议
enum {
NFPROTO_UNSPEC = 0,
NFPROTO_INET = 1,
NFPROTO_IPV4 = 2,
NFPROTO_ARP = 3,
NFPROTO_NETDEV = 5,
NFPROTO_BRIDGE = 7,
NFPROTO_IPV6 = 10,
NFPROTO_DECNET = 12,
NFPROTO_NUMPROTO,
};
NF_MAX_HOOKS表示勾子应用的位置,可选值在每个协议模块内部定义,这些值代表了勾子函数在协议流程中应用的位置
以IPv4为例
enum nf_inet_hooks {
NF_INET_PRE_ROUTING,
NF_INET_LOCAL_IN,
NF_INET_FORWARD,
NF_INET_LOCAL_OUT,
NF_INET_POST_ROUTING,
NF_INET_NUMHOOKS
};
bridge时:
/* Bridge Hooks */
/* After promisc drops, checksum checks. */
#define NF_BR_PRE_ROUTING 0
/* If the packet is destined for this box. */
#define NF_BR_LOCAL_IN 1
/* If the packet is destined for another interface. */
#define NF_BR_FORWARD 2
/* Packets coming from a local process. */
#define NF_BR_LOCAL_OUT 3
/* Packets about to hit the wire. */
#define NF_BR_POST_ROUTING 4
/* Not really a hook, but used for the ebtables broute table */
#define NF_BR_BROUTING 5
#define NF_BR_NUMHOOKS 6
测试Ping的
https://blog.csdn.net/stone8761/article/details/72821733
师兄的Netfilter
https://blog.csdn.net/Sophisticated_/article/details/83542395
深入Linux网络核心堆栈(对于netfilter的用法和讲解)
https://blog.csdn.net/wswifth/article/details/5115475
netfilter 理解
https://blog.csdn.net/ruisenabc/article/details/87920528
未看
https://www.linuxidc.com/Linux/2016-02/128396.htm
http://www.zsythink.net/archives/tag/iptables/page/2/
https://blog.csdn.net/adamska0104/article/details/40857579
http://blog.chinaunix.net/uid-30226910-id-5134197.html
https://blog.csdn.net/qq_35493457/article/details/80588381
https://bbs.csdn.net/topics/390808627
https://bbs.csdn.net/topics/392090702