46cf330263
Changes in 5.4.274 amdkfd: use calloc instead of kzalloc to avoid integer overflow Documentation/hw-vuln: Update spectre doc x86/cpu: Support AMD Automatic IBRS x86/bugs: Use sysfs_emit() timers: Update kernel-doc for various functions timers: Use del_timer_sync() even on UP timers: Rename del_timer_sync() to timer_delete_sync() wifi: brcmfmac: Fix use-after-free bug in brcmf_cfg80211_detach media: staging: ipu3-imgu: Set fields before media_entity_pads_init() clk: qcom: gcc-sdm845: Add soft dependency on rpmhpd smack: Set SMACK64TRANSMUTE only for dirs in smack_inode_setxattr() smack: Handle SMACK64TRANSMUTE in smack_inode_setsecurity() ARM: dts: mmp2-brownstone: Don't redeclare phandle references arm: dts: marvell: Fix maxium->maxim typo in brownstone dts serial: max310x: fix NULL pointer dereference in I2C instantiation media: xc4000: Fix atomicity violation in xc4000_get_frequency KVM: Always flush async #PF workqueue when vCPU is being destroyed sparc64: NMI watchdog: fix return value of __setup handler sparc: vDSO: fix return value of __setup handler crypto: qat - fix double free during reset crypto: qat - resolve race condition during AER recovery selftests/mqueue: Set timeout to 180 seconds ext4: correct best extent lstart adjustment logic fat: fix uninitialized field in nostale filehandles ubifs: Set page uptodate in the correct place ubi: Check for too small LEB size in VTBL code ubi: correct the calculation of fastmap size mtd: rawnand: meson: fix scrambling mode value in command macro parisc: Do not hardcode registers in checksum functions parisc: Fix ip_fast_csum parisc: Fix csum_ipv6_magic on 32-bit systems parisc: Fix csum_ipv6_magic on 64-bit systems parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds PM: suspend: Set mem_sleep_current during kernel command line setup clk: qcom: gcc-ipq8074: fix terminating of frequency table arrays clk: qcom: mmcc-apq8084: fix terminating of frequency table arrays clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays powerpc/fsl: Fix mfpmr build errors with newer binutils USB: serial: ftdi_sio: add support for GMC Z216C Adapter IR-USB USB: serial: add device ID for VeriFone adapter USB: serial: cp210x: add ID for MGP Instruments PDS100 USB: serial: option: add MeiG Smart SLM320 product USB: serial: cp210x: add pid/vid for TDK NC0110013M and MM0110113M PM: sleep: wakeirq: fix wake irq warning in system suspend mmc: tmio: avoid concurrent runs of mmc_request_done() fuse: don't unhash root btrfs: fix off-by-one chunk length calculation at contains_pending_extent() PCI: Drop pci_device_remove() test of pci_dev->driver PCI/PM: Drain runtime-idle callbacks before driver removal Revert "Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d"" dm-raid: fix lockdep waring in "pers->hot_add_disk" mmc: core: Fix switch on gp3 partition hwmon: (amc6821) add of_match table ext4: fix corruption during on-line resize firmware: meson_sm: Rework driver as a proper platform driver nvmem: meson-efuse: fix function pointer type mismatch slimbus: core: Remove usage of the deprecated ida_simple_xx() API speakup: Fix 8bit characters from direct synth kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 vfio/platform: Disable virqfds on cleanup ring-buffer: Fix resetting of shortest_full ring-buffer: Fix full_waiters_pending in poll soc: fsl: qbman: Always disable interrupts when taking cgr_lock soc: fsl: qbman: Add helper for sanity checking cgr ops soc: fsl: qbman: Add CGR update function soc: fsl: qbman: Use raw spinlock for cgr_lock s390/zcrypt: fix reference counting on zcrypt card objects drm/exynos: do not return negative values from .get_modes() drm/imx/ipuv3: do not return negative values from .get_modes() drm/vc4: hdmi: do not return negative values from .get_modes() memtest: use {READ,WRITE}_ONCE in memory scanning nilfs2: fix failure to detect DAT corruption in btree and direct mappings nilfs2: use a more common logging style nilfs2: prevent kernel bug at submit_bh_wbc() x86/CPU/AMD: Update the Zenbleed microcode revisions ahci: asm1064: correct count of reported ports ahci: asm1064: asm1166: don't limit reported ports dm snapshot: fix lockup in dm_exception_table_exit comedi: comedi_test: Prevent timers rescheduling during deletion netfilter: nf_tables: mark set as dead when unbinding anonymous set with timeout netfilter: nf_tables: disallow anonymous set with timeout flag netfilter: nf_tables: reject constant set with timeout xfrm: Avoid clang fortify warning in copy_to_user_tmpl() ALSA: hda/realtek - Fix headset Mic no show at resume back for Lenovo ALC897 platform USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command usb: gadget: ncm: Fix handling of zero block length packets usb: port: Don't try to peer unused USB ports based on location tty: serial: fsl_lpuart: avoid idle preamble pending if CTS is enabled vt: fix unicode buffer corruption when deleting characters fs/aio: Check IOCB_AIO_RW before the struct aio_kiocb conversion objtool: is_fentry_call() crashes if call has no destination objtool: Add support for intra-function calls x86/speculation: Support intra-function call validation xen/events: close evtchn after mapping cleanup printk: Update @console_may_schedule in console_trylock_spinning() btrfs: allocate btrfs_ioctl_defrag_range_args on stack Revert "loop: Check for overflow while configuring loop" loop: Call loop_config_discard() only after new config is applied loop: Remove sector_t truncation checks loop: Factor out setting loop device size loop: Refactor loop_set_status() size calculation loop: Factor out configuring loop from status loop: Check for overflow while configuring loop loop: loop_set_status_from_info() check before assignment perf/core: Fix reentry problem in perf_output_read_group() efivarfs: Request at most 512 bytes for variable names powerpc: xor_vmx: Add '-mhard-float' to CFLAGS bounds: support non-power-of-two CONFIG_NR_CPUS vt: fix memory overlapping when deleting chars in the buffer mm/memory-failure: fix an incorrect use of tail pages mm/migrate: set swap entry values of THP tail pages properly. wifi: mac80211: check/clear fast rx for non-4addr sta VLAN changes exec: Fix NOMMU linux_binprm::exec in transfer_args_to_stack() mmc: core: Initialize mmc_blk_ioc_data mmc: core: Avoid negative index with array access usb: cdc-wdm: close race between read and workqueue ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs scsi: core: Fix unremoved procfs host directory regression usb: dwc2: host: Fix remote wakeup from hibernation usb: dwc2: host: Fix hibernation flow usb: dwc2: host: Fix ISOC flow in DDMA mode usb: dwc2: gadget: LPM flow fix usb: udc: remove warning when queue disabled ep scsi: qla2xxx: Fix command flush on cable pull x86/cpu: Enable STIBP on AMD if Automatic IBRS is enabled scsi: lpfc: Correct size for wqe for memset() USB: core: Fix deadlock in usb_deauthorize_interface() nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet ixgbe: avoid sleeping allocation in ixgbe_ipsec_vf_add_sa() tcp: properly terminate timers for kernel sockets dm integrity: fix out-of-range warning r8169: fix issue caused by buggy BIOS on certain boards with RTL8168d x86/cpufeatures: Add new word for scattered features Bluetooth: hci_event: set the conn encrypted before conn establishes Bluetooth: Fix TOCTOU in HCI debugfs implementation netfilter: nf_tables: disallow timeout for anonymous sets net/rds: fix possible cp null dereference vfio/pci: Disable auto-enable of exclusive INTx IRQ vfio/pci: Lock external INTx masking ops vfio: Introduce interface to flush virqfd inject workqueue vfio/pci: Create persistent INTx handler vfio/platform: Create persistent IRQ handlers Revert "x86/mm/ident_map: Use gbpages only where full GB page should be mapped." mm, vmscan: prevent infinite loop for costly GFP_NOIO | __GFP_RETRY_MAYFAIL allocations netfilter: nf_tables: flush pending destroy work before exit_net release netfilter: nf_tables: Fix potential data-race in __nft_flowtable_type_get() bpf, sockmap: Prevent lock inversion deadlock in map delete elem net/sched: act_skbmod: prevent kernel-infoleak net: stmmac: fix rx queue priority assignment selftests: reuseaddr_conflict: add missing new line at the end of the output ipv6: Fix infinite recursion in fib6_dump_done(). i40e: fix vf may be used uninitialized in this function warning staging: mmal-vchiq: Allocate and free components as required staging: mmal-vchiq: Fix client_component for 64 bit kernel staging: vc04_services: changen strncpy() to strscpy_pad() staging: vc04_services: fix information leak in create_component() fs: add a vfs_fchown helper fs: add a vfs_fchmod helper initramfs: switch initramfs unpacking to struct file based APIs init: open /initrd.image with O_LARGEFILE erspan: Add type I version 0 support. erspan: make sure erspan_base_hdr is present in skb->head net: ravb: Always process TX descriptor ring ASoC: ops: Fix wraparound for mask in snd_soc_get_volsw ata: sata_sx4: fix pdc20621_get_from_dimm() on 64-bit scsi: mylex: Fix sysfs buffer lengths ata: sata_mv: Fix PCI device ID table declaration compilation warning ALSA: hda/realtek: Update Panasonic CF-SZ6 quirk to support headset with microphone x86/mce: Make sure to grab mce_sysfs_mutex in set_bank() s390/entry: align system call table on 8 bytes wifi: ath9k: fix LNA selection in ath_ant_try_scan() VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host() panic: Flush kernel log buffer at the end arm64: dts: rockchip: fix rk3328 hdmi ports node arm64: dts: rockchip: fix rk3399 hdmi ports node ionic: set adminq irq affinity tools/power x86_energy_perf_policy: Fix file leak in get_pkg_num() btrfs: handle chunk tree lookup error in btrfs_relocate_sys_chunks() btrfs: export: handle invalid inode or root reference in btrfs_get_parent() btrfs: send: handle path ref underflow in header iterate_inode_ref() Bluetooth: btintel: Fix null ptr deref in btintel_read_version Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails sysv: don't call sb_bread() with pointers_lock held scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc() isofs: handle CDs with bad root inode but good Joliet root directory media: sta2x11: fix irq handler cast drm/amd/display: Fix nanosec stat overflow SUNRPC: increase size of rpc_wait_queue.qlen from unsigned short to unsigned int Revert "ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default" block: prevent division by zero in blk_rq_stat_sum() Input: allocate keycode for Display refresh rate toggle ktest: force $buildonly = 1 for 'make_warnings_file' test type tools: iio: replace seekdir() in iio_generic_buffer usb: typec: tcpci: add generic tcpci fallback compatible usb: sl811-hcd: only defined function checkdone if QUIRK2 is defined fbdev: viafb: fix typo in hw_bitblt_1 and hw_bitblt_2 fbmon: prevent division by zero in fb_videomode_from_videomode() netfilter: nf_tables: reject new basechain after table flag update netfilter: nf_tables: release batch on table validation from abort path netfilter: nf_tables: release mutex after nft_gc_seq_end from abort path netfilter: nf_tables: discard table flag update with pending basechain deletion tty: n_gsm: require CAP_NET_ADMIN to attach N_GSM0710 ldisc drm/vkms: call drm_atomic_helper_shutdown before drm_dev_put() virtio: reenable config if freezing device failed x86/mm/pat: fix VM_PAT handling in COW mappings drm/i915/gt: Reset queue_priority_hint on parking x86/alternative: Don't call text_poke() in lazy TLB mode Bluetooth: btintel: Fixe build regression VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler() erspan: Check IFLA_GRE_ERSPAN_VER is set. ip_gre: do not report erspan version on GRE interface firmware: meson_sm: fix to avoid potential NULL pointer dereference Linux 5.4.274 Change-Id: I759c99412f0d27d194308663aa08ab3682a1c43c Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
361 lines
11 KiB
C
361 lines
11 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* NET Generic infrastructure for INET connection oriented protocols.
|
|
*
|
|
* Definitions for inet_connection_sock
|
|
*
|
|
* Authors: Many people, see the TCP sources
|
|
*
|
|
* From code originally in TCP
|
|
*/
|
|
#ifndef _INET_CONNECTION_SOCK_H
|
|
#define _INET_CONNECTION_SOCK_H
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/string.h>
|
|
#include <linux/timer.h>
|
|
#include <linux/poll.h>
|
|
#include <linux/kernel.h>
|
|
|
|
#include <net/inet_sock.h>
|
|
#include <net/request_sock.h>
|
|
|
|
/* Cancel timers, when they are not required. */
|
|
#undef INET_CSK_CLEAR_TIMERS
|
|
|
|
struct inet_bind_bucket;
|
|
struct tcp_congestion_ops;
|
|
|
|
/*
|
|
* Pointers to address related TCP functions
|
|
* (i.e. things that depend on the address family)
|
|
*/
|
|
struct inet_connection_sock_af_ops {
|
|
int (*queue_xmit)(struct sock *sk, struct sk_buff *skb, struct flowi *fl);
|
|
void (*send_check)(struct sock *sk, struct sk_buff *skb);
|
|
int (*rebuild_header)(struct sock *sk);
|
|
void (*sk_rx_dst_set)(struct sock *sk, const struct sk_buff *skb);
|
|
int (*conn_request)(struct sock *sk, struct sk_buff *skb);
|
|
struct sock *(*syn_recv_sock)(const struct sock *sk, struct sk_buff *skb,
|
|
struct request_sock *req,
|
|
struct dst_entry *dst,
|
|
struct request_sock *req_unhash,
|
|
bool *own_req);
|
|
u16 net_header_len;
|
|
u16 net_frag_header_len;
|
|
u16 sockaddr_len;
|
|
int (*setsockopt)(struct sock *sk, int level, int optname,
|
|
char __user *optval, unsigned int optlen);
|
|
int (*getsockopt)(struct sock *sk, int level, int optname,
|
|
char __user *optval, int __user *optlen);
|
|
#ifdef CONFIG_COMPAT
|
|
int (*compat_setsockopt)(struct sock *sk,
|
|
int level, int optname,
|
|
char __user *optval, unsigned int optlen);
|
|
int (*compat_getsockopt)(struct sock *sk,
|
|
int level, int optname,
|
|
char __user *optval, int __user *optlen);
|
|
#endif
|
|
void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
|
|
void (*mtu_reduced)(struct sock *sk);
|
|
};
|
|
|
|
/** inet_connection_sock - INET connection oriented sock
|
|
*
|
|
* @icsk_accept_queue: FIFO of established children
|
|
* @icsk_bind_hash: Bind node
|
|
* @icsk_timeout: Timeout
|
|
* @icsk_retransmit_timer: Resend (no ack)
|
|
* @icsk_rto: Retransmit timeout
|
|
* @icsk_pmtu_cookie Last pmtu seen by socket
|
|
* @icsk_ca_ops Pluggable congestion control hook
|
|
* @icsk_af_ops Operations which are AF_INET{4,6} specific
|
|
* @icsk_ulp_ops Pluggable ULP control hook
|
|
* @icsk_ulp_data ULP private data
|
|
* @icsk_clean_acked Clean acked data hook
|
|
* @icsk_listen_portaddr_node hash to the portaddr listener hashtable
|
|
* @icsk_ca_state: Congestion control state
|
|
* @icsk_retransmits: Number of unrecovered [RTO] timeouts
|
|
* @icsk_pending: Scheduled timer event
|
|
* @icsk_backoff: Backoff
|
|
* @icsk_syn_retries: Number of allowed SYN (or equivalent) retries
|
|
* @icsk_probes_out: unanswered 0 window probes
|
|
* @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options)
|
|
* @icsk_ack: Delayed ACK control data
|
|
* @icsk_mtup; MTU probing control data
|
|
* @icsk_probes_tstamp: Probe timestamp (cleared by non-zero window ack)
|
|
* @icsk_user_timeout: TCP_USER_TIMEOUT value
|
|
*/
|
|
struct inet_connection_sock {
|
|
/* inet_sock has to be the first member! */
|
|
struct inet_sock icsk_inet;
|
|
struct request_sock_queue icsk_accept_queue;
|
|
struct inet_bind_bucket *icsk_bind_hash;
|
|
unsigned long icsk_timeout;
|
|
struct timer_list icsk_retransmit_timer;
|
|
struct timer_list icsk_delack_timer;
|
|
__u32 icsk_rto;
|
|
__u32 icsk_pmtu_cookie;
|
|
const struct tcp_congestion_ops *icsk_ca_ops;
|
|
const struct inet_connection_sock_af_ops *icsk_af_ops;
|
|
const struct tcp_ulp_ops *icsk_ulp_ops;
|
|
void __rcu *icsk_ulp_data;
|
|
void (*icsk_clean_acked)(struct sock *sk, u32 acked_seq);
|
|
struct hlist_node icsk_listen_portaddr_node;
|
|
unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
|
|
__u8 icsk_ca_state:6,
|
|
icsk_ca_setsockopt:1,
|
|
icsk_ca_dst_locked:1;
|
|
__u8 icsk_retransmits;
|
|
__u8 icsk_pending;
|
|
__u8 icsk_backoff;
|
|
__u8 icsk_syn_retries;
|
|
__u8 icsk_probes_out;
|
|
__u16 icsk_ext_hdr_len;
|
|
struct {
|
|
__u8 pending; /* ACK is pending */
|
|
__u8 quick; /* Scheduled number of quick acks */
|
|
__u8 pingpong; /* The session is interactive */
|
|
__u8 blocked; /* Delayed ACK was blocked by socket lock */
|
|
__u32 ato; /* Predicted tick of soft clock */
|
|
unsigned long timeout; /* Currently scheduled timeout */
|
|
__u32 lrcvtime; /* timestamp of last received data packet */
|
|
__u16 last_seg_size; /* Size of last incoming segment */
|
|
__u16 rcv_mss; /* MSS used for delayed ACK decisions */
|
|
} icsk_ack;
|
|
#ifdef __GENKSYMS__
|
|
struct {
|
|
int enabled;
|
|
|
|
/* Range of MTUs to search */
|
|
int search_high;
|
|
int search_low;
|
|
|
|
/* Information on the current probe. */
|
|
int probe_size;
|
|
|
|
u32 probe_timestamp;
|
|
} icsk_mtup;
|
|
#else
|
|
struct {
|
|
/* Range of MTUs to search */
|
|
int search_high;
|
|
int search_low;
|
|
|
|
/* Information on the current probe. */
|
|
int enabled:1;
|
|
int probe_size:31;
|
|
|
|
u32 probe_timestamp;
|
|
} icsk_mtup;
|
|
u32 icsk_probes_tstamp;
|
|
#endif
|
|
u32 icsk_user_timeout;
|
|
|
|
u64 icsk_ca_priv[104 / sizeof(u64)];
|
|
#define ICSK_CA_PRIV_SIZE (13 * sizeof(u64))
|
|
};
|
|
|
|
#define ICSK_TIME_RETRANS 1 /* Retransmit timer */
|
|
#define ICSK_TIME_DACK 2 /* Delayed ack timer */
|
|
#define ICSK_TIME_PROBE0 3 /* Zero window probe timer */
|
|
#define ICSK_TIME_EARLY_RETRANS 4 /* Early retransmit timer */
|
|
#define ICSK_TIME_LOSS_PROBE 5 /* Tail loss probe timer */
|
|
#define ICSK_TIME_REO_TIMEOUT 6 /* Reordering timer */
|
|
|
|
static inline struct inet_connection_sock *inet_csk(const struct sock *sk)
|
|
{
|
|
return (struct inet_connection_sock *)sk;
|
|
}
|
|
|
|
static inline void *inet_csk_ca(const struct sock *sk)
|
|
{
|
|
return (void *)inet_csk(sk)->icsk_ca_priv;
|
|
}
|
|
|
|
struct sock *inet_csk_clone_lock(const struct sock *sk,
|
|
const struct request_sock *req,
|
|
const gfp_t priority);
|
|
|
|
enum inet_csk_ack_state_t {
|
|
ICSK_ACK_SCHED = 1,
|
|
ICSK_ACK_TIMER = 2,
|
|
ICSK_ACK_PUSHED = 4,
|
|
ICSK_ACK_PUSHED2 = 8,
|
|
ICSK_ACK_NOW = 16 /* Send the next ACK immediately (once) */
|
|
};
|
|
|
|
void inet_csk_init_xmit_timers(struct sock *sk,
|
|
void (*retransmit_handler)(struct timer_list *),
|
|
void (*delack_handler)(struct timer_list *),
|
|
void (*keepalive_handler)(struct timer_list *));
|
|
void inet_csk_clear_xmit_timers(struct sock *sk);
|
|
void inet_csk_clear_xmit_timers_sync(struct sock *sk);
|
|
|
|
static inline void inet_csk_schedule_ack(struct sock *sk)
|
|
{
|
|
inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_SCHED;
|
|
}
|
|
|
|
static inline int inet_csk_ack_scheduled(const struct sock *sk)
|
|
{
|
|
return inet_csk(sk)->icsk_ack.pending & ICSK_ACK_SCHED;
|
|
}
|
|
|
|
static inline void inet_csk_delack_init(struct sock *sk)
|
|
{
|
|
memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack));
|
|
}
|
|
|
|
void inet_csk_delete_keepalive_timer(struct sock *sk);
|
|
void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout);
|
|
|
|
static inline void inet_csk_clear_xmit_timer(struct sock *sk, const int what)
|
|
{
|
|
struct inet_connection_sock *icsk = inet_csk(sk);
|
|
|
|
if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) {
|
|
icsk->icsk_pending = 0;
|
|
#ifdef INET_CSK_CLEAR_TIMERS
|
|
sk_stop_timer(sk, &icsk->icsk_retransmit_timer);
|
|
#endif
|
|
} else if (what == ICSK_TIME_DACK) {
|
|
icsk->icsk_ack.blocked = icsk->icsk_ack.pending = 0;
|
|
#ifdef INET_CSK_CLEAR_TIMERS
|
|
sk_stop_timer(sk, &icsk->icsk_delack_timer);
|
|
#endif
|
|
} else {
|
|
pr_debug("inet_csk BUG: unknown timer value\n");
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Reset the retransmission timer
|
|
*/
|
|
static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
|
|
unsigned long when,
|
|
const unsigned long max_when)
|
|
{
|
|
struct inet_connection_sock *icsk = inet_csk(sk);
|
|
|
|
if (when > max_when) {
|
|
pr_debug("reset_xmit_timer: sk=%p %d when=0x%lx, caller=%p\n",
|
|
sk, what, when, (void *)_THIS_IP_);
|
|
when = max_when;
|
|
}
|
|
|
|
if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0 ||
|
|
what == ICSK_TIME_EARLY_RETRANS || what == ICSK_TIME_LOSS_PROBE ||
|
|
what == ICSK_TIME_REO_TIMEOUT) {
|
|
icsk->icsk_pending = what;
|
|
icsk->icsk_timeout = jiffies + when;
|
|
sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout);
|
|
} else if (what == ICSK_TIME_DACK) {
|
|
icsk->icsk_ack.pending |= ICSK_ACK_TIMER;
|
|
icsk->icsk_ack.timeout = jiffies + when;
|
|
sk_reset_timer(sk, &icsk->icsk_delack_timer, icsk->icsk_ack.timeout);
|
|
} else {
|
|
pr_debug("inet_csk BUG: unknown timer value\n");
|
|
}
|
|
}
|
|
|
|
static inline unsigned long
|
|
inet_csk_rto_backoff(const struct inet_connection_sock *icsk,
|
|
unsigned long max_when)
|
|
{
|
|
u64 when = (u64)icsk->icsk_rto << icsk->icsk_backoff;
|
|
|
|
return (unsigned long)min_t(u64, when, max_when);
|
|
}
|
|
|
|
struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern);
|
|
|
|
int inet_csk_get_port(struct sock *sk, unsigned short snum);
|
|
|
|
struct dst_entry *inet_csk_route_req(const struct sock *sk, struct flowi4 *fl4,
|
|
const struct request_sock *req);
|
|
struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
|
|
struct sock *newsk,
|
|
const struct request_sock *req);
|
|
|
|
struct sock *inet_csk_reqsk_queue_add(struct sock *sk,
|
|
struct request_sock *req,
|
|
struct sock *child);
|
|
void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
|
|
unsigned long timeout);
|
|
struct sock *inet_csk_complete_hashdance(struct sock *sk, struct sock *child,
|
|
struct request_sock *req,
|
|
bool own_req);
|
|
|
|
static inline void inet_csk_reqsk_queue_added(struct sock *sk)
|
|
{
|
|
reqsk_queue_added(&inet_csk(sk)->icsk_accept_queue);
|
|
}
|
|
|
|
static inline int inet_csk_reqsk_queue_len(const struct sock *sk)
|
|
{
|
|
return reqsk_queue_len(&inet_csk(sk)->icsk_accept_queue);
|
|
}
|
|
|
|
static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk)
|
|
{
|
|
return inet_csk_reqsk_queue_len(sk) >= sk->sk_max_ack_backlog;
|
|
}
|
|
|
|
bool inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req);
|
|
void inet_csk_reqsk_queue_drop_and_put(struct sock *sk, struct request_sock *req);
|
|
|
|
void inet_csk_destroy_sock(struct sock *sk);
|
|
void inet_csk_prepare_forced_close(struct sock *sk);
|
|
|
|
/*
|
|
* LISTEN is a special case for poll..
|
|
*/
|
|
static inline __poll_t inet_csk_listen_poll(const struct sock *sk)
|
|
{
|
|
return !reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue) ?
|
|
(EPOLLIN | EPOLLRDNORM) : 0;
|
|
}
|
|
|
|
int inet_csk_listen_start(struct sock *sk, int backlog);
|
|
void inet_csk_listen_stop(struct sock *sk);
|
|
|
|
void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
|
|
|
|
int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
|
|
char __user *optval, int __user *optlen);
|
|
int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
|
|
char __user *optval, unsigned int optlen);
|
|
|
|
/* update the fast reuse flag when adding a socket */
|
|
void inet_csk_update_fastreuse(struct inet_bind_bucket *tb,
|
|
struct sock *sk);
|
|
|
|
struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);
|
|
|
|
#define TCP_PINGPONG_THRESH 3
|
|
|
|
static inline void inet_csk_enter_pingpong_mode(struct sock *sk)
|
|
{
|
|
inet_csk(sk)->icsk_ack.pingpong = TCP_PINGPONG_THRESH;
|
|
}
|
|
|
|
static inline void inet_csk_exit_pingpong_mode(struct sock *sk)
|
|
{
|
|
inet_csk(sk)->icsk_ack.pingpong = 0;
|
|
}
|
|
|
|
static inline bool inet_csk_in_pingpong_mode(struct sock *sk)
|
|
{
|
|
return inet_csk(sk)->icsk_ack.pingpong >= TCP_PINGPONG_THRESH;
|
|
}
|
|
|
|
static inline void inet_csk_inc_pingpong_cnt(struct sock *sk)
|
|
{
|
|
struct inet_connection_sock *icsk = inet_csk(sk);
|
|
|
|
if (icsk->icsk_ack.pingpong < U8_MAX)
|
|
icsk->icsk_ack.pingpong++;
|
|
}
|
|
#endif /* _INET_CONNECTION_SOCK_H */
|