|
@@ -66,18 +66,18 @@ static void tcp_write_err(struct sock *sk)
|
|
static int tcp_out_of_resources(struct sock *sk, int do_reset)
|
|
static int tcp_out_of_resources(struct sock *sk, int do_reset)
|
|
{
|
|
{
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
- int orphans = percpu_counter_read_positive(&tcp_orphan_count);
|
|
|
|
|
|
+ int shift = 0;
|
|
|
|
|
|
/* If peer does not open window for long time, or did not transmit
|
|
/* If peer does not open window for long time, or did not transmit
|
|
* anything for long time, penalize it. */
|
|
* anything for long time, penalize it. */
|
|
if ((s32)(tcp_time_stamp - tp->lsndtime) > 2*TCP_RTO_MAX || !do_reset)
|
|
if ((s32)(tcp_time_stamp - tp->lsndtime) > 2*TCP_RTO_MAX || !do_reset)
|
|
- orphans <<= 1;
|
|
|
|
|
|
+ shift++;
|
|
|
|
|
|
/* If some dubious ICMP arrived, penalize even more. */
|
|
/* If some dubious ICMP arrived, penalize even more. */
|
|
if (sk->sk_err_soft)
|
|
if (sk->sk_err_soft)
|
|
- orphans <<= 1;
|
|
|
|
|
|
+ shift++;
|
|
|
|
|
|
- if (tcp_too_many_orphans(sk, orphans)) {
|
|
|
|
|
|
+ if (tcp_too_many_orphans(sk, shift)) {
|
|
if (net_ratelimit())
|
|
if (net_ratelimit())
|
|
printk(KERN_INFO "Out of socket memory\n");
|
|
printk(KERN_INFO "Out of socket memory\n");
|
|
|
|
|