* [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace
@ 2008-03-13 11:46 Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 1/6][NETNS][IPV6] mcast - fix compilation warning when procfs is not compiled in Daniel Lezcano
` (7 more replies)
0 siblings, 8 replies; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-13 11:46 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
This patchset makes tcp6/udp6 to have their proc files to be per
namespace. This is useful for netstat :)
It fixes also a compilation warning for multicast.
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [net-2.6.26 patch 1/6][NETNS][IPV6] mcast - fix compilation warning when procfs is not compiled in
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
@ 2008-03-13 11:46 ` Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 2/6][NETNS][IPV6] udp - make proc handle the network namespace Daniel Lezcano
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-13 11:46 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
[-- Attachment #1: mcast-fix-procfs-config-no-warning.patch --]
[-- Type: text/plain, Size: 2256 bytes --]
When CONFIG_PROC_FS=no, the out_sock_create label is not used because the code
using it is disabled and that leads to a warning at compile time.
This patch fix that by making a specific function to initialize proc for igmp6,
and remove the annoying CONFIG_PROC_FS sections in init/exit function.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
net/ipv6/mcast.c | 53 ++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 38 insertions(+), 15 deletions(-)
Index: net-2.6.26/net/ipv6/mcast.c
===================================================================
--- net-2.6.26.orig/net/ipv6/mcast.c
+++ net-2.6.26/net/ipv6/mcast.c
@@ -2633,6 +2633,41 @@ static const struct file_operations igmp
.llseek = seq_lseek,
.release = seq_release_net,
};
+
+static int igmp6_proc_init(struct net *net)
+{
+ int err;
+
+ err = -ENOMEM;
+ if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops))
+ goto out;
+ if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO,
+ &igmp6_mcf_seq_fops))
+ goto out_proc_net_igmp6;
+
+ err = 0;
+out:
+ return err;
+
+out_proc_net_igmp6:
+ proc_net_remove(net, "igmp6");
+ goto out;
+}
+
+static void igmp6_proc_exit(struct net *net)
+{
+ proc_net_remove(net, "mcfilter6");
+ proc_net_remove(net, "igmp6");
+}
+#else
+static int igmp6_proc_init(struct net *net)
+{
+ return 0;
+}
+static void igmp6_proc_exit(struct net *net)
+{
+ ;
+}
#endif
static int igmp6_net_init(struct net *net)
@@ -2658,18 +2693,9 @@ static int igmp6_net_init(struct net *ne
np = inet6_sk(sk);
np->hop_limit = 1;
-#ifdef CONFIG_PROC_FS
- err = -ENOMEM;
- if (!proc_net_fops_create(net, "igmp6", S_IRUGO, &igmp6_mc_seq_fops))
+ err = igmp6_proc_init(net);
+ if (err)
goto out_sock_create;
- if (!proc_net_fops_create(net, "mcfilter6", S_IRUGO,
- &igmp6_mcf_seq_fops)) {
- proc_net_remove(net, "igmp6");
- goto out_sock_create;
- }
-#endif
-
- err = 0;
out:
return err;
@@ -2681,10 +2707,7 @@ out_sock_create:
static void igmp6_net_exit(struct net *net)
{
sk_release_kernel(net->ipv6.igmp_sk);
-#ifdef CONFIG_PROC_FS
- proc_net_remove(net, "mcfilter6");
- proc_net_remove(net, "igmp6");
-#endif
+ igmp6_proc_exit(net);
}
static struct pernet_operations igmp6_net_ops = {
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [net-2.6.26 patch 2/6][NETNS][IPV6] udp - make proc handle the network namespace
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 1/6][NETNS][IPV6] mcast - fix compilation warning when procfs is not compiled in Daniel Lezcano
@ 2008-03-13 11:46 ` Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 3/6][NETNS][IPV6] tcp - assign the netns for timewait sockets Daniel Lezcano
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-13 11:46 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
[-- Attachment #1: udp-proc-handle-namespace.patch --]
[-- Type: text/plain, Size: 3353 bytes --]
This patch makes the common udp proc functions to take care
of which socket they should show taking into account the namespace
it belongs.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/udp.h | 1 +
net/ipv4/udp.c | 32 ++++++++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
Index: net-2.6.26/net/ipv4/udp.c
===================================================================
--- net-2.6.26.orig/net/ipv4/udp.c
+++ net-2.6.26/net/ipv4/udp.c
@@ -1512,10 +1512,13 @@ static struct sock *udp_get_first(struct
{
struct sock *sk;
struct udp_iter_state *state = seq->private;
+ struct net *net = state->net;
for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
struct hlist_node *node;
sk_for_each(sk, node, state->hashtable + state->bucket) {
+ if (sk->sk_net != net)
+ continue;
if (sk->sk_family == state->family)
goto found;
}
@@ -1528,12 +1531,13 @@ found:
static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk)
{
struct udp_iter_state *state = seq->private;
+ struct net *net = state->net;
do {
sk = sk_next(sk);
try_again:
;
- } while (sk && sk->sk_family != state->family);
+ } while (sk && sk->sk_net != net && sk->sk_family != state->family);
if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
sk = sk_head(state->hashtable + state->bucket);
@@ -1582,31 +1586,51 @@ static int udp_seq_open(struct inode *in
{
struct udp_seq_afinfo *afinfo = PDE(inode)->data;
struct seq_file *seq;
+ struct net *net;
int rc = -ENOMEM;
struct udp_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s)
goto out;
+
+ rc = -ENXIO;
+ net = get_proc_net(inode);
+ if (!net)
+ goto out_kfree;
+
s->family = afinfo->family;
s->hashtable = afinfo->hashtable;
s->seq_ops.start = udp_seq_start;
s->seq_ops.next = udp_seq_next;
s->seq_ops.show = afinfo->seq_show;
s->seq_ops.stop = udp_seq_stop;
+ s->net = net;
rc = seq_open(file, &s->seq_ops);
if (rc)
- goto out_kfree;
+ goto out_put_net;
- seq = file->private_data;
+ seq = file->private_data;
seq->private = s;
out:
return rc;
+out_put_net:
+ put_net(net);
out_kfree:
kfree(s);
goto out;
}
+static int udp_seq_release(struct inode *inode, struct file *file)
+{
+ struct seq_file *seq = file->private_data;
+ struct udp_iter_state *s = seq->private;
+
+ put_net(s->net);
+ seq_release_private(inode, file);
+ return 0;
+}
+
/* ------------------------------------------------------------------------ */
int udp_proc_register(struct udp_seq_afinfo *afinfo)
{
@@ -1619,7 +1643,7 @@ int udp_proc_register(struct udp_seq_afi
afinfo->seq_fops->open = udp_seq_open;
afinfo->seq_fops->read = seq_read;
afinfo->seq_fops->llseek = seq_lseek;
- afinfo->seq_fops->release = seq_release_private;
+ afinfo->seq_fops->release = udp_seq_release;
p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops);
if (p)
Index: net-2.6.26/include/net/udp.h
===================================================================
--- net-2.6.26.orig/include/net/udp.h
+++ net-2.6.26/include/net/udp.h
@@ -192,6 +192,7 @@ struct udp_seq_afinfo {
};
struct udp_iter_state {
+ struct net *net;
sa_family_t family;
struct hlist_head *hashtable;
int bucket;
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [net-2.6.26 patch 3/6][NETNS][IPV6] tcp - assign the netns for timewait sockets
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 1/6][NETNS][IPV6] mcast - fix compilation warning when procfs is not compiled in Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 2/6][NETNS][IPV6] udp - make proc handle the network namespace Daniel Lezcano
@ 2008-03-13 11:46 ` Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 4/6][NETNS][IPV6] tcp - make proc handle the network namespaces Daniel Lezcano
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-13 11:46 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
[-- Attachment #1: tw-copy-network-namespace-from-sock.patch --]
[-- Type: text/plain, Size: 719 bytes --]
Copy the network namespace from the socket to the timewait
socket.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
net/ipv4/inet_timewait_sock.c | 1 +
1 file changed, 1 insertion(+)
Index: net-2.6.26/net/ipv4/inet_timewait_sock.c
===================================================================
--- net-2.6.26.orig/net/ipv4/inet_timewait_sock.c
+++ net-2.6.26/net/ipv4/inet_timewait_sock.c
@@ -124,6 +124,7 @@ struct inet_timewait_sock *inet_twsk_all
tw->tw_hash = sk->sk_hash;
tw->tw_ipv6only = 0;
tw->tw_prot = sk->sk_prot_creator;
+ tw->tw_net = sk->sk_net;
atomic_set(&tw->tw_refcnt, 1);
inet_twsk_dead_node_init(tw);
__module_get(tw->tw_prot->owner);
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [net-2.6.26 patch 4/6][NETNS][IPV6] tcp - make proc handle the network namespaces
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
` (2 preceding siblings ...)
2008-03-13 11:46 ` [net-2.6.26 patch 3/6][NETNS][IPV6] tcp - assign the netns for timewait sockets Daniel Lezcano
@ 2008-03-13 11:46 ` Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 5/6][NETNS][IPV6] udp6 - make proc per namespace Daniel Lezcano
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-13 11:46 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
[-- Attachment #1: tcp-proc-handle-namespace.patch --]
[-- Type: text/plain, Size: 4758 bytes --]
This patch, like udp proc, makes the proc functions to take care of
which namespace the socket belongs.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/tcp.h | 1 +
net/ipv4/tcp_ipv4.c | 44 +++++++++++++++++++++++++++++++++++---------
2 files changed, 36 insertions(+), 9 deletions(-)
Index: net-2.6.26/include/net/tcp.h
===================================================================
--- net-2.6.26.orig/include/net/tcp.h
+++ net-2.6.26/include/net/tcp.h
@@ -1328,6 +1328,7 @@ struct tcp_seq_afinfo {
};
struct tcp_iter_state {
+ struct net *net;
sa_family_t family;
enum tcp_seq_states state;
struct sock *syn_wait_sk;
Index: net-2.6.26/net/ipv4/tcp_ipv4.c
===================================================================
--- net-2.6.26.orig/net/ipv4/tcp_ipv4.c
+++ net-2.6.26/net/ipv4/tcp_ipv4.c
@@ -1948,6 +1948,7 @@ static void *listening_get_next(struct s
struct hlist_node *node;
struct sock *sk = cur;
struct tcp_iter_state* st = seq->private;
+ struct net *net = st->net;
if (!sk) {
st->bucket = 0;
@@ -1964,7 +1965,8 @@ static void *listening_get_next(struct s
req = req->dl_next;
while (1) {
while (req) {
- if (req->rsk_ops->family == st->family) {
+ if (req->rsk_ops->family == st->family &&
+ req->sk->sk_net == net) {
cur = req;
goto out;
}
@@ -1988,7 +1990,7 @@ get_req:
}
get_sk:
sk_for_each_from(sk, node) {
- if (sk->sk_family == st->family) {
+ if (sk->sk_family == st->family && sk->sk_net == net) {
cur = sk;
goto out;
}
@@ -2027,6 +2029,7 @@ static void *listening_get_idx(struct se
static void *established_get_first(struct seq_file *seq)
{
struct tcp_iter_state* st = seq->private;
+ struct net *net = st->net;
void *rc = NULL;
for (st->bucket = 0; st->bucket < tcp_hashinfo.ehash_size; ++st->bucket) {
@@ -2037,7 +2040,8 @@ static void *established_get_first(struc
read_lock_bh(lock);
sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
- if (sk->sk_family != st->family) {
+ if (sk->sk_family != st->family ||
+ sk->sk_net != net) {
continue;
}
rc = sk;
@@ -2046,7 +2050,8 @@ static void *established_get_first(struc
st->state = TCP_SEQ_STATE_TIME_WAIT;
inet_twsk_for_each(tw, node,
&tcp_hashinfo.ehash[st->bucket].twchain) {
- if (tw->tw_family != st->family) {
+ if (tw->tw_family != st->family &&
+ tw->tw_net != net) {
continue;
}
rc = tw;
@@ -2065,6 +2070,7 @@ static void *established_get_next(struct
struct inet_timewait_sock *tw;
struct hlist_node *node;
struct tcp_iter_state* st = seq->private;
+ struct net *net = st->net;
++st->num;
@@ -2072,7 +2078,7 @@ static void *established_get_next(struct
tw = cur;
tw = tw_next(tw);
get_tw:
- while (tw && tw->tw_family != st->family) {
+ while (tw && tw->tw_family != st->family && tw->tw_net != net) {
tw = tw_next(tw);
}
if (tw) {
@@ -2093,7 +2099,7 @@ get_tw:
sk = sk_next(sk);
sk_for_each_from(sk, node) {
- if (sk->sk_family == st->family)
+ if (sk->sk_family == st->family && sk->sk_net == net)
goto found;
}
@@ -2201,6 +2207,7 @@ static int tcp_seq_open(struct inode *in
struct tcp_seq_afinfo *afinfo = PDE(inode)->data;
struct seq_file *seq;
struct tcp_iter_state *s;
+ struct net *net;
int rc;
if (unlikely(afinfo == NULL))
@@ -2209,24 +2216,43 @@ static int tcp_seq_open(struct inode *in
s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s)
return -ENOMEM;
+
+ rc = -ENXIO;
+ net = get_proc_net(inode);
+ if (!net)
+ goto out_kfree;
+
s->family = afinfo->family;
s->seq_ops.start = tcp_seq_start;
s->seq_ops.next = tcp_seq_next;
s->seq_ops.show = afinfo->seq_show;
s->seq_ops.stop = tcp_seq_stop;
+ s->net = net;
rc = seq_open(file, &s->seq_ops);
if (rc)
- goto out_kfree;
- seq = file->private_data;
+ goto out_put_net;
+ seq = file->private_data;
seq->private = s;
out:
return rc;
+out_put_net:
+ put_net(net);
out_kfree:
kfree(s);
goto out;
}
+static int tcp_seq_release(struct inode *inode, struct file *file)
+{
+ struct seq_file *seq = file->private_data;
+ struct tcp_iter_state *s = seq->private;
+
+ put_net(s->net);
+ seq_release_private(inode, file);
+ return 0;
+}
+
int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
{
int rc = 0;
@@ -2238,7 +2264,7 @@ int tcp_proc_register(struct tcp_seq_afi
afinfo->seq_fops->open = tcp_seq_open;
afinfo->seq_fops->read = seq_read;
afinfo->seq_fops->llseek = seq_lseek;
- afinfo->seq_fops->release = seq_release_private;
+ afinfo->seq_fops->release = tcp_seq_release;
p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops);
if (p)
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [net-2.6.26 patch 5/6][NETNS][IPV6] udp6 - make proc per namespace
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
` (3 preceding siblings ...)
2008-03-13 11:46 ` [net-2.6.26 patch 4/6][NETNS][IPV6] tcp - make proc handle the network namespaces Daniel Lezcano
@ 2008-03-13 11:46 ` Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 6/6][NETNS][IPV6] tcp6 " Daniel Lezcano
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-13 11:46 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
[-- Attachment #1: udp6-proc-per-namespace.patch --]
[-- Type: text/plain, Size: 6527 bytes --]
The proc init/exit functions take a new network namespace parameter
in order to register/unregister /proc/net/udp6 for a namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/ipv6.h | 4 ++--
include/net/udp.h | 4 ++--
net/ipv4/udp.c | 12 ++++++------
net/ipv4/udplite.c | 2 +-
net/ipv6/af_inet6.c | 19 ++++++++++++-------
net/ipv6/udp.c | 8 ++++----
net/ipv6/udplite.c | 4 ++--
7 files changed, 29 insertions(+), 24 deletions(-)
Index: net-2.6.26/net/ipv6/udp.c
===================================================================
--- net-2.6.26.orig/net/ipv6/udp.c
+++ net-2.6.26/net/ipv6/udp.c
@@ -989,13 +989,13 @@ static struct udp_seq_afinfo udp6_seq_af
.seq_fops = &udp6_seq_fops,
};
-int __init udp6_proc_init(void)
+int udp6_proc_init(struct net *net)
{
- return udp_proc_register(&udp6_seq_afinfo);
+ return udp_proc_register(net, &udp6_seq_afinfo);
}
-void udp6_proc_exit(void) {
- udp_proc_unregister(&udp6_seq_afinfo);
+void udp6_proc_exit(struct net *net) {
+ udp_proc_unregister(net, &udp6_seq_afinfo);
}
#endif /* CONFIG_PROC_FS */
Index: net-2.6.26/include/net/udp.h
===================================================================
--- net-2.6.26.orig/include/net/udp.h
+++ net-2.6.26/include/net/udp.h
@@ -200,8 +200,8 @@ struct udp_iter_state {
};
#ifdef CONFIG_PROC_FS
-extern int udp_proc_register(struct udp_seq_afinfo *afinfo);
-extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo);
+extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
+extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
extern int udp4_proc_init(void);
extern void udp4_proc_exit(void);
Index: net-2.6.26/net/ipv4/udp.c
===================================================================
--- net-2.6.26.orig/net/ipv4/udp.c
+++ net-2.6.26/net/ipv4/udp.c
@@ -1632,7 +1632,7 @@ static int udp_seq_release(struct inode
}
/* ------------------------------------------------------------------------ */
-int udp_proc_register(struct udp_seq_afinfo *afinfo)
+int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
{
struct proc_dir_entry *p;
int rc = 0;
@@ -1645,7 +1645,7 @@ int udp_proc_register(struct udp_seq_afi
afinfo->seq_fops->llseek = seq_lseek;
afinfo->seq_fops->release = udp_seq_release;
- p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops);
+ p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
if (p)
p->data = afinfo;
else
@@ -1653,11 +1653,11 @@ int udp_proc_register(struct udp_seq_afi
return rc;
}
-void udp_proc_unregister(struct udp_seq_afinfo *afinfo)
+void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo)
{
if (!afinfo)
return;
- proc_net_remove(&init_net, afinfo->name);
+ proc_net_remove(net, afinfo->name);
memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
}
@@ -1709,12 +1709,12 @@ static struct udp_seq_afinfo udp4_seq_af
int __init udp4_proc_init(void)
{
- return udp_proc_register(&udp4_seq_afinfo);
+ return udp_proc_register(&init_net, &udp4_seq_afinfo);
}
void udp4_proc_exit(void)
{
- udp_proc_unregister(&udp4_seq_afinfo);
+ udp_proc_unregister(&init_net, &udp4_seq_afinfo);
}
#endif /* CONFIG_PROC_FS */
Index: net-2.6.26/net/ipv4/udplite.c
===================================================================
--- net-2.6.26.orig/net/ipv4/udplite.c
+++ net-2.6.26/net/ipv4/udplite.c
@@ -105,7 +105,7 @@ void __init udplite4_register(void)
inet_register_protosw(&udplite4_protosw);
#ifdef CONFIG_PROC_FS
- if (udp_proc_register(&udplite4_seq_afinfo)) /* udplite4_proc_init() */
+ if (udp_proc_register(&init_net, &udplite4_seq_afinfo))
printk(KERN_ERR "%s: Cannot register /proc!\n", __func__);
#endif
return;
Index: net-2.6.26/net/ipv6/udplite.c
===================================================================
--- net-2.6.26.orig/net/ipv6/udplite.c
+++ net-2.6.26/net/ipv6/udplite.c
@@ -115,11 +115,11 @@ static struct udp_seq_afinfo udplite6_se
int __init udplite6_proc_init(void)
{
- return udp_proc_register(&udplite6_seq_afinfo);
+ return udp_proc_register(&init_net, &udplite6_seq_afinfo);
}
void udplite6_proc_exit(void)
{
- udp_proc_unregister(&udplite6_seq_afinfo);
+ udp_proc_unregister(&init_net, &udplite6_seq_afinfo);
}
#endif
Index: net-2.6.26/net/ipv6/af_inet6.c
===================================================================
--- net-2.6.26.orig/net/ipv6/af_inet6.c
+++ net-2.6.26/net/ipv6/af_inet6.c
@@ -842,6 +842,8 @@ static void cleanup_ipv6_mibs(void)
static int inet6_net_init(struct net *net)
{
+ int err = 0;
+
net->ipv6.sysctl.bindv6only = 0;
net->ipv6.sysctl.flush_delay = 0;
net->ipv6.sysctl.ip6_rt_max_size = 4096;
@@ -853,12 +855,20 @@ static int inet6_net_init(struct net *ne
net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40;
net->ipv6.sysctl.icmpv6_time = 1*HZ;
- return 0;
+#ifdef CONFIG_PROC_FS
+ err = udp6_proc_init(net);
+ if (err)
+ goto out;
+out:
+#endif
+ return err;
}
static void inet6_net_exit(struct net *net)
{
- return;
+#ifdef CONFIG_PROC_FS
+ udp6_proc_exit(net);
+#endif
}
static struct pernet_operations inet6_net_ops = {
@@ -943,8 +953,6 @@ static int __init inet6_init(void)
goto proc_raw6_fail;
if (tcp6_proc_init())
goto proc_tcp6_fail;
- if (udp6_proc_init())
- goto proc_udp6_fail;
if (udplite6_proc_init())
goto proc_udplite6_fail;
if (ipv6_misc_proc_init())
@@ -1029,8 +1037,6 @@ proc_anycast6_fail:
proc_misc6_fail:
udplite6_proc_exit();
proc_udplite6_fail:
- udp6_proc_exit();
-proc_udp6_fail:
tcp6_proc_exit();
proc_tcp6_fail:
raw6_proc_exit();
@@ -1092,7 +1098,6 @@ static void __exit inet6_exit(void)
ac6_proc_exit();
ipv6_misc_proc_exit();
udplite6_proc_exit();
- udp6_proc_exit();
tcp6_proc_exit();
raw6_proc_exit();
#endif
Index: net-2.6.26/include/net/ipv6.h
===================================================================
--- net-2.6.26.orig/include/net/ipv6.h
+++ net-2.6.26/include/net/ipv6.h
@@ -597,8 +597,8 @@ extern int raw6_proc_init(void);
extern void raw6_proc_exit(void);
extern int tcp6_proc_init(void);
extern void tcp6_proc_exit(void);
-extern int udp6_proc_init(void);
-extern void udp6_proc_exit(void);
+extern int udp6_proc_init(struct net *net);
+extern void udp6_proc_exit(struct net *net);
extern int udplite6_proc_init(void);
extern void udplite6_proc_exit(void);
extern int ipv6_misc_proc_init(void);
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* [net-2.6.26 patch 6/6][NETNS][IPV6] tcp6 - make proc per namespace
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
` (4 preceding siblings ...)
2008-03-13 11:46 ` [net-2.6.26 patch 5/6][NETNS][IPV6] udp6 - make proc per namespace Daniel Lezcano
@ 2008-03-13 11:46 ` Daniel Lezcano
2008-03-21 10:59 ` [net-2.6.26 patch 0/6][NETNS][IPV6] handling more " Daniel Lezcano
2008-03-21 11:16 ` David Miller
7 siblings, 0 replies; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-13 11:46 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
[-- Attachment #1: tcp6-proc-per-namespace.patch --]
[-- Type: text/plain, Size: 5037 bytes --]
Make the proc for tcp6 to be per namespace.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
---
include/net/ipv6.h | 4 ++--
include/net/tcp.h | 4 ++--
net/ipv4/tcp_ipv4.c | 12 ++++++------
net/ipv6/af_inet6.c | 15 ++++++++++-----
net/ipv6/tcp_ipv6.c | 8 ++++----
5 files changed, 24 insertions(+), 19 deletions(-)
Index: net-2.6.26/include/net/tcp.h
===================================================================
--- net-2.6.26.orig/include/net/tcp.h
+++ net-2.6.26/include/net/tcp.h
@@ -1336,8 +1336,8 @@ struct tcp_iter_state {
struct seq_operations seq_ops;
};
-extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo);
-extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo);
+extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
+extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
extern struct request_sock_ops tcp_request_sock_ops;
extern struct request_sock_ops tcp6_request_sock_ops;
Index: net-2.6.26/net/ipv6/tcp_ipv6.c
===================================================================
--- net-2.6.26.orig/net/ipv6/tcp_ipv6.c
+++ net-2.6.26/net/ipv6/tcp_ipv6.c
@@ -2129,14 +2129,14 @@ static struct tcp_seq_afinfo tcp6_seq_af
.seq_fops = &tcp6_seq_fops,
};
-int __init tcp6_proc_init(void)
+int tcp6_proc_init(struct net *net)
{
- return tcp_proc_register(&tcp6_seq_afinfo);
+ return tcp_proc_register(net, &tcp6_seq_afinfo);
}
-void tcp6_proc_exit(void)
+void tcp6_proc_exit(struct net *net)
{
- tcp_proc_unregister(&tcp6_seq_afinfo);
+ tcp_proc_unregister(net, &tcp6_seq_afinfo);
}
#endif
Index: net-2.6.26/include/net/ipv6.h
===================================================================
--- net-2.6.26.orig/include/net/ipv6.h
+++ net-2.6.26/include/net/ipv6.h
@@ -595,8 +595,8 @@ extern int ac6_proc_init(void);
extern void ac6_proc_exit(void);
extern int raw6_proc_init(void);
extern void raw6_proc_exit(void);
-extern int tcp6_proc_init(void);
-extern void tcp6_proc_exit(void);
+extern int tcp6_proc_init(struct net *net);
+extern void tcp6_proc_exit(struct net *net);
extern int udp6_proc_init(struct net *net);
extern void udp6_proc_exit(struct net *net);
extern int udplite6_proc_init(void);
Index: net-2.6.26/net/ipv4/tcp_ipv4.c
===================================================================
--- net-2.6.26.orig/net/ipv4/tcp_ipv4.c
+++ net-2.6.26/net/ipv4/tcp_ipv4.c
@@ -2253,7 +2253,7 @@ static int tcp_seq_release(struct inode
return 0;
}
-int tcp_proc_register(struct tcp_seq_afinfo *afinfo)
+int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
{
int rc = 0;
struct proc_dir_entry *p;
@@ -2266,7 +2266,7 @@ int tcp_proc_register(struct tcp_seq_afi
afinfo->seq_fops->llseek = seq_lseek;
afinfo->seq_fops->release = tcp_seq_release;
- p = proc_net_fops_create(&init_net, afinfo->name, S_IRUGO, afinfo->seq_fops);
+ p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
if (p)
p->data = afinfo;
else
@@ -2274,11 +2274,11 @@ int tcp_proc_register(struct tcp_seq_afi
return rc;
}
-void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo)
+void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
{
if (!afinfo)
return;
- proc_net_remove(&init_net, afinfo->name);
+ proc_net_remove(net, afinfo->name);
memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
}
@@ -2419,12 +2419,12 @@ static struct tcp_seq_afinfo tcp4_seq_af
int __init tcp4_proc_init(void)
{
- return tcp_proc_register(&tcp4_seq_afinfo);
+ return tcp_proc_register(&init_net, &tcp4_seq_afinfo);
}
void tcp4_proc_exit(void)
{
- tcp_proc_unregister(&tcp4_seq_afinfo);
+ tcp_proc_unregister(&init_net, &tcp4_seq_afinfo);
}
#endif /* CONFIG_PROC_FS */
Index: net-2.6.26/net/ipv6/af_inet6.c
===================================================================
--- net-2.6.26.orig/net/ipv6/af_inet6.c
+++ net-2.6.26/net/ipv6/af_inet6.c
@@ -859,15 +859,25 @@ static int inet6_net_init(struct net *ne
err = udp6_proc_init(net);
if (err)
goto out;
+ err = tcp6_proc_init(net);
+ if (err)
+ goto proc_tcp6_fail;
out:
#endif
return err;
+
+#ifdef CONFIG_PROC_FS
+proc_tcp6_fail:
+ udp6_proc_exit(net);
+ goto out;
+#endif
}
static void inet6_net_exit(struct net *net)
{
#ifdef CONFIG_PROC_FS
udp6_proc_exit(net);
+ tcp6_proc_exit(net);
#endif
}
@@ -951,8 +961,6 @@ static int __init inet6_init(void)
err = -ENOMEM;
if (raw6_proc_init())
goto proc_raw6_fail;
- if (tcp6_proc_init())
- goto proc_tcp6_fail;
if (udplite6_proc_init())
goto proc_udplite6_fail;
if (ipv6_misc_proc_init())
@@ -1037,8 +1045,6 @@ proc_anycast6_fail:
proc_misc6_fail:
udplite6_proc_exit();
proc_udplite6_fail:
- tcp6_proc_exit();
-proc_tcp6_fail:
raw6_proc_exit();
proc_raw6_fail:
#endif
@@ -1098,7 +1104,6 @@ static void __exit inet6_exit(void)
ac6_proc_exit();
ipv6_misc_proc_exit();
udplite6_proc_exit();
- tcp6_proc_exit();
raw6_proc_exit();
#endif
ipv6_netfilter_fini();
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
` (5 preceding siblings ...)
2008-03-13 11:46 ` [net-2.6.26 patch 6/6][NETNS][IPV6] tcp6 " Daniel Lezcano
@ 2008-03-21 10:59 ` Daniel Lezcano
2008-03-21 11:05 ` David Miller
2008-03-21 11:16 ` David Miller
7 siblings, 1 reply; 10+ messages in thread
From: Daniel Lezcano @ 2008-03-21 10:59 UTC (permalink / raw)
To: davem; +Cc: netdev, benjamin.thery, den
Daniel Lezcano wrote:
> This patchset makes tcp6/udp6 to have their proc files to be per
> namespace. This is useful for netstat :)
> It fixes also a compilation warning for multicast.
>
Hi David,
I sent this patchset more than 1 week ago, I know you were very busy
with your presentations in Japan. Shall I resend them ? or do you have
them in your backlog ?
-- Daniel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace
2008-03-21 10:59 ` [net-2.6.26 patch 0/6][NETNS][IPV6] handling more " Daniel Lezcano
@ 2008-03-21 11:05 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2008-03-21 11:05 UTC (permalink / raw)
To: dlezcano; +Cc: netdev, benjamin.thery, den
From: Daniel Lezcano <dlezcano@fr.ibm.com>
Date: Fri, 21 Mar 2008 11:59:49 +0100
> I sent this patchset more than 1 week ago, I know you were very busy
> with your presentations in Japan. Shall I resend them ? or do you have
> them in your backlog ?
I have them in my queue.
Thank you for using the correct way of contacting me
and the netdev community when you're curious about
the status of your patch. Some others have not been
so kind and respectful.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
` (6 preceding siblings ...)
2008-03-21 10:59 ` [net-2.6.26 patch 0/6][NETNS][IPV6] handling more " Daniel Lezcano
@ 2008-03-21 11:16 ` David Miller
7 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2008-03-21 11:16 UTC (permalink / raw)
To: dlezcano; +Cc: netdev, benjamin.thery, den
From: Daniel Lezcano <dlezcano@fr.ibm.com>
Date: Thu, 13 Mar 2008 12:46:09 +0100
> This patchset makes tcp6/udp6 to have their proc files to be per
> namespace. This is useful for netstat :)
> It fixes also a compilation warning for multicast.
All applied and pushed to net-2.6.26, thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-03-21 11:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13 11:46 [net-2.6.26 patch 0/6][NETNS][IPV6] handling more proc per namespace Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 1/6][NETNS][IPV6] mcast - fix compilation warning when procfs is not compiled in Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 2/6][NETNS][IPV6] udp - make proc handle the network namespace Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 3/6][NETNS][IPV6] tcp - assign the netns for timewait sockets Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 4/6][NETNS][IPV6] tcp - make proc handle the network namespaces Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 5/6][NETNS][IPV6] udp6 - make proc per namespace Daniel Lezcano
2008-03-13 11:46 ` [net-2.6.26 patch 6/6][NETNS][IPV6] tcp6 " Daniel Lezcano
2008-03-21 10:59 ` [net-2.6.26 patch 0/6][NETNS][IPV6] handling more " Daniel Lezcano
2008-03-21 11:05 ` David Miller
2008-03-21 11:16 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).