David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 1 | /* RxRPC packet transmission |
| 2 | * |
| 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
Joe Perches | 9b6d539 | 2016-06-02 12:08:52 -0700 | [diff] [blame] | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 13 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 14 | #include <linux/net.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 15 | #include <linux/gfp.h> |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 16 | #include <linux/skbuff.h> |
Paul Gortmaker | bc3b2d7 | 2011-07-15 11:47:34 -0400 | [diff] [blame] | 17 | #include <linux/export.h> |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 18 | #include <net/sock.h> |
| 19 | #include <net/af_rxrpc.h> |
| 20 | #include "ar-internal.h" |
| 21 | |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 22 | struct rxrpc_pkt_buffer { |
| 23 | struct rxrpc_wire_header whdr; |
| 24 | union { |
| 25 | struct { |
| 26 | struct rxrpc_ackpacket ack; |
| 27 | u8 acks[255]; |
| 28 | u8 pad[3]; |
| 29 | }; |
| 30 | __be32 abort_code; |
| 31 | }; |
| 32 | struct rxrpc_ackinfo ackinfo; |
| 33 | }; |
| 34 | |
| 35 | /* |
| 36 | * Fill out an ACK packet. |
| 37 | */ |
| 38 | static size_t rxrpc_fill_out_ack(struct rxrpc_call *call, |
| 39 | struct rxrpc_pkt_buffer *pkt) |
| 40 | { |
David Howells | f3639df | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 41 | rxrpc_serial_t serial; |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 42 | rxrpc_seq_t hard_ack, top, seq; |
| 43 | int ix; |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 44 | u32 mtu, jmax; |
| 45 | u8 *ackp = pkt->acks; |
| 46 | |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 47 | /* Barrier against rxrpc_input_data(). */ |
David Howells | f3639df | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 48 | serial = call->ackr_serial; |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 49 | hard_ack = READ_ONCE(call->rx_hard_ack); |
| 50 | top = smp_load_acquire(&call->rx_top); |
| 51 | |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 52 | pkt->ack.bufferSpace = htons(8); |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 53 | pkt->ack.maxSkew = htons(call->ackr_skew); |
| 54 | pkt->ack.firstPacket = htonl(hard_ack + 1); |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 55 | pkt->ack.previousPacket = htonl(call->ackr_prev_seq); |
David Howells | f3639df | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 56 | pkt->ack.serial = htonl(serial); |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 57 | pkt->ack.reason = call->ackr_reason; |
| 58 | pkt->ack.nAcks = top - hard_ack; |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 59 | |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 60 | if (after(top, hard_ack)) { |
| 61 | seq = hard_ack + 1; |
| 62 | do { |
| 63 | ix = seq & RXRPC_RXTX_BUFF_MASK; |
| 64 | if (call->rxtx_buffer[ix]) |
| 65 | *ackp++ = RXRPC_ACK_TYPE_ACK; |
| 66 | else |
| 67 | *ackp++ = RXRPC_ACK_TYPE_NACK; |
| 68 | seq++; |
| 69 | } while (before_eq(seq, top)); |
| 70 | } |
| 71 | |
| 72 | mtu = call->conn->params.peer->if_mtu; |
| 73 | mtu -= call->conn->params.peer->hdrsize; |
David Howells | 75e4212 | 2016-09-13 22:36:22 +0100 | [diff] [blame] | 74 | jmax = (call->nr_jumbo_bad > 3) ? 1 : rxrpc_rx_jumbo_max; |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 75 | pkt->ackinfo.rxMTU = htonl(rxrpc_rx_mtu); |
| 76 | pkt->ackinfo.maxMTU = htonl(mtu); |
David Howells | 75e4212 | 2016-09-13 22:36:22 +0100 | [diff] [blame] | 77 | pkt->ackinfo.rwind = htonl(call->rx_winsize); |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 78 | pkt->ackinfo.jumbo_max = htonl(jmax); |
| 79 | |
David Howells | f3639df | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 80 | trace_rxrpc_tx_ack(call, hard_ack + 1, serial, call->ackr_reason, |
| 81 | top - hard_ack); |
| 82 | |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 83 | *ackp++ = 0; |
| 84 | *ackp++ = 0; |
| 85 | *ackp++ = 0; |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 86 | return top - hard_ack + 3; |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | /* |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 90 | * Send an ACK or ABORT call packet. |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 91 | */ |
| 92 | int rxrpc_send_call_packet(struct rxrpc_call *call, u8 type) |
| 93 | { |
| 94 | struct rxrpc_connection *conn = NULL; |
| 95 | struct rxrpc_pkt_buffer *pkt; |
| 96 | struct msghdr msg; |
| 97 | struct kvec iov[2]; |
| 98 | rxrpc_serial_t serial; |
| 99 | size_t len, n; |
| 100 | int ioc, ret; |
| 101 | u32 abort_code; |
| 102 | |
| 103 | _enter("%u,%s", call->debug_id, rxrpc_pkts[type]); |
| 104 | |
| 105 | spin_lock_bh(&call->lock); |
| 106 | if (call->conn) |
| 107 | conn = rxrpc_get_connection_maybe(call->conn); |
| 108 | spin_unlock_bh(&call->lock); |
| 109 | if (!conn) |
| 110 | return -ECONNRESET; |
| 111 | |
| 112 | pkt = kzalloc(sizeof(*pkt), GFP_KERNEL); |
| 113 | if (!pkt) { |
| 114 | rxrpc_put_connection(conn); |
| 115 | return -ENOMEM; |
| 116 | } |
| 117 | |
| 118 | serial = atomic_inc_return(&conn->serial); |
| 119 | |
| 120 | msg.msg_name = &call->peer->srx.transport; |
| 121 | msg.msg_namelen = call->peer->srx.transport_len; |
| 122 | msg.msg_control = NULL; |
| 123 | msg.msg_controllen = 0; |
| 124 | msg.msg_flags = 0; |
| 125 | |
| 126 | pkt->whdr.epoch = htonl(conn->proto.epoch); |
| 127 | pkt->whdr.cid = htonl(call->cid); |
| 128 | pkt->whdr.callNumber = htonl(call->call_id); |
| 129 | pkt->whdr.seq = 0; |
| 130 | pkt->whdr.serial = htonl(serial); |
| 131 | pkt->whdr.type = type; |
| 132 | pkt->whdr.flags = conn->out_clientflag; |
| 133 | pkt->whdr.userStatus = 0; |
| 134 | pkt->whdr.securityIndex = call->security_ix; |
| 135 | pkt->whdr._rsvd = 0; |
| 136 | pkt->whdr.serviceId = htons(call->service_id); |
| 137 | |
| 138 | iov[0].iov_base = pkt; |
| 139 | iov[0].iov_len = sizeof(pkt->whdr); |
| 140 | len = sizeof(pkt->whdr); |
| 141 | |
| 142 | switch (type) { |
| 143 | case RXRPC_PACKET_TYPE_ACK: |
| 144 | spin_lock_bh(&call->lock); |
David Howells | 27d0fc4 | 2016-09-17 10:49:13 +0100 | [diff] [blame] | 145 | if (!call->ackr_reason) { |
| 146 | spin_unlock_bh(&call->lock); |
| 147 | ret = 0; |
| 148 | goto out; |
| 149 | } |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 150 | n = rxrpc_fill_out_ack(call, pkt); |
| 151 | call->ackr_reason = 0; |
| 152 | |
| 153 | spin_unlock_bh(&call->lock); |
| 154 | |
| 155 | _proto("Tx ACK %%%u { m=%hu f=#%u p=#%u s=%%%u r=%s n=%u }", |
| 156 | serial, |
| 157 | ntohs(pkt->ack.maxSkew), |
| 158 | ntohl(pkt->ack.firstPacket), |
| 159 | ntohl(pkt->ack.previousPacket), |
| 160 | ntohl(pkt->ack.serial), |
| 161 | rxrpc_acks(pkt->ack.reason), |
| 162 | pkt->ack.nAcks); |
| 163 | |
| 164 | iov[0].iov_len += sizeof(pkt->ack) + n; |
| 165 | iov[1].iov_base = &pkt->ackinfo; |
| 166 | iov[1].iov_len = sizeof(pkt->ackinfo); |
| 167 | len += sizeof(pkt->ack) + n + sizeof(pkt->ackinfo); |
| 168 | ioc = 2; |
| 169 | break; |
| 170 | |
| 171 | case RXRPC_PACKET_TYPE_ABORT: |
| 172 | abort_code = call->abort_code; |
| 173 | pkt->abort_code = htonl(abort_code); |
| 174 | _proto("Tx ABORT %%%u { %d }", serial, abort_code); |
| 175 | iov[0].iov_len += sizeof(pkt->abort_code); |
| 176 | len += sizeof(pkt->abort_code); |
| 177 | ioc = 1; |
| 178 | break; |
| 179 | |
| 180 | default: |
| 181 | BUG(); |
| 182 | ret = -ENOANO; |
| 183 | goto out; |
| 184 | } |
| 185 | |
| 186 | ret = kernel_sendmsg(conn->params.local->socket, |
| 187 | &msg, iov, ioc, len); |
| 188 | |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 189 | if (ret < 0 && call->state < RXRPC_CALL_COMPLETE) { |
David Howells | 2311e32 | 2016-09-17 10:49:12 +0100 | [diff] [blame] | 190 | switch (type) { |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 191 | case RXRPC_PACKET_TYPE_ACK: |
| 192 | rxrpc_propose_ACK(call, pkt->ack.reason, |
| 193 | ntohs(pkt->ack.maxSkew), |
| 194 | ntohl(pkt->ack.serial), |
| 195 | true, true); |
| 196 | break; |
| 197 | case RXRPC_PACKET_TYPE_ABORT: |
| 198 | break; |
| 199 | } |
| 200 | } |
| 201 | |
David Howells | 8d94aa3 | 2016-09-07 09:19:31 +0100 | [diff] [blame] | 202 | out: |
| 203 | rxrpc_put_connection(conn); |
| 204 | kfree(pkt); |
| 205 | return ret; |
| 206 | } |
| 207 | |
David Howells | 5873c08 | 2014-02-07 18:58:44 +0000 | [diff] [blame] | 208 | /* |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 209 | * send a packet through the transport endpoint |
| 210 | */ |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 211 | int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 212 | { |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 213 | struct rxrpc_connection *conn = call->conn; |
| 214 | struct rxrpc_wire_header whdr; |
| 215 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 216 | struct msghdr msg; |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 217 | struct kvec iov[2]; |
| 218 | rxrpc_serial_t serial; |
| 219 | size_t len; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 220 | int ret, opt; |
| 221 | |
| 222 | _enter(",{%d}", skb->len); |
| 223 | |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 224 | /* Each transmission of a Tx packet needs a new serial number */ |
| 225 | serial = atomic_inc_return(&conn->serial); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 226 | |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 227 | whdr.epoch = htonl(conn->proto.epoch); |
| 228 | whdr.cid = htonl(call->cid); |
| 229 | whdr.callNumber = htonl(call->call_id); |
| 230 | whdr.seq = htonl(sp->hdr.seq); |
| 231 | whdr.serial = htonl(serial); |
| 232 | whdr.type = RXRPC_PACKET_TYPE_DATA; |
| 233 | whdr.flags = sp->hdr.flags; |
| 234 | whdr.userStatus = 0; |
| 235 | whdr.securityIndex = call->security_ix; |
| 236 | whdr._rsvd = htons(sp->hdr._rsvd); |
| 237 | whdr.serviceId = htons(call->service_id); |
| 238 | |
| 239 | iov[0].iov_base = &whdr; |
| 240 | iov[0].iov_len = sizeof(whdr); |
| 241 | iov[1].iov_base = skb->head; |
| 242 | iov[1].iov_len = skb->len; |
| 243 | len = iov[0].iov_len + iov[1].iov_len; |
| 244 | |
| 245 | msg.msg_name = &call->peer->srx.transport; |
| 246 | msg.msg_namelen = call->peer->srx.transport_len; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 247 | msg.msg_control = NULL; |
| 248 | msg.msg_controllen = 0; |
| 249 | msg.msg_flags = 0; |
| 250 | |
David Howells | 8a681c36 | 2016-09-17 10:49:15 +0100 | [diff] [blame] | 251 | if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) { |
| 252 | static int lose; |
| 253 | if ((lose++ & 7) == 7) { |
| 254 | rxrpc_lose_skb(skb, rxrpc_skb_tx_lost); |
| 255 | _leave(" = 0 [lose]"); |
| 256 | return 0; |
| 257 | } |
| 258 | } |
| 259 | |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 260 | _proto("Tx DATA %%%u { #%u }", serial, sp->hdr.seq); |
| 261 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 262 | /* send the packet with the don't fragment bit set if we currently |
| 263 | * think it's small enough */ |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 264 | if (iov[1].iov_len >= call->peer->maxdata) |
| 265 | goto send_fragmentable; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 266 | |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 267 | down_read(&conn->params.local->defrag_sem); |
| 268 | /* send the packet by UDP |
| 269 | * - returns -EMSGSIZE if UDP would have to fragment the packet |
| 270 | * to go out of the interface |
| 271 | * - in which case, we'll have processed the ICMP error |
| 272 | * message and update the peer record |
| 273 | */ |
| 274 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 275 | |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 276 | up_read(&conn->params.local->defrag_sem); |
| 277 | if (ret == -EMSGSIZE) |
| 278 | goto send_fragmentable; |
| 279 | |
| 280 | done: |
| 281 | if (ret == 0) { |
| 282 | sp->resend_at = jiffies + rxrpc_resend_timeout; |
| 283 | sp->hdr.serial = serial; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 284 | } |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 285 | _leave(" = %d [%u]", ret, call->peer->maxdata); |
| 286 | return ret; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 287 | |
| 288 | send_fragmentable: |
| 289 | /* attempt to send this message with fragmentation enabled */ |
| 290 | _debug("send fragment"); |
| 291 | |
David Howells | 985a5c8 | 2016-06-17 11:53:37 +0100 | [diff] [blame] | 292 | down_write(&conn->params.local->defrag_sem); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 293 | |
David Howells | 985a5c8 | 2016-06-17 11:53:37 +0100 | [diff] [blame] | 294 | switch (conn->params.local->srx.transport.family) { |
| 295 | case AF_INET: |
| 296 | opt = IP_PMTUDISC_DONT; |
| 297 | ret = kernel_setsockopt(conn->params.local->socket, |
| 298 | SOL_IP, IP_MTU_DISCOVER, |
| 299 | (char *)&opt, sizeof(opt)); |
| 300 | if (ret == 0) { |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 301 | ret = kernel_sendmsg(conn->params.local->socket, &msg, |
| 302 | iov, 2, len); |
David Howells | 985a5c8 | 2016-06-17 11:53:37 +0100 | [diff] [blame] | 303 | |
| 304 | opt = IP_PMTUDISC_DO; |
| 305 | kernel_setsockopt(conn->params.local->socket, SOL_IP, |
| 306 | IP_MTU_DISCOVER, |
| 307 | (char *)&opt, sizeof(opt)); |
| 308 | } |
| 309 | break; |
David Howells | 75b54cb | 2016-09-13 08:49:05 +0100 | [diff] [blame] | 310 | |
David Howells | d191274 | 2016-09-17 07:26:01 +0100 | [diff] [blame] | 311 | #ifdef CONFIG_AF_RXRPC_IPV6 |
David Howells | 75b54cb | 2016-09-13 08:49:05 +0100 | [diff] [blame] | 312 | case AF_INET6: |
| 313 | opt = IPV6_PMTUDISC_DONT; |
| 314 | ret = kernel_setsockopt(conn->params.local->socket, |
| 315 | SOL_IPV6, IPV6_MTU_DISCOVER, |
| 316 | (char *)&opt, sizeof(opt)); |
| 317 | if (ret == 0) { |
| 318 | ret = kernel_sendmsg(conn->params.local->socket, &msg, |
| 319 | iov, 1, iov[0].iov_len); |
| 320 | |
| 321 | opt = IPV6_PMTUDISC_DO; |
| 322 | kernel_setsockopt(conn->params.local->socket, |
| 323 | SOL_IPV6, IPV6_MTU_DISCOVER, |
| 324 | (char *)&opt, sizeof(opt)); |
| 325 | } |
| 326 | break; |
David Howells | d191274 | 2016-09-17 07:26:01 +0100 | [diff] [blame] | 327 | #endif |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 328 | } |
| 329 | |
David Howells | 985a5c8 | 2016-06-17 11:53:37 +0100 | [diff] [blame] | 330 | up_write(&conn->params.local->defrag_sem); |
David Howells | 5a924b8 | 2016-09-22 00:29:31 +0100 | [diff] [blame^] | 331 | goto done; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 332 | } |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 333 | |
| 334 | /* |
| 335 | * reject packets through the local endpoint |
| 336 | */ |
| 337 | void rxrpc_reject_packets(struct rxrpc_local *local) |
| 338 | { |
David Howells | 1c2bc7b | 2016-09-13 08:49:05 +0100 | [diff] [blame] | 339 | struct sockaddr_rxrpc srx; |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 340 | struct rxrpc_skb_priv *sp; |
| 341 | struct rxrpc_wire_header whdr; |
| 342 | struct sk_buff *skb; |
| 343 | struct msghdr msg; |
| 344 | struct kvec iov[2]; |
| 345 | size_t size; |
| 346 | __be32 code; |
| 347 | |
| 348 | _enter("%d", local->debug_id); |
| 349 | |
| 350 | iov[0].iov_base = &whdr; |
| 351 | iov[0].iov_len = sizeof(whdr); |
| 352 | iov[1].iov_base = &code; |
| 353 | iov[1].iov_len = sizeof(code); |
| 354 | size = sizeof(whdr) + sizeof(code); |
| 355 | |
David Howells | 1c2bc7b | 2016-09-13 08:49:05 +0100 | [diff] [blame] | 356 | msg.msg_name = &srx.transport; |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 357 | msg.msg_control = NULL; |
| 358 | msg.msg_controllen = 0; |
| 359 | msg.msg_flags = 0; |
| 360 | |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 361 | memset(&whdr, 0, sizeof(whdr)); |
| 362 | whdr.type = RXRPC_PACKET_TYPE_ABORT; |
| 363 | |
| 364 | while ((skb = skb_dequeue(&local->reject_queue))) { |
David Howells | 71f3ca4 | 2016-09-17 10:49:14 +0100 | [diff] [blame] | 365 | rxrpc_see_skb(skb, rxrpc_skb_rx_seen); |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 366 | sp = rxrpc_skb(skb); |
David Howells | 1c2bc7b | 2016-09-13 08:49:05 +0100 | [diff] [blame] | 367 | |
| 368 | if (rxrpc_extract_addr_from_skb(&srx, skb) == 0) { |
| 369 | msg.msg_namelen = srx.transport_len; |
| 370 | |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 371 | code = htonl(skb->priority); |
| 372 | |
| 373 | whdr.epoch = htonl(sp->hdr.epoch); |
| 374 | whdr.cid = htonl(sp->hdr.cid); |
| 375 | whdr.callNumber = htonl(sp->hdr.callNumber); |
| 376 | whdr.serviceId = htons(sp->hdr.serviceId); |
| 377 | whdr.flags = sp->hdr.flags; |
| 378 | whdr.flags ^= RXRPC_CLIENT_INITIATED; |
| 379 | whdr.flags &= RXRPC_CLIENT_INITIATED; |
| 380 | |
| 381 | kernel_sendmsg(local->socket, &msg, iov, 2, size); |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 382 | } |
| 383 | |
David Howells | 71f3ca4 | 2016-09-17 10:49:14 +0100 | [diff] [blame] | 384 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | _leave(""); |
| 388 | } |