mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
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: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org cc: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -71,5 +71,6 @@ void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
|
||||
unsigned long);
|
||||
|
||||
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 */
|
||||
|
||||
@@ -58,4 +58,11 @@ config RXKAD
|
||||
|
||||
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
|
||||
|
||||
@@ -36,3 +36,6 @@ rxrpc-y := \
|
||||
rxrpc-$(CONFIG_PROC_FS) += proc.o
|
||||
rxrpc-$(CONFIG_RXKAD) += rxkad.o
|
||||
rxrpc-$(CONFIG_SYSCTL) += sysctl.o
|
||||
|
||||
|
||||
obj-$(CONFIG_RXPERF) += rxperf.o
|
||||
|
||||
619
net/rxrpc/rxperf.c
Normal file
619
net/rxrpc/rxperf.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -144,3 +144,28 @@ int rxrpc_server_keyring(struct rxrpc_sock *rx, sockptr_t optval, int optlen)
|
||||
_leave(" = 0 [key %x]", key->serial);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user