From patchwork Wed Jan 30 22:57:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijay Subramanian X-Patchwork-Id: 217007 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E3DC92C0086 for ; Thu, 31 Jan 2013 09:56:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756475Ab3A3W4l (ORCPT ); Wed, 30 Jan 2013 17:56:41 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:54247 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754216Ab3A3W4j (ORCPT ); Wed, 30 Jan 2013 17:56:39 -0500 Received: by mail-pb0-f48.google.com with SMTP id wy12so1237347pbc.21 for ; Wed, 30 Jan 2013 14:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=RdDXN05Gc2rYnoZxdxDE2NpBhRMavGAhHC5Z6nRw2vI=; b=Uxf5XAs+nG5DflM5OdncbZ+SwaRA6bM/I0emxUhukRBsXqfoAYQo8dyy4eqigBZq9Z 1J72ElB6M0Z8DOj7c1utxgRsCmgrQmHjgI3T5YGjqp87ogYeg4kjhfqT6iohTB7Gm0h3 Kh4cuJfRAlFOu00rpA1HWwdhF8BlWvpmNkbdiOTSwGPVw84hwNUlaSyROaxCmmEW4xut Q4E4Y0CKlyAAPY+UPSyXZbQg5m8pTdu+w14/GVD5m/NUeJkSQIJDq/2gdeMDFyv4+wzv Vz+kBi80qdaKtZ3uPMAqQBCVbOL8QKud5Chn4JD2UuQH7SiAlPj4T59/q+iHqTtjB7Rj S6bg== X-Received: by 10.68.197.9 with SMTP id iq9mr16228124pbc.130.1359586599492; Wed, 30 Jan 2013 14:56:39 -0800 (PST) Received: from localhost.localdomain (128-107-239-234.cisco.com. [128.107.239.234]) by mx.google.com with ESMTPS id ov4sm2824165pbb.45.2013.01.30.14.56.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 30 Jan 2013 14:56:38 -0800 (PST) From: Vijay Subramanian To: netdev@vger.kernel.org Cc: davem@davemloft.net, niveditasinghvi@gmail.com, Vijay Subramanian Subject: [PATCH net] tcp: Update MIB counters for drops Date: Wed, 30 Jan 2013 14:57:50 -0800 Message-Id: <1359586670-16072-1-git-send-email-subramanian.vijay@gmail.com> X-Mailer: git-send-email 1.7.0.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch updates LINUX_MIB_LISTENDROPS and LINUX_MIB_LISTENOVERFLOWS in tcp_v4_conn_request() and tcp_v4_err(). tcp_v4_conn_request() in particular can drop SYNs for various reasons which are not currently tracked. Signed-off-by: Vijay Subramanian --- Ignored "line over 80 chars" warning for readability. net/ipv4/tcp_ipv4.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 629937d..029ac1f 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -496,6 +496,7 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) * errors returned from accept(). */ inet_csk_reqsk_queue_drop(sk, req, prev); + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); goto out; case TCP_SYN_SENT: @@ -1491,8 +1492,10 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) */ if (inet_csk_reqsk_queue_is_full(sk) && !isn) { want_cookie = tcp_syn_flood_action(sk, skb, "TCP"); - if (!want_cookie) + if (!want_cookie) { + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); goto drop; + } } /* Accept backlog is full. If we have already queued enough @@ -1502,7 +1505,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) */ if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) { NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); goto drop; } @@ -1669,6 +1671,7 @@ drop_and_release: drop_and_free: reqsk_free(req); drop: + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); return 0; } EXPORT_SYMBOL(tcp_v4_conn_request);