Subject: [PATCH] nethost: Only display ipv4 raw sockets for the current host in proc From: Eric W. Biederman Date: 1133875930 -0700 --- net/ipv4/raw.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) 9cdddd8d2755b6201701c9e238d39ef25c74b6b3 diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index f25f0d6..2f2b0b7 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -748,6 +748,7 @@ struct proto raw_prot = { #ifdef CONFIG_PROC_FS struct raw_iter_state { + struct nethost *host; int bucket; }; @@ -762,7 +763,8 @@ static struct sock *raw_get_first(struct struct hlist_node *node; sk_for_each(sk, node, &raw_v4_htable[state->bucket]) - if (sk->sk_family == PF_INET) + if ((sk->sk_family == PF_INET) && + (sk->sk_host == state->host)) goto found; } sk = NULL; @@ -778,7 +780,7 @@ static struct sock *raw_get_next(struct sk = sk_next(sk); try_again: ; - } while (sk && sk->sk_family != PF_INET); + } while ((sk && sk->sk_family != PF_INET) && (sk->sk_host == state->host)); if (!sk && ++state->bucket < RAWV4_HTABLE_SIZE) { sk = sk_head(&raw_v4_htable[state->bucket]); @@ -871,6 +873,7 @@ static int raw_seq_open(struct inode *in if (!s) goto out; + s->host = current->host; rc = seq_open(file, &raw_seq_ops); if (rc) goto out_kfree; -- 1.0.GIT