Changes in 4.9.214 media: iguanair: fix endpoint sanity check x86/cpu: Update cached HLE state on write to TSX_CTRL_CPUID_CLEAR sparc32: fix struct ipc64_perm type definition ASoC: qcom: Fix of-node refcount unbalance to link->codec_of_node cls_rsvp: fix rsvp_policy gtp: use __GFP_NOWARN to avoid memalloc warning net: hsr: fix possible NULL deref in hsr_handle_frame() net_sched: fix an OOB access in cls_tcindex rxrpc: Fix insufficient receive notification generation rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect tcp: clear tp->total_retrans in tcp_disconnect() tcp: clear tp->delivered in tcp_disconnect() tcp: clear tp->data_segs{in|out} in tcp_disconnect() tcp: clear tp->segs_{in|out} in tcp_disconnect() media: uvcvideo: Avoid cyclic entity chains due to malformed USB descriptors mfd: dln2: More sanity checking for endpoints brcmfmac: Fix memory leak in brcmf_usbdev_qinit usb: gadget: legacy: set max_speed to super-speed usb: gadget: f_ncm: Use atomic_t to track in-flight request usb: gadget: f_ecm: Use atomic_t to track in-flight request ALSA: dummy: Fix PCM format loop in proc output media/v4l2-core: set pages dirty upon releasing DMA buffers media: v4l2-rect.h: fix v4l2_rect_map_inside() top/left adjustments lib/test_kasan.c: fix memory leak in kmalloc_oob_krealloc_more() powerpc/pseries: Advance pfn if section is not present in lmb_is_removable() mmc: spi: Toggle SPI polarity, do not hardcode it PCI: keystone: Fix link training retries initiation ubifs: Change gfp flags in page allocation for bulk read ubifs: Fix deadlock in concurrent bulk-read and writepage crypto: api - Check spawn->alg under lock in crypto_drop_spawn scsi: qla2xxx: Fix mtcp dump collection failure power: supply: ltc2941-battery-gauge: fix use-after-free of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc dm space map common: fix to ensure new block isn't already in use crypto: pcrypt - Do not clear MAY_SLEEP flag in original request crypto: atmel-aes - Fix counter overflow in CTR mode crypto: api - Fix race condition in crypto_spawn_alg crypto: picoxcell - adjust the position of tasklet_init and fix missed tasklet_kill btrfs: set trans->drity in btrfs_commit_transaction ARM: tegra: Enable PLLP bypass during Tegra124 LP1 mwifiex: fix unbalanced locking in mwifiex_process_country_ie() sunrpc: expiry_time should be seconds not timeval KVM: x86: Refactor prefix decoding to prevent Spectre-v1/L1TF attacks KVM: x86: Protect DR-based index computations from Spectre-v1/L1TF attacks KVM: x86: Protect kvm_lapic_reg_write() from Spectre-v1/L1TF attacks KVM: x86: Protect kvm_hv_msr_[get|set]_crash_data() from Spectre-v1/L1TF attacks KVM: x86: Protect ioapic_write_indirect() from Spectre-v1/L1TF attacks KVM: x86: Protect MSR-based index computations in pmu.h from Spectre-v1/L1TF attacks KVM: x86: Protect ioapic_read_indirect() from Spectre-v1/L1TF attacks KVM: x86: Protect MSR-based index computations from Spectre-v1/L1TF attacks in x86.c KVM: x86: Protect x86_decode_insn from Spectre-v1/L1TF attacks KVM: x86: Protect MSR-based index computations in fixed_msr_to_seg_unit() from Spectre-v1/L1TF attacks KVM: PPC: Book3S HV: Uninit vCPU if vcore creation fails KVM: PPC: Book3S PR: Free shared page if mmu initialization fails KVM: x86: Free wbinvd_dirty_mask if vCPU creation fails clk: tegra: Mark fuse clock as critical scsi: qla2xxx: Fix the endianness of the qla82xx_get_fw_size() return type scsi: csiostor: Adjust indentation in csio_device_reset scsi: qla4xxx: Adjust indentation in qla4xxx_mem_free ext2: Adjust indentation in ext2_fill_super powerpc/44x: Adjust indentation in ibm4xx_denali_fixup_memsize NFC: pn544: Adjust indentation in pn544_hci_check_presence ppp: Adjust indentation into ppp_async_input net: smc911x: Adjust indentation in smc911x_phy_configure net: tulip: Adjust indentation in {dmfe, uli526x}_init_module IB/mlx5: Fix outstanding_pi index for GSI qps nfsd: fix delay timer on 32-bit architectures nfsd: fix jiffies/time_t mixup in LRU list ubi: fastmap: Fix inverted logic in seen selfcheck ubi: Fix an error pointer dereference in error handling code mfd: da9062: Fix watchdog compatible string mfd: rn5t618: Mark ADC control register volatile net: systemport: Avoid RBUF stuck in Wake-on-LAN mode bonding/alb: properly access headers in bond_alb_xmit() NFS: switch back to to ->iterate() NFS: Fix memory leaks and corruption in readdir NFS: Fix bool initialization/comparison NFS: Directory page cache pages need to be locked when read ext4: fix deadlock allocating crypto bounce page from mempool Btrfs: fix assertion failure on fsync with NO_HOLES enabled btrfs: use bool argument in free_root_pointers() btrfs: remove trivial locking wrappers of tree mod log Btrfs: fix race between adding and putting tree mod seq elements and nodes drm: atmel-hlcdc: enable clock before configuring timing engine KVM: x86: Protect pmu_intel.c from Spectre-v1/L1TF attacks btrfs: flush write bio if we loop in extent_write_cache_pages KVM: x86/mmu: Apply max PA check for MMIO sptes to 32-bit KVM KVM: VMX: Add non-canonical check on writes to RTIT address MSRs KVM: nVMX: vmread should not set rflags to specify success in case of #PF cifs: fail i/o on soft mounts if sessionsetup errors out clocksource: Prevent double add_timer_on() for watchdog_timer perf/core: Fix mlock accounting in perf_mmap() rxrpc: Fix service call disconnection ASoC: pcm: update FE/BE trigger order based on the command RDMA/netlink: Do not always generate an ACK for some netlink operations scsi: ufs: Fix ufshcd_probe_hba() reture value in case ufshcd_scsi_add_wlus() fails PCI: Don't disable bridge BARs when assigning bus resources nfs: NFS_SWAP should depend on SWAP NFSv4: try lease recovery on NFS4ERR_EXPIRED rtc: hym8563: Return -EINVAL if the time is known to be invalid rtc: cmos: Stop using shared IRQ ARC: [plat-axs10x]: Add missing multicast filter number to GMAC node ARM: dts: at91: sama5d3: fix maximum peripheral clock rates ARM: dts: at91: sama5d3: define clock rate range for tcb1 tools/power/acpi: fix compilation error powerpc/pseries: Allow not having ibm, hypertas-functions::hcall-multi-tce for DDW pinctrl: sh-pfc: r8a7778: Fix duplicate SDSELF_B and SD1_CLK_B scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state dm: fix potential for q->make_request_fn NULL pointer mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status() mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv() libertas: don't exit from lbs_ibss_join_existing() with RCU read lock held libertas: make lbs_ibss_join_existing() return error code on rates overflow Linux 4.9.214 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ieac421e286126a690fd2c206ea7b4dde45e4a475
459 lines
12 KiB
C
459 lines
12 KiB
C
/* RxRPC packet transmission
|
|
*
|
|
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
#include <linux/net.h>
|
|
#include <linux/gfp.h>
|
|
#include <linux/skbuff.h>
|
|
#include <linux/export.h>
|
|
#include <net/sock.h>
|
|
#include <net/af_rxrpc.h>
|
|
#include "ar-internal.h"
|
|
|
|
struct rxrpc_ack_buffer {
|
|
struct rxrpc_wire_header whdr;
|
|
struct rxrpc_ackpacket ack;
|
|
u8 acks[255];
|
|
u8 pad[3];
|
|
struct rxrpc_ackinfo ackinfo;
|
|
};
|
|
|
|
struct rxrpc_abort_buffer {
|
|
struct rxrpc_wire_header whdr;
|
|
__be32 abort_code;
|
|
};
|
|
|
|
/*
|
|
* Fill out an ACK packet.
|
|
*/
|
|
static size_t rxrpc_fill_out_ack(struct rxrpc_call *call,
|
|
struct rxrpc_ack_buffer *pkt,
|
|
rxrpc_seq_t *_hard_ack,
|
|
rxrpc_seq_t *_top,
|
|
u8 reason)
|
|
{
|
|
rxrpc_serial_t serial;
|
|
rxrpc_seq_t hard_ack, top, seq;
|
|
int ix;
|
|
u32 mtu, jmax;
|
|
u8 *ackp = pkt->acks;
|
|
|
|
/* Barrier against rxrpc_input_data(). */
|
|
serial = call->ackr_serial;
|
|
hard_ack = READ_ONCE(call->rx_hard_ack);
|
|
top = smp_load_acquire(&call->rx_top);
|
|
*_hard_ack = hard_ack;
|
|
*_top = top;
|
|
|
|
pkt->ack.bufferSpace = htons(8);
|
|
pkt->ack.maxSkew = htons(call->ackr_skew);
|
|
pkt->ack.firstPacket = htonl(hard_ack + 1);
|
|
pkt->ack.previousPacket = htonl(call->ackr_prev_seq);
|
|
pkt->ack.serial = htonl(serial);
|
|
pkt->ack.reason = reason;
|
|
pkt->ack.nAcks = top - hard_ack;
|
|
|
|
if (reason == RXRPC_ACK_PING)
|
|
pkt->whdr.flags |= RXRPC_REQUEST_ACK;
|
|
|
|
if (after(top, hard_ack)) {
|
|
seq = hard_ack + 1;
|
|
do {
|
|
ix = seq & RXRPC_RXTX_BUFF_MASK;
|
|
if (call->rxtx_buffer[ix])
|
|
*ackp++ = RXRPC_ACK_TYPE_ACK;
|
|
else
|
|
*ackp++ = RXRPC_ACK_TYPE_NACK;
|
|
seq++;
|
|
} while (before_eq(seq, top));
|
|
}
|
|
|
|
mtu = call->conn->params.peer->if_mtu;
|
|
mtu -= call->conn->params.peer->hdrsize;
|
|
jmax = (call->nr_jumbo_bad > 3) ? 1 : rxrpc_rx_jumbo_max;
|
|
pkt->ackinfo.rxMTU = htonl(rxrpc_rx_mtu);
|
|
pkt->ackinfo.maxMTU = htonl(mtu);
|
|
pkt->ackinfo.rwind = htonl(call->rx_winsize);
|
|
pkt->ackinfo.jumbo_max = htonl(jmax);
|
|
|
|
*ackp++ = 0;
|
|
*ackp++ = 0;
|
|
*ackp++ = 0;
|
|
return top - hard_ack + 3;
|
|
}
|
|
|
|
/*
|
|
* Send an ACK call packet.
|
|
*/
|
|
int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping)
|
|
{
|
|
struct rxrpc_connection *conn;
|
|
struct rxrpc_ack_buffer *pkt;
|
|
struct msghdr msg;
|
|
struct kvec iov[2];
|
|
rxrpc_serial_t serial;
|
|
rxrpc_seq_t hard_ack, top;
|
|
size_t len, n;
|
|
int ret;
|
|
u8 reason;
|
|
|
|
if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
|
|
return -ECONNRESET;
|
|
|
|
pkt = kzalloc(sizeof(*pkt), GFP_KERNEL);
|
|
if (!pkt)
|
|
return -ENOMEM;
|
|
|
|
conn = call->conn;
|
|
|
|
msg.msg_name = &call->peer->srx.transport;
|
|
msg.msg_namelen = call->peer->srx.transport_len;
|
|
msg.msg_control = NULL;
|
|
msg.msg_controllen = 0;
|
|
msg.msg_flags = 0;
|
|
|
|
pkt->whdr.epoch = htonl(conn->proto.epoch);
|
|
pkt->whdr.cid = htonl(call->cid);
|
|
pkt->whdr.callNumber = htonl(call->call_id);
|
|
pkt->whdr.seq = 0;
|
|
pkt->whdr.type = RXRPC_PACKET_TYPE_ACK;
|
|
pkt->whdr.flags = RXRPC_SLOW_START_OK | conn->out_clientflag;
|
|
pkt->whdr.userStatus = 0;
|
|
pkt->whdr.securityIndex = call->security_ix;
|
|
pkt->whdr._rsvd = 0;
|
|
pkt->whdr.serviceId = htons(call->service_id);
|
|
|
|
spin_lock_bh(&call->lock);
|
|
if (ping) {
|
|
reason = RXRPC_ACK_PING;
|
|
} else {
|
|
reason = call->ackr_reason;
|
|
if (!call->ackr_reason) {
|
|
spin_unlock_bh(&call->lock);
|
|
ret = 0;
|
|
goto out;
|
|
}
|
|
call->ackr_reason = 0;
|
|
}
|
|
n = rxrpc_fill_out_ack(call, pkt, &hard_ack, &top, reason);
|
|
|
|
spin_unlock_bh(&call->lock);
|
|
|
|
iov[0].iov_base = pkt;
|
|
iov[0].iov_len = sizeof(pkt->whdr) + sizeof(pkt->ack) + n;
|
|
iov[1].iov_base = &pkt->ackinfo;
|
|
iov[1].iov_len = sizeof(pkt->ackinfo);
|
|
len = iov[0].iov_len + iov[1].iov_len;
|
|
|
|
serial = atomic_inc_return(&conn->serial);
|
|
pkt->whdr.serial = htonl(serial);
|
|
trace_rxrpc_tx_ack(call, serial,
|
|
ntohl(pkt->ack.firstPacket),
|
|
ntohl(pkt->ack.serial),
|
|
pkt->ack.reason, pkt->ack.nAcks);
|
|
|
|
if (ping) {
|
|
call->ping_serial = serial;
|
|
smp_wmb();
|
|
/* We need to stick a time in before we send the packet in case
|
|
* the reply gets back before kernel_sendmsg() completes - but
|
|
* asking UDP to send the packet can take a relatively long
|
|
* time, so we update the time after, on the assumption that
|
|
* the packet transmission is more likely to happen towards the
|
|
* end of the kernel_sendmsg() call.
|
|
*/
|
|
call->ping_time = ktime_get_real();
|
|
set_bit(RXRPC_CALL_PINGING, &call->flags);
|
|
trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial);
|
|
}
|
|
|
|
ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
|
|
if (ping)
|
|
call->ping_time = ktime_get_real();
|
|
|
|
if (call->state < RXRPC_CALL_COMPLETE) {
|
|
if (ret < 0) {
|
|
if (ping)
|
|
clear_bit(RXRPC_CALL_PINGING, &call->flags);
|
|
rxrpc_propose_ACK(call, pkt->ack.reason,
|
|
ntohs(pkt->ack.maxSkew),
|
|
ntohl(pkt->ack.serial),
|
|
true, true,
|
|
rxrpc_propose_ack_retry_tx);
|
|
} else {
|
|
spin_lock_bh(&call->lock);
|
|
if (after(hard_ack, call->ackr_consumed))
|
|
call->ackr_consumed = hard_ack;
|
|
if (after(top, call->ackr_seen))
|
|
call->ackr_seen = top;
|
|
spin_unlock_bh(&call->lock);
|
|
}
|
|
}
|
|
|
|
out:
|
|
kfree(pkt);
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* Send an ABORT call packet.
|
|
*/
|
|
int rxrpc_send_abort_packet(struct rxrpc_call *call)
|
|
{
|
|
struct rxrpc_connection *conn;
|
|
struct rxrpc_abort_buffer pkt;
|
|
struct msghdr msg;
|
|
struct kvec iov[1];
|
|
rxrpc_serial_t serial;
|
|
int ret;
|
|
|
|
if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags))
|
|
return -ECONNRESET;
|
|
|
|
conn = call->conn;
|
|
|
|
msg.msg_name = &call->peer->srx.transport;
|
|
msg.msg_namelen = call->peer->srx.transport_len;
|
|
msg.msg_control = NULL;
|
|
msg.msg_controllen = 0;
|
|
msg.msg_flags = 0;
|
|
|
|
pkt.whdr.epoch = htonl(conn->proto.epoch);
|
|
pkt.whdr.cid = htonl(call->cid);
|
|
pkt.whdr.callNumber = htonl(call->call_id);
|
|
pkt.whdr.seq = 0;
|
|
pkt.whdr.type = RXRPC_PACKET_TYPE_ABORT;
|
|
pkt.whdr.flags = conn->out_clientflag;
|
|
pkt.whdr.userStatus = 0;
|
|
pkt.whdr.securityIndex = call->security_ix;
|
|
pkt.whdr._rsvd = 0;
|
|
pkt.whdr.serviceId = htons(call->service_id);
|
|
pkt.abort_code = htonl(call->abort_code);
|
|
|
|
iov[0].iov_base = &pkt;
|
|
iov[0].iov_len = sizeof(pkt);
|
|
|
|
serial = atomic_inc_return(&conn->serial);
|
|
pkt.whdr.serial = htonl(serial);
|
|
|
|
ret = kernel_sendmsg(conn->params.local->socket,
|
|
&msg, iov, 1, sizeof(pkt));
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* send a packet through the transport endpoint
|
|
*/
|
|
int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
|
|
bool retrans)
|
|
{
|
|
struct rxrpc_connection *conn = call->conn;
|
|
struct rxrpc_wire_header whdr;
|
|
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
|
|
struct msghdr msg;
|
|
struct kvec iov[2];
|
|
rxrpc_serial_t serial;
|
|
size_t len;
|
|
bool lost = false;
|
|
int ret, opt;
|
|
|
|
_enter(",{%d}", skb->len);
|
|
|
|
/* Each transmission of a Tx packet needs a new serial number */
|
|
serial = atomic_inc_return(&conn->serial);
|
|
|
|
whdr.epoch = htonl(conn->proto.epoch);
|
|
whdr.cid = htonl(call->cid);
|
|
whdr.callNumber = htonl(call->call_id);
|
|
whdr.seq = htonl(sp->hdr.seq);
|
|
whdr.serial = htonl(serial);
|
|
whdr.type = RXRPC_PACKET_TYPE_DATA;
|
|
whdr.flags = sp->hdr.flags;
|
|
whdr.userStatus = 0;
|
|
whdr.securityIndex = call->security_ix;
|
|
whdr._rsvd = htons(sp->hdr._rsvd);
|
|
whdr.serviceId = htons(call->service_id);
|
|
|
|
iov[0].iov_base = &whdr;
|
|
iov[0].iov_len = sizeof(whdr);
|
|
iov[1].iov_base = skb->head;
|
|
iov[1].iov_len = skb->len;
|
|
len = iov[0].iov_len + iov[1].iov_len;
|
|
|
|
msg.msg_name = &call->peer->srx.transport;
|
|
msg.msg_namelen = call->peer->srx.transport_len;
|
|
msg.msg_control = NULL;
|
|
msg.msg_controllen = 0;
|
|
msg.msg_flags = 0;
|
|
|
|
/* If our RTT cache needs working on, request an ACK. Also request
|
|
* ACKs if a DATA packet appears to have been lost.
|
|
*/
|
|
if (!(sp->hdr.flags & RXRPC_LAST_PACKET) &&
|
|
(retrans ||
|
|
call->cong_mode == RXRPC_CALL_SLOW_START ||
|
|
(call->peer->rtt_usage < 3 && sp->hdr.seq & 1) ||
|
|
ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000),
|
|
ktime_get_real())))
|
|
whdr.flags |= RXRPC_REQUEST_ACK;
|
|
|
|
if (IS_ENABLED(CONFIG_AF_RXRPC_INJECT_LOSS)) {
|
|
static int lose;
|
|
if ((lose++ & 7) == 7) {
|
|
ret = 0;
|
|
lost = true;
|
|
goto done;
|
|
}
|
|
}
|
|
|
|
_proto("Tx DATA %%%u { #%u }", serial, sp->hdr.seq);
|
|
|
|
/* send the packet with the don't fragment bit set if we currently
|
|
* think it's small enough */
|
|
if (iov[1].iov_len >= call->peer->maxdata)
|
|
goto send_fragmentable;
|
|
|
|
down_read(&conn->params.local->defrag_sem);
|
|
/* send the packet by UDP
|
|
* - returns -EMSGSIZE if UDP would have to fragment the packet
|
|
* to go out of the interface
|
|
* - in which case, we'll have processed the ICMP error
|
|
* message and update the peer record
|
|
*/
|
|
ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
|
|
|
|
up_read(&conn->params.local->defrag_sem);
|
|
if (ret == -EMSGSIZE)
|
|
goto send_fragmentable;
|
|
|
|
done:
|
|
trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags,
|
|
retrans, lost);
|
|
if (ret >= 0) {
|
|
ktime_t now = ktime_get_real();
|
|
skb->tstamp = now;
|
|
smp_wmb();
|
|
sp->hdr.serial = serial;
|
|
if (whdr.flags & RXRPC_REQUEST_ACK) {
|
|
call->peer->rtt_last_req = now;
|
|
trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial);
|
|
}
|
|
}
|
|
_leave(" = %d [%u]", ret, call->peer->maxdata);
|
|
return ret;
|
|
|
|
send_fragmentable:
|
|
/* attempt to send this message with fragmentation enabled */
|
|
_debug("send fragment");
|
|
|
|
down_write(&conn->params.local->defrag_sem);
|
|
|
|
switch (conn->params.local->srx.transport.family) {
|
|
case AF_INET:
|
|
opt = IP_PMTUDISC_DONT;
|
|
ret = kernel_setsockopt(conn->params.local->socket,
|
|
SOL_IP, IP_MTU_DISCOVER,
|
|
(char *)&opt, sizeof(opt));
|
|
if (ret == 0) {
|
|
ret = kernel_sendmsg(conn->params.local->socket, &msg,
|
|
iov, 2, len);
|
|
|
|
opt = IP_PMTUDISC_DO;
|
|
kernel_setsockopt(conn->params.local->socket, SOL_IP,
|
|
IP_MTU_DISCOVER,
|
|
(char *)&opt, sizeof(opt));
|
|
}
|
|
break;
|
|
|
|
#ifdef CONFIG_AF_RXRPC_IPV6
|
|
case AF_INET6:
|
|
opt = IPV6_PMTUDISC_DONT;
|
|
ret = kernel_setsockopt(conn->params.local->socket,
|
|
SOL_IPV6, IPV6_MTU_DISCOVER,
|
|
(char *)&opt, sizeof(opt));
|
|
if (ret == 0) {
|
|
ret = kernel_sendmsg(conn->params.local->socket, &msg,
|
|
iov, 2, len);
|
|
|
|
opt = IPV6_PMTUDISC_DO;
|
|
kernel_setsockopt(conn->params.local->socket,
|
|
SOL_IPV6, IPV6_MTU_DISCOVER,
|
|
(char *)&opt, sizeof(opt));
|
|
}
|
|
break;
|
|
#endif
|
|
|
|
default:
|
|
BUG();
|
|
}
|
|
|
|
up_write(&conn->params.local->defrag_sem);
|
|
goto done;
|
|
}
|
|
|
|
/*
|
|
* reject packets through the local endpoint
|
|
*/
|
|
void rxrpc_reject_packets(struct rxrpc_local *local)
|
|
{
|
|
struct sockaddr_rxrpc srx;
|
|
struct rxrpc_skb_priv *sp;
|
|
struct rxrpc_wire_header whdr;
|
|
struct sk_buff *skb;
|
|
struct msghdr msg;
|
|
struct kvec iov[2];
|
|
size_t size;
|
|
__be32 code;
|
|
|
|
_enter("%d", local->debug_id);
|
|
|
|
iov[0].iov_base = &whdr;
|
|
iov[0].iov_len = sizeof(whdr);
|
|
iov[1].iov_base = &code;
|
|
iov[1].iov_len = sizeof(code);
|
|
size = sizeof(whdr) + sizeof(code);
|
|
|
|
msg.msg_name = &srx.transport;
|
|
msg.msg_control = NULL;
|
|
msg.msg_controllen = 0;
|
|
msg.msg_flags = 0;
|
|
|
|
memset(&whdr, 0, sizeof(whdr));
|
|
whdr.type = RXRPC_PACKET_TYPE_ABORT;
|
|
|
|
while ((skb = skb_dequeue(&local->reject_queue))) {
|
|
rxrpc_see_skb(skb, rxrpc_skb_rx_seen);
|
|
sp = rxrpc_skb(skb);
|
|
|
|
if (rxrpc_extract_addr_from_skb(&srx, skb) == 0) {
|
|
msg.msg_namelen = srx.transport_len;
|
|
|
|
code = htonl(skb->priority);
|
|
|
|
whdr.epoch = htonl(sp->hdr.epoch);
|
|
whdr.cid = htonl(sp->hdr.cid);
|
|
whdr.callNumber = htonl(sp->hdr.callNumber);
|
|
whdr.serviceId = htons(sp->hdr.serviceId);
|
|
whdr.flags = sp->hdr.flags;
|
|
whdr.flags ^= RXRPC_CLIENT_INITIATED;
|
|
whdr.flags &= RXRPC_CLIENT_INITIATED;
|
|
|
|
kernel_sendmsg(local->socket, &msg, iov, 2, size);
|
|
}
|
|
|
|
rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
|
|
}
|
|
|
|
_leave("");
|
|
}
|