diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2008-10-08 05:35:19 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-10-08 05:35:19 -0400 |
commit | 7eb3558655aaa87a3e71a0c065dfaddda521fa6d (patch) | |
tree | 724466c66c96f14b0378fab87040d8393bc05c8b /net/ipv4 | |
parent | 6be3d8598e883fb632edf059ba2f8d1b9f4da138 (diff) |
netfilter: xtables: move extension arguments into compound structure (4/6)
This patch does this for target extensions' target functions.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 23 | ||||
-rw-r--r-- | net/ipv4/netfilter/arpt_mangle.c | 7 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 24 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_CLUSTERIP.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_ECN.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_LOG.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_MASQUERADE.c | 14 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_NETMAP.c | 17 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_REDIRECT.c | 12 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_REJECT.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_TTL.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_ULOG.c | 10 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_rule.c | 32 |
13 files changed, 70 insertions, 103 deletions
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index ae525a9afbec..5b631ad74b5f 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -200,15 +200,12 @@ static inline int arp_checkentry(const struct arpt_arp *arp) | |||
200 | return 1; | 200 | return 1; |
201 | } | 201 | } |
202 | 202 | ||
203 | static unsigned int arpt_error(struct sk_buff *skb, | 203 | static unsigned int |
204 | const struct net_device *in, | 204 | arpt_error(struct sk_buff *skb, const struct xt_target_param *par) |
205 | const struct net_device *out, | ||
206 | unsigned int hooknum, | ||
207 | const struct xt_target *target, | ||
208 | const void *targinfo) | ||
209 | { | 205 | { |
210 | if (net_ratelimit()) | 206 | if (net_ratelimit()) |
211 | printk("arp_tables: error: '%s'\n", (char *)targinfo); | 207 | printk("arp_tables: error: '%s'\n", |
208 | (const char *)par->targinfo); | ||
212 | 209 | ||
213 | return NF_DROP; | 210 | return NF_DROP; |
214 | } | 211 | } |
@@ -232,6 +229,7 @@ unsigned int arpt_do_table(struct sk_buff *skb, | |||
232 | const char *indev, *outdev; | 229 | const char *indev, *outdev; |
233 | void *table_base; | 230 | void *table_base; |
234 | const struct xt_table_info *private; | 231 | const struct xt_table_info *private; |
232 | struct xt_target_param tgpar; | ||
235 | 233 | ||
236 | if (!pskb_may_pull(skb, arp_hdr_len(skb->dev))) | 234 | if (!pskb_may_pull(skb, arp_hdr_len(skb->dev))) |
237 | return NF_DROP; | 235 | return NF_DROP; |
@@ -245,6 +243,10 @@ unsigned int arpt_do_table(struct sk_buff *skb, | |||
245 | e = get_entry(table_base, private->hook_entry[hook]); | 243 | e = get_entry(table_base, private->hook_entry[hook]); |
246 | back = get_entry(table_base, private->underflow[hook]); | 244 | back = get_entry(table_base, private->underflow[hook]); |
247 | 245 | ||
246 | tgpar.in = in; | ||
247 | tgpar.out = out; | ||
248 | tgpar.hooknum = hook; | ||
249 | |||
248 | arp = arp_hdr(skb); | 250 | arp = arp_hdr(skb); |
249 | do { | 251 | do { |
250 | if (arp_packet_match(arp, skb->dev, indev, outdev, &e->arp)) { | 252 | if (arp_packet_match(arp, skb->dev, indev, outdev, &e->arp)) { |
@@ -290,11 +292,10 @@ unsigned int arpt_do_table(struct sk_buff *skb, | |||
290 | /* Targets which reenter must return | 292 | /* Targets which reenter must return |
291 | * abs. verdicts | 293 | * abs. verdicts |
292 | */ | 294 | */ |
295 | tgpar.target = t->u.kernel.target; | ||
296 | tgpar.targinfo = t->data; | ||
293 | verdict = t->u.kernel.target->target(skb, | 297 | verdict = t->u.kernel.target->target(skb, |
294 | in, out, | 298 | &tgpar); |
295 | hook, | ||
296 | t->u.kernel.target, | ||
297 | t->data); | ||
298 | 299 | ||
299 | /* Target might have changed stuff. */ | 300 | /* Target might have changed stuff. */ |
300 | arp = arp_hdr(skb); | 301 | arp = arp_hdr(skb); |
diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c index 3f9e4ccd6168..0bf81b353694 100644 --- a/net/ipv4/netfilter/arpt_mangle.c +++ b/net/ipv4/netfilter/arpt_mangle.c | |||
@@ -9,12 +9,9 @@ MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); | |||
9 | MODULE_DESCRIPTION("arptables arp payload mangle target"); | 9 | MODULE_DESCRIPTION("arptables arp payload mangle target"); |
10 | 10 | ||
11 | static unsigned int | 11 | static unsigned int |
12 | target(struct sk_buff *skb, | 12 | target(struct sk_buff *skb, const struct xt_target_param *par) |
13 | const struct net_device *in, const struct net_device *out, | ||
14 | unsigned int hooknum, const struct xt_target *target, | ||
15 | const void *targinfo) | ||
16 | { | 13 | { |
17 | const struct arpt_mangle *mangle = targinfo; | 14 | const struct arpt_mangle *mangle = par->targinfo; |
18 | const struct arphdr *arp; | 15 | const struct arphdr *arp; |
19 | unsigned char *arpptr; | 16 | unsigned char *arpptr; |
20 | int pln, hln; | 17 | int pln, hln; |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 12ad4d5c55d6..0f8ecf390229 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -171,15 +171,11 @@ ip_checkentry(const struct ipt_ip *ip) | |||
171 | } | 171 | } |
172 | 172 | ||
173 | static unsigned int | 173 | static unsigned int |
174 | ipt_error(struct sk_buff *skb, | 174 | ipt_error(struct sk_buff *skb, const struct xt_target_param *par) |
175 | const struct net_device *in, | ||
176 | const struct net_device *out, | ||
177 | unsigned int hooknum, | ||
178 | const struct xt_target *target, | ||
179 | const void *targinfo) | ||
180 | { | 175 | { |
181 | if (net_ratelimit()) | 176 | if (net_ratelimit()) |
182 | printk("ip_tables: error: `%s'\n", (char *)targinfo); | 177 | printk("ip_tables: error: `%s'\n", |
178 | (const char *)par->targinfo); | ||
183 | 179 | ||
184 | return NF_DROP; | 180 | return NF_DROP; |
185 | } | 181 | } |
@@ -334,6 +330,7 @@ ipt_do_table(struct sk_buff *skb, | |||
334 | struct ipt_entry *e, *back; | 330 | struct ipt_entry *e, *back; |
335 | struct xt_table_info *private; | 331 | struct xt_table_info *private; |
336 | struct xt_match_param mtpar; | 332 | struct xt_match_param mtpar; |
333 | struct xt_target_param tgpar; | ||
337 | 334 | ||
338 | /* Initialization */ | 335 | /* Initialization */ |
339 | ip = ip_hdr(skb); | 336 | ip = ip_hdr(skb); |
@@ -349,8 +346,9 @@ ipt_do_table(struct sk_buff *skb, | |||
349 | mtpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; | 346 | mtpar.fragoff = ntohs(ip->frag_off) & IP_OFFSET; |
350 | mtpar.thoff = ip_hdrlen(skb); | 347 | mtpar.thoff = ip_hdrlen(skb); |
351 | mtpar.hotdrop = &hotdrop; | 348 | mtpar.hotdrop = &hotdrop; |
352 | mtpar.in = in; | 349 | mtpar.in = tgpar.in = in; |
353 | mtpar.out = out; | 350 | mtpar.out = tgpar.out = out; |
351 | tgpar.hooknum = hook; | ||
354 | 352 | ||
355 | read_lock_bh(&table->lock); | 353 | read_lock_bh(&table->lock); |
356 | IP_NF_ASSERT(table->valid_hooks & (1 << hook)); | 354 | IP_NF_ASSERT(table->valid_hooks & (1 << hook)); |
@@ -414,16 +412,14 @@ ipt_do_table(struct sk_buff *skb, | |||
414 | } else { | 412 | } else { |
415 | /* Targets which reenter must return | 413 | /* Targets which reenter must return |
416 | abs. verdicts */ | 414 | abs. verdicts */ |
415 | tgpar.target = t->u.kernel.target; | ||
416 | tgpar.targinfo = t->data; | ||
417 | #ifdef CONFIG_NETFILTER_DEBUG | 417 | #ifdef CONFIG_NETFILTER_DEBUG |
418 | ((struct ipt_entry *)table_base)->comefrom | 418 | ((struct ipt_entry *)table_base)->comefrom |
419 | = 0xeeeeeeec; | 419 | = 0xeeeeeeec; |
420 | #endif | 420 | #endif |
421 | verdict = t->u.kernel.target->target(skb, | 421 | verdict = t->u.kernel.target->target(skb, |
422 | in, out, | 422 | &tgpar); |
423 | hook, | ||
424 | t->u.kernel.target, | ||
425 | t->data); | ||
426 | |||
427 | #ifdef CONFIG_NETFILTER_DEBUG | 423 | #ifdef CONFIG_NETFILTER_DEBUG |
428 | if (((struct ipt_entry *)table_base)->comefrom | 424 | if (((struct ipt_entry *)table_base)->comefrom |
429 | != 0xeeeeeeec | 425 | != 0xeeeeeeec |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 63faddc18a1c..67e8aa8f34f2 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -281,11 +281,9 @@ clusterip_responsible(const struct clusterip_config *config, u_int32_t hash) | |||
281 | ***********************************************************************/ | 281 | ***********************************************************************/ |
282 | 282 | ||
283 | static unsigned int | 283 | static unsigned int |
284 | clusterip_tg(struct sk_buff *skb, const struct net_device *in, | 284 | clusterip_tg(struct sk_buff *skb, const struct xt_target_param *par) |
285 | const struct net_device *out, unsigned int hooknum, | ||
286 | const struct xt_target *target, const void *targinfo) | ||
287 | { | 285 | { |
288 | const struct ipt_clusterip_tgt_info *cipinfo = targinfo; | 286 | const struct ipt_clusterip_tgt_info *cipinfo = par->targinfo; |
289 | struct nf_conn *ct; | 287 | struct nf_conn *ct; |
290 | enum ip_conntrack_info ctinfo; | 288 | enum ip_conntrack_info ctinfo; |
291 | u_int32_t hash; | 289 | u_int32_t hash; |
diff --git a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c index aee2364afffd..e37f181e8298 100644 --- a/net/ipv4/netfilter/ipt_ECN.c +++ b/net/ipv4/netfilter/ipt_ECN.c | |||
@@ -77,11 +77,9 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | static unsigned int | 79 | static unsigned int |
80 | ecn_tg(struct sk_buff *skb, const struct net_device *in, | 80 | ecn_tg(struct sk_buff *skb, const struct xt_target_param *par) |
81 | const struct net_device *out, unsigned int hooknum, | ||
82 | const struct xt_target *target, const void *targinfo) | ||
83 | { | 81 | { |
84 | const struct ipt_ECN_info *einfo = targinfo; | 82 | const struct ipt_ECN_info *einfo = par->targinfo; |
85 | 83 | ||
86 | if (einfo->operation & IPT_ECN_OP_SET_IP) | 84 | if (einfo->operation & IPT_ECN_OP_SET_IP) |
87 | if (!set_ect_ip(skb, einfo)) | 85 | if (!set_ect_ip(skb, einfo)) |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index 1c9785df4df7..e9942aed35ae 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -426,18 +426,16 @@ ipt_log_packet(u_int8_t pf, | |||
426 | } | 426 | } |
427 | 427 | ||
428 | static unsigned int | 428 | static unsigned int |
429 | log_tg(struct sk_buff *skb, const struct net_device *in, | 429 | log_tg(struct sk_buff *skb, const struct xt_target_param *par) |
430 | const struct net_device *out, unsigned int hooknum, | ||
431 | const struct xt_target *target, const void *targinfo) | ||
432 | { | 430 | { |
433 | const struct ipt_log_info *loginfo = targinfo; | 431 | const struct ipt_log_info *loginfo = par->targinfo; |
434 | struct nf_loginfo li; | 432 | struct nf_loginfo li; |
435 | 433 | ||
436 | li.type = NF_LOG_TYPE_LOG; | 434 | li.type = NF_LOG_TYPE_LOG; |
437 | li.u.log.level = loginfo->level; | 435 | li.u.log.level = loginfo->level; |
438 | li.u.log.logflags = loginfo->logflags; | 436 | li.u.log.logflags = loginfo->logflags; |
439 | 437 | ||
440 | ipt_log_packet(NFPROTO_IPV4, hooknum, skb, in, out, &li, | 438 | ipt_log_packet(NFPROTO_IPV4, par->hooknum, skb, par->in, par->out, &li, |
441 | loginfo->prefix); | 439 | loginfo->prefix); |
442 | return XT_CONTINUE; | 440 | return XT_CONTINUE; |
443 | } | 441 | } |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index 65c811b27b7b..e0d9d49b79ee 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -50,9 +50,7 @@ masquerade_tg_check(const char *tablename, const void *e, | |||
50 | } | 50 | } |
51 | 51 | ||
52 | static unsigned int | 52 | static unsigned int |
53 | masquerade_tg(struct sk_buff *skb, const struct net_device *in, | 53 | masquerade_tg(struct sk_buff *skb, const struct xt_target_param *par) |
54 | const struct net_device *out, unsigned int hooknum, | ||
55 | const struct xt_target *target, const void *targinfo) | ||
56 | { | 54 | { |
57 | struct nf_conn *ct; | 55 | struct nf_conn *ct; |
58 | struct nf_conn_nat *nat; | 56 | struct nf_conn_nat *nat; |
@@ -62,7 +60,7 @@ masquerade_tg(struct sk_buff *skb, const struct net_device *in, | |||
62 | const struct rtable *rt; | 60 | const struct rtable *rt; |
63 | __be32 newsrc; | 61 | __be32 newsrc; |
64 | 62 | ||
65 | NF_CT_ASSERT(hooknum == NF_INET_POST_ROUTING); | 63 | NF_CT_ASSERT(par->hooknum == NF_INET_POST_ROUTING); |
66 | 64 | ||
67 | ct = nf_ct_get(skb, &ctinfo); | 65 | ct = nf_ct_get(skb, &ctinfo); |
68 | nat = nfct_nat(ct); | 66 | nat = nfct_nat(ct); |
@@ -76,16 +74,16 @@ masquerade_tg(struct sk_buff *skb, const struct net_device *in, | |||
76 | if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip == 0) | 74 | if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip == 0) |
77 | return NF_ACCEPT; | 75 | return NF_ACCEPT; |
78 | 76 | ||
79 | mr = targinfo; | 77 | mr = par->targinfo; |
80 | rt = skb->rtable; | 78 | rt = skb->rtable; |
81 | newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE); | 79 | newsrc = inet_select_addr(par->out, rt->rt_gateway, RT_SCOPE_UNIVERSE); |
82 | if (!newsrc) { | 80 | if (!newsrc) { |
83 | printk("MASQUERADE: %s ate my IP address\n", out->name); | 81 | printk("MASQUERADE: %s ate my IP address\n", par->out->name); |
84 | return NF_DROP; | 82 | return NF_DROP; |
85 | } | 83 | } |
86 | 84 | ||
87 | write_lock_bh(&masq_lock); | 85 | write_lock_bh(&masq_lock); |
88 | nat->masq_index = out->ifindex; | 86 | nat->masq_index = par->out->ifindex; |
89 | write_unlock_bh(&masq_lock); | 87 | write_unlock_bh(&masq_lock); |
90 | 88 | ||
91 | /* Transfer from original range. */ | 89 | /* Transfer from original range. */ |
diff --git a/net/ipv4/netfilter/ipt_NETMAP.c b/net/ipv4/netfilter/ipt_NETMAP.c index f281500bd7fa..cf18f23b3460 100644 --- a/net/ipv4/netfilter/ipt_NETMAP.c +++ b/net/ipv4/netfilter/ipt_NETMAP.c | |||
@@ -41,24 +41,23 @@ netmap_tg_check(const char *tablename, const void *e, | |||
41 | } | 41 | } |
42 | 42 | ||
43 | static unsigned int | 43 | static unsigned int |
44 | netmap_tg(struct sk_buff *skb, const struct net_device *in, | 44 | netmap_tg(struct sk_buff *skb, const struct xt_target_param *par) |
45 | const struct net_device *out, unsigned int hooknum, | ||
46 | const struct xt_target *target, const void *targinfo) | ||
47 | { | 45 | { |
48 | struct nf_conn *ct; | 46 | struct nf_conn *ct; |
49 | enum ip_conntrack_info ctinfo; | 47 | enum ip_conntrack_info ctinfo; |
50 | __be32 new_ip, netmask; | 48 | __be32 new_ip, netmask; |
51 | const struct nf_nat_multi_range_compat *mr = targinfo; | 49 | const struct nf_nat_multi_range_compat *mr = par->targinfo; |
52 | struct nf_nat_range newrange; | 50 | struct nf_nat_range newrange; |
53 | 51 | ||
54 | NF_CT_ASSERT(hooknum == NF_INET_PRE_ROUTING | 52 | NF_CT_ASSERT(par->hooknum == NF_INET_PRE_ROUTING || |
55 | || hooknum == NF_INET_POST_ROUTING | 53 | par->hooknum == NF_INET_POST_ROUTING || |
56 | || hooknum == NF_INET_LOCAL_OUT); | 54 | par->hooknum == NF_INET_LOCAL_OUT); |
57 | ct = nf_ct_get(skb, &ctinfo); | 55 | ct = nf_ct_get(skb, &ctinfo); |
58 | 56 | ||
59 | netmask = ~(mr->range[0].min_ip ^ mr->range[0].max_ip); | 57 | netmask = ~(mr->range[0].min_ip ^ mr->range[0].max_ip); |
60 | 58 | ||
61 | if (hooknum == NF_INET_PRE_ROUTING || hooknum == NF_INET_LOCAL_OUT) | 59 | if (par->hooknum == NF_INET_PRE_ROUTING || |
60 | par->hooknum == NF_INET_LOCAL_OUT) | ||
62 | new_ip = ip_hdr(skb)->daddr & ~netmask; | 61 | new_ip = ip_hdr(skb)->daddr & ~netmask; |
63 | else | 62 | else |
64 | new_ip = ip_hdr(skb)->saddr & ~netmask; | 63 | new_ip = ip_hdr(skb)->saddr & ~netmask; |
@@ -70,7 +69,7 @@ netmap_tg(struct sk_buff *skb, const struct net_device *in, | |||
70 | mr->range[0].min, mr->range[0].max }); | 69 | mr->range[0].min, mr->range[0].max }); |
71 | 70 | ||
72 | /* Hand modified range to generic setup. */ | 71 | /* Hand modified range to generic setup. */ |
73 | return nf_nat_setup_info(ct, &newrange, HOOK2MANIP(hooknum)); | 72 | return nf_nat_setup_info(ct, &newrange, HOOK2MANIP(par->hooknum)); |
74 | } | 73 | } |
75 | 74 | ||
76 | static struct xt_target netmap_tg_reg __read_mostly = { | 75 | static struct xt_target netmap_tg_reg __read_mostly = { |
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index ef496105eae1..23adb09ddfb4 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -45,24 +45,22 @@ redirect_tg_check(const char *tablename, const void *e, | |||
45 | } | 45 | } |
46 | 46 | ||
47 | static unsigned int | 47 | static unsigned int |
48 | redirect_tg(struct sk_buff *skb, const struct net_device *in, | 48 | redirect_tg(struct sk_buff *skb, const struct xt_target_param *par) |
49 | const struct net_device *out, unsigned int hooknum, | ||
50 | const struct xt_target *target, const void *targinfo) | ||
51 | { | 49 | { |
52 | struct nf_conn *ct; | 50 | struct nf_conn *ct; |
53 | enum ip_conntrack_info ctinfo; | 51 | enum ip_conntrack_info ctinfo; |
54 | __be32 newdst; | 52 | __be32 newdst; |
55 | const struct nf_nat_multi_range_compat *mr = targinfo; | 53 | const struct nf_nat_multi_range_compat *mr = par->targinfo; |
56 | struct nf_nat_range newrange; | 54 | struct nf_nat_range newrange; |
57 | 55 | ||
58 | NF_CT_ASSERT(hooknum == NF_INET_PRE_ROUTING | 56 | NF_CT_ASSERT(par->hooknum == NF_INET_PRE_ROUTING || |
59 | || hooknum == NF_INET_LOCAL_OUT); | 57 | par->hooknum == NF_INET_LOCAL_OUT); |
60 | 58 | ||
61 | ct = nf_ct_get(skb, &ctinfo); | 59 | ct = nf_ct_get(skb, &ctinfo); |
62 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED)); | 60 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED)); |
63 | 61 | ||
64 | /* Local packets: make them go to loopback */ | 62 | /* Local packets: make them go to loopback */ |
65 | if (hooknum == NF_INET_LOCAL_OUT) | 63 | if (par->hooknum == NF_INET_LOCAL_OUT) |
66 | newdst = htonl(0x7F000001); | 64 | newdst = htonl(0x7F000001); |
67 | else { | 65 | else { |
68 | struct in_device *indev; | 66 | struct in_device *indev; |
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index 9f5da0c2cae8..b36071bb1077 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
@@ -136,11 +136,9 @@ static inline void send_unreach(struct sk_buff *skb_in, int code) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | static unsigned int | 138 | static unsigned int |
139 | reject_tg(struct sk_buff *skb, const struct net_device *in, | 139 | reject_tg(struct sk_buff *skb, const struct xt_target_param *par) |
140 | const struct net_device *out, unsigned int hooknum, | ||
141 | const struct xt_target *target, const void *targinfo) | ||
142 | { | 140 | { |
143 | const struct ipt_reject_info *reject = targinfo; | 141 | const struct ipt_reject_info *reject = par->targinfo; |
144 | 142 | ||
145 | /* WARNING: This code causes reentry within iptables. | 143 | /* WARNING: This code causes reentry within iptables. |
146 | This means that the iptables jump stack is now crap. We | 144 | This means that the iptables jump stack is now crap. We |
@@ -168,7 +166,7 @@ reject_tg(struct sk_buff *skb, const struct net_device *in, | |||
168 | send_unreach(skb, ICMP_PKT_FILTERED); | 166 | send_unreach(skb, ICMP_PKT_FILTERED); |
169 | break; | 167 | break; |
170 | case IPT_TCP_RESET: | 168 | case IPT_TCP_RESET: |
171 | send_reset(skb, hooknum); | 169 | send_reset(skb, par->hooknum); |
172 | case IPT_ICMP_ECHOREPLY: | 170 | case IPT_ICMP_ECHOREPLY: |
173 | /* Doesn't happen. */ | 171 | /* Doesn't happen. */ |
174 | break; | 172 | break; |
diff --git a/net/ipv4/netfilter/ipt_TTL.c b/net/ipv4/netfilter/ipt_TTL.c index 7d01d424a71a..05cbfd2f7470 100644 --- a/net/ipv4/netfilter/ipt_TTL.c +++ b/net/ipv4/netfilter/ipt_TTL.c | |||
@@ -20,12 +20,10 @@ MODULE_DESCRIPTION("Xtables: IPv4 TTL field modification target"); | |||
20 | MODULE_LICENSE("GPL"); | 20 | MODULE_LICENSE("GPL"); |
21 | 21 | ||
22 | static unsigned int | 22 | static unsigned int |
23 | ttl_tg(struct sk_buff *skb, const struct net_device *in, | 23 | ttl_tg(struct sk_buff *skb, const struct xt_target_param *par) |
24 | const struct net_device *out, unsigned int hooknum, | ||
25 | const struct xt_target *target, const void *targinfo) | ||
26 | { | 24 | { |
27 | struct iphdr *iph; | 25 | struct iphdr *iph; |
28 | const struct ipt_TTL_info *info = targinfo; | 26 | const struct ipt_TTL_info *info = par->targinfo; |
29 | int new_ttl; | 27 | int new_ttl; |
30 | 28 | ||
31 | if (!skb_make_writable(skb, skb->len)) | 29 | if (!skb_make_writable(skb, skb->len)) |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index 9065e4a34fbc..46c0df0dc2dc 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -281,14 +281,10 @@ alloc_failure: | |||
281 | } | 281 | } |
282 | 282 | ||
283 | static unsigned int | 283 | static unsigned int |
284 | ulog_tg(struct sk_buff *skb, const struct net_device *in, | 284 | ulog_tg(struct sk_buff *skb, const struct xt_target_param *par) |
285 | const struct net_device *out, unsigned int hooknum, | ||
286 | const struct xt_target *target, const void *targinfo) | ||
287 | { | 285 | { |
288 | struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo; | 286 | ipt_ulog_packet(par->hooknum, skb, par->in, par->out, |
289 | 287 | par->targinfo, NULL); | |
290 | ipt_ulog_packet(hooknum, skb, in, out, loginfo, NULL); | ||
291 | |||
292 | return XT_CONTINUE; | 288 | return XT_CONTINUE; |
293 | } | 289 | } |
294 | 290 | ||
diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c index f929352ec0ee..83170ff131f9 100644 --- a/net/ipv4/netfilter/nf_nat_rule.c +++ b/net/ipv4/netfilter/nf_nat_rule.c | |||
@@ -67,25 +67,21 @@ static struct xt_table nat_table = { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | /* Source NAT */ | 69 | /* Source NAT */ |
70 | static unsigned int ipt_snat_target(struct sk_buff *skb, | 70 | static unsigned int |
71 | const struct net_device *in, | 71 | ipt_snat_target(struct sk_buff *skb, const struct xt_target_param *par) |
72 | const struct net_device *out, | ||
73 | unsigned int hooknum, | ||
74 | const struct xt_target *target, | ||
75 | const void *targinfo) | ||
76 | { | 72 | { |
77 | struct nf_conn *ct; | 73 | struct nf_conn *ct; |
78 | enum ip_conntrack_info ctinfo; | 74 | enum ip_conntrack_info ctinfo; |
79 | const struct nf_nat_multi_range_compat *mr = targinfo; | 75 | const struct nf_nat_multi_range_compat *mr = par->targinfo; |
80 | 76 | ||
81 | NF_CT_ASSERT(hooknum == NF_INET_POST_ROUTING); | 77 | NF_CT_ASSERT(par->hooknum == NF_INET_POST_ROUTING); |
82 | 78 | ||
83 | ct = nf_ct_get(skb, &ctinfo); | 79 | ct = nf_ct_get(skb, &ctinfo); |
84 | 80 | ||
85 | /* Connection must be valid and new. */ | 81 | /* Connection must be valid and new. */ |
86 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || | 82 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED || |
87 | ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); | 83 | ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)); |
88 | NF_CT_ASSERT(out); | 84 | NF_CT_ASSERT(par->out != NULL); |
89 | 85 | ||
90 | return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_SRC); | 86 | return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_SRC); |
91 | } | 87 | } |
@@ -109,28 +105,24 @@ static void warn_if_extra_mangle(struct net *net, __be32 dstip, __be32 srcip) | |||
109 | ip_rt_put(rt); | 105 | ip_rt_put(rt); |
110 | } | 106 | } |
111 | 107 | ||
112 | static unsigned int ipt_dnat_target(struct sk_buff *skb, | 108 | static unsigned int |
113 | const struct net_device *in, | 109 | ipt_dnat_target(struct sk_buff *skb, const struct xt_target_param *par) |
114 | const struct net_device *out, | ||
115 | unsigned int hooknum, | ||
116 | const struct xt_target *target, | ||
117 | const void *targinfo) | ||
118 | { | 110 | { |
119 | struct nf_conn *ct; | 111 | struct nf_conn *ct; |
120 | enum ip_conntrack_info ctinfo; | 112 | enum ip_conntrack_info ctinfo; |
121 | const struct nf_nat_multi_range_compat *mr = targinfo; | 113 | const struct nf_nat_multi_range_compat *mr = par->targinfo; |
122 | 114 | ||
123 | NF_CT_ASSERT(hooknum == NF_INET_PRE_ROUTING || | 115 | NF_CT_ASSERT(par->hooknum == NF_INET_PRE_ROUTING || |
124 | hooknum == NF_INET_LOCAL_OUT); | 116 | par->hooknum == NF_INET_LOCAL_OUT); |
125 | 117 | ||
126 | ct = nf_ct_get(skb, &ctinfo); | 118 | ct = nf_ct_get(skb, &ctinfo); |
127 | 119 | ||
128 | /* Connection must be valid and new. */ | 120 | /* Connection must be valid and new. */ |
129 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED)); | 121 | NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED)); |
130 | 122 | ||
131 | if (hooknum == NF_INET_LOCAL_OUT && | 123 | if (par->hooknum == NF_INET_LOCAL_OUT && |
132 | mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) | 124 | mr->range[0].flags & IP_NAT_RANGE_MAP_IPS) |
133 | warn_if_extra_mangle(dev_net(out), ip_hdr(skb)->daddr, | 125 | warn_if_extra_mangle(dev_net(par->out), ip_hdr(skb)->daddr, |
134 | mr->range[0].min_ip); | 126 | mr->range[0].min_ip); |
135 | 127 | ||
136 | return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_DST); | 128 | return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_DST); |