Changes in 4.9.156 drm/bufs: Fix Spectre v1 vulnerability staging: iio: adc: ad7280a: handle error from __ad7280_read32() ASoC: Intel: mrfld: fix uninitialized variable access gpu: ipu-v3: image-convert: Prevent race between run and unprepare ath9k: dynack: use authentication messages for 'late' ack scsi: lpfc: Correct LCB RJT handling ARM: 8808/1: kexec:offline panic_smp_self_stop CPU dlm: Don't swamp the CPU with callbacks queued during recovery x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux) powerpc/pseries: add of_node_put() in dlpar_detach_node() drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE serial: fsl_lpuart: clear parity enable bit when disable parity ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl staging:iio:ad2s90: Make probe handle spi_setup failure staging: iio: ad7780: update voltage on read ARM: OMAP2+: hwmod: Fix some section annotations modpost: validate symbol names also in find_elf_symbol perf tools: Add Hygon Dhyana support soc/tegra: Don't leak device tree node reference media: mtk-vcodec: Release device nodes in mtk_vcodec_init_enc_pm() dmaengine: xilinx_dma: Remove __aligned attribute on zynqmp_dma_desc_ll iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID media: adv*/tc358743/ths8200: fill in min width/height/pixelclock f2fs: move dir data flush to write checkpoint process f2fs: fix wrong return value of f2fs_acl_create sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN soc: bcm: brcmstb: Don't leak device tree node reference nfsd4: fix crash on writing v4_end_grace before nfsd startup Thermal: do not clear passive state during system sleep firmware/efi: Add NULL pointer checks in efivars API functions arm64: ftrace: don't adjust the LR value ARM: dts: mmp2: fix TWSI2 x86/fpu: Add might_fault() to user_insn() media: DaVinci-VPBE: fix error handling in vpbe_initialize() smack: fix access permissions for keyring usb: hub: delay hub autosuspend if USB3 port is still link training timekeeping: Use proper seqcount initializer clk: sunxi-ng: a33: Set CLK_SET_RATE_PARENT for all audio module clocks iommu/amd: Fix amd_iommu=force_isolation ARM: dts: Fix OMAP4430 SDP Ethernet startup mips: bpf: fix encoding bug for mm_srlv32_op iommu/arm-smmu: Add support for qcom,smmu-v2 variant iommu/arm-smmu-v3: Use explicit mb() when moving cons pointer sata_rcar: fix deferred probing clk: imx6sl: ensure MMDC CH0 handshake is bypassed cpuidle: big.LITTLE: fix refcount leak i2c-axxia: check for error conditions first udf: Fix BUG on corrupted inode ARM: pxa: avoid section mismatch warning ASoC: fsl: Fix SND_SOC_EUKREA_TLV320 build error on i.MX8M memstick: Prevent memstick host from getting runtime suspended during card detection tty: serial: samsung: Properly set flags in autoCTS mode perf header: Fix unchecked usage of strncpy() perf probe: Fix unchecked usage of strncpy() arm64: KVM: Skip MMIO insn after emulation powerpc/uaccess: fix warning/error with access_ok() mac80211: fix radiotap vendor presence bitmap handling xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi Bluetooth: Fix unnecessary error message for HCI request completion scsi: smartpqi: correct host serial num for ssa scsi: smartpqi: correct volume status cw1200: Fix concurrency use-after-free bugs in cw1200_hw_scan() drbd: narrow rcu_read_lock in drbd_sync_handshake drbd: disconnect, if the wrong UUIDs are attached on a connected peer drbd: skip spurious timeout (ping-timeo) when failing promote drbd: Avoid Clang warning about pointless switch statment video: clps711x-fb: release disp device node in probe() fbdev: fbmem: behave better with small rotated displays and many CPUs i40e: define proper net_device::neigh_priv_len igb: Fix an issue that PME is not enabled during runtime suspend fbdev: fbcon: Fix unregister crash when more than one framebuffer pinctrl: meson: meson8: fix the GPIO function for the GPIOAO pins pinctrl: meson: meson8b: fix the GPIO function for the GPIOAO pins KVM: x86: svm: report MSR_IA32_MCG_EXT_CTL as unsupported NFS: nfs_compare_mount_options always compare auth flavors. hwmon: (lm80) fix a missing check of the status of SMBus read hwmon: (lm80) fix a missing check of bus read in lm80 probe seq_buf: Make seq_buf_puts() null-terminate the buffer crypto: ux500 - Use proper enum in cryp_set_dma_transfer crypto: ux500 - Use proper enum in hash_set_dma_transfer MIPS: ralink: Select CONFIG_CPU_MIPSR2_IRQ_VI on MT7620/8 cifs: check ntwrk_buf_start for NULL before dereferencing it um: Avoid marking pages with "changed protection" niu: fix missing checks of niu_pci_eeprom_read f2fs: fix sbi->extent_list corruption issue scripts/decode_stacktrace: only strip base path when a prefix of the path ocfs2: don't clear bh uptodate for block read isdn: hisax: hfc_pci: Fix a possible concurrency use-after-free bug in HFCPCI_l1hw() gdrom: fix a memory leak bug fsl/fman: Use GFP_ATOMIC in {memac,tgec}_add_hash_mac_address() block/swim3: Fix -EBUSY error when re-opening device after unmount thermal: generic-adc: Fix adc to temp interpolation HID: lenovo: Add checks to fix of_led_classdev_register kernel/hung_task.c: break RCU locks based on jiffies proc/sysctl: fix return error for proc_doulongvec_minmax() fs/epoll: drop ovflist branch prediction exec: load_script: don't blindly truncate shebang string thermal: hwmon: inline helpers when CONFIG_THERMAL_HWMON is not set dccp: fool proof ccid_hc_[rt]x_parse_options() net: dp83640: expire old TX-skb rxrpc: bad unlock balance in rxrpc_recvmsg skge: potential memory corruption in skge_get_regs() rds: fix refcount bug in rds_sock_addref net: systemport: Fix WoL with password after deep sleep net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames net: dsa: slave: Don't propagate flag changes on down slave interfaces enic: fix checksum validation for IPv6 ALSA: compress: Fix stop handling on compressed capture streams ALSA: hda - Serialize codec registrations fuse: call pipe_buf_release() under pipe lock fuse: decrement NR_WRITEBACK_TEMP on the right page fuse: handle zero sized retrieve correctly dmaengine: bcm2835: Fix interrupt race on RT dmaengine: bcm2835: Fix abort of transactions dmaengine: imx-dma: fix wrong callback invoke usb: phy: am335x: fix race condition in _probe usb: gadget: udc: net2272: Fix bitwise and boolean operations usb: gadget: musb: fix short isoc packets with inventra dma scsi: aic94xx: fix module loading KVM: x86: work around leak of uninitialized stack contents (CVE-2019-7222) kvm: fix kvm_ioctl_create_device() reference counting (CVE-2019-6974) KVM: nVMX: unconditionally cancel preemption timer in free_nested (CVE-2019-7221) perf/x86/intel/uncore: Add Node ID mask x86/MCE: Initialize mce.bank in the case of a fatal error in mce_no_way_out() perf/core: Don't WARN() for impossible ring-buffer sizes perf tests evsel-tp-sched: Fix bitwise operator serial: fix race between flush_to_ldisc and tty_open oom, oom_reaper: do not enqueue same task twice PCI: vmd: Free up IRQs on suspend path IB/hfi1: Add limit test for RC/UC send via loopback perf/x86/intel: Delay memory deallocation until x86_pmu_dead_cpu() ath9k: dynack: make ewma estimation faster ath9k: dynack: check da->enabled first in sampling routines Linux 4.9.156 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
266 lines
8.7 KiB
C
266 lines
8.7 KiB
C
#ifndef _CCID_H
|
|
#define _CCID_H
|
|
/*
|
|
* net/dccp/ccid.h
|
|
*
|
|
* An implementation of the DCCP protocol
|
|
* Arnaldo Carvalho de Melo <acme@conectiva.com.br>
|
|
*
|
|
* CCID infrastructure
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <net/sock.h>
|
|
#include <linux/compiler.h>
|
|
#include <linux/dccp.h>
|
|
#include <linux/list.h>
|
|
#include <linux/module.h>
|
|
|
|
/* maximum value for a CCID (RFC 4340, 19.5) */
|
|
#define CCID_MAX 255
|
|
#define CCID_SLAB_NAME_LENGTH 32
|
|
|
|
struct tcp_info;
|
|
|
|
/**
|
|
* struct ccid_operations - Interface to Congestion-Control Infrastructure
|
|
*
|
|
* @ccid_id: numerical CCID ID (up to %CCID_MAX, cf. table 5 in RFC 4340, 10.)
|
|
* @ccid_ccmps: the CCMPS including network/transport headers (0 when disabled)
|
|
* @ccid_name: alphabetical identifier string for @ccid_id
|
|
* @ccid_hc_{r,t}x_slab: memory pool for the receiver/sender half-connection
|
|
* @ccid_hc_{r,t}x_obj_size: size of the receiver/sender half-connection socket
|
|
*
|
|
* @ccid_hc_{r,t}x_init: CCID-specific initialisation routine (before startup)
|
|
* @ccid_hc_{r,t}x_exit: CCID-specific cleanup routine (before destruction)
|
|
* @ccid_hc_rx_packet_recv: implements the HC-receiver side
|
|
* @ccid_hc_{r,t}x_parse_options: parsing routine for CCID/HC-specific options
|
|
* @ccid_hc_{r,t}x_insert_options: insert routine for CCID/HC-specific options
|
|
* @ccid_hc_tx_packet_recv: implements feedback processing for the HC-sender
|
|
* @ccid_hc_tx_send_packet: implements the sending part of the HC-sender
|
|
* @ccid_hc_tx_packet_sent: does accounting for packets in flight by HC-sender
|
|
* @ccid_hc_{r,t}x_get_info: INET_DIAG information for HC-receiver/sender
|
|
* @ccid_hc_{r,t}x_getsockopt: socket options specific to HC-receiver/sender
|
|
*/
|
|
struct ccid_operations {
|
|
unsigned char ccid_id;
|
|
__u32 ccid_ccmps;
|
|
const char *ccid_name;
|
|
struct kmem_cache *ccid_hc_rx_slab,
|
|
*ccid_hc_tx_slab;
|
|
char ccid_hc_rx_slab_name[CCID_SLAB_NAME_LENGTH];
|
|
char ccid_hc_tx_slab_name[CCID_SLAB_NAME_LENGTH];
|
|
__u32 ccid_hc_rx_obj_size,
|
|
ccid_hc_tx_obj_size;
|
|
/* Interface Routines */
|
|
int (*ccid_hc_rx_init)(struct ccid *ccid, struct sock *sk);
|
|
int (*ccid_hc_tx_init)(struct ccid *ccid, struct sock *sk);
|
|
void (*ccid_hc_rx_exit)(struct sock *sk);
|
|
void (*ccid_hc_tx_exit)(struct sock *sk);
|
|
void (*ccid_hc_rx_packet_recv)(struct sock *sk,
|
|
struct sk_buff *skb);
|
|
int (*ccid_hc_rx_parse_options)(struct sock *sk, u8 pkt,
|
|
u8 opt, u8 *val, u8 len);
|
|
int (*ccid_hc_rx_insert_options)(struct sock *sk,
|
|
struct sk_buff *skb);
|
|
void (*ccid_hc_tx_packet_recv)(struct sock *sk,
|
|
struct sk_buff *skb);
|
|
int (*ccid_hc_tx_parse_options)(struct sock *sk, u8 pkt,
|
|
u8 opt, u8 *val, u8 len);
|
|
int (*ccid_hc_tx_send_packet)(struct sock *sk,
|
|
struct sk_buff *skb);
|
|
void (*ccid_hc_tx_packet_sent)(struct sock *sk,
|
|
unsigned int len);
|
|
void (*ccid_hc_rx_get_info)(struct sock *sk,
|
|
struct tcp_info *info);
|
|
void (*ccid_hc_tx_get_info)(struct sock *sk,
|
|
struct tcp_info *info);
|
|
int (*ccid_hc_rx_getsockopt)(struct sock *sk,
|
|
const int optname, int len,
|
|
u32 __user *optval,
|
|
int __user *optlen);
|
|
int (*ccid_hc_tx_getsockopt)(struct sock *sk,
|
|
const int optname, int len,
|
|
u32 __user *optval,
|
|
int __user *optlen);
|
|
};
|
|
|
|
extern struct ccid_operations ccid2_ops;
|
|
#ifdef CONFIG_IP_DCCP_CCID3
|
|
extern struct ccid_operations ccid3_ops;
|
|
#endif
|
|
|
|
int ccid_initialize_builtins(void);
|
|
void ccid_cleanup_builtins(void);
|
|
|
|
struct ccid {
|
|
struct ccid_operations *ccid_ops;
|
|
char ccid_priv[0];
|
|
};
|
|
|
|
static inline void *ccid_priv(const struct ccid *ccid)
|
|
{
|
|
return (void *)ccid->ccid_priv;
|
|
}
|
|
|
|
bool ccid_support_check(u8 const *ccid_array, u8 array_len);
|
|
int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len);
|
|
int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
|
|
char __user *, int __user *);
|
|
|
|
struct ccid *ccid_new(const u8 id, struct sock *sk, bool rx);
|
|
|
|
static inline int ccid_get_current_rx_ccid(struct dccp_sock *dp)
|
|
{
|
|
struct ccid *ccid = dp->dccps_hc_rx_ccid;
|
|
|
|
if (ccid == NULL || ccid->ccid_ops == NULL)
|
|
return -1;
|
|
return ccid->ccid_ops->ccid_id;
|
|
}
|
|
|
|
static inline int ccid_get_current_tx_ccid(struct dccp_sock *dp)
|
|
{
|
|
struct ccid *ccid = dp->dccps_hc_tx_ccid;
|
|
|
|
if (ccid == NULL || ccid->ccid_ops == NULL)
|
|
return -1;
|
|
return ccid->ccid_ops->ccid_id;
|
|
}
|
|
|
|
void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk);
|
|
void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk);
|
|
|
|
/*
|
|
* Congestion control of queued data packets via CCID decision.
|
|
*
|
|
* The TX CCID performs its congestion-control by indicating whether and when a
|
|
* queued packet may be sent, using the return code of ccid_hc_tx_send_packet().
|
|
* The following modes are supported via the symbolic constants below:
|
|
* - timer-based pacing (CCID returns a delay value in milliseconds);
|
|
* - autonomous dequeueing (CCID internally schedules dccps_xmitlet).
|
|
*/
|
|
|
|
enum ccid_dequeueing_decision {
|
|
CCID_PACKET_SEND_AT_ONCE = 0x00000, /* "green light": no delay */
|
|
CCID_PACKET_DELAY_MAX = 0x0FFFF, /* maximum delay in msecs */
|
|
CCID_PACKET_DELAY = 0x10000, /* CCID msec-delay mode */
|
|
CCID_PACKET_WILL_DEQUEUE_LATER = 0x20000, /* CCID autonomous mode */
|
|
CCID_PACKET_ERR = 0xF0000, /* error condition */
|
|
};
|
|
|
|
static inline int ccid_packet_dequeue_eval(const int return_code)
|
|
{
|
|
if (return_code < 0)
|
|
return CCID_PACKET_ERR;
|
|
if (return_code == 0)
|
|
return CCID_PACKET_SEND_AT_ONCE;
|
|
if (return_code <= CCID_PACKET_DELAY_MAX)
|
|
return CCID_PACKET_DELAY;
|
|
return return_code;
|
|
}
|
|
|
|
static inline int ccid_hc_tx_send_packet(struct ccid *ccid, struct sock *sk,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (ccid->ccid_ops->ccid_hc_tx_send_packet != NULL)
|
|
return ccid->ccid_ops->ccid_hc_tx_send_packet(sk, skb);
|
|
return CCID_PACKET_SEND_AT_ONCE;
|
|
}
|
|
|
|
static inline void ccid_hc_tx_packet_sent(struct ccid *ccid, struct sock *sk,
|
|
unsigned int len)
|
|
{
|
|
if (ccid->ccid_ops->ccid_hc_tx_packet_sent != NULL)
|
|
ccid->ccid_ops->ccid_hc_tx_packet_sent(sk, len);
|
|
}
|
|
|
|
static inline void ccid_hc_rx_packet_recv(struct ccid *ccid, struct sock *sk,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (ccid->ccid_ops->ccid_hc_rx_packet_recv != NULL)
|
|
ccid->ccid_ops->ccid_hc_rx_packet_recv(sk, skb);
|
|
}
|
|
|
|
static inline void ccid_hc_tx_packet_recv(struct ccid *ccid, struct sock *sk,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (ccid->ccid_ops->ccid_hc_tx_packet_recv != NULL)
|
|
ccid->ccid_ops->ccid_hc_tx_packet_recv(sk, skb);
|
|
}
|
|
|
|
/**
|
|
* ccid_hc_tx_parse_options - Parse CCID-specific options sent by the receiver
|
|
* @pkt: type of packet that @opt appears on (RFC 4340, 5.1)
|
|
* @opt: the CCID-specific option type (RFC 4340, 5.8 and 10.3)
|
|
* @val: value of @opt
|
|
* @len: length of @val in bytes
|
|
*/
|
|
static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk,
|
|
u8 pkt, u8 opt, u8 *val, u8 len)
|
|
{
|
|
if (!ccid || !ccid->ccid_ops->ccid_hc_tx_parse_options)
|
|
return 0;
|
|
return ccid->ccid_ops->ccid_hc_tx_parse_options(sk, pkt, opt, val, len);
|
|
}
|
|
|
|
/**
|
|
* ccid_hc_rx_parse_options - Parse CCID-specific options sent by the sender
|
|
* Arguments are analogous to ccid_hc_tx_parse_options()
|
|
*/
|
|
static inline int ccid_hc_rx_parse_options(struct ccid *ccid, struct sock *sk,
|
|
u8 pkt, u8 opt, u8 *val, u8 len)
|
|
{
|
|
if (!ccid || !ccid->ccid_ops->ccid_hc_rx_parse_options)
|
|
return 0;
|
|
return ccid->ccid_ops->ccid_hc_rx_parse_options(sk, pkt, opt, val, len);
|
|
}
|
|
|
|
static inline int ccid_hc_rx_insert_options(struct ccid *ccid, struct sock *sk,
|
|
struct sk_buff *skb)
|
|
{
|
|
if (ccid->ccid_ops->ccid_hc_rx_insert_options != NULL)
|
|
return ccid->ccid_ops->ccid_hc_rx_insert_options(sk, skb);
|
|
return 0;
|
|
}
|
|
|
|
static inline void ccid_hc_rx_get_info(struct ccid *ccid, struct sock *sk,
|
|
struct tcp_info *info)
|
|
{
|
|
if (ccid->ccid_ops->ccid_hc_rx_get_info != NULL)
|
|
ccid->ccid_ops->ccid_hc_rx_get_info(sk, info);
|
|
}
|
|
|
|
static inline void ccid_hc_tx_get_info(struct ccid *ccid, struct sock *sk,
|
|
struct tcp_info *info)
|
|
{
|
|
if (ccid->ccid_ops->ccid_hc_tx_get_info != NULL)
|
|
ccid->ccid_ops->ccid_hc_tx_get_info(sk, info);
|
|
}
|
|
|
|
static inline int ccid_hc_rx_getsockopt(struct ccid *ccid, struct sock *sk,
|
|
const int optname, int len,
|
|
u32 __user *optval, int __user *optlen)
|
|
{
|
|
int rc = -ENOPROTOOPT;
|
|
if (ccid != NULL && ccid->ccid_ops->ccid_hc_rx_getsockopt != NULL)
|
|
rc = ccid->ccid_ops->ccid_hc_rx_getsockopt(sk, optname, len,
|
|
optval, optlen);
|
|
return rc;
|
|
}
|
|
|
|
static inline int ccid_hc_tx_getsockopt(struct ccid *ccid, struct sock *sk,
|
|
const int optname, int len,
|
|
u32 __user *optval, int __user *optlen)
|
|
{
|
|
int rc = -ENOPROTOOPT;
|
|
if (ccid != NULL && ccid->ccid_ops->ccid_hc_tx_getsockopt != NULL)
|
|
rc = ccid->ccid_ops->ccid_hc_tx_getsockopt(sk, optname, len,
|
|
optval, optlen);
|
|
return rc;
|
|
}
|
|
#endif /* _CCID_H */
|