Lines Matching refs:sock
79 struct sock sk;
100 static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb);
101 static void tipc_data_ready(struct sock *sk);
102 static void tipc_write_space(struct sock *sk);
103 static int tipc_release(struct socket *sock);
104 static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags);
105 static int tipc_wait_for_sndmsg(struct socket *sock, long *timeo_p);
212 static struct tipc_sock *tipc_sk(const struct sock *sk) in tipc_sk()
227 static void tsk_advance_rx_queue(struct sock *sk) in tsk_advance_rx_queue()
237 static void tsk_rej_rx_queue(struct sock *sk) in tsk_rej_rx_queue()
292 static int tipc_sk_create(struct net *net, struct socket *sock, in tipc_sk_create() argument
297 struct sock *sk; in tipc_sk_create()
306 switch (sock->type) { in tipc_sk_create()
348 sock->ops = ops; in tipc_sk_create()
349 sock->state = state; in tipc_sk_create()
350 sock_init_data(sock, sk); in tipc_sk_create()
360 if (sock->state == SS_READY) { in tipc_sk_create()
362 if (sock->type == SOCK_DGRAM) in tipc_sk_create()
400 void tipc_sock_release_local(struct socket *sock) in tipc_sock_release_local() argument
402 tipc_release(sock); in tipc_sock_release_local()
403 sock->ops = NULL; in tipc_sock_release_local()
404 sock_release(sock); in tipc_sock_release_local()
417 int tipc_sock_accept_local(struct socket *sock, struct socket **newsock, in tipc_sock_accept_local() argument
420 struct sock *sk = sock->sk; in tipc_sock_accept_local()
428 ret = tipc_accept(sock, *newsock, flags); in tipc_sock_accept_local()
433 (*newsock)->ops = sock->ops; in tipc_sock_accept_local()
453 static int tipc_release(struct socket *sock) in tipc_release() argument
455 struct sock *sk = sock->sk; in tipc_release()
475 while (sock->state != SS_DISCONNECTING) { in tipc_release()
482 if ((sock->state == SS_CONNECTING) || in tipc_release()
483 (sock->state == SS_CONNECTED)) { in tipc_release()
484 sock->state = SS_DISCONNECTING; in tipc_release()
511 sock->state = SS_DISCONNECTING; in tipc_release()
514 sock->sk = NULL; in tipc_release()
534 static int tipc_bind(struct socket *sock, struct sockaddr *uaddr, in tipc_bind() argument
537 struct sock *sk = sock->sk; in tipc_bind()
592 static int tipc_getname(struct socket *sock, struct sockaddr *uaddr, in tipc_getname() argument
596 struct tipc_sock *tsk = tipc_sk(sock->sk); in tipc_getname()
600 if ((sock->state != SS_CONNECTED) && in tipc_getname()
601 ((peer != 2) || (sock->state != SS_DISCONNECTING))) in tipc_getname()
659 static unsigned int tipc_poll(struct file *file, struct socket *sock, in tipc_poll() argument
662 struct sock *sk = sock->sk; in tipc_poll()
668 switch ((int)sock->state) { in tipc_poll()
702 static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq, in tipc_sendmcast() argument
705 struct sock *sk = sock->sk; in tipc_sendmcast()
737 rc = tipc_wait_for_sndmsg(sock, &timeo); in tipc_sendmcast()
854 static int tipc_wait_for_sndmsg(struct socket *sock, long *timeo_p) in tipc_wait_for_sndmsg() argument
856 struct sock *sk = sock->sk; in tipc_wait_for_sndmsg()
865 if (sock->state == SS_DISCONNECTING) in tipc_wait_for_sndmsg()
893 static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock, in tipc_sendmsg() argument
897 struct sock *sk = sock->sk; in tipc_sendmsg()
921 if (unlikely(sock->state != SS_READY)) { in tipc_sendmsg()
922 if (sock->state == SS_LISTENING) { in tipc_sendmsg()
926 if (sock->state != SS_UNCONNECTED) { in tipc_sendmsg()
946 rc = tipc_sendmcast(sock, seq, iov, dsz, timeo); in tipc_sendmsg()
985 if (sock->state != SS_READY) in tipc_sendmsg()
986 sock->state = SS_CONNECTING; in tipc_sendmsg()
995 rc = tipc_wait_for_sndmsg(sock, &timeo); in tipc_sendmsg()
1006 static int tipc_wait_for_sndpkt(struct socket *sock, long *timeo_p) in tipc_wait_for_sndpkt() argument
1008 struct sock *sk = sock->sk; in tipc_wait_for_sndpkt()
1017 if (sock->state == SS_DISCONNECTING) in tipc_wait_for_sndpkt()
1019 else if (sock->state != SS_CONNECTED) in tipc_wait_for_sndpkt()
1048 static int tipc_send_stream(struct kiocb *iocb, struct socket *sock, in tipc_send_stream() argument
1051 struct sock *sk = sock->sk; in tipc_send_stream()
1064 rc = tipc_sendmsg(iocb, sock, m, dsz); in tipc_send_stream()
1075 if (unlikely(sock->state != SS_CONNECTED)) { in tipc_send_stream()
1076 if (sock->state == SS_DISCONNECTING) in tipc_send_stream()
1110 rc = tipc_wait_for_sndpkt(sock, &timeo); in tipc_send_stream()
1131 static int tipc_send_packet(struct kiocb *iocb, struct socket *sock, in tipc_send_packet() argument
1137 return tipc_send_stream(iocb, sock, m, dsz); in tipc_send_packet()
1273 static int tipc_wait_for_rcvmsg(struct socket *sock, long *timeop) in tipc_wait_for_rcvmsg() argument
1275 struct sock *sk = sock->sk; in tipc_wait_for_rcvmsg()
1283 if (sock->state == SS_DISCONNECTING) { in tipc_wait_for_rcvmsg()
1318 static int tipc_recvmsg(struct kiocb *iocb, struct socket *sock, in tipc_recvmsg() argument
1321 struct sock *sk = sock->sk; in tipc_recvmsg()
1336 if (unlikely(sock->state == SS_UNCONNECTED)) { in tipc_recvmsg()
1345 res = tipc_wait_for_rcvmsg(sock, &timeo); in tipc_recvmsg()
1381 if ((sock->state == SS_READY) || in tipc_recvmsg()
1390 if ((sock->state != SS_READY) && in tipc_recvmsg()
1414 static int tipc_recv_stream(struct kiocb *iocb, struct socket *sock, in tipc_recv_stream() argument
1417 struct sock *sk = sock->sk; in tipc_recv_stream()
1434 if (unlikely(sock->state == SS_UNCONNECTED)) { in tipc_recv_stream()
1444 res = tipc_wait_for_rcvmsg(sock, &timeo); in tipc_recv_stream()
1525 static void tipc_write_space(struct sock *sk) in tipc_write_space()
1542 static void tipc_data_ready(struct sock *sk) in tipc_data_ready()
1563 struct sock *sk = &tsk->sk; in filter_connect()
1564 struct socket *sock = sk->sk_socket; in filter_connect() local
1571 switch ((int)sock->state) { in filter_connect()
1576 sock->state = SS_DISCONNECTING; in filter_connect()
1592 sock->state = SS_DISCONNECTING; in filter_connect()
1599 sock->state = SS_DISCONNECTING; in filter_connect()
1607 sock->state = SS_CONNECTED; in filter_connect()
1631 pr_err("Unknown socket state %u\n", sock->state); in filter_connect()
1654 static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf) in rcvbuf_limit()
1678 static int filter_rcv(struct sock *sk, struct sk_buff *buf) in filter_rcv()
1680 struct socket *sock = sk->sk_socket; in filter_rcv() local
1701 if (sock->state == SS_READY) { in filter_rcv()
1732 static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *buf) in tipc_backlog_rcv()
1764 struct sock *sk; in tipc_sk_rcv()
1802 static int tipc_wait_for_connect(struct socket *sock, long *timeo_p) in tipc_wait_for_connect() argument
1804 struct sock *sk = sock->sk; in tipc_wait_for_connect()
1818 done = sk_wait_event(sk, timeo_p, sock->state != SS_CONNECTING); in tipc_wait_for_connect()
1833 static int tipc_connect(struct socket *sock, struct sockaddr *dest, in tipc_connect() argument
1836 struct sock *sk = sock->sk; in tipc_connect()
1846 if (sock->state == SS_READY) { in tipc_connect()
1862 previous = sock->state; in tipc_connect()
1863 switch (sock->state) { in tipc_connect()
1875 res = tipc_sendmsg(NULL, sock, &m, 0); in tipc_connect()
1891 res = tipc_wait_for_connect(sock, &timeout); in tipc_connect()
1912 static int tipc_listen(struct socket *sock, int len) in tipc_listen() argument
1914 struct sock *sk = sock->sk; in tipc_listen()
1919 if (sock->state != SS_UNCONNECTED) in tipc_listen()
1922 sock->state = SS_LISTENING; in tipc_listen()
1930 static int tipc_wait_for_accept(struct socket *sock, long timeo) in tipc_wait_for_accept() argument
1932 struct sock *sk = sock->sk; in tipc_wait_for_accept()
1953 if (sock->state != SS_LISTENING) in tipc_wait_for_accept()
1974 static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags) in tipc_accept() argument
1976 struct sock *new_sk, *sk = sock->sk; in tipc_accept()
1985 if (sock->state != SS_LISTENING) { in tipc_accept()
1990 res = tipc_wait_for_accept(sock, timeo); in tipc_accept()
1996 res = tipc_sk_create(sock_net(sock->sk), new_sock, 0, 1); in tipc_accept()
1999 security_sk_clone(sock->sk, new_sock->sk); in tipc_accept()
2053 static int tipc_shutdown(struct socket *sock, int how) in tipc_shutdown() argument
2055 struct sock *sk = sock->sk; in tipc_shutdown()
2066 switch (sock->state) { in tipc_shutdown()
2091 sock->state = SS_DISCONNECTING; in tipc_shutdown()
2116 struct sock *sk; in tipc_sk_timeout()
2552 static int tipc_setsockopt(struct socket *sock, int lvl, int opt, in tipc_setsockopt() argument
2555 struct sock *sk = sock->sk; in tipc_setsockopt()
2560 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) in tipc_setsockopt()
2577 if (sock->type != SOCK_STREAM) in tipc_setsockopt()
2611 static int tipc_getsockopt(struct socket *sock, int lvl, int opt, in tipc_getsockopt() argument
2614 struct sock *sk = sock->sk; in tipc_getsockopt()
2620 if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) in tipc_getsockopt()