[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4921551B.4000102@cosmosbay.com>
Date: Mon, 17 Nov 2008 12:27:23 +0100
From: Eric Dumazet <dada1@...mosbay.com>
To: Alexey Dobriyan <adobriyan@...il.com>,
"David S. Miller" <davem@...emloft.net>
CC: "Denis V. Lunev" <den@...nvz.org>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: [PATCH] net: make /proc/net/protocols namespace aware
Alexey Dobriyan a écrit :
> On Mon, Nov 17, 2008 at 11:53:43AM +0100, Eric Dumazet wrote:
>> --- a/net/core/sock.c
>> +++ b/net/core/sock.c
>
>> @@ -2230,7 +2230,8 @@ static const struct seq_operations proto_seq_ops = {
>>
>> static int proto_seq_open(struct inode *inode, struct file *file)
>> {
>> - return seq_open(file, &proto_seq_ops);
>> + return seq_open_net(inode, file, &proto_seq_ops,
>> + sizeof(struct seq_net_private));
>
> You have to hook seq_release_net if you do this.
>
>> }
>>
>> static const struct file_operations proto_seq_fops = {
>> @@ -2241,10 +2242,28 @@ static const struct file_operations proto_seq_fops = {
>> .release = seq_release,
> +.release = seq_release_net,
>
>
Good catch, thanks Alexey
[PATCH] net: make /proc/net/protocols namespace aware
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@...mosbay.com>
Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
net/core/sock.c | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
View attachment "protocols_pernet.patch" of type "text/plain" (1889 bytes)
Powered by blists - more mailing lists