diff -urN linux.orig/include/net/sock.h linux/include/net/sock.h --- linux.orig/include/net/sock.h Fri Dec 21 18:42:04 2001 +++ linux/include/net/sock.h Sat Feb 16 15:25:16 2002 @@ -668,7 +668,10 @@ /* RPC layer private data */ void *user_data; - + + /* Context of process creating this socket */ + int s_context; + /* Callbacks */ void (*state_change)(struct sock *sk); void (*data_ready)(struct sock *sk,int bytes); diff -urN linux.orig/include/net/tcp.h linux/include/net/tcp.h --- linux.orig/include/net/tcp.h Thu Nov 22 20:47:22 2001 +++ linux/include/net/tcp.h Sat Feb 16 16:00:13 2002 @@ -190,6 +190,7 @@ struct in6_addr v6_daddr; struct in6_addr v6_rcv_saddr; #endif + int s_context; }; extern kmem_cache_t *tcp_timewait_cachep; diff -urN linux.orig/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c --- linux.orig/net/ipv4/af_inet.c Sat Feb 16 16:33:43 2002 +++ linux/net/ipv4/af_inet.c Sat Feb 16 15:21:32 2002 @@ -393,6 +393,8 @@ sk->protinfo.af_inet.mc_index = 0; sk->protinfo.af_inet.mc_list = NULL; + sk->s_context = current->s_context; + #ifdef INET_REFCNT_DEBUG atomic_inc(&inet_sock_nr); #endif diff -urN linux.orig/net/ipv4/raw.c linux/net/ipv4/raw.c --- linux.orig/net/ipv4/raw.c Wed Jul 11 01:11:43 2001 +++ linux/net/ipv4/raw.c Sat Feb 16 15:54:41 2002 @@ -657,7 +657,7 @@ struct sock *sk; for (sk = raw_v4_htable[i]; sk; sk = sk->next, num++) { - if (sk->family != PF_INET) + if (sk->family != PF_INET || (current->s_context != 1 && sk->s_context != current->s_context)) continue; pos += 128; if (pos <= offset) diff -urN linux.orig/net/ipv4/tcp_ipv4.c linux/net/ipv4/tcp_ipv4.c --- linux.orig/net/ipv4/tcp_ipv4.c Fri Dec 21 18:42:05 2001 +++ linux/net/ipv4/tcp_ipv4.c Sat Feb 16 16:08:30 2002 @@ -2073,6 +2073,9 @@ int uid; struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); + if (current->s_context != 1 && sk->s_context != current->s_context) + continue; + if (!TCP_INET_FAMILY(sk->family)) goto skip_listen; @@ -2126,7 +2129,7 @@ read_lock(&head->lock); for(sk = head->chain; sk; sk = sk->next, num++) { - if (!TCP_INET_FAMILY(sk->family)) + if (!TCP_INET_FAMILY(sk->family) || (current->s_context != 1 && sk->s_context != current->s_context)) continue; pos += TMPSZ; if (pos <= offset) @@ -2141,7 +2144,7 @@ for (tw = (struct tcp_tw_bucket *)tcp_ehash[i+tcp_ehash_size].chain; tw != NULL; tw = (struct tcp_tw_bucket *)tw->next, num++) { - if (!TCP_INET_FAMILY(tw->family)) + if (!TCP_INET_FAMILY(tw->family) || (current->s_context != 1 && tw->s_context != current->s_context)) continue; pos += TMPSZ; if (pos <= offset) diff -urN linux.orig/net/ipv4/tcp_minisocks.c linux/net/ipv4/tcp_minisocks.c --- linux.orig/net/ipv4/tcp_minisocks.c Mon Oct 1 18:19:57 2001 +++ linux/net/ipv4/tcp_minisocks.c Sat Feb 16 16:07:38 2002 @@ -381,6 +381,8 @@ tw->ts_recent_stamp= tp->ts_recent_stamp; tw->pprev_death = NULL; + tw->s_context = sk->s_context; + #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) if(tw->family == PF_INET6) { memcpy(&tw->v6_daddr, diff -urN linux.orig/net/ipv4/udp.c linux/net/ipv4/udp.c --- linux.orig/net/ipv4/udp.c Wed Oct 17 23:16:39 2001 +++ linux/net/ipv4/udp.c Sat Feb 16 15:55:22 2002 @@ -983,7 +983,7 @@ struct sock *sk; for (sk = udp_hash[i]; sk; sk = sk->next, num++) { - if (sk->family != PF_INET) + if (sk->family != PF_INET || (current->s_context != 1 && sk->s_context != current->s_context)) continue; pos += 128; if (pos <= offset) diff -urN linux.orig/net/ipv6/raw.c linux/net/ipv6/raw.c --- linux.orig/net/ipv6/raw.c Thu Sep 20 23:12:56 2001 +++ linux/net/ipv6/raw.c Sat Feb 16 16:21:19 2002 @@ -797,7 +797,7 @@ struct sock *sk; for (sk = raw_v6_htable[i]; sk; sk = sk->next, num++) { - if (sk->family != PF_INET6) + if (sk->family != PF_INET6 || (current->s_context != 1 && sk->s_context != current->s_context)) continue; pos += LINE_LEN+1; if (pos <= offset) diff -urN linux.orig/net/ipv6/tcp_ipv6.c linux/net/ipv6/tcp_ipv6.c --- linux.orig/net/ipv6/tcp_ipv6.c Fri Dec 21 18:42:05 2001 +++ linux/net/ipv6/tcp_ipv6.c Sat Feb 16 16:20:31 2002 @@ -2005,7 +2005,7 @@ int uid; struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp); - if (sk->family != PF_INET6) + if (sk->family != PF_INET6 || (current->s_context != 1 && sk->s_context != current->s_context)) continue; pos += LINE_LEN+1; if (pos >= offset) { @@ -2055,7 +2055,7 @@ read_lock(&head->lock); for(sk = head->chain; sk; sk = sk->next, num++) { - if (sk->family != PF_INET6) + if (sk->family != PF_INET6 || (current->s_context != 1 && sk->s_context != current->s_context)) continue; pos += LINE_LEN+1; if (pos <= offset) @@ -2070,7 +2070,7 @@ for (tw = (struct tcp_tw_bucket *)tcp_ehash[i+tcp_ehash_size].chain; tw != NULL; tw = (struct tcp_tw_bucket *)tw->next, num++) { - if (tw->family != PF_INET6) + if (tw->family != PF_INET6 || (current->s_context != 1 && tw->s_context != current->s_context)) continue; pos += LINE_LEN+1; if (pos <= offset) diff -urN linux.orig/net/ipv6/udp.c linux/net/ipv6/udp.c --- linux.orig/net/ipv6/udp.c Fri Sep 7 20:01:21 2001 +++ linux/net/ipv6/udp.c Sat Feb 16 16:20:56 2002 @@ -952,7 +952,7 @@ struct sock *sk; for (sk = udp_hash[i]; sk; sk = sk->next, num++) { - if (sk->family != PF_INET6) + if (sk->family != PF_INET6 || (current->s_context != 1 && sk->s_context != current->s_context)) continue; pos += LINE_LEN+1; if (pos <= offset) diff -urN linux.orig/net/unix/af_unix.c linux/net/unix/af_unix.c --- linux.orig/net/unix/af_unix.c Fri Dec 21 18:42:06 2001 +++ linux/net/unix/af_unix.c Sat Feb 16 15:57:34 2002 @@ -478,6 +478,8 @@ sk->write_space = unix_write_space; + sk->s_context = current->s_context; + sk->max_ack_backlog = sysctl_unix_max_dgram_qlen; sk->destruct = unix_sock_destructor; sk->protinfo.af_unix.dentry=NULL; @@ -1740,6 +1742,9 @@ read_lock(&unix_table_lock); forall_unix_sockets (i,s) { + if (current->s_context != 1 && s->s_context != current->s_context) + continue; + unix_state_rlock(s); len+=sprintf(buffer+len,"%p: %08X %08X %08X %04X %02X %5ld",