報錯:
錯誤:‘NF_INET_PRE_ROUTING’ 未聲明 (在此函數內第一次使用)
在kernel>=2.6.32的版本中,netfilter的hooks定義在linux/netfilter.h中:
45 enum nf_inet_hooks {
46 ~ NF_INET_PRE_ROUTING,
47 ~ NF_INET_LOCAL_IN,
48 ~ NF_INET_FORWARD,
49 ~ NF_INET_LOCAL_OUT,
50 ~ NF_INET_POST_ROUTING,
51 ~ NF_INET_NUMHOOKS
52 };
在kernel==2.6.18的版本中,netfilter的hooks定義在linux/netfilter_ipv4.h中:
41 /* IP Hooks */
42 /* After promisc drops, checksum checks. */
43 #define NF_IP_PRE_ROUTING~ 0
44 /* If the packet is destined for this box. */
45 #define NF_IP_LOCAL_IN~ ~ 1
46 /* If the packet is destined for another interface. */
47 #define NF_IP_FORWARD~ ~ 2
48 /* Packets coming from a local process. */
49 #define NF_IP_LOCAL_OUT~~ 3
50 /* Packets about to hit the wire. */
51 #define NF_IP_POST_ROUTING~ 4
52 #define NF_IP_NUMHOOKS~ ~ 5
有的文章講到,在2.6.9版本之後,內核想要將netfilter與協議分離,但是看當前的版本,應該還沒有做完,在32版本之後就好很多了