aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/ipvs/ip_vs_est.c
diff options
context:
space:
mode:
authorHans Schillstrom <hans.schillstrom@ericsson.com>2011-01-03 14:44:42 +0100
committerSimon Horman <horms@verge.net.au>2011-01-13 10:30:26 +0900
commit61b1ab4583e275af216c8454b9256de680499b19 (patch)
tree43e7cd6c71030c4d94c4e02dd34de77e57943a2d /net/netfilter/ipvs/ip_vs_est.c
parentfee1cc0895fd7bde875a86bbc3a1e82089e540b8 (diff)
downloadkernel_samsung_smdk4412-61b1ab4583e275af216c8454b9256de680499b19.zip
kernel_samsung_smdk4412-61b1ab4583e275af216c8454b9256de680499b19.tar.gz
kernel_samsung_smdk4412-61b1ab4583e275af216c8454b9256de680499b19.tar.bz2
IPVS: netns, add basic init per netns.
Preparation for network name-space init, in this stage some empty functions exists. In most files there is a check if it is root ns i.e. init_net if (!net_eq(net, &init_net)) return ... this will be removed by the last patch, when enabling name-space. *v3 ip_vs_conn.c merge error corrected. net_ipvs #ifdef removed as sugested by Jan Engelhardt [ horms@verge.net.au: Removed whitespace-change-only hunks ] Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net/netfilter/ipvs/ip_vs_est.c')
-rw-r--r--net/netfilter/ipvs/ip_vs_est.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/netfilter/ipvs/ip_vs_est.c b/net/netfilter/ipvs/ip_vs_est.c
index ff28801..7417a0c 100644
--- a/net/netfilter/ipvs/ip_vs_est.c
+++ b/net/netfilter/ipvs/ip_vs_est.c
@@ -157,13 +157,31 @@ void ip_vs_zero_estimator(struct ip_vs_stats *stats)
est->outbps = 0;
}
+static int __net_init __ip_vs_estimator_init(struct net *net)
+{
+ if (!net_eq(net, &init_net)) /* netns not enabled yet */
+ return -EPERM;
+
+ return 0;
+}
+
+static struct pernet_operations ip_vs_app_ops = {
+ .init = __ip_vs_estimator_init,
+};
+
int __init ip_vs_estimator_init(void)
{
+ int rv;
+
+ rv = register_pernet_subsys(&ip_vs_app_ops);
+ if (rv < 0)
+ return rv;
mod_timer(&est_timer, jiffies + 2 * HZ);
- return 0;
+ return rv;
}
void ip_vs_estimator_cleanup(void)
{
del_timer_sync(&est_timer);
+ unregister_pernet_subsys(&ip_vs_app_ops);
}