RXRPC(7) | kafs-client | RXRPC(7) |
rxrpc - Linux RxRPC (AFS) protocol implementation
#include <sys/socket.h> #include <linux/rxrpc.h> socket = socket(AF_RXRPC, SOCK_DGRAM, PF_INET); socket = socket(AF_RXRPC, SOCK_DGRAM, PF_INET6);
Linux optionally implements the RxRPC transport protocol, as used by the AFS network filesystem. Both client and server ends are support - even on the same socket - and authentication is supported at both ends.
This can be used through the BSD socket interface, using the sendmsg(2) and recvmsg(2) system calls with control data to multiplex calls over the socket and to provide or retrieve call metadata. request_key(2) is used to find the authentication keys to use in the calling process's keyrings.
The AF_RXRPC driver uses udp(7) sockets underneath, either IPv4-only or IPv6 (with IPv4), for transport. Under certain circumstances, the underlying transport sockets may be shared between client-only sockets (but are never shared if a socket is implementing a server).
struct sockaddr_rxrpc { sa_family_t srx_family; /* AF_RXRPC */ uint16_t srx_service; /* The service identifier */ uint16_t transport_type; /* The type of transport */ uint16_t transport_len; /* Transport address length */ union { sa_family_t family; /* Transport address family */ struct sockaddr_in sin; /* IPv4 transport address */ struct sockaddr_in6 sin6; /* IPv6 transport address */ } transport; };
Where "srx_family" is always set to "AF_RXRPC" ; "srx_service" is set to the service ID of the desired service; transport_type is set to the transport type, which is always SOCK_DGRAM for now; transport_len says how big the address in transport is.
Inside the transport address part, and appropriate address for the underlying socket should be set, including things like family, port and address as appropriate. Note that it may be permissible to use IPv4 addresses on an IPv6 socket.
AF_RXRPC provides a number of socket options that can be set with setsockopt(2) and read with getsockopt(2). The socket option level for IPv6 is SOL_RXRPC.
If this isn't set, AF_RXRPC will perform an unauthenticated, unencrypted call to the server.
The service keys in the ring should be of type rxrpc_s and their descriptions should be of the form "<service-id>:<security-index>" and each should be given an 8-byte secret.
Slot[0] in the array specified the service ID to upgrade from; slot[1] specifies the service ID to upgrade to. This allows a client to find out if there's a 'better' version of the service available on the same address, but a different service ID.
If the client follows the correct protocol for probing an upgradeable service, the kernel will automatically upgrade the service ID on the connection and this will be reflected in the address returned by recvmsg(2).
AF_RXRPC communicates certain information by way of the message flags passed to and received from sendmsg(2) and recvmsg(2).
AF_RXRPC communicates metadata to the caller through the ancillary data buffer (msg_control) in the messages passed to and fro using sendmsg(2) and recvmsg(2). When building a control message buffer for sendmsg(), the RXRPC_SUPPORTED_CMSG value should be consulted to make sure that the control message type is supported.
[sendmsg] This is passed to sendmsg() when the message proposed will create a client call. It must thereafter be included in all future sendmsg() calls pertaining to that call.
[recvmsg] recvmsg() includes the tag in all messages pertaining to a call until the final termination message is reached - which recvmsg() will mark by setting MSG_EOR.
[sendmsg] When passed to sendmsg(), this causes the operation matching the tag to be aborted; this will be followed up by recvmsg() indicating MSG_EOR and a local error of ECONNABORTED, thereby terminating the tag.
[recvmsg] When obtained from recvmsg(), this indicates that a remote abort was received from the peer and the data gives the code for that abort.
[sendmsg] Supply a user call ID tag to a new service call.
[sendmsg] Specify the exact total transmit size. This allows AF_RXRPC to work out in advance how big encrypted packets are going to be (under some circumstances, there's a data length encrypted inside the packet).
If this is set, it may allow AF_RXRPC to be more efficient at filling packets. If the wrong amount of data is given (too little or too much), then the call will be aborted.
[sendmsg] Specify various call timeouts. The first timeout is the hard timeout for the call in seconds: the call will be aborted if it takes longer than this amount of time in total.
The second timeout is the \fIidle\fP timeout for the call in milliseconds: the call will be aborted if we don't receive the next DATA packet within that amount of time during the reception phase.
The third timeout is the \fInormal\fP timeout for the call in milliseconds: the call will be aborted if we go for that amount of time without receiving any type of packet pertaining to the call.
kafs(7), request_key(2)
Copyright (C) 2019 Red Hat, Inc. All Rights Reserved.
Written by David Howells (dhowells@redhat.com)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
2024-07-09 | 0.5-5 |