@@ -71,51 +71,6 @@ static const struct xt_table packet_mangler = {
7171 .af = NFPROTO_IPV4 ,
7272};
7373
74- /* The work comes in here from netfilter.c. */
75- static unsigned int
76- ipt_pre_routing_hook (unsigned int hook ,
77- struct sk_buff * skb ,
78- const struct net_device * in ,
79- const struct net_device * out ,
80- int (* okfn )(struct sk_buff * ))
81- {
82- return ipt_do_table (skb , hook , in , out ,
83- dev_net (in )-> ipv4 .iptable_mangle );
84- }
85-
86- static unsigned int
87- ipt_post_routing_hook (unsigned int hook ,
88- struct sk_buff * skb ,
89- const struct net_device * in ,
90- const struct net_device * out ,
91- int (* okfn )(struct sk_buff * ))
92- {
93- return ipt_do_table (skb , hook , in , out ,
94- dev_net (out )-> ipv4 .iptable_mangle );
95- }
96-
97- static unsigned int
98- ipt_local_in_hook (unsigned int hook ,
99- struct sk_buff * skb ,
100- const struct net_device * in ,
101- const struct net_device * out ,
102- int (* okfn )(struct sk_buff * ))
103- {
104- return ipt_do_table (skb , hook , in , out ,
105- dev_net (in )-> ipv4 .iptable_mangle );
106- }
107-
108- static unsigned int
109- ipt_forward_hook (unsigned int hook ,
110- struct sk_buff * skb ,
111- const struct net_device * in ,
112- const struct net_device * out ,
113- int (* okfn )(struct sk_buff * ))
114- {
115- return ipt_do_table (skb , hook , in , out ,
116- dev_net (in )-> ipv4 .iptable_mangle );
117- }
118-
11974static unsigned int
12075ipt_local_hook (unsigned int hook ,
12176 struct sk_buff * skb ,
@@ -158,37 +113,53 @@ ipt_local_hook(unsigned int hook,
158113 return ret ;
159114}
160115
116+ /* The work comes in here from netfilter.c. */
117+ static unsigned int
118+ iptable_mangle_hook (unsigned int hook ,
119+ struct sk_buff * skb ,
120+ const struct net_device * in ,
121+ const struct net_device * out ,
122+ int (* okfn )(struct sk_buff * ))
123+ {
124+ if (hook == NF_INET_LOCAL_OUT )
125+ return ipt_local_hook (hook , skb , in , out , okfn );
126+
127+ /* PREROUTING/INPUT/FORWARD: */
128+ return ipt_do_table (skb , hook , in , out ,
129+ dev_net (in )-> ipv4 .iptable_mangle );
130+ }
131+
161132static struct nf_hook_ops ipt_ops [] __read_mostly = {
162133 {
163- .hook = ipt_pre_routing_hook ,
134+ .hook = iptable_mangle_hook ,
164135 .owner = THIS_MODULE ,
165136 .pf = NFPROTO_IPV4 ,
166137 .hooknum = NF_INET_PRE_ROUTING ,
167138 .priority = NF_IP_PRI_MANGLE ,
168139 },
169140 {
170- .hook = ipt_local_in_hook ,
141+ .hook = iptable_mangle_hook ,
171142 .owner = THIS_MODULE ,
172143 .pf = NFPROTO_IPV4 ,
173144 .hooknum = NF_INET_LOCAL_IN ,
174145 .priority = NF_IP_PRI_MANGLE ,
175146 },
176147 {
177- .hook = ipt_forward_hook ,
148+ .hook = iptable_mangle_hook ,
178149 .owner = THIS_MODULE ,
179150 .pf = NFPROTO_IPV4 ,
180151 .hooknum = NF_INET_FORWARD ,
181152 .priority = NF_IP_PRI_MANGLE ,
182153 },
183154 {
184- .hook = ipt_local_hook ,
155+ .hook = iptable_mangle_hook ,
185156 .owner = THIS_MODULE ,
186157 .pf = NFPROTO_IPV4 ,
187158 .hooknum = NF_INET_LOCAL_OUT ,
188159 .priority = NF_IP_PRI_MANGLE ,
189160 },
190161 {
191- .hook = ipt_post_routing_hook ,
162+ .hook = iptable_mangle_hook ,
192163 .owner = THIS_MODULE ,
193164 .pf = NFPROTO_IPV4 ,
194165 .hooknum = NF_INET_POST_ROUTING ,
0 commit comments