diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-12-19 20:54:51 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-12-24 06:55:09 -0500 |
commit | 10db9069eb5c60195170a4119bdbcbce69a4945f (patch) | |
tree | 4ba585b7e16c265365751c57eeb17015351e77db /net/netfilter | |
parent | e035edd16ee83498cccc9beedfc215e15cab3a07 (diff) |
netfilter: xt_CT: recover NOTRACK target support
Florian Westphal reported that the removal of the NOTRACK target
(9655050 netfilter: remove xt_NOTRACK) is breaking some existing
setups.
That removal was scheduled for removal since long time ago as
described in Documentation/feature-removal-schedule.txt
What: xt_NOTRACK
Files: net/netfilter/xt_NOTRACK.c
When: April 2011
Why: Superseded by xt_CT
Still, people may have not notice / may have decided to stick to an
old iptables version. I agree with him in that some more conservative
approach by spotting some printk to warn users for some time is less
agressive.
Current iptables 1.4.16.3 already contains the aliasing support
that makes it point to the CT target, so upgrading would fix it.
Still, the policy so far has been to avoid pushing our users to
upgrade.
As a solution, this patch recovers the NOTRACK target inside the CT
target and it now spots a warning.
Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/Kconfig | 4 | ||||
-rw-r--r-- | net/netfilter/xt_CT.c | 50 |
2 files changed, 53 insertions, 1 deletions
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index fefa514b9917..390f96cc8ed4 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -680,6 +680,10 @@ config NETFILTER_XT_TARGET_NFQUEUE | |||
680 | 680 | ||
681 | To compile it as a module, choose M here. If unsure, say N. | 681 | To compile it as a module, choose M here. If unsure, say N. |
682 | 682 | ||
683 | config NETFILTER_XT_TARGET_NOTRACK | ||
684 | tristate '"NOTRACK" target support (DEPRECATED)' | ||
685 | select NETFILTER_XT_TARGET_CT | ||
686 | |||
683 | config NETFILTER_XT_TARGET_RATEEST | 687 | config NETFILTER_XT_TARGET_RATEEST |
684 | tristate '"RATEEST" target support' | 688 | tristate '"RATEEST" target support' |
685 | depends on NETFILTER_ADVANCED | 689 | depends on NETFILTER_ADVANCED |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 1668f41acc6e..2a0843081840 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
@@ -385,14 +385,60 @@ static struct xt_target xt_ct_tg_reg[] __read_mostly = { | |||
385 | }, | 385 | }, |
386 | }; | 386 | }; |
387 | 387 | ||
388 | static unsigned int | ||
389 | notrack_tg(struct sk_buff *skb, const struct xt_action_param *par) | ||
390 | { | ||
391 | /* Previously seen (loopback)? Ignore. */ | ||
392 | if (skb->nfct != NULL) | ||
393 | return XT_CONTINUE; | ||
394 | |||
395 | skb->nfct = &nf_ct_untracked_get()->ct_general; | ||
396 | skb->nfctinfo = IP_CT_NEW; | ||
397 | nf_conntrack_get(skb->nfct); | ||
398 | |||
399 | return XT_CONTINUE; | ||
400 | } | ||
401 | |||
402 | static int notrack_chk(const struct xt_tgchk_param *par) | ||
403 | { | ||
404 | if (!par->net->xt.notrack_deprecated_warning) { | ||
405 | pr_info("netfilter: NOTRACK target is deprecated, " | ||
406 | "use CT instead or upgrade iptables\n"); | ||
407 | par->net->xt.notrack_deprecated_warning = true; | ||
408 | } | ||
409 | return 0; | ||
410 | } | ||
411 | |||
412 | static struct xt_target notrack_tg_reg __read_mostly = { | ||
413 | .name = "NOTRACK", | ||
414 | .revision = 0, | ||
415 | .family = NFPROTO_UNSPEC, | ||
416 | .checkentry = notrack_chk, | ||
417 | .target = notrack_tg, | ||
418 | .table = "raw", | ||
419 | .me = THIS_MODULE, | ||
420 | }; | ||
421 | |||
388 | static int __init xt_ct_tg_init(void) | 422 | static int __init xt_ct_tg_init(void) |
389 | { | 423 | { |
390 | return xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); | 424 | int ret; |
425 | |||
426 | ret = xt_register_target(¬rack_tg_reg); | ||
427 | if (ret < 0) | ||
428 | return ret; | ||
429 | |||
430 | ret = xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); | ||
431 | if (ret < 0) { | ||
432 | xt_unregister_target(¬rack_tg_reg); | ||
433 | return ret; | ||
434 | } | ||
435 | return 0; | ||
391 | } | 436 | } |
392 | 437 | ||
393 | static void __exit xt_ct_tg_exit(void) | 438 | static void __exit xt_ct_tg_exit(void) |
394 | { | 439 | { |
395 | xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); | 440 | xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); |
441 | xt_unregister_target(¬rack_tg_reg); | ||
396 | } | 442 | } |
397 | 443 | ||
398 | module_init(xt_ct_tg_init); | 444 | module_init(xt_ct_tg_init); |
@@ -402,3 +448,5 @@ MODULE_LICENSE("GPL"); | |||
402 | MODULE_DESCRIPTION("Xtables: connection tracking target"); | 448 | MODULE_DESCRIPTION("Xtables: connection tracking target"); |
403 | MODULE_ALIAS("ipt_CT"); | 449 | MODULE_ALIAS("ipt_CT"); |
404 | MODULE_ALIAS("ip6t_CT"); | 450 | MODULE_ALIAS("ip6t_CT"); |
451 | MODULE_ALIAS("ipt_NOTRACK"); | ||
452 | MODULE_ALIAS("ip6t_NOTRACK"); | ||