Commit 75bfdbf2 authored by David Howells's avatar David Howells

rxrpc: Implement an in-kernel rxperf server for testing purposes

Implement an in-kernel rxperf server to allow kernel-based rxrpc services
to be tested directly, unlike with AFS where they're accessed by the
fileserver when the latter decides it wants to.

This is implemented as a module that, if loaded, opens UDP port 7009
(afs3-rmtsys) and listens on it for incoming calls.  Calls can be generated
using the rxperf command shipped with OpenAFS, for example.

Changes
=======
ver #2)
 - Use min_t() instead of min().
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: Jakub Kicinski <kuba@kernel.org>
parent 84924aac
...@@ -71,5 +71,6 @@ void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *, ...@@ -71,5 +71,6 @@ void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
unsigned long); unsigned long);
int rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val); int rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val);
int rxrpc_sock_set_security_keyring(struct sock *, struct key *);
#endif /* _NET_RXRPC_H */ #endif /* _NET_RXRPC_H */
...@@ -58,4 +58,11 @@ config RXKAD ...@@ -58,4 +58,11 @@ config RXKAD
See Documentation/networking/rxrpc.rst. See Documentation/networking/rxrpc.rst.
config RXPERF
tristate "RxRPC test service"
help
Provide an rxperf service tester. This listens on UDP port 7009 for
incoming calls from the rxperf program (an example of which can be
found in OpenAFS).
endif endif
...@@ -36,3 +36,6 @@ rxrpc-y := \ ...@@ -36,3 +36,6 @@ rxrpc-y := \
rxrpc-$(CONFIG_PROC_FS) += proc.o rxrpc-$(CONFIG_PROC_FS) += proc.o
rxrpc-$(CONFIG_RXKAD) += rxkad.o rxrpc-$(CONFIG_RXKAD) += rxkad.o
rxrpc-$(CONFIG_SYSCTL) += sysctl.o rxrpc-$(CONFIG_SYSCTL) += sysctl.o
obj-$(CONFIG_RXPERF) += rxperf.o
This diff is collapsed.
...@@ -144,3 +144,28 @@ int rxrpc_server_keyring(struct rxrpc_sock *rx, sockptr_t optval, int optlen) ...@@ -144,3 +144,28 @@ int rxrpc_server_keyring(struct rxrpc_sock *rx, sockptr_t optval, int optlen)
_leave(" = 0 [key %x]", key->serial); _leave(" = 0 [key %x]", key->serial);
return 0; return 0;
} }
/**
* rxrpc_sock_set_security_keyring - Set the security keyring for a kernel service
* @sk: The socket to set the keyring on
* @keyring: The keyring to set
*
* Set the server security keyring on an rxrpc socket. This is used to provide
* the encryption keys for a kernel service.
*/
int rxrpc_sock_set_security_keyring(struct sock *sk, struct key *keyring)
{
struct rxrpc_sock *rx = rxrpc_sk(sk);
int ret = 0;
lock_sock(sk);
if (rx->securities)
ret = -EINVAL;
else if (rx->sk.sk_state != RXRPC_UNBOUND)
ret = -EISCONN;
else
rx->securities = key_get(keyring);
release_sock(sk);
return ret;
}
EXPORT_SYMBOL(rxrpc_sock_set_security_keyring);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment