summaryrefslogtreecommitdiff
path: root/net/rxrpc/output.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-04-04 14:00:36 +0100
committerDavid Howells <dhowells@redhat.com>2016-06-22 09:09:59 +0100
commit19ffa01c9c45861ad6b181323e0d36904298e326 (patch)
treeb81cd9ec90ca2c51829ffe9f765fd7a6b26e5e7b /net/rxrpc/output.c
parent2f9f9f5210887b1019fbd0327ffdf7c3aff271fd (diff)
rxrpc: Use structs to hold connection params and protocol info
Define and use a structure to hold connection parameters. This makes it easier to pass multiple connection parameters around. Define and use a structure to hold protocol information used to hash a connection for lookup on incoming packet. Most of these fields will be disposed of eventually, including the duplicate local pointer. Whilst we're at it rename "proto" to "family" when referring to a protocol family. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/output.c')
-rw-r--r--net/rxrpc/output.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index e6fb3863b0bc..8c51745cccea 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -133,6 +133,7 @@ static struct rxrpc_call *
rxrpc_new_client_call_for_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg,
unsigned long user_call_ID)
{
+ struct rxrpc_conn_parameters cp;
struct rxrpc_conn_bundle *bundle;
struct rxrpc_transport *trans;
struct rxrpc_call *call;
@@ -146,23 +147,32 @@ rxrpc_new_client_call_for_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg,
if (!msg->msg_name)
return ERR_PTR(-EDESTADDRREQ);
- trans = rxrpc_name_to_transport(rx, msg->msg_name, msg->msg_namelen, 0,
+ key = rx->key;
+ if (key && !rx->key->payload.data[0])
+ key = NULL;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.local = rx->local;
+ cp.key = rx->key;
+ cp.security_level = rx->min_sec_level;
+ cp.exclusive = test_bit(RXRPC_SOCK_EXCLUSIVE_CONN, &rx->flags);
+ cp.service_id = srx->srx_service;
+ trans = rxrpc_name_to_transport(&cp, msg->msg_name, msg->msg_namelen,
GFP_KERNEL);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
goto out;
}
+ cp.peer = trans->peer;
- key = rx->key;
- if (key && !rx->key->payload.data[0])
- key = NULL;
- bundle = rxrpc_get_bundle(rx, trans, key, srx->srx_service, GFP_KERNEL);
+ bundle = rxrpc_get_bundle(rx, trans, cp.key, srx->srx_service,
+ GFP_KERNEL);
if (IS_ERR(bundle)) {
ret = PTR_ERR(bundle);
goto out_trans;
}
- call = rxrpc_new_client_call(rx, trans, bundle, user_call_ID,
+ call = rxrpc_new_client_call(rx, &cp, trans, bundle, user_call_ID,
GFP_KERNEL);
rxrpc_put_bundle(trans, bundle);
rxrpc_put_transport(trans);
@@ -664,7 +674,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
seq = atomic_inc_return(&call->sequence);
- sp->hdr.epoch = conn->epoch;
+ sp->hdr.epoch = conn->proto.epoch;
sp->hdr.cid = call->cid;
sp->hdr.callNumber = call->call_id;
sp->hdr.seq = seq;