Lines Matching refs:rx
76 static int rxrpc_validate_address(struct rxrpc_sock *rx, in rxrpc_validate_address() argument
98 if (rx->family != AF_INET && in rxrpc_validate_address()
99 rx->family != AF_INET6) in rxrpc_validate_address()
108 if (rx->family != AF_INET6) in rxrpc_validate_address()
134 struct rxrpc_sock *rx = rxrpc_sk(sock->sk); in rxrpc_bind() local
138 _enter("%p,%p,%d", rx, saddr, len); in rxrpc_bind()
140 ret = rxrpc_validate_address(rx, srx, len); in rxrpc_bind()
145 lock_sock(&rx->sk); in rxrpc_bind()
147 switch (rx->sk.sk_state) { in rxrpc_bind()
149 rx->srx = *srx; in rxrpc_bind()
150 local = rxrpc_lookup_local(sock_net(&rx->sk), &rx->srx); in rxrpc_bind()
160 rx->local = local; in rxrpc_bind()
161 local->service = rx; in rxrpc_bind()
164 rx->sk.sk_state = RXRPC_SERVER_BOUND; in rxrpc_bind()
166 rx->local = local; in rxrpc_bind()
167 rx->sk.sk_state = RXRPC_CLIENT_BOUND; in rxrpc_bind()
176 if (service_id == rx->srx.srx_service) in rxrpc_bind()
179 srx->srx_service = rx->srx.srx_service; in rxrpc_bind()
180 if (memcmp(srx, &rx->srx, sizeof(*srx)) != 0) in rxrpc_bind()
182 rx->second_service = service_id; in rxrpc_bind()
183 rx->sk.sk_state = RXRPC_SERVER_BOUND2; in rxrpc_bind()
191 release_sock(&rx->sk); in rxrpc_bind()
201 release_sock(&rx->sk); in rxrpc_bind()
213 struct rxrpc_sock *rx = rxrpc_sk(sk); in rxrpc_listen() local
217 _enter("%p,%d", rx, backlog); in rxrpc_listen()
219 lock_sock(&rx->sk); in rxrpc_listen()
221 switch (rx->sk.sk_state) { in rxrpc_listen()
227 ASSERT(rx->local != NULL); in rxrpc_listen()
236 ret = rxrpc_service_prealloc(rx, GFP_KERNEL); in rxrpc_listen()
238 rx->sk.sk_state = RXRPC_SERVER_LISTENING; in rxrpc_listen()
244 rx->sk.sk_state = RXRPC_SERVER_LISTEN_DISABLED; in rxrpc_listen()
246 rxrpc_discard_prealloc(rx); in rxrpc_listen()
256 release_sock(&rx->sk); in rxrpc_listen()
297 struct rxrpc_sock *rx = rxrpc_sk(sock->sk); in rxrpc_kernel_begin_call() local
302 ret = rxrpc_validate_address(rx, srx, sizeof(*srx)); in rxrpc_kernel_begin_call()
306 lock_sock(&rx->sk); in rxrpc_kernel_begin_call()
309 key = rx->key; in rxrpc_kernel_begin_call()
321 cp.local = rx->local; in rxrpc_kernel_begin_call()
323 cp.security_level = rx->min_sec_level; in rxrpc_kernel_begin_call()
327 call = rxrpc_new_client_call(rx, &cp, srx, &p, gfp, debug_id); in rxrpc_kernel_begin_call()
433 struct rxrpc_sock *rx = rxrpc_sk(sock->sk); in rxrpc_kernel_new_call_notification() local
435 rx->notify_new_call = notify_new_call; in rxrpc_kernel_new_call_notification()
436 rx->discard_new_call = discard_new_call; in rxrpc_kernel_new_call_notification()
474 struct rxrpc_sock *rx = rxrpc_sk(sock->sk); in rxrpc_connect() local
477 _enter("%p,%p,%d,%d", rx, addr, addr_len, flags); in rxrpc_connect()
479 ret = rxrpc_validate_address(rx, srx, addr_len); in rxrpc_connect()
485 lock_sock(&rx->sk); in rxrpc_connect()
488 if (test_bit(RXRPC_SOCK_CONNECTED, &rx->flags)) in rxrpc_connect()
491 switch (rx->sk.sk_state) { in rxrpc_connect()
493 rx->sk.sk_state = RXRPC_CLIENT_UNBOUND; in rxrpc_connect()
503 rx->connect_srx = *srx; in rxrpc_connect()
504 set_bit(RXRPC_SOCK_CONNECTED, &rx->flags); in rxrpc_connect()
508 release_sock(&rx->sk); in rxrpc_connect()
524 struct rxrpc_sock *rx = rxrpc_sk(sock->sk); in rxrpc_sendmsg() local
527 _enter(",{%d},,%zu", rx->sk.sk_state, len); in rxrpc_sendmsg()
533 ret = rxrpc_validate_address(rx, m->msg_name, m->msg_namelen); in rxrpc_sendmsg()
540 lock_sock(&rx->sk); in rxrpc_sendmsg()
542 switch (rx->sk.sk_state) { in rxrpc_sendmsg()
545 rx->srx.srx_family = AF_RXRPC; in rxrpc_sendmsg()
546 rx->srx.srx_service = 0; in rxrpc_sendmsg()
547 rx->srx.transport_type = SOCK_DGRAM; in rxrpc_sendmsg()
548 rx->srx.transport.family = rx->family; in rxrpc_sendmsg()
549 switch (rx->family) { in rxrpc_sendmsg()
551 rx->srx.transport_len = sizeof(struct sockaddr_in); in rxrpc_sendmsg()
555 rx->srx.transport_len = sizeof(struct sockaddr_in6); in rxrpc_sendmsg()
562 local = rxrpc_lookup_local(sock_net(sock->sk), &rx->srx); in rxrpc_sendmsg()
568 rx->local = local; in rxrpc_sendmsg()
569 rx->sk.sk_state = RXRPC_CLIENT_BOUND; in rxrpc_sendmsg()
574 test_bit(RXRPC_SOCK_CONNECTED, &rx->flags)) { in rxrpc_sendmsg()
575 m->msg_name = &rx->connect_srx; in rxrpc_sendmsg()
576 m->msg_namelen = sizeof(rx->connect_srx); in rxrpc_sendmsg()
581 ret = rxrpc_do_sendmsg(rx, m, len); in rxrpc_sendmsg()
590 release_sock(&rx->sk); in rxrpc_sendmsg()
615 struct rxrpc_sock *rx = rxrpc_sk(sock->sk); in rxrpc_setsockopt() local
622 lock_sock(&rx->sk); in rxrpc_setsockopt()
632 if (rx->sk.sk_state != RXRPC_UNBOUND) in rxrpc_setsockopt()
634 rx->exclusive = true; in rxrpc_setsockopt()
639 if (rx->key) in rxrpc_setsockopt()
642 if (rx->sk.sk_state != RXRPC_UNBOUND) in rxrpc_setsockopt()
644 ret = rxrpc_request_key(rx, optval, optlen); in rxrpc_setsockopt()
649 if (rx->key) in rxrpc_setsockopt()
652 if (rx->sk.sk_state != RXRPC_UNBOUND) in rxrpc_setsockopt()
654 ret = rxrpc_server_keyring(rx, optval, optlen); in rxrpc_setsockopt()
662 if (rx->sk.sk_state != RXRPC_UNBOUND) in rxrpc_setsockopt()
671 rx->min_sec_level = min_sec_level; in rxrpc_setsockopt()
677 rx->service_upgrade.from != 0) in rxrpc_setsockopt()
680 if (rx->sk.sk_state != RXRPC_SERVER_BOUND2) in rxrpc_setsockopt()
687 if ((service_upgrade[0] != rx->srx.srx_service || in rxrpc_setsockopt()
688 service_upgrade[1] != rx->second_service) && in rxrpc_setsockopt()
689 (service_upgrade[0] != rx->second_service || in rxrpc_setsockopt()
690 service_upgrade[1] != rx->srx.srx_service)) in rxrpc_setsockopt()
692 rx->service_upgrade.from = service_upgrade[0]; in rxrpc_setsockopt()
693 rx->service_upgrade.to = service_upgrade[1]; in rxrpc_setsockopt()
704 release_sock(&rx->sk); in rxrpc_setsockopt()
743 struct rxrpc_sock *rx = rxrpc_sk(sk); in rxrpc_poll() local
751 if (!list_empty(&rx->recvmsg_q)) in rxrpc_poll()
770 struct rxrpc_sock *rx; in rxrpc_create() local
797 rx = rxrpc_sk(sk); in rxrpc_create()
798 rx->family = protocol; in rxrpc_create()
799 rx->calls = RB_ROOT; in rxrpc_create()
801 spin_lock_init(&rx->incoming_lock); in rxrpc_create()
802 INIT_LIST_HEAD(&rx->sock_calls); in rxrpc_create()
803 INIT_LIST_HEAD(&rx->to_be_accepted); in rxrpc_create()
804 INIT_LIST_HEAD(&rx->recvmsg_q); in rxrpc_create()
805 spin_lock_init(&rx->recvmsg_lock); in rxrpc_create()
806 rwlock_init(&rx->call_lock); in rxrpc_create()
807 memset(&rx->srx, 0, sizeof(rx->srx)); in rxrpc_create()
809 rxnet = rxrpc_net(sock_net(&rx->sk)); in rxrpc_create()
812 _leave(" = 0 [%p]", rx); in rxrpc_create()
822 struct rxrpc_sock *rx = rxrpc_sk(sk); in rxrpc_shutdown() local
841 rxrpc_discard_prealloc(rx); in rxrpc_shutdown()
871 struct rxrpc_sock *rx = rxrpc_sk(sk); in rxrpc_release_sock() local
888 rx->local->service_closed = true; in rxrpc_release_sock()
894 if (rx->local && rx->local->service == rx) { in rxrpc_release_sock()
895 write_lock(&rx->local->services_lock); in rxrpc_release_sock()
896 rx->local->service = NULL; in rxrpc_release_sock()
897 write_unlock(&rx->local->services_lock); in rxrpc_release_sock()
901 rxrpc_discard_prealloc(rx); in rxrpc_release_sock()
902 rxrpc_release_calls_on_socket(rx); in rxrpc_release_sock()
906 rxrpc_unuse_local(rx->local, rxrpc_local_unuse_release_sock); in rxrpc_release_sock()
907 rxrpc_put_local(rx->local, rxrpc_local_put_release_sock); in rxrpc_release_sock()
908 rx->local = NULL; in rxrpc_release_sock()
909 key_put(rx->key); in rxrpc_release_sock()
910 rx->key = NULL; in rxrpc_release_sock()
911 key_put(rx->securities); in rxrpc_release_sock()
912 rx->securities = NULL; in rxrpc_release_sock()