提交 07feaebf 编写于 作者: E Eric W. Biederman 提交者: David S. Miller

[NET]: Add a network namespace parameter to struct sock

Sockets need to get a reference to their network namespace,
or possibly a simple hold if someone registers on the network
namespace notifier and will free the sockets when the namespace
is going to be destroyed.
Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4a1c5371
...@@ -115,6 +115,7 @@ struct inet_timewait_sock { ...@@ -115,6 +115,7 @@ struct inet_timewait_sock {
#define tw_refcnt __tw_common.skc_refcnt #define tw_refcnt __tw_common.skc_refcnt
#define tw_hash __tw_common.skc_hash #define tw_hash __tw_common.skc_hash
#define tw_prot __tw_common.skc_prot #define tw_prot __tw_common.skc_prot
#define tw_net __tw_common.skc_net
volatile unsigned char tw_substate; volatile unsigned char tw_substate;
/* 3 bits hole, try to pack */ /* 3 bits hole, try to pack */
unsigned char tw_rcv_wscale; unsigned char tw_rcv_wscale;
......
...@@ -105,6 +105,7 @@ struct proto; ...@@ -105,6 +105,7 @@ struct proto;
* @skc_refcnt: reference count * @skc_refcnt: reference count
* @skc_hash: hash value used with various protocol lookup tables * @skc_hash: hash value used with various protocol lookup tables
* @skc_prot: protocol handlers inside a network family * @skc_prot: protocol handlers inside a network family
* @skc_net: reference to the network namespace of this socket
* *
* This is the minimal network layer representation of sockets, the header * This is the minimal network layer representation of sockets, the header
* for struct sock and struct inet_timewait_sock. * for struct sock and struct inet_timewait_sock.
...@@ -119,6 +120,7 @@ struct sock_common { ...@@ -119,6 +120,7 @@ struct sock_common {
atomic_t skc_refcnt; atomic_t skc_refcnt;
unsigned int skc_hash; unsigned int skc_hash;
struct proto *skc_prot; struct proto *skc_prot;
struct net *skc_net;
}; };
/** /**
...@@ -195,6 +197,7 @@ struct sock { ...@@ -195,6 +197,7 @@ struct sock {
#define sk_refcnt __sk_common.skc_refcnt #define sk_refcnt __sk_common.skc_refcnt
#define sk_hash __sk_common.skc_hash #define sk_hash __sk_common.skc_hash
#define sk_prot __sk_common.skc_prot #define sk_prot __sk_common.skc_prot
#define sk_net __sk_common.skc_net
unsigned char sk_shutdown : 2, unsigned char sk_shutdown : 2,
sk_no_check : 2, sk_no_check : 2,
sk_userlocks : 4; sk_userlocks : 4;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册