summaryrefslogtreecommitdiffstats
path: root/net/tipc/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/server.c')
-rw-r--r--net/tipc/server.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/net/tipc/server.c b/net/tipc/server.c
index 04a6dd99dd65..8aa2a33b1e48 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -33,6 +33,7 @@
33 * POSSIBILITY OF SUCH DAMAGE. 33 * POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36#include "subscr.h"
36#include "server.h" 37#include "server.h"
37#include "core.h" 38#include "core.h"
38#include "socket.h" 39#include "socket.h"
@@ -182,7 +183,6 @@ static void tipc_register_callbacks(struct socket *sock, struct tipc_conn *con)
182 183
183static void tipc_close_conn(struct tipc_conn *con) 184static void tipc_close_conn(struct tipc_conn *con)
184{ 185{
185 struct tipc_server *s = con->server;
186 struct sock *sk = con->sock->sk; 186 struct sock *sk = con->sock->sk;
187 bool disconnect = false; 187 bool disconnect = false;
188 188
@@ -191,7 +191,7 @@ static void tipc_close_conn(struct tipc_conn *con)
191 if (disconnect) { 191 if (disconnect) {
192 sk->sk_user_data = NULL; 192 sk->sk_user_data = NULL;
193 if (con->conid) 193 if (con->conid)
194 s->tipc_conn_release(con->conid, con->usr_data); 194 tipc_subscrb_delete(con->usr_data);
195 } 195 }
196 write_unlock_bh(&sk->sk_callback_lock); 196 write_unlock_bh(&sk->sk_callback_lock);
197 197
@@ -240,7 +240,6 @@ static int tipc_receive_from_sock(struct tipc_conn *con)
240{ 240{
241 struct tipc_server *s = con->server; 241 struct tipc_server *s = con->server;
242 struct sock *sk = con->sock->sk; 242 struct sock *sk = con->sock->sk;
243 struct sockaddr_tipc addr;
244 struct msghdr msg = {}; 243 struct msghdr msg = {};
245 struct kvec iov; 244 struct kvec iov;
246 void *buf; 245 void *buf;
@@ -254,7 +253,7 @@ static int tipc_receive_from_sock(struct tipc_conn *con)
254 253
255 iov.iov_base = buf; 254 iov.iov_base = buf;
256 iov.iov_len = s->max_rcvbuf_size; 255 iov.iov_len = s->max_rcvbuf_size;
257 msg.msg_name = &addr; 256 msg.msg_name = NULL;
258 iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, iov.iov_len); 257 iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, iov.iov_len);
259 ret = sock_recvmsg(con->sock, &msg, MSG_DONTWAIT); 258 ret = sock_recvmsg(con->sock, &msg, MSG_DONTWAIT);
260 if (ret <= 0) { 259 if (ret <= 0) {
@@ -264,8 +263,8 @@ static int tipc_receive_from_sock(struct tipc_conn *con)
264 263
265 read_lock_bh(&sk->sk_callback_lock); 264 read_lock_bh(&sk->sk_callback_lock);
266 if (test_bit(CF_CONNECTED, &con->flags)) 265 if (test_bit(CF_CONNECTED, &con->flags))
267 ret = s->tipc_conn_recvmsg(sock_net(con->sock->sk), con->conid, 266 ret = tipc_subscrb_rcv(sock_net(con->sock->sk), con->conid,
268 &addr, con->usr_data, buf, ret); 267 con->usr_data, buf, ret);
269 read_unlock_bh(&sk->sk_callback_lock); 268 read_unlock_bh(&sk->sk_callback_lock);
270 kmem_cache_free(s->rcvbuf_cache, buf); 269 kmem_cache_free(s->rcvbuf_cache, buf);
271 if (ret < 0) 270 if (ret < 0)
@@ -284,7 +283,6 @@ out_close:
284 283
285static int tipc_accept_from_sock(struct tipc_conn *con) 284static int tipc_accept_from_sock(struct tipc_conn *con)
286{ 285{
287 struct tipc_server *s = con->server;
288 struct socket *sock = con->sock; 286 struct socket *sock = con->sock;
289 struct socket *newsock; 287 struct socket *newsock;
290 struct tipc_conn *newcon; 288 struct tipc_conn *newcon;
@@ -305,7 +303,8 @@ static int tipc_accept_from_sock(struct tipc_conn *con)
305 tipc_register_callbacks(newsock, newcon); 303 tipc_register_callbacks(newsock, newcon);
306 304
307 /* Notify that new connection is incoming */ 305 /* Notify that new connection is incoming */
308 newcon->usr_data = s->tipc_conn_new(newcon->conid); 306 newcon->usr_data = tipc_subscrb_create(newcon->conid);
307
309 if (!newcon->usr_data) { 308 if (!newcon->usr_data) {
310 sock_release(newsock); 309 sock_release(newsock);
311 conn_put(newcon); 310 conn_put(newcon);
@@ -489,7 +488,7 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type, u32 lower,
489 488
490 *conid = con->conid; 489 *conid = con->conid;
491 s = con->server; 490 s = con->server;
492 scbr = s->tipc_conn_new(*conid); 491 scbr = tipc_subscrb_create(*conid);
493 if (!scbr) { 492 if (!scbr) {
494 conn_put(con); 493 conn_put(con);
495 return false; 494 return false;
@@ -497,7 +496,7 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type, u32 lower,
497 496
498 con->usr_data = scbr; 497 con->usr_data = scbr;
499 con->sock = NULL; 498 con->sock = NULL;
500 s->tipc_conn_recvmsg(net, *conid, NULL, scbr, &sub, sizeof(sub)); 499 tipc_subscrb_rcv(net, *conid, scbr, &sub, sizeof(sub));
501 return true; 500 return true;
502} 501}
503 502
@@ -513,7 +512,7 @@ void tipc_topsrv_kern_unsubscr(struct net *net, int conid)
513 test_and_clear_bit(CF_CONNECTED, &con->flags); 512 test_and_clear_bit(CF_CONNECTED, &con->flags);
514 srv = con->server; 513 srv = con->server;
515 if (con->conid) 514 if (con->conid)
516 srv->tipc_conn_release(con->conid, con->usr_data); 515 tipc_subscrb_delete(con->usr_data);
517 conn_put(con); 516 conn_put(con);
518 conn_put(con); 517 conn_put(con);
519} 518}