aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2013-01-21 17:10:29 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2013-01-23 06:56:02 -0500
commit8684094cf17d8ce96e0a8c63003f331aa017e22d (patch)
tree32fb86ab62e22e98eb1e31160c13ce230648ba9e /net/netfilter
parent3fe0f943d4f52f875f0fdf8dbe472c8a9b852891 (diff)
netfilter: nf_ct_timeout: move initialization out of pernet_operations
Move the global initial codes to the module_init/exit context. Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_conntrack_core.c15
-rw-r--r--net/netfilter/nf_conntrack_timeout.c23
2 files changed, 15 insertions, 23 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 048fe77bf20c..4f4d1075644e 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1348,6 +1348,7 @@ void nf_conntrack_cleanup_end(void)
1348#ifdef CONFIG_NF_CONNTRACK_ZONES 1348#ifdef CONFIG_NF_CONNTRACK_ZONES
1349 nf_ct_extend_unregister(&nf_ct_zone_extend); 1349 nf_ct_extend_unregister(&nf_ct_zone_extend);
1350#endif 1350#endif
1351 nf_conntrack_timeout_fini();
1351 nf_conntrack_ecache_fini(); 1352 nf_conntrack_ecache_fini();
1352 nf_conntrack_tstamp_fini(); 1353 nf_conntrack_tstamp_fini();
1353 nf_conntrack_acct_fini(); 1354 nf_conntrack_acct_fini();
@@ -1378,7 +1379,6 @@ void nf_conntrack_cleanup_net(struct net *net)
1378 nf_conntrack_proto_fini(net); 1379 nf_conntrack_proto_fini(net);
1379 nf_conntrack_labels_fini(net); 1380 nf_conntrack_labels_fini(net);
1380 nf_conntrack_helper_fini(net); 1381 nf_conntrack_helper_fini(net);
1381 nf_conntrack_timeout_fini(net);
1382 nf_conntrack_ecache_pernet_fini(net); 1382 nf_conntrack_ecache_pernet_fini(net);
1383 nf_conntrack_tstamp_pernet_fini(net); 1383 nf_conntrack_tstamp_pernet_fini(net);
1384 nf_conntrack_acct_pernet_fini(net); 1384 nf_conntrack_acct_pernet_fini(net);
@@ -1522,6 +1522,10 @@ int nf_conntrack_init_start(void)
1522 if (ret < 0) 1522 if (ret < 0)
1523 goto err_ecache; 1523 goto err_ecache;
1524 1524
1525 ret = nf_conntrack_timeout_init();
1526 if (ret < 0)
1527 goto err_timeout;
1528
1525#ifdef CONFIG_NF_CONNTRACK_ZONES 1529#ifdef CONFIG_NF_CONNTRACK_ZONES
1526 ret = nf_ct_extend_register(&nf_ct_zone_extend); 1530 ret = nf_ct_extend_register(&nf_ct_zone_extend);
1527 if (ret < 0) 1531 if (ret < 0)
@@ -1539,8 +1543,10 @@ int nf_conntrack_init_start(void)
1539 1543
1540#ifdef CONFIG_NF_CONNTRACK_ZONES 1544#ifdef CONFIG_NF_CONNTRACK_ZONES
1541err_extend: 1545err_extend:
1542 nf_conntrack_ecache_fini(); 1546 nf_conntrack_timeout_fini();
1543#endif 1547#endif
1548err_timeout:
1549 nf_conntrack_ecache_fini();
1544err_ecache: 1550err_ecache:
1545 nf_conntrack_tstamp_fini(); 1551 nf_conntrack_tstamp_fini();
1546err_tstamp: 1552err_tstamp:
@@ -1616,9 +1622,6 @@ int nf_conntrack_init_net(struct net *net)
1616 ret = nf_conntrack_ecache_pernet_init(net); 1622 ret = nf_conntrack_ecache_pernet_init(net);
1617 if (ret < 0) 1623 if (ret < 0)
1618 goto err_ecache; 1624 goto err_ecache;
1619 ret = nf_conntrack_timeout_init(net);
1620 if (ret < 0)
1621 goto err_timeout;
1622 ret = nf_conntrack_helper_init(net); 1625 ret = nf_conntrack_helper_init(net);
1623 if (ret < 0) 1626 if (ret < 0)
1624 goto err_helper; 1627 goto err_helper;
@@ -1637,8 +1640,6 @@ err_proto:
1637err_labels: 1640err_labels:
1638 nf_conntrack_helper_fini(net); 1641 nf_conntrack_helper_fini(net);
1639err_helper: 1642err_helper:
1640 nf_conntrack_timeout_fini(net);
1641err_timeout:
1642 nf_conntrack_ecache_pernet_fini(net); 1643 nf_conntrack_ecache_pernet_fini(net);
1643err_ecache: 1644err_ecache:
1644 nf_conntrack_tstamp_pernet_fini(net); 1645 nf_conntrack_tstamp_pernet_fini(net);
diff --git a/net/netfilter/nf_conntrack_timeout.c b/net/netfilter/nf_conntrack_timeout.c
index a878ce5b252c..93da609d9d29 100644
--- a/net/netfilter/nf_conntrack_timeout.c
+++ b/net/netfilter/nf_conntrack_timeout.c
@@ -37,24 +37,15 @@ static struct nf_ct_ext_type timeout_extend __read_mostly = {
37 .id = NF_CT_EXT_TIMEOUT, 37 .id = NF_CT_EXT_TIMEOUT,
38}; 38};
39 39
40int nf_conntrack_timeout_init(struct net *net) 40int nf_conntrack_timeout_init(void)
41{ 41{
42 int ret = 0; 42 int ret = nf_ct_extend_register(&timeout_extend);
43 43 if (ret < 0)
44 if (net_eq(net, &init_net)) { 44 pr_err("nf_ct_timeout: Unable to register timeout extension.\n");
45 ret = nf_ct_extend_register(&timeout_extend); 45 return ret;
46 if (ret < 0) {
47 printk(KERN_ERR "nf_ct_timeout: Unable to register "
48 "timeout extension.\n");
49 return ret;
50 }
51 }
52
53 return 0;
54} 46}
55 47
56void nf_conntrack_timeout_fini(struct net *net) 48void nf_conntrack_timeout_fini(void)
57{ 49{
58 if (net_eq(net, &init_net)) 50 nf_ct_extend_unregister(&timeout_extend);
59 nf_ct_extend_unregister(&timeout_extend);
60} 51}