Skip to content
Snippets Groups Projects
Select Git revision
  • 36e31b0af58728071e8023cf8e20c5166b700717
  • openEuler-1.0-LTS default protected
  • openEuler-22.09
  • OLK-5.10
  • openEuler-22.03-LTS
  • openEuler-22.03-LTS-Ascend
  • master
  • openEuler-22.03-LTS-LoongArch-NW
  • openEuler-22.09-HCK
  • openEuler-20.03-LTS-SP3
  • openEuler-21.09
  • openEuler-21.03
  • openEuler-20.09
  • 4.19.90-2210.5.0
  • 5.10.0-123.0.0
  • 5.10.0-60.63.0
  • 5.10.0-60.62.0
  • 4.19.90-2210.4.0
  • 5.10.0-121.0.0
  • 5.10.0-60.61.0
  • 4.19.90-2210.3.0
  • 5.10.0-60.60.0
  • 5.10.0-120.0.0
  • 5.10.0-60.59.0
  • 5.10.0-119.0.0
  • 4.19.90-2210.2.0
  • 4.19.90-2210.1.0
  • 5.10.0-118.0.0
  • 5.10.0-106.19.0
  • 5.10.0-60.58.0
  • 4.19.90-2209.6.0
  • 5.10.0-106.18.0
  • 5.10.0-106.17.0
33 results

tcp_timer.c

Blame
  • tcp_timer.c 16.49 KiB
    /*
     * INET		An implementation of the TCP/IP protocol suite for the LINUX
     *		operating system.  INET is implemented using the  BSD Socket
     *		interface as the means of communication with the user level.
     *
     *		Implementation of the Transmission Control Protocol(TCP).
     *
     * Authors:	Ross Biro
     *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
     *		Mark Evans, <evansmp@uhura.aston.ac.uk>
     *		Corey Minyard <wf-rch!minyard@relay.EU.net>
     *		Florian La Roche, <flla@stud.uni-sb.de>
     *		Charles Hedrick, <hedrick@klinzhai.rutgers.edu>
     *		Linus Torvalds, <torvalds@cs.helsinki.fi>
     *		Alan Cox, <gw4pts@gw4pts.ampr.org>
     *		Matthew Dillon, <dillon@apollo.west.oic.com>
     *		Arnt Gulbrandsen, <agulbra@nvg.unit.no>
     *		Jorge Cwik, <jorge@laser.satlink.net>
     */
    
    #include <linux/module.h>
    #include <net/tcp.h>
    
    int sysctl_tcp_syn_retries __read_mostly = TCP_SYN_RETRIES;
    int sysctl_tcp_synack_retries __read_mostly = TCP_SYNACK_RETRIES;
    int sysctl_tcp_keepalive_time __read_mostly = TCP_KEEPALIVE_TIME;
    int sysctl_tcp_keepalive_probes __read_mostly = TCP_KEEPALIVE_PROBES;
    int sysctl_tcp_keepalive_intvl __read_mostly = TCP_KEEPALIVE_INTVL;
    int sysctl_tcp_retries1 __read_mostly = TCP_RETR1;
    int sysctl_tcp_retries2 __read_mostly = TCP_RETR2;
    int sysctl_tcp_orphan_retries __read_mostly;
    int sysctl_tcp_thin_linear_timeouts __read_mostly;
    
    static void tcp_write_timer(unsigned long);
    static void tcp_delack_timer(unsigned long);
    static void tcp_keepalive_timer (unsigned long data);
    
    void tcp_init_xmit_timers(struct sock *sk)
    {
    	inet_csk_init_xmit_timers(sk, &tcp_write_timer, &tcp_delack_timer,
    				  &tcp_keepalive_timer);
    }
    
    EXPORT_SYMBOL(tcp_init_xmit_timers);
    
    static void tcp_write_err(struct sock *sk)
    {
    	sk->sk_err = sk->sk_err_soft ? : ETIMEDOUT;
    	sk->sk_error_report(sk);
    
    	tcp_done(sk);
    	NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPABORTONTIMEOUT);
    }
    
    /* Do not allow orphaned sockets to eat all our resources.
     * This is direct violation of TCP specs, but it is required
     * to prevent DoS attacks. It is called when a retransmission timeout
     * or zero probe timeout occurs on orphaned socket.
     *
     * Criteria is still not confirmed experimentally and may change.
     * We kill the socket, if:
     * 1. If number of orphaned sockets exceeds an administratively configured
     *    limit.
     * 2. If we have strong memory pressure.
     */
    static int tcp_out_of_resources(struct sock *sk, int do_reset)
    {
    	struct tcp_sock *tp = tcp_sk(sk);
    	int orphans = percpu_counter_read_positive(&tcp_orphan_count);