<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>RxRPC Network Protocol — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css?v=3918102e" />
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../_static/doctools.js?v=9bcbadda"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Linux Kernel SCTP" href="sctp.html" />
<link rel="prev" title="Network Function Representors" href="representors.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../subsystem-apis.html#networking-interfaces">Networking interfaces</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="index.html">Networking</a></li>
<li class="toctree-l3"><a class="reference internal" href="../netlabel/index.html">NetLabel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../infiniband/index.html">InfiniBand</a></li>
<li class="toctree-l3"><a class="reference internal" href="../isdn/index.html">ISDN</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mhi/index.html">MHI</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../subsystem-apis.html#other-subsystems">Other subsystems</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/networking/rxrpc.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="rxrpc-network-protocol">
<h1>RxRPC Network Protocol<a class="headerlink" href="#rxrpc-network-protocol" title="Link to this heading">¶</a></h1>
<p>The RxRPC protocol driver provides a reliable two-phase transport on top of UDP
that can be used to perform RxRPC remote operations. This is done over sockets
of AF_RXRPC family, using <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> and <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> with control data to send and
receive data, aborts and errors.</p>
<p>Contents of this document:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Overview.</p></li>
<li><p>RxRPC protocol summary.</p></li>
<li><p>AF_RXRPC driver model.</p></li>
<li><p>Control messages.</p></li>
<li><p>Socket options.</p></li>
<li><p>Security.</p></li>
<li><p>Example client usage.</p></li>
<li><p>Example server usage.</p></li>
<li><p>AF_RXRPC kernel interface.</p></li>
<li><p>Configurable parameters.</p></li>
</ol>
</div></blockquote>
<section id="overview">
<h2>Overview<a class="headerlink" href="#overview" title="Link to this heading">¶</a></h2>
<p>RxRPC is a two-layer protocol. There is a session layer which provides
reliable virtual connections using UDP over IPv4 (or IPv6) as the transport
layer, but implements a real network protocol; and there’s the presentation
layer which renders structured data to binary blobs and back again using XDR
(as does SunRPC):</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>+-------------+
| Application |
+-------------+
| XDR | Presentation
+-------------+
| RxRPC | Session
+-------------+
| UDP | Transport
+-------------+
</pre></div>
</div>
<p>AF_RXRPC provides:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Part of an RxRPC facility for both kernel and userspace applications by
making the session part of it a Linux network protocol (AF_RXRPC).</p></li>
<li><p>A two-phase protocol. The client transmits a blob (the request) and then
receives a blob (the reply), and the server receives the request and then
transmits the reply.</p></li>
<li><p>Retention of the reusable bits of the transport system set up for one call
to speed up subsequent calls.</p></li>
<li><p>A secure protocol, using the Linux kernel’s key retention facility to
manage security on the client end. The server end must of necessity be
more active in security negotiations.</p></li>
</ol>
</div></blockquote>
<p>AF_RXRPC does not provide XDR marshalling/presentation facilities. That is
left to the application. AF_RXRPC only deals in blobs. Even the operation ID
is just the first four bytes of the request blob, and as such is beyond the
kernel’s interest.</p>
<p>Sockets of AF_RXRPC family are:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>created as type SOCK_DGRAM;</p></li>
<li><p>provided with a protocol of the type of underlying transport they’re going
to use - currently only PF_INET is supported.</p></li>
</ol>
</div></blockquote>
<p>The Andrew File System (AFS) is an example of an application that uses this and
that has both kernel (filesystem) and userspace (utility) components.</p>
</section>
<section id="rxrpc-protocol-summary">
<h2>RxRPC Protocol Summary<a class="headerlink" href="#rxrpc-protocol-summary" title="Link to this heading">¶</a></h2>
<p>An overview of the RxRPC protocol:</p>
<blockquote>
<div><ol class="arabic">
<li><p>RxRPC sits on top of another networking protocol (UDP is the only option
currently), and uses this to provide network transport. UDP ports, for
example, provide transport endpoints.</p></li>
<li><p>RxRPC supports multiple virtual “connections” from any given transport
endpoint, thus allowing the endpoints to be shared, even to the same
remote endpoint.</p></li>
<li><p>Each connection goes to a particular “service”. A connection may not go
to multiple services. A service may be considered the RxRPC equivalent of
a port number. AF_RXRPC permits multiple services to share an endpoint.</p></li>
<li><p>Client-originating packets are marked, thus a transport endpoint can be
shared between client and server connections (connections have a
direction).</p></li>
<li><p>Up to a billion connections may be supported concurrently between one
local transport endpoint and one service on one remote endpoint. An RxRPC
connection is described by seven numbers:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Local address }
Local port } Transport (UDP) address
Remote address }
Remote port }
Direction
Connection ID
Service ID
</pre></div>
</div>
</li>
<li><p>Each RxRPC operation is a “call”. A connection may make up to four
billion calls, but only up to four calls may be in progress on a
connection at any one time.</p></li>
<li><p>Calls are two-phase and asymmetric: the client sends its request data,
which the service receives; then the service transmits the reply data
which the client receives.</p></li>
<li><p>The data blobs are of indefinite size, the end of a phase is marked with a
flag in the packet. The number of packets of data making up one blob may
not exceed 4 billion, however, as this would cause the sequence number to
wrap.</p></li>
<li><p>The first four bytes of the request data are the service operation ID.</p></li>
<li><p>Security is negotiated on a per-connection basis. The connection is
initiated by the first data packet on it arriving. If security is
requested, the server then issues a “challenge” and then the client
replies with a “response”. If the response is successful, the security is
set for the lifetime of that connection, and all subsequent calls made
upon it use that same security. In the event that the server lets a
connection lapse before the client, the security will be renegotiated if
the client uses the connection again.</p></li>
<li><p>Calls use ACK packets to handle reliability. Data packets are also
explicitly sequenced per call.</p></li>
<li><p>There are two types of positive acknowledgment: hard-ACKs and soft-ACKs.
A hard-ACK indicates to the far side that all the data received to a point
has been received and processed; a soft-ACK indicates that the data has
been received but may yet be discarded and re-requested. The sender may
not discard any transmittable packets until they’ve been hard-ACK’d.</p></li>
<li><p>Reception of a reply data packet implicitly hard-ACK’s all the data
packets that make up the request.</p></li>
<li><p>An call is complete when the request has been sent, the reply has been
received and the final hard-ACK on the last packet of the reply has
reached the server.</p></li>
<li><p>An call may be aborted by either end at any time up to its completion.</p></li>
</ol>
</div></blockquote>
</section>
<section id="af-rxrpc-driver-model">
<h2>AF_RXRPC Driver Model<a class="headerlink" href="#af-rxrpc-driver-model" title="Link to this heading">¶</a></h2>
<p>About the AF_RXRPC driver:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>The AF_RXRPC protocol transparently uses internal sockets of the transport
protocol to represent transport endpoints.</p></li>
<li><p>AF_RXRPC sockets map onto RxRPC connection bundles. Actual RxRPC
connections are handled transparently. One client socket may be used to
make multiple simultaneous calls to the same service. One server socket
may handle calls from many clients.</p></li>
<li><p>Additional parallel client connections will be initiated to support extra
concurrent calls, up to a tunable limit.</p></li>
<li><p>Each connection is retained for a certain amount of time [tunable] after
the last call currently using it has completed in case a new call is made
that could reuse it.</p></li>
<li><p>Each internal UDP socket is retained [tunable] for a certain amount of
time [tunable] after the last connection using it discarded, in case a new
connection is made that could use it.</p></li>
<li><p>A client-side connection is only shared between calls if they have
the same key <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">describing</span></code> their security (and assuming the calls
would otherwise share the connection). Non-secured calls would also be
able to share connections with each other.</p></li>
<li><p>A server-side connection is shared if the client says it is.</p></li>
<li><p>ACK’ing is handled by the protocol driver automatically, including ping
replying.</p></li>
<li><p>SO_KEEPALIVE automatically pings the other side to keep the connection
alive [TODO].</p></li>
<li><p>If an ICMP error is received, all calls affected by that error will be
aborted with an appropriate network error passed through <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code>.</p></li>
</ol>
</div></blockquote>
<p>Interaction with the user of the RxRPC socket:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>A socket is made into a server socket by binding an address with a
non-zero service ID.</p></li>
<li><p>In the client, sending a request is achieved with one or more sendmsgs,
followed by the reply being received with one or more recvmsgs.</p></li>
<li><p>The first sendmsg for a request to be sent from a client contains a tag to
be used in all other sendmsgs or recvmsgs associated with that call. The
tag is carried in the control data.</p></li>
<li><p><code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">connect()</span></code> is used to supply a default destination address for a client
socket. This may be overridden by supplying an alternate address to the
first <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> of a call (<code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">msghdr</span></code>::msg_name).</p></li>
<li><p>If <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">connect()</span></code> is called on an unbound client, a random local port will
bound before the operation takes place.</p></li>
<li><p>A server socket may also be used to make client calls. To do this, the
first <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> of the call must specify the target address. The server’s
transport endpoint is used to send the packets.</p></li>
<li><p>Once the application has received the last message associated with a call,
the tag is guaranteed not to be seen again, and so it can be used to pin
client resources. A new call can then be initiated with the same tag
without fear of interference.</p></li>
<li><p>In the server, a request is received with one or more recvmsgs, then the
the reply is transmitted with one or more sendmsgs, and then the final ACK
is received with a last recvmsg.</p></li>
<li><p>When sending data for a call, sendmsg is given MSG_MORE if there’s more
data to come on that call.</p></li>
<li><p>When receiving data for a call, recvmsg flags MSG_MORE if there’s more
data to come for that call.</p></li>
<li><p>When receiving data or messages for a call, MSG_EOR is flagged by recvmsg
to indicate the terminal message for that call.</p></li>
<li><p>A call may be aborted by adding an abort control message to the control
data. Issuing an abort terminates the kernel’s use of that call’s tag.
Any messages waiting in the receive queue for that call will be discarded.</p></li>
<li><p>Aborts, busy notifications and challenge packets are delivered by recvmsg,
and control data messages will be set to indicate the context. Receiving
an abort or a busy message terminates the kernel’s use of that call’s tag.</p></li>
<li><p>The control data part of the msghdr <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">is</span></code> used for a number of things:</p>
<ol class="arabic simple">
<li><p>The tag of the intended or affected call.</p></li>
<li><p>Sending or receiving errors, aborts and busy notifications.</p></li>
<li><p>Notifications of incoming calls.</p></li>
<li><p>Sending debug requests and receiving debug replies [TODO].</p></li>
</ol>
</li>
<li><p>When the kernel has received and set up an incoming call, it sends a
message to server application to let it know there’s a new call awaiting
its acceptance [recvmsg reports a special control message]. The server
application then uses sendmsg to assign a tag to the new call. Once that
is done, the first part of the request data will be delivered by recvmsg.</p></li>
<li><p>The server application has to provide the server socket with a keyring of
secret keys corresponding to the security types it permits. When a secure
connection is being set up, the kernel looks up the appropriate secret key
in the keyring and then sends a challenge packet to the client and
receives a response packet. The kernel then checks the authorisation of
the packet and either aborts the connection or sets up the security.</p></li>
<li><p>The name of the key a client will use to secure its communications is
nominated by a socket option.</p></li>
</ol>
</div></blockquote>
<p>Notes on sendmsg:</p>
<blockquote>
<div><ol class="arabic">
<li><p>MSG_WAITALL can be set to tell sendmsg to ignore signals if the peer is
making progress at accepting packets within a reasonable time such that we
manage to queue up all the data for transmission. This requires the
client to accept at least one packet per 2*RTT time period.</p>
<p>If this isn’t set, <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> will return immediately, either returning
EINTR/ERESTARTSYS if nothing was consumed or returning the amount of data
consumed.</p>
</li>
</ol>
</div></blockquote>
<p>Notes on recvmsg:</p>
<blockquote>
<div><ol class="arabic">
<li><p>If there’s a sequence of data messages belonging to a particular call on
the receive queue, then recvmsg will keep working through them until:</p>
<ol class="loweralpha simple">
<li><p>it meets the end of that call’s received data,</p></li>
<li><p>it meets a non-data message,</p></li>
<li><p>it meets a message belonging to a different call, or</p></li>
<li><p>it fills the user buffer.</p></li>
</ol>
<p>If recvmsg is called in blocking mode, it will keep sleeping, awaiting the
reception of further data, until one of the above four conditions is met.</p>
</li>
</ol>
<ol class="arabic simple" start="2">
<li><p>MSG_PEEK operates similarly, but will return immediately if it has put any
data in the buffer rather than sleeping until it can fill the buffer.</p></li>
<li><p>If a data message is only partially consumed in filling a user buffer,
then the remainder of that message will be left on the front of the queue
for the next taker. MSG_TRUNC will never be flagged.</p></li>
<li><p>If there is more data to be had on a call (it hasn’t copied the last byte
of the last data message in that phase yet), then MSG_MORE will be
flagged.</p></li>
</ol>
</div></blockquote>
</section>
<section id="control-messages">
<h2>Control Messages<a class="headerlink" href="#control-messages" title="Link to this heading">¶</a></h2>
<p>AF_RXRPC makes use of control messages in <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> and <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> to multiplex
calls, to invoke certain actions and to report certain conditions. These are:</p>
<blockquote>
<div><blockquote>
<div><table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>MESSAGE ID</p></th>
<th class="head"><p>SRT</p></th>
<th class="head"><p>DATA</p></th>
<th class="head"><p>MEANING</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>RXRPC_USER_CALL_ID</p></td>
<td><p>sr-</p></td>
<td><p>User ID</p></td>
<td><p>App’s call specifier</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_ABORT</p></td>
<td><p>srt</p></td>
<td><p>Abort code</p></td>
<td><p>Abort code to issue/received</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_ACK</p></td>
<td><p>-rt</p></td>
<td><p>n/a</p></td>
<td><p>Final ACK received</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_NET_ERROR</p></td>
<td><p>-rt</p></td>
<td><p>error num</p></td>
<td><p>Network error on call</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_BUSY</p></td>
<td><p>-rt</p></td>
<td><p>n/a</p></td>
<td><p>Call rejected (server busy)</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_LOCAL_ERROR</p></td>
<td><p>-rt</p></td>
<td><p>error num</p></td>
<td><p>Local error encountered</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_NEW_CALL</p></td>
<td><p>-r-</p></td>
<td><p>n/a</p></td>
<td><p>New call received</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_ACCEPT</p></td>
<td><p>s--</p></td>
<td><p>n/a</p></td>
<td><p>Accept new call</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_EXCLUSIVE_CALL</p></td>
<td><p>s--</p></td>
<td><p>n/a</p></td>
<td><p>Make an exclusive client call</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_UPGRADE_SERVICE</p></td>
<td><p>s--</p></td>
<td><p>n/a</p></td>
<td><p>Client call can be upgraded</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_TX_LENGTH</p></td>
<td><p>s--</p></td>
<td><p>data len</p></td>
<td><p>Total length of Tx data</p></td>
</tr>
</tbody>
</table>
<p>(SRT = usable in Sendmsg / delivered by Recvmsg / Terminal message)</p>
</div></blockquote>
<ol class="arabic">
<li><p>RXRPC_USER_CALL_ID</p>
<p>This is used to indicate the application’s call ID. It’s an unsigned long
that the app specifies in the client by attaching it to the first data
message or in the server by passing it in association with an RXRPC_ACCEPT
message. <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> passes it in conjunction with all messages except
those of the RXRPC_NEW_CALL message.</p>
</li>
<li><p>RXRPC_ABORT</p>
<p>This is can be used by an application to abort a call by passing it to
sendmsg, or it can be delivered by recvmsg to indicate a remote abort was
received. Either way, it must be associated with an RXRPC_USER_CALL_ID to
specify the call affected. If an abort is being sent, then error EBADSLT
will be returned if there is no call with that user ID.</p>
</li>
<li><p>RXRPC_ACK</p>
<p>This is delivered to a server application to indicate that the final ACK
of a call was received from the client. It will be associated with an
RXRPC_USER_CALL_ID to indicate the call that’s now complete.</p>
</li>
<li><p>RXRPC_NET_ERROR</p>
<p>This is delivered to an application to indicate that an ICMP error message
was encountered in the process of trying to talk to the peer. An
errno-class integer value will be included in the control message data
indicating the problem, and an RXRPC_USER_CALL_ID will indicate the call
affected.</p>
</li>
<li><p>RXRPC_BUSY</p>
<p>This is delivered to a client application to indicate that a call was
rejected by the server due to the server being busy. It will be
associated with an RXRPC_USER_CALL_ID to indicate the rejected call.</p>
</li>
<li><p>RXRPC_LOCAL_ERROR</p>
<p>This is delivered to an application to indicate that a local error was
encountered and that a call has been aborted because of it. An
errno-class integer value will be included in the control message data
indicating the problem, and an RXRPC_USER_CALL_ID will indicate the call
affected.</p>
</li>
<li><p>RXRPC_NEW_CALL</p>
<p>This is delivered to indicate to a server application that a new call has
arrived and is awaiting acceptance. No user ID is associated with this,
as a user ID must subsequently be assigned by doing an RXRPC_ACCEPT.</p>
</li>
<li><p>RXRPC_ACCEPT</p>
<p>This is used by a server application to attempt to accept a call and
assign it a user ID. It should be associated with an RXRPC_USER_CALL_ID
to indicate the user ID to be assigned. If there is no call to be
accepted (it may have timed out, been aborted, etc.), then sendmsg will
return error ENODATA. If the user ID is already in use by another call,
then error EBADSLT will be returned.</p>
</li>
<li><p>RXRPC_EXCLUSIVE_CALL</p>
<p>This is used to indicate that a client call should be made on a one-off
connection. The connection is discarded once the call has terminated.</p>
</li>
<li><p>RXRPC_UPGRADE_SERVICE</p>
<p>This is used to make a client call to probe if the specified service ID
may be upgraded by the server. The caller must check msg_name returned to
<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> for the service ID actually in use. The operation probed must
be one that takes the same arguments in both services.</p>
<p>Once this has been used to establish the upgrade capability (or lack
thereof) of the server, the service ID returned should be used for all
future communication to that server and RXRPC_UPGRADE_SERVICE should no
longer be set.</p>
</li>
<li><p>RXRPC_TX_LENGTH</p>
<p>This is used to inform the kernel of the total amount of data that is
going to be transmitted by a call (whether in a client request or a
service response). If given, it allows the kernel to encrypt from the
userspace buffer directly to the packet buffers, rather than copying into
the buffer and then encrypting in place. This may only be given with the
first <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> providing data for a call. EMSGSIZE will be generated if
the amount of data actually given is different.</p>
<p>This takes a parameter of __s64 type that indicates how much will be
transmitted. This may not be less than zero.</p>
</li>
</ol>
</div></blockquote>
<p>The symbol RXRPC__SUPPORTED is defined as one more than the highest control
message type supported. At run time this can be queried by means of the
RXRPC_SUPPORTED_CMSG socket option (see below).</p>
</section>
<section id="socket-options">
<h2>Socket Options<a class="headerlink" href="#socket-options" title="Link to this heading">¶</a></h2>
<p>AF_RXRPC sockets support a few socket options at the SOL_RXRPC level:</p>
<blockquote>
<div><ol class="arabic">
<li><p>RXRPC_SECURITY_KEY</p>
<p>This is used to specify the description of the key to be used. The key is
extracted from the calling process’s keyrings with <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">request_key()</span></code> and
should be of “rxrpc” type.</p>
<p>The optval pointer points to the description string, and optlen indicates
how long the string is, without the NUL terminator.</p>
</li>
<li><p>RXRPC_SECURITY_KEYRING</p>
<p>Similar to above but specifies a keyring of server secret keys to use (key
type “keyring”). See the “Security” section.</p>
</li>
<li><p>RXRPC_EXCLUSIVE_CONNECTION</p>
<p>This is used to request that new connections should be used for each call
made subsequently on this socket. optval should be NULL and optlen 0.</p>
</li>
<li><p>RXRPC_MIN_SECURITY_LEVEL</p>
<p>This is used to specify the minimum security level required for calls on
this socket. optval must point to an int containing one of the following
values:</p>
<ol class="loweralpha">
<li><p>RXRPC_SECURITY_PLAIN</p>
<p>Encrypted checksum only.</p>
</li>
<li><p>RXRPC_SECURITY_AUTH</p>
<p>Encrypted checksum plus packet padded and first eight bytes of packet
encrypted - which includes the actual packet length.</p>
</li>
<li><p>RXRPC_SECURITY_ENCRYPT</p>
<p>Encrypted checksum plus entire packet padded and encrypted, including
actual packet length.</p>
</li>
</ol>
</li>
<li><p>RXRPC_UPGRADEABLE_SERVICE</p>
<p>This is used to indicate that a service socket with two bindings may
upgrade one bound service to the other if requested by the client. optval
must point to an array of two unsigned short ints. The first is the
service ID to upgrade from and the second the service ID to upgrade to.</p>
</li>
<li><p>RXRPC_SUPPORTED_CMSG</p>
<p>This is a read-only option that writes an int into the buffer indicating
the highest control message type supported.</p>
</li>
</ol>
</div></blockquote>
</section>
<section id="security">
<h2>Security<a class="headerlink" href="#security" title="Link to this heading">¶</a></h2>
<p>Currently, only the kerberos 4 equivalent protocol has been implemented
(security index 2 - rxkad). This requires the rxkad module to be loaded and,
on the client, tickets of the appropriate type to be obtained from the AFS
kaserver or the kerberos server and installed as “rxrpc” type keys. This is
normally done using the klog program. An example simple klog program can be
found at:</p>
<blockquote>
<div><p><a class="reference external" href="http://people.redhat.com/~dhowells/rxrpc/klog.c">http://people.redhat.com/~dhowells/rxrpc/klog.c</a></p>
</div></blockquote>
<p>The payload provided to <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">add_key()</span></code> on the client should be of the following
form:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct rxrpc_key_sec2_v1 {
uint16_t security_index; /* 2 */
uint16_t ticket_length; /* length of ticket[] */
uint32_t expiry; /* time at which expires */
uint8_t kvno; /* key version number */
uint8_t __pad[3];
uint8_t session_key[8]; /* DES session key */
uint8_t ticket[0]; /* the encrypted ticket */
};
</pre></div>
</div>
<p>Where the ticket blob is just appended to the above structure.</p>
<p>For the server, keys of type “rxrpc_s” must be made available to the server.
They have a description of “<serviceID>:<securityIndex>” (eg: “52:2” for an
rxkad key for the AFS VL service). When such a key is created, it should be
given the server’s secret key as the instantiation data (see the example
below).</p>
<blockquote>
<div><p>add_key(“rxrpc_s”, “52:2”, secret_key, 8, keyring);</p>
</div></blockquote>
<p>A keyring is passed to the server socket by naming it in a sockopt. The server
socket then looks the server secret keys up in this keyring when secure
incoming connections are made. This can be seen in an example program that can
be found at:</p>
<blockquote>
<div><p><a class="reference external" href="http://people.redhat.com/~dhowells/rxrpc/listen.c">http://people.redhat.com/~dhowells/rxrpc/listen.c</a></p>
</div></blockquote>
</section>
<section id="example-client-usage">
<h2>Example Client Usage<a class="headerlink" href="#example-client-usage" title="Link to this heading">¶</a></h2>
<p>A client would issue an operation by:</p>
<blockquote>
<div><ol class="arabic">
<li><p>An RxRPC socket is set up by:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>client = socket(AF_RXRPC, SOCK_DGRAM, PF_INET);
</pre></div>
</div>
<p>Where the third parameter indicates the protocol family of the transport
socket used - usually IPv4 but it can also be IPv6 [TODO].</p>
</li>
<li><p>A local address can optionally be bound:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct sockaddr_rxrpc srx = {
.srx_family = AF_RXRPC,
.srx_service = 0, /* we're a client */
.transport_type = SOCK_DGRAM, /* type of transport socket */
.transport.sin_family = AF_INET,
.transport.sin_port = htons(7000), /* AFS callback */
.transport.sin_address = 0, /* all local interfaces */
};
bind(client, &srx, sizeof(srx));
</pre></div>
</div>
<p>This specifies the local UDP port to be used. If not given, a random
non-privileged port will be used. A UDP port may be shared between
several unrelated RxRPC sockets. Security is handled on a basis of
per-RxRPC virtual connection.</p>
</li>
<li><p>The security is set:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>const char *key = "AFS:cambridge.redhat.com";
setsockopt(client, SOL_RXRPC, RXRPC_SECURITY_KEY, key, strlen(key));
</pre></div>
</div>
<p>This issues a <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">request_key()</span></code> to get the key representing the security
context. The minimum security level can be set:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>unsigned int sec = RXRPC_SECURITY_ENCRYPT;
setsockopt(client, SOL_RXRPC, RXRPC_MIN_SECURITY_LEVEL,
&sec, sizeof(sec));
</pre></div>
</div>
</li>
<li><p>The server to be contacted can then be specified (alternatively this can
be done through sendmsg):</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct sockaddr_rxrpc srx = {
.srx_family = AF_RXRPC,
.srx_service = VL_SERVICE_ID,
.transport_type = SOCK_DGRAM, /* type of transport socket */
.transport.sin_family = AF_INET,
.transport.sin_port = htons(7005), /* AFS volume manager */
.transport.sin_address = ...,
};
connect(client, &srx, sizeof(srx));
</pre></div>
</div>
</li>
<li><p>The request data should then be posted to the server socket using a series
of <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> calls, each with the following control message attached:</p>
<blockquote>
<div><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>RXRPC_USER_CALL_ID</p></td>
<td><p>specifies the user ID for this call</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>MSG_MORE should be set in msghdr::msg_flags on all but the last part of
the request. Multiple requests may be made simultaneously.</p>
<p>An RXRPC_TX_LENGTH control message can also be specified on the first
<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> call.</p>
<p>If a call is intended to go to a destination other than the default
specified through <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">connect()</span></code>, then msghdr::msg_name should be set on the
first request message of that call.</p>
</li>
<li><p>The reply data will then be posted to the server socket for <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> to
pick up. MSG_MORE will be flagged by <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> if there’s more reply data
for a particular call to be read. MSG_EOR will be set on the terminal
read for a call.</p>
<p>All data will be delivered with the following control message attached:</p>
<blockquote>
<div><p>RXRPC_USER_CALL_ID - specifies the user ID for this call</p>
</div></blockquote>
<p>If an abort or error occurred, this will be returned in the control data
buffer instead, and MSG_EOR will be flagged to indicate the end of that
call.</p>
</li>
</ol>
</div></blockquote>
<p>A client may ask for a service ID it knows and ask that this be upgraded to a
better service if one is available by supplying RXRPC_UPGRADE_SERVICE on the
first <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> of a call. The client should then check srx_service in the
msg_name filled in by <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> when collecting the result. srx_service will
hold the same value as given to <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> if the upgrade request was ignored by
the service - otherwise it will be altered to indicate the service ID the
server upgraded to. Note that the upgraded service ID is chosen by the server.
The caller has to wait until it sees the service ID in the reply before sending
any more calls (further calls to the same destination will be blocked until the
probe is concluded).</p>
</section>
<section id="example-server-usage">
<h2>Example Server Usage<a class="headerlink" href="#example-server-usage" title="Link to this heading">¶</a></h2>
<p>A server would be set up to accept operations in the following manner:</p>
<blockquote>
<div><ol class="arabic">
<li><p>An RxRPC socket is created by:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>server = socket(AF_RXRPC, SOCK_DGRAM, PF_INET);
</pre></div>
</div>
<p>Where the third parameter indicates the address type of the transport
socket used - usually IPv4.</p>
</li>
<li><p>Security is set up if desired by giving the socket a keyring with server
secret keys in it:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>keyring = add_key("keyring", "AFSkeys", NULL, 0,
KEY_SPEC_PROCESS_KEYRING);
const char secret_key[8] = {
0xa7, 0x83, 0x8a, 0xcb, 0xc7, 0x83, 0xec, 0x94 };
add_key("rxrpc_s", "52:2", secret_key, 8, keyring);
setsockopt(server, SOL_RXRPC, RXRPC_SECURITY_KEYRING, "AFSkeys", 7);
</pre></div>
</div>
<p>The keyring can be manipulated after it has been given to the socket. This
permits the server to add more keys, replace keys, etc. while it is live.</p>
</li>
<li><p>A local address must then be bound:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct sockaddr_rxrpc srx = {
.srx_family = AF_RXRPC,
.srx_service = VL_SERVICE_ID, /* RxRPC service ID */
.transport_type = SOCK_DGRAM, /* type of transport socket */
.transport.sin_family = AF_INET,
.transport.sin_port = htons(7000), /* AFS callback */
.transport.sin_address = 0, /* all local interfaces */
};
bind(server, &srx, sizeof(srx));
</pre></div>
</div>
<p>More than one service ID may be bound to a socket, provided the transport
parameters are the same. The limit is currently two. To do this, <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">bind()</span></code>
should be called twice.</p>
</li>
<li><p>If service upgrading is required, first two service IDs must have been
bound and then the following option must be set:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>unsigned short service_ids[2] = { from_ID, to_ID };
setsockopt(server, SOL_RXRPC, RXRPC_UPGRADEABLE_SERVICE,
service_ids, sizeof(service_ids));
</pre></div>
</div>
<p>This will automatically upgrade connections on service from_ID to service
to_ID if they request it. This will be reflected in msg_name obtained
through <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> when the request data is delivered to userspace.</p>
</li>
<li><p>The server is then set to listen out for incoming calls:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>listen(server, 100);
</pre></div>
</div>
</li>
<li><p>The kernel notifies the server of pending incoming connections by sending
it a message for each. This is received with <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> on the server
socket. It has no data, and has a single dataless control message
attached:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>RXRPC_NEW_CALL
</pre></div>
</div>
<p>The address that can be passed back by <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> at this point should be
ignored since the call for which the message was posted may have gone by
the time it is accepted - in which case the first call still on the queue
will be accepted.</p>
</li>
<li><p>The server then accepts the new call by issuing a <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> with two
pieces of control data and no actual data:</p>
<blockquote>
<div><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>RXRPC_ACCEPT</p></td>
<td><p>indicate connection acceptance</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_USER_CALL_ID</p></td>
<td><p>specify user ID for this call</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
</li>
<li><p>The first request data packet will then be posted to the server socket for
<code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> to pick up. At that point, the RxRPC address for the call can
be read from the address fields in the msghdr struct.</p>
<p>Subsequent request data will be posted to the server socket for <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code>
to collect as it arrives. All but the last piece of the request data will
be delivered with MSG_MORE flagged.</p>
<p>All data will be delivered with the following control message attached:</p>
<blockquote>
<div><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>RXRPC_USER_CALL_ID</p></td>
<td><p>specifies the user ID for this call</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
</li>
<li><p>The reply data should then be posted to the server socket using a series
of <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> calls, each with the following control messages attached:</p>
<blockquote>
<div><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>RXRPC_USER_CALL_ID</p></td>
<td><p>specifies the user ID for this call</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>MSG_MORE should be set in msghdr::msg_flags on all but the last message
for a particular call.</p>
</li>
</ol>
</div></blockquote>
<ol class="arabic" start="10">
<li><p>The final ACK from the client will be posted for retrieval by <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code>
when it is received. It will take the form of a dataless message with two
control messages attached:</p>
<blockquote>
<div><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>RXRPC_USER_CALL_ID</p></td>
<td><p>specifies the user ID for this call</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_ACK</p></td>
<td><p>indicates final ACK (no data)</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>MSG_EOR will be flagged to indicate that this is the final message for
this call.</p>
</li>
<li><p>Up to the point the final packet of reply data is sent, the call can be
aborted by calling <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> with a dataless message with the following
control messages attached:</p>
<blockquote>
<div><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>RXRPC_USER_CALL_ID</p></td>
<td><p>specifies the user ID for this call</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_ABORT</p></td>
<td><p>indicates abort code (4 byte data)</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>Any packets waiting in the socket’s receive queue will be discarded if
this is issued.</p>
</li>
</ol>
<p>Note that all the communications for a particular service take place through
the one server socket, using control messages on <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> and <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> to
determine the call affected.</p>
</section>
<section id="af-rxrpc-kernel-interface">
<h2>AF_RXRPC Kernel Interface<a class="headerlink" href="#af-rxrpc-kernel-interface" title="Link to this heading">¶</a></h2>
<p>The AF_RXRPC module also provides an interface for use by in-kernel utilities
such as the AFS filesystem. This permits such a utility to:</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>Use different keys directly on individual client calls on one socket
rather than having to open a whole slew of sockets, one for each key it
might want to use.</p></li>
<li><p>Avoid having RxRPC call <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">request_key()</span></code> at the point of issue of a call or
opening of a socket. Instead the utility is responsible for requesting a
key at the appropriate point. AFS, for instance, would do this during VFS
operations such as open() or <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">unlink()</span></code>. The key is then handed through
when the call is initiated.</p></li>
<li><p>Request the use of something other than GFP_KERNEL to allocate memory.</p></li>
<li><p>Avoid the overhead of using the <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> call. RxRPC messages can be
intercepted before they get put into the socket Rx queue and the socket
buffers manipulated directly.</p></li>
</ol>
</div></blockquote>
<p>To use the RxRPC facility, a kernel utility must still open an AF_RXRPC socket,
bind an address as appropriate and listen if it’s to be a server socket, but
then it passes this to the kernel interface functions.</p>
<p>The kernel interface functions are as follows:</p>
<blockquote>
<div><ol class="arabic">
<li><p>Begin a new client call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct rxrpc_call *
rxrpc_kernel_begin_call(struct socket *sock,
struct sockaddr_rxrpc *srx,
struct key *key,
unsigned long user_call_ID,
s64 tx_total_len,
gfp_t gfp,
rxrpc_notify_rx_t notify_rx,
bool upgrade,
bool intr,
unsigned int debug_id);
</pre></div>
</div>
<p>This allocates the infrastructure to make a new RxRPC call and assigns
call and connection numbers. The call will be made on the UDP port that
the socket is bound to. The call will go to the destination address of a
connected client socket unless an alternative is supplied (srx is
non-NULL).</p>
<p>If a key is supplied then this will be used to secure the call instead of
the key bound to the socket with the RXRPC_SECURITY_KEY sockopt. Calls
secured in this way will still share connections if at all possible.</p>
<p>The user_call_ID is equivalent to that supplied to <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> in the
control data buffer. It is entirely feasible to use this to point to a
kernel data structure.</p>
<p>tx_total_len is the amount of data the caller is intending to transmit
with this call (or -1 if unknown at this point). Setting the data size
allows the kernel to encrypt directly to the packet buffers, thereby
saving a copy. The value may not be less than -1.</p>
<p>notify_rx is a pointer to a function to be called when events such as
incoming data packets or remote aborts happen.</p>
<p>upgrade should be set to true if a client operation should request that
the server upgrade the service to a better one. The resultant service ID
is returned by <a class="reference internal" href="#c.rxrpc_kernel_recv_data" title="rxrpc_kernel_recv_data"><code class="xref c c-func docutils literal notranslate"><span class="pre">rxrpc_kernel_recv_data()</span></code></a>.</p>
<p>intr should be set to true if the call should be interruptible. If this
is not set, this function may not return until a channel has been
allocated; if it is set, the function may return -ERESTARTSYS.</p>
<p>debug_id is the call debugging ID to be used for tracing. This can be
obtained by atomically incrementing rxrpc_debug_id.</p>
<p>If this function is successful, an opaque reference to the RxRPC call is
returned. The caller now holds a reference on this and it must be
properly ended.</p>
</li>
<li><p>Shut down a client call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>void rxrpc_kernel_shutdown_call(struct socket *sock,
struct rxrpc_call *call);
</pre></div>
</div>
<p>This is used to shut down a previously begun call. The user_call_ID is
expunged from AF_RXRPC’s knowledge and will not be seen again in
association with the specified call.</p>
</li>
<li><p>Release the ref on a client call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>void rxrpc_kernel_put_call(struct socket *sock,
struct rxrpc_call *call);
</pre></div>
</div>
<p>This is used to release the caller’s ref on an rxrpc call.</p>
</li>
<li><p>Send data through a call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>typedef void (*rxrpc_notify_end_tx_t)(struct sock *sk,
unsigned long user_call_ID,
struct sk_buff *skb);
int rxrpc_kernel_send_data(struct socket *sock,
struct rxrpc_call *call,
struct msghdr *msg,
size_t len,
rxrpc_notify_end_tx_t notify_end_rx);
</pre></div>
</div>
<p>This is used to supply either the request part of a client call or the
reply part of a server call. msg.msg_iovlen and msg.msg_iov specify the
data buffers to be used. msg_iov may not be NULL and must point
exclusively to in-kernel virtual addresses. msg.msg_flags may be given
MSG_MORE if there will be subsequent data sends for this call.</p>
<p>The msg must not specify a destination address, control data or any flags
other than MSG_MORE. len is the total amount of data to transmit.</p>
<p>notify_end_rx can be NULL or it can be used to specify a function to be
called when the call changes state to end the Tx phase. This function is
called with a spinlock held to prevent the last DATA packet from being
transmitted until the function returns.</p>
</li>
<li><p>Receive data from a call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span> int rxrpc_kernel_recv_data(struct socket *sock,
struct rxrpc_call *call,
void *buf,
size_t size,
size_t *_offset,
bool want_more,
u32 *_abort,
u16 *_service)
This is used to receive data from either the reply part of a client call
or the request part of a service call. buf and size specify how much
data is desired and where to store it. *_offset is added on to buf and
subtracted from size internally; the amount copied into the buffer is
added to *_offset before returning.
want_more should be true if further data will be required after this is
satisfied and false if this is the last item of the receive phase.
There are three normal returns: 0 if the buffer was filled and want_more
was true; 1 if the buffer was filled, the last DATA packet has been
emptied and want_more was false; and -EAGAIN if the function needs to be
called again.
If the last DATA packet is processed but the buffer contains less than
the amount requested, EBADMSG is returned. If want_more wasn't set, but
more data was available, EMSGSIZE is returned.
If a remote ABORT is detected, the abort code received will be stored in
``*_abort`` and ECONNABORTED will be returned.
The service ID that the call ended up with is returned into *_service.
This can be used to see if a call got a service upgrade.
</pre></div>
</div>
</li>
<li><p>Abort a call??</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>void rxrpc_kernel_abort_call(struct socket *sock,
struct rxrpc_call *call,
u32 abort_code);
</pre></div>
</div>
<p>This is used to abort a call if it’s still in an abortable state. The
abort code specified will be placed in the ABORT message sent.</p>
</li>
<li><p>Intercept received RxRPC messages:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>typedef void (*rxrpc_interceptor_t)(struct sock *sk,
unsigned long user_call_ID,
struct sk_buff *skb);
void
rxrpc_kernel_intercept_rx_messages(struct socket *sock,
rxrpc_interceptor_t interceptor);
</pre></div>
</div>
<p>This installs an interceptor function on the specified AF_RXRPC socket.
All messages that would otherwise wind up in the socket’s Rx queue are
then diverted to this function. Note that care must be taken to process
the messages in the right order to maintain DATA message sequentiality.</p>
<p>The interceptor function itself is provided with the address of the socket
and handling the incoming message, the ID assigned by the kernel utility
to the call and the socket buffer containing the message.</p>
<p>The skb->mark field indicates the type of message:</p>
<blockquote>
<div><table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Mark</p></th>
<th class="head"><p>Meaning</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>RXRPC_SKB_MARK_DATA</p></td>
<td><p>Data message</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_SKB_MARK_FINAL_ACK</p></td>
<td><p>Final ACK received for an incoming call</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_SKB_MARK_BUSY</p></td>
<td><p>Client call rejected as server busy</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_SKB_MARK_REMOTE_ABORT</p></td>
<td><p>Call aborted by peer</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_SKB_MARK_NET_ERROR</p></td>
<td><p>Network error detected</p></td>
</tr>
<tr class="row-odd"><td><p>RXRPC_SKB_MARK_LOCAL_ERROR</p></td>
<td><p>Local error encountered</p></td>
</tr>
<tr class="row-even"><td><p>RXRPC_SKB_MARK_NEW_CALL</p></td>
<td><p>New incoming call awaiting acceptance</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>The remote abort message can be probed with <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">rxrpc_kernel_get_abort_code()</span></code>.
The two error messages can be probed with <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">rxrpc_kernel_get_error_number()</span></code>.
A new call can be accepted with <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">rxrpc_kernel_accept_call()</span></code>.</p>
<p>Data messages can have their contents extracted with the usual bunch of
socket buffer manipulation functions. A data message can be determined to
be the last one in a sequence with <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">rxrpc_kernel_is_data_last()</span></code>. When a
data message has been used up, <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">rxrpc_kernel_data_consumed()</span></code> should be
called on it.</p>
<p>Messages should be handled to <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">rxrpc_kernel_free_skb()</span></code> to dispose of. It
is possible to get extra refs on all types of message for later freeing,
but this may pin the state of a call until the message is finally freed.</p>
</li>
<li><p>Accept an incoming call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct rxrpc_call *
rxrpc_kernel_accept_call(struct socket *sock,
unsigned long user_call_ID);
</pre></div>
</div>
<p>This is used to accept an incoming call and to assign it a call ID. This
function is similar to <a class="reference internal" href="#c.rxrpc_kernel_begin_call" title="rxrpc_kernel_begin_call"><code class="xref c c-func docutils literal notranslate"><span class="pre">rxrpc_kernel_begin_call()</span></code></a> and calls accepted must
be ended in the same way.</p>
<p>If this function is successful, an opaque reference to the RxRPC call is
returned. The caller now holds a reference on this and it must be
properly ended.</p>
</li>
<li><p>Reject an incoming call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>int rxrpc_kernel_reject_call(struct socket *sock);
</pre></div>
</div>
<p>This is used to reject the first incoming call on the socket’s queue with
a BUSY message. -ENODATA is returned if there were no incoming calls.
Other errors may be returned if the call had been aborted (-ECONNABORTED)
or had timed out (-ETIME).</p>
</li>
<li><p>Allocate a null key for doing anonymous security:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct key *rxrpc_get_null_key(const char *keyname);
</pre></div>
</div>
<p>This is used to allocate a null RxRPC key that can be used to indicate
anonymous security for a particular domain.</p>
</li>
<li><p>Get the peer address of a call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>void rxrpc_kernel_get_peer(struct socket *sock, struct rxrpc_call *call,
struct sockaddr_rxrpc *_srx);
</pre></div>
</div>
<p>This is used to find the remote peer address of a call.</p>
</li>
<li><p>Set the total transmit data size on a call:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>void rxrpc_kernel_set_tx_length(struct socket *sock,
struct rxrpc_call *call,
s64 tx_total_len);
</pre></div>
</div>
<p>This sets the amount of data that the caller is intending to transmit on a
call. It’s intended to be used for setting the reply size as the request
size should be set when the call is begun. tx_total_len may not be less
than zero.</p>
</li>
<li><p>Get call RTT:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call);
</pre></div>
</div>
<p>Get the RTT time to the peer in use by a call. The value returned is in
nanoseconds.</p>
</li>
<li><p>Check call still alive:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>bool rxrpc_kernel_check_life(struct socket *sock,
struct rxrpc_call *call,
u32 *_life);
void rxrpc_kernel_probe_life(struct socket *sock,
struct rxrpc_call *call);
</pre></div>
</div>
<p>The first function passes back in <code class="docutils literal notranslate"><span class="pre">*_life</span></code> a number that is updated when
ACKs are received from the peer (notably including PING RESPONSE ACKs
which we can elicit by sending PING ACKs to see if the call still exists
on the server). The caller should compare the numbers of two calls to see
if the call is still alive after waiting for a suitable interval. It also
returns true as long as the call hasn’t yet reached the completed state.</p>
<p>This allows the caller to work out if the server is still contactable and
if the call is still alive on the server while waiting for the server to
process a client operation.</p>
<p>The second function causes a ping ACK to be transmitted to try to provoke
the peer into responding, which would then cause the value returned by the
first function to change. Note that this must be called in TASK_RUNNING
state.</p>
</li>
<li><p>Apply the RXRPC_MIN_SECURITY_LEVEL sockopt to a socket from within in the
kernel:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>int rxrpc_sock_set_min_security_level(struct sock *sk,
unsigned int val);
</pre></div>
</div>
<p>This specifies the minimum security level required for calls on this
socket.</p>
</li>
</ol>
</div></blockquote>
</section>
<section id="configurable-parameters">
<h2>Configurable Parameters<a class="headerlink" href="#configurable-parameters" title="Link to this heading">¶</a></h2>
<p>The RxRPC protocol driver has a number of configurable parameters that can be
adjusted through sysctls in /proc/net/rxrpc/:</p>
<blockquote>
<div><ol class="arabic">
<li><p>req_ack_delay</p>
<p>The amount of time in milliseconds after receiving a packet with the
request-ack flag set before we honour the flag and actually send the
requested ack.</p>
<p>Usually the other side won’t stop sending packets until the advertised
reception window is full (to a maximum of 255 packets), so delaying the
ACK permits several packets to be ACK’d in one go.</p>
</li>
<li><p>soft_ack_delay</p>
<p>The amount of time in milliseconds after receiving a new packet before we
generate a soft-ACK to tell the sender that it doesn’t need to resend.</p>
</li>
<li><p>idle_ack_delay</p>
<p>The amount of time in milliseconds after all the packets currently in the
received queue have been consumed before we generate a hard-ACK to tell
the sender it can free its buffers, assuming no other reason occurs that
we would send an ACK.</p>
</li>
<li><p>resend_timeout</p>
<p>The amount of time in milliseconds after transmitting a packet before we
transmit it again, assuming no ACK is received from the receiver telling
us they got it.</p>
</li>
<li><p>max_call_lifetime</p>
<p>The maximum amount of time in seconds that a call may be in progress
before we preemptively kill it.</p>
</li>
<li><p>dead_call_expiry</p>
<p>The amount of time in seconds before we remove a dead call from the call
list. Dead calls are kept around for a little while for the purpose of
repeating ACK and ABORT packets.</p>
</li>
<li><p>connection_expiry</p>
<p>The amount of time in seconds after a connection was last used before we
remove it from the connection list. While a connection is in existence,
it serves as a placeholder for negotiated security; when it is deleted,
the security must be renegotiated.</p>
</li>
<li><p>transport_expiry</p>
<p>The amount of time in seconds after a transport was last used before we
remove it from the transport list. While a transport is in existence, it
serves to anchor the peer data and keeps the connection ID counter.</p>
</li>
<li><p>rxrpc_rx_window_size</p>
<p>The size of the receive window in packets. This is the maximum number of
unconsumed received packets we’re willing to hold in memory for any
particular call.</p>
</li>
<li><p>rxrpc_rx_mtu</p>
<p>The maximum packet MTU size that we’re willing to receive in bytes. This
indicates to the peer whether we’re willing to accept jumbo packets.</p>
</li>
<li><p>rxrpc_rx_jumbo_max</p>
<p>The maximum number of packets that we’re willing to accept in a jumbo
packet. Non-terminal packets in a jumbo packet must contain a four byte
header plus exactly 1412 bytes of data. The terminal packet must contain
a four byte header plus any amount of data. In any event, a jumbo packet
may not exceed rxrpc_rx_mtu in size.</p>
</li>
</ol>
</div></blockquote>
</section>
<section id="api-function-reference">
<h2>API Function Reference<a class="headerlink" href="#api-function-reference" title="Link to this heading">¶</a></h2>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_lookup_peer">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_lookup_peer</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">sockaddr_rxrpc</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">srx</span></span>, <span class="n"><span class="pre">gfp_t</span></span><span class="w"> </span><span class="n"><span class="pre">gfp</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_lookup_peer" title="Link to this definition">¶</a><br /></dt>
<dd><p>Obtain remote transport endpoint for an address</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket through which it will be accessed</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sockaddr_rxrpc</span> <span class="pre">*srx</span></code></dt><dd><p>The network address</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">gfp_t</span> <span class="pre">gfp</span></code></dt><dd><p>Allocation flags</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Lookup or create a remote transport endpoint record for the specified
address.</p>
<p><strong>Return</strong></p>
<p>The peer record found with a reference or a negative error code if
the address is invalid or unsupported.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_get_peer">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_get_peer</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_get_peer" title="Link to this definition">¶</a><br /></dt>
<dd><p>Get a reference on a peer</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to get a reference on (may be NULL).</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Get a reference for a remote peer record (if not NULL).</p>
<p><strong>Return</strong></p>
<p>The <strong>peer</strong> argument.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_put_peer">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_put_peer</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_put_peer" title="Link to this definition">¶</a><br /></dt>
<dd><p>Allow a kernel app to drop a peer reference</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to drop a ref on</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Drop a reference on a peer record.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_begin_call">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_begin_call</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.rxrpc_kernel_begin_call" title="key"><span class="n"><span class="pre">key</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">key</span></span>, <span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="n"><span class="pre">user_call_ID</span></span>, <span class="n"><span class="pre">s64</span></span><span class="w"> </span><span class="n"><span class="pre">tx_total_len</span></span>, <span class="n"><span class="pre">u32</span></span><span class="w"> </span><span class="n"><span class="pre">hard_timeout</span></span>, <span class="n"><span class="pre">gfp_t</span></span><span class="w"> </span><span class="n"><span class="pre">gfp</span></span>, <span class="n"><span class="pre">rxrpc_notify_rx_t</span></span><span class="w"> </span><span class="n"><span class="pre">notify_rx</span></span>, <span class="n"><span class="pre">u16</span></span><span class="w"> </span><span class="n"><span class="pre">service_id</span></span>, <span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="n"><span class="pre">upgrade</span></span>, <span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_interruptibility</span></span><span class="w"> </span><span class="n"><span class="pre">interruptibility</span></span>, <span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">debug_id</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_begin_call" title="Link to this definition">¶</a><br /></dt>
<dd><p>Allow a kernel service to begin a call</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket on which to make the call</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to contact</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">key</span> <span class="pre">*key</span></code></dt><dd><p>The security context to use (defaults to socket setting)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">user_call_ID</span></code></dt><dd><p>The ID to use</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">s64</span> <span class="pre">tx_total_len</span></code></dt><dd><p>Total length of data to transmit during the call (or -1)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u32</span> <span class="pre">hard_timeout</span></code></dt><dd><p>The maximum lifespan of the call in sec</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">gfp_t</span> <span class="pre">gfp</span></code></dt><dd><p>The allocation constraints</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">rxrpc_notify_rx_t</span> <span class="pre">notify_rx</span></code></dt><dd><p>Where to send notifications instead of socket queue</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u16</span> <span class="pre">service_id</span></code></dt><dd><p>The ID of the service to contact</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bool</span> <span class="pre">upgrade</span></code></dt><dd><p>Request service upgrade for call</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">enum</span> <span class="pre">rxrpc_interruptibility</span> <span class="pre">interruptibility</span></code></dt><dd><p>The call is interruptible, or can be canceled.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">int</span> <span class="pre">debug_id</span></code></dt><dd><p>The debug ID for tracing to be assigned to the call</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to begin a call on the nominated socket. This just
sets up all the internal tracking structures and allocates connection and
call IDs as appropriate.</p>
<p>The default socket destination address and security may be overridden by
supplying <strong>srx</strong> and <strong>key</strong>.</p>
<p><strong>Return</strong></p>
<p>The new call or an error code.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_shutdown_call">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_shutdown_call</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_shutdown_call" title="Link to this definition">¶</a><br /></dt>
<dd><p>Allow a kernel service to shut down a call it was using</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket the call is on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to end</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to shut down a call it was using. The call must be
complete before this is called (the call should be aborted if necessary).</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_put_call">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_put_call</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_put_call" title="Link to this definition">¶</a><br /></dt>
<dd><p>Release a reference to a call</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket the call is on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to put</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Drop the application’s ref on an rxrpc call.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_check_life">
<span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_check_life</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_check_life" title="Link to this definition">¶</a><br /></dt>
<dd><p>Check to see whether a call is still alive</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket the call is on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to check</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to find out whether a call is still alive - whether
it has completed successfully and all received data has been consumed.</p>
<p><strong>Return</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">true</span></code> if the call is still ongoing and <code class="docutils literal notranslate"><span class="pre">false</span></code> if it has completed.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_set_notifications">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_set_notifications</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_kernel_ops</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">app_ops</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_set_notifications" title="Link to this definition">¶</a><br /></dt>
<dd><p>Set table of callback operations</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket to install table upon</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">rxrpc_kernel_ops</span> <span class="pre">*app_ops</span></code></dt><dd><p>Callback operation table to set</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to set a table of event notifications on a socket.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_query_call_security">
<span class="n"><span class="pre">u8</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_query_call_security</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span>, <span class="n"><span class="pre">u16</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_service_id</span></span>, <span class="n"><span class="pre">u32</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_enctype</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_query_call_security" title="Link to this definition">¶</a><br /></dt>
<dd><p>Query call’s security parameters</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to query</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u16</span> <span class="pre">*_service_id</span></code></dt><dd><p>Where to return the service ID</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u32</span> <span class="pre">*_enctype</span></code></dt><dd><p>Where to return the “encoding type”</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>This queries the security parameters of a call, setting <strong>*_service_id</strong> and
<strong>*_enctype</strong> and returning the security class.</p>
<p><strong>Return</strong></p>
<p>The security class protocol number.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_get_null_key">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">key</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_get_null_key</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">keyname</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_get_null_key" title="Link to this definition">¶</a><br /></dt>
<dd><p>Generate a null RxRPC key</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">char</span> <span class="pre">*keyname</span></code></dt><dd><p>The name to give the key.</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Generate a null RxRPC key that can be used to indicate anonymous security is
required for a particular domain.</p>
<p><strong>Return</strong></p>
<p>The new key or a negative error code.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_query_oob">
<span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_oob_type</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_query_oob</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">oob</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_peer</span></span>, <span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_peer_appdata</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_query_oob" title="Link to this definition">¶</a><br /></dt>
<dd><p>Query the parameters of an out-of-band message</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span> <span class="pre">*oob</span></code></dt><dd><p>The message to query</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">**_peer</span></code></dt><dd><p>Where to return the peer record</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">*_peer_appdata</span></code></dt><dd><p>The application data attached to a peer record</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Extract useful parameters from an out-of-band message. The source peer
parameters are returned through the argument list and the message type is
returned.</p>
<p><strong>Return</strong></p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">RXRPC_OOB_CHALLENGE</span></code> - Challenge wanting a response.</p></li>
</ul>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_dequeue_oob">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_dequeue_oob</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_oob_type</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_type</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_dequeue_oob" title="Link to this definition">¶</a><br /></dt>
<dd><p>Dequeue and return the front OOB message</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket to query</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">enum</span> <span class="pre">rxrpc_oob_type</span> <span class="pre">*_type</span></code></dt><dd><p>Where to return the message type</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Dequeue the front OOB message, if there is one, and return it and
its type.</p>
<p><strong>Return</strong></p>
<p>The sk_buff representing the OOB message or <code class="docutils literal notranslate"><span class="pre">NULL</span></code> if the queue was
empty.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_free_oob">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_free_oob</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">oob</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_free_oob" title="Link to this definition">¶</a><br /></dt>
<dd><p>Free an out-of-band message</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span> <span class="pre">*oob</span></code></dt><dd><p>The OOB message to free</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Free an OOB message along with any resources it holds.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_query_challenge">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_query_challenge</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">challenge</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_peer</span></span>, <span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_peer_appdata</span></span>, <span class="n"><span class="pre">u16</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_service_id</span></span>, <span class="n"><span class="pre">u8</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_security_index</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_query_challenge" title="Link to this definition">¶</a><br /></dt>
<dd><p>Query the parameters of a challenge</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span> <span class="pre">*challenge</span></code></dt><dd><p>The challenge to query</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">**_peer</span></code></dt><dd><p>Where to return the peer record</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">*_peer_appdata</span></code></dt><dd><p>The application data attached to a peer record</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u16</span> <span class="pre">*_service_id</span></code></dt><dd><p>Where to return the connection service ID</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u8</span> <span class="pre">*_security_index</span></code></dt><dd><p>Where to return the connection security index</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Extract useful parameters from a CHALLENGE message.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_reject_challenge">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_reject_challenge</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">challenge</span></span>, <span class="n"><span class="pre">u32</span></span><span class="w"> </span><span class="n"><span class="pre">abort_code</span></span>, <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">error</span></span>, <span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_abort_reason</span></span><span class="w"> </span><span class="n"><span class="pre">why</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_reject_challenge" title="Link to this definition">¶</a><br /></dt>
<dd><p>Allow a kernel service to reject a challenge</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span> <span class="pre">*challenge</span></code></dt><dd><p>The challenge to be rejected</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u32</span> <span class="pre">abort_code</span></code></dt><dd><p>The abort code to stick into the ABORT packet</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">error</span></code></dt><dd><p>Local error value</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">enum</span> <span class="pre">rxrpc_abort_reason</span> <span class="pre">why</span></code></dt><dd><p>Indication as to why.</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to reject a challenge by aborting the connection if
it’s still in an abortable state. The error is returned so this function
can be used with a return statement.</p>
<p><strong>Return</strong></p>
<p>The <code class="docutils literal notranslate"><span class="pre">error</span></code> parameter.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_get_call_peer">
<span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_get_call_peer</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_get_call_peer" title="Link to this definition">¶</a><br /></dt>
<dd><p>Get the peer address of a call</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket on which the call is in progress.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to query</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Get a record for the remote peer in a call.</p>
<p><strong>Return</strong></p>
<p>The call’s peer record.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_get_srtt">
<span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_get_srtt</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_get_srtt" title="Link to this definition">¶</a><br /></dt>
<dd><p>Get a call’s peer smoothed RTT</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to query</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Get the call’s peer smoothed RTT.</p>
<p><strong>Return</strong></p>
<p>The RTT in uS or <code class="docutils literal notranslate"><span class="pre">UINT_MAX</span></code> if we have no samples.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_remote_srx">
<span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">sockaddr_rxrpc</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_remote_srx</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_remote_srx" title="Link to this definition">¶</a><br /></dt>
<dd><p>Get the address of a peer</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to query</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Get a pointer to the address from a peer record. The caller is responsible
for making sure that the address is not deallocated. A fake address will be
substituted if <code class="docutils literal notranslate"><span class="pre">peer</span></code> in NULL.</p>
<p><strong>Return</strong></p>
<p>The rxrpc address record or a fake record.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_remote_addr">
<span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">sockaddr</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_remote_addr</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_remote_addr" title="Link to this definition">¶</a><br /></dt>
<dd><p>Get the peer transport address of a call</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to query</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Get a pointer to the transport address from a peer record. The caller is
responsible for making sure that the address is not deallocated. A fake
address will be substituted if <code class="docutils literal notranslate"><span class="pre">peer</span></code> in NULL.</p>
<p><strong>Return</strong></p>
<p>The transport address record or a fake record.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_set_peer_data">
<span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_set_peer_data</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span>, <span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="n"><span class="pre">app_data</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_set_peer_data" title="Link to this definition">¶</a><br /></dt>
<dd><p>Set app-specific data on a peer.</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to alter</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">unsigned</span> <span class="pre">long</span> <span class="pre">app_data</span></code></dt><dd><p>The data to set</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Set the app-specific data on a peer. AF_RXRPC makes no effort to retain
anything the data might refer to.</p>
<p><strong>Return</strong></p>
<p>The previous app_data.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_get_peer_data">
<span class="kt"><span class="pre">unsigned</span></span><span class="w"> </span><span class="kt"><span class="pre">long</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_get_peer_data</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_peer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">peer</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_get_peer_data" title="Link to this definition">¶</a><br /></dt>
<dd><p>Get app-specific data from a peer.</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">struct</span> <span class="pre">rxrpc_peer</span> <span class="pre">*peer</span></code></dt><dd><p>The peer to query</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Retrieve the app-specific data from a peer.</p>
<p><strong>Return</strong></p>
<p>The peer’s app data.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_recv_data">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_recv_data</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">iov_iter</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">iter</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_len</span></span>, <span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="n"><span class="pre">want_more</span></span>, <span class="n"><span class="pre">u32</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_abort</span></span>, <span class="n"><span class="pre">u16</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">_service</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_recv_data" title="Link to this definition">¶</a><br /></dt>
<dd><p>Allow a kernel service to receive data/info</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket that the call exists on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to send data through</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">iov_iter</span> <span class="pre">*iter</span></code></dt><dd><p>The buffer to receive into</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">*_len</span></code></dt><dd><p>The amount of data we want to receive (decreased on return)</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bool</span> <span class="pre">want_more</span></code></dt><dd><p>True if more data is expected to be read</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u32</span> <span class="pre">*_abort</span></code></dt><dd><p>Where the abort code is stored if -ECONNABORTED is returned</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u16</span> <span class="pre">*_service</span></code></dt><dd><p>Where to store the actual service ID (may be upgraded)</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to receive data and pick up information about the
state of a call. Note that <strong>*_abort</strong> should also be initialised to <code class="docutils literal notranslate"><span class="pre">0</span></code>.</p>
<p>Note that we may return <code class="docutils literal notranslate"><span class="pre">-EAGAIN</span></code> to drain empty packets at the end
of the data, even if we’ve already copied over the requested data.</p>
<p><strong>Return</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">0</span></code> if got what was asked for and there’s more available, <code class="docutils literal notranslate"><span class="pre">1</span></code>
if we got what was asked for and we’re at the end of the data and
<code class="docutils literal notranslate"><span class="pre">-EAGAIN</span></code> if we need more data.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxgk_kernel_query_challenge">
<span class="n"><span class="pre">u32</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxgk_kernel_query_challenge</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">challenge</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxgk_kernel_query_challenge" title="Link to this definition">¶</a><br /></dt>
<dd><p>Query RxGK-specific challenge parameters</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span> <span class="pre">*challenge</span></code></dt><dd><p>The challenge packet to query</p>
</dd>
</dl>
<p><strong>Return</strong></p>
<p>The Kerberos 5 encoding type for the challenged connection.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxgk_kernel_respond_to_challenge">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxgk_kernel_respond_to_challenge</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">challenge</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">krb5_buffer</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">appdata</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxgk_kernel_respond_to_challenge" title="Link to this definition">¶</a><br /></dt>
<dd><p>Respond to a challenge with appdata</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span> <span class="pre">*challenge</span></code></dt><dd><p>The challenge to respond to</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">krb5_buffer</span> <span class="pre">*appdata</span></code></dt><dd><p>The application data to include in the RESPONSE authenticator</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel application to respond to a CHALLENGE with application data
to be included in the RxGK RESPONSE Authenticator.</p>
<p><strong>Return</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">0</span></code> if successful and a negative error code otherwise.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxkad_kernel_respond_to_challenge">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxkad_kernel_respond_to_challenge</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sk_buff" title="sk_buff"><span class="n"><span class="pre">sk_buff</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">challenge</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxkad_kernel_respond_to_challenge" title="Link to this definition">¶</a><br /></dt>
<dd><p>Respond to a challenge with appdata</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sk_buff</span> <span class="pre">*challenge</span></code></dt><dd><p>The challenge to respond to</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel application to respond to a CHALLENGE.</p>
<p><strong>Return</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">0</span></code> if successful and a negative error code otherwise.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_send_data">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_send_data</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">msghdr</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">msg</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="n"><span class="pre">len</span></span>, <span class="n"><span class="pre">rxrpc_notify_end_tx_t</span></span><span class="w"> </span><span class="n"><span class="pre">notify_end_tx</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_send_data" title="Link to this definition">¶</a><br /></dt>
<dd><p>Allow a kernel service to send data on a call</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket the call is on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to send data through</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">msghdr</span> <span class="pre">*msg</span></code></dt><dd><p>The data to send</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">size_t</span> <span class="pre">len</span></code></dt><dd><p>The amount of data to send</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">rxrpc_notify_end_tx_t</span> <span class="pre">notify_end_tx</span></code></dt><dd><p>Notification that the last packet is queued.</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to send data on a call. The call must be in an state
appropriate to sending data. No control data should be supplied in <strong>msg</strong>,
nor should an address be supplied. MSG_MORE should be flagged if there’s
more data to come, otherwise this data will end the transmission phase.</p>
<p><strong>Return</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">0</span></code> if successful and a negative error code otherwise.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_abort_call">
<span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_abort_call</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span>, <span class="n"><span class="pre">u32</span></span><span class="w"> </span><span class="n"><span class="pre">abort_code</span></span>, <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">error</span></span>, <span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_abort_reason</span></span><span class="w"> </span><span class="n"><span class="pre">why</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_abort_call" title="Link to this definition">¶</a><br /></dt>
<dd><p>Allow a kernel service to abort a call</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket the call is on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to be aborted</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">u32</span> <span class="pre">abort_code</span></code></dt><dd><p>The abort code to stick into the ABORT packet</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">int</span> <span class="pre">error</span></code></dt><dd><p>Local error value</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">enum</span> <span class="pre">rxrpc_abort_reason</span> <span class="pre">why</span></code></dt><dd><p>Indication as to why.</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to abort a call if it’s still in an abortable state.</p>
<p><strong>Return</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">true</span></code> if the call was aborted, <code class="docutils literal notranslate"><span class="pre">false</span></code> if it was already complete.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_kernel_set_tx_length">
<span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_kernel_set_tx_length</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.socket" title="socket"><span class="n"><span class="pre">socket</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sock</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">rxrpc_call</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">call</span></span>, <span class="n"><span class="pre">s64</span></span><span class="w"> </span><span class="n"><span class="pre">tx_total_len</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_kernel_set_tx_length" title="Link to this definition">¶</a><br /></dt>
<dd><p>Set the total Tx length on a call</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">socket</span> <span class="pre">*sock</span></code></dt><dd><p>The socket the call is on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">rxrpc_call</span> <span class="pre">*call</span></code></dt><dd><p>The call to be informed</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">s64</span> <span class="pre">tx_total_len</span></code></dt><dd><p>The amount of data to be transmitted for this call</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Allow a kernel service to set the total transmit length on a call. This
allows buffer-to-packet encrypt-and-copy to be performed.</p>
<p>This function is primarily for use for setting the reply length since the
request length can be set when beginning the call.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_sock_set_security_keyring">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_sock_set_security_keyring</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sock" title="sock"><span class="n"><span class="pre">sock</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sk</span></span>, <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">key</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">keyring</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_sock_set_security_keyring" title="Link to this definition">¶</a><br /></dt>
<dd><p>Set the security keyring for a kernel service</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sock</span> <span class="pre">*sk</span></code></dt><dd><p>The socket to set the keyring on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">key</span> <span class="pre">*keyring</span></code></dt><dd><p>The keyring to set</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Set the server security keyring on an rxrpc socket. This is used to provide
the encryption keys for a kernel service.</p>
<p><strong>Return</strong></p>
<p><code class="docutils literal notranslate"><span class="pre">0</span></code> if successful and a negative error code otherwise.</p>
</div>
<dl class="c function">
<dt class="sig sig-object c" id="c.rxrpc_sock_set_manage_response">
<span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">rxrpc_sock_set_manage_response</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="kapi.html#c.sock" title="sock"><span class="n"><span class="pre">sock</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">sk</span></span>, <span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="n"><span class="pre">set</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.rxrpc_sock_set_manage_response" title="Link to this definition">¶</a><br /></dt>
<dd><p>Set the manage-response flag for a kernel service</p>
</dd></dl>
<div class="kernelindent docutils container">
<p><strong>Parameters</strong></p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">sock</span> <span class="pre">*sk</span></code></dt><dd><p>The socket to set the keyring on</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">bool</span> <span class="pre">set</span></code></dt><dd><p>True to set, false to clear the flag</p>
</dd>
</dl>
<p><strong>Description</strong></p>
<p>Set the flag on an rxrpc socket to say that the caller wants to manage the
RESPONSE packet and the user-defined data it may contain. Setting this
means that <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">recvmsg()</span></code> will return messages with RXRPC_CHALLENGED in the
control message buffer containing information about the challenge.</p>
<p>The user should respond to the challenge by passing RXRPC_RESPOND or
RXRPC_RESPOND_ABORT control messages with <code class="xref c c-func broken_xref docutils literal notranslate"><span class="pre">sendmsg()</span></code> to the same call.
Supplementary control messages, such as RXRPC_RESP_RXGK_APPDATA, may be
included to indicate the parts the user wants to supply.</p>
<p>The server will be passed the response data with a RXRPC_RESPONDED control
message when it gets the first data from each call.</p>
<p>Note that this is only honoured by security classes that need auxiliary data
(e.g. RxGK). Those that don’t offer the facility (e.g. RxKAD) respond
without consulting userspace.</p>
<p><strong>Return</strong></p>
<p>The previous setting.</p>
</div>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../_sources/networking/rxrpc.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>