netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: make /proc/net/protocols namespace aware
@ 2008-11-17 10:50 Eric Dumazet
  2008-11-17 10:53 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2008-11-17 10:50 UTC (permalink / raw)
  To: David S. Miller; +Cc: Denis V. Lunev, Linux Netdev List

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

Converting /proc/net/protocols to be namespace aware is quite easy
and permits us to use sock_prot_inuse_get().

This provides seperate counters for each protocol. For example
we can really count TCPv6 sockets and TCPv4 sockets, while previously,
we had the same value, and this value was not namespace aware.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
---
 net/core/sock.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)


[-- Attachment #2: af_unix_inuse.patch --]
[-- Type: text/plain, Size: 679 bytes --]

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a1eb596..36856ca 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -361,6 +361,7 @@ static void unix_sock_destructor(struct sock *sk)
 		unix_release_addr(u->addr);
 
 	atomic_dec(&unix_nr_socks);
+	sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
 #ifdef UNIX_REFCNT_DEBUG
 	printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk,
 		atomic_read(&unix_nr_socks));
@@ -612,6 +613,9 @@ static struct sock *unix_create1(struct net *net, struct socket *sock)
 out:
 	if (sk == NULL)
 		atomic_dec(&unix_nr_socks);
+	else
+		sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
+		
 	return sk;
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-11-19 23:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-17 10:50 [PATCH] net: make /proc/net/protocols namespace aware Eric Dumazet
2008-11-17 10:53 ` Eric Dumazet
2008-11-17 11:15   ` Alexey Dobriyan
2008-11-17 11:27     ` Eric Dumazet
2008-11-19 23:14       ` 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).