Skip to content

Commit c6d2d44

Browse files
Hans Schillstromhorms
authored andcommitted
IPVS: netns, final patch enabling network name space.
all init_net removed, (except for some alloc related that needs to be there) 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>
1 parent 4a98480 commit c6d2d44

7 files changed

Lines changed: 1 addition & 32 deletions

File tree

‎net/netfilter/ipvs/ip_vs_app.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,6 @@ static int __net_init __ip_vs_app_init(struct net *net)
582582
{
583583
struct netns_ipvs *ipvs = net_ipvs(net);
584584

585-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
586-
return -EPERM;
587-
588585
INIT_LIST_HEAD(&ipvs->app_list);
589586
__mutex_init(&ipvs->app_mutex, "ipvs->app_mutex", &ipvs->app_key);
590587
proc_net_fops_create(net, "ip_vs_app", 0, &ip_vs_app_fops);

‎net/netfilter/ipvs/ip_vs_conn.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,8 +1234,6 @@ int __net_init __ip_vs_conn_init(struct net *net)
12341234
{
12351235
struct netns_ipvs *ipvs = net_ipvs(net);
12361236

1237-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
1238-
return -EPERM;
12391237
atomic_set(&ipvs->conn_count, 0);
12401238

12411239
proc_net_fops_create(net, "ip_vs_conn", 0, &ip_vs_conn_fops);
@@ -1245,9 +1243,6 @@ int __net_init __ip_vs_conn_init(struct net *net)
12451243

12461244
static void __net_exit __ip_vs_conn_cleanup(struct net *net)
12471245
{
1248-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
1249-
return;
1250-
12511246
/* flush all the connection entries first */
12521247
ip_vs_conn_flush(net);
12531248
proc_net_remove(net, "ip_vs_conn");

‎net/netfilter/ipvs/ip_vs_core.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,10 +1877,6 @@ static int __net_init __ip_vs_init(struct net *net)
18771877
{
18781878
struct netns_ipvs *ipvs;
18791879

1880-
if (!net_eq(net, &init_net)) {
1881-
pr_err("The final patch for enabling netns is missing\n");
1882-
return -EPERM;
1883-
}
18841880
ipvs = net_generic(net, ip_vs_net_id);
18851881
if (ipvs == NULL) {
18861882
pr_err("%s(): no memory.\n", __func__);

‎net/netfilter/ipvs/ip_vs_ctl.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,7 @@ static struct genl_family ip_vs_genl_family = {
26172617
.name = IPVS_GENL_NAME,
26182618
.version = IPVS_GENL_VERSION,
26192619
.maxattr = IPVS_CMD_MAX,
2620+
.netnsok = true, /* Make ipvsadm to work on netns */
26202621
};
26212622

26222623
/* Policy used for first-level command attributes */
@@ -3483,9 +3484,6 @@ int __net_init __ip_vs_control_init(struct net *net)
34833484
struct netns_ipvs *ipvs = net_ipvs(net);
34843485
struct ctl_table *tbl;
34853486

3486-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
3487-
return -EPERM;
3488-
34893487
atomic_set(&ipvs->dropentry, 0);
34903488
spin_lock_init(&ipvs->dropentry_lock);
34913489
spin_lock_init(&ipvs->droppacket_lock);
@@ -3578,9 +3576,6 @@ static void __net_exit __ip_vs_control_cleanup(struct net *net)
35783576
{
35793577
struct netns_ipvs *ipvs = net_ipvs(net);
35803578

3581-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
3582-
return;
3583-
35843579
ip_vs_trash_cleanup(net);
35853580
ip_vs_kill_estimator(net, ipvs->tot_stats);
35863581
cancel_delayed_work_sync(&ipvs->defense_work);

‎net/netfilter/ipvs/ip_vs_est.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ static int __net_init __ip_vs_estimator_init(struct net *net)
203203
{
204204
struct netns_ipvs *ipvs = net_ipvs(net);
205205

206-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
207-
return -EPERM;
208-
209206
INIT_LIST_HEAD(&ipvs->est_list);
210207
spin_lock_init(&ipvs->est_lock);
211208
setup_timer(&ipvs->est_timer, estimation_timer, (unsigned long)net);

‎net/netfilter/ipvs/ip_vs_ftp.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,6 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
413413
int i, ret;
414414
struct ip_vs_app *app = &ip_vs_ftp;
415415

416-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
417-
return -EPERM;
418-
419416
ret = register_ip_vs_app(net, app);
420417
if (ret)
421418
return ret;
@@ -442,9 +439,6 @@ static void __ip_vs_ftp_exit(struct net *net)
442439
{
443440
struct ip_vs_app *app = &ip_vs_ftp;
444441

445-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
446-
return;
447-
448442
unregister_ip_vs_app(net, app);
449443
}
450444

‎net/netfilter/ipvs/ip_vs_sync.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,9 +1659,6 @@ static int __net_init __ip_vs_sync_init(struct net *net)
16591659
{
16601660
struct netns_ipvs *ipvs = net_ipvs(net);
16611661

1662-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
1663-
return -EPERM;
1664-
16651662
INIT_LIST_HEAD(&ipvs->sync_queue);
16661663
spin_lock_init(&ipvs->sync_lock);
16671664
spin_lock_init(&ipvs->sync_buff_lock);
@@ -1674,8 +1671,6 @@ static int __net_init __ip_vs_sync_init(struct net *net)
16741671

16751672
static void __ip_vs_sync_cleanup(struct net *net)
16761673
{
1677-
if (!net_eq(net, &init_net)) /* netns not enabled yet */
1678-
return;
16791674
stop_sync_thread(net, IP_VS_STATE_MASTER);
16801675
stop_sync_thread(net, IP_VS_STATE_BACKUP);
16811676
}

0 commit comments

Comments
 (0)