Skip to content
  • Tung Nguyen's avatar
    tipc: buffer overflow handling in listener socket · 67879274
    Tung Nguyen authored
    
    
    Default socket receive buffer size for a listener socket is 2Mb. For
    each arriving empty SYN, the linux kernel allocates a 768 bytes buffer.
    This means that a listener socket can serve maximum 2700 simultaneous
    empty connection setup requests before it hits a receive buffer
    overflow, and much fewer if the SYN is carrying any significant
    amount of data.
    
    When this happens the setup request is rejected, and the client
    receives an ECONNREFUSED error.
    
    This commit mitigates this problem by letting the client socket try to
    retransmit the SYN message multiple times when it sees it rejected with
    the code TIPC_ERR_OVERLOAD. Retransmission is done at random intervals
    in the range of [100 ms, setup_timeout / 4], as many times as there is
    room for within the setup timeout limit.
    
    Signed-off-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
    Acked-by: default avatarYing Xue <ying.xue@windriver.com>
    Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    67879274