diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-01-31 08:05:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 22:28:18 -0500 |
commit | 941b1d22cc035ad58b3d9b44a1c74efac2d7e499 (patch) | |
tree | 9b50211c27a209c02d97b73f74bf33cc87f4c9c3 /net/ipv4/inet_connection_sock.c | |
parent | 5ee31fc1ecdcbc234c8c56dcacef87c8e09909d8 (diff) |
[NETNS]: Make bind buckets live in net namespaces.
This tags the inet_bind_bucket struct with net pointer,
initializes it during creation and makes a filtering
during lookup.
A better hashfn, that takes the net into account is to
be done in the future, but currently all bind buckets
with similar port will be in one hash chain.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 7801cceb2d1b..de5a41de191a 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -87,6 +87,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
87 | struct hlist_node *node; | 87 | struct hlist_node *node; |
88 | struct inet_bind_bucket *tb; | 88 | struct inet_bind_bucket *tb; |
89 | int ret; | 89 | int ret; |
90 | struct net *net = sk->sk_net; | ||
90 | 91 | ||
91 | local_bh_disable(); | 92 | local_bh_disable(); |
92 | if (!snum) { | 93 | if (!snum) { |
@@ -100,7 +101,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
100 | head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; | 101 | head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; |
101 | spin_lock(&head->lock); | 102 | spin_lock(&head->lock); |
102 | inet_bind_bucket_for_each(tb, node, &head->chain) | 103 | inet_bind_bucket_for_each(tb, node, &head->chain) |
103 | if (tb->port == rover) | 104 | if (tb->ib_net == net && tb->port == rover) |
104 | goto next; | 105 | goto next; |
105 | break; | 106 | break; |
106 | next: | 107 | next: |
@@ -127,7 +128,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, | |||
127 | head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)]; | 128 | head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)]; |
128 | spin_lock(&head->lock); | 129 | spin_lock(&head->lock); |
129 | inet_bind_bucket_for_each(tb, node, &head->chain) | 130 | inet_bind_bucket_for_each(tb, node, &head->chain) |
130 | if (tb->port == snum) | 131 | if (tb->ib_net == net && tb->port == snum) |
131 | goto tb_found; | 132 | goto tb_found; |
132 | } | 133 | } |
133 | tb = NULL; | 134 | tb = NULL; |
@@ -147,7 +148,8 @@ tb_found: | |||
147 | } | 148 | } |
148 | tb_not_found: | 149 | tb_not_found: |
149 | ret = 1; | 150 | ret = 1; |
150 | if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep, head, snum)) == NULL) | 151 | if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep, |
152 | net, head, snum)) == NULL) | ||
151 | goto fail_unlock; | 153 | goto fail_unlock; |
152 | if (hlist_empty(&tb->owners)) { | 154 | if (hlist_empty(&tb->owners)) { |
153 | if (sk->sk_reuse && sk->sk_state != TCP_LISTEN) | 155 | if (sk->sk_reuse && sk->sk_state != TCP_LISTEN) |