All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: [PATCH 2.6 2/12]: add sysctl to read out the number of current connections
Date: Tue, 21 Sep 2004 05:21:55 +0200	[thread overview]
Message-ID: <414F9E53.3090604@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

This patch adds a sysctl to read out the number of current connections.
ip_conntrack_count is an atomic_t, but it is read out by proc_dointvec.
I have checked all arches, all use an int, but I'm not sure if it works
on all of them.


ChangeSet@1.1935.1.2, 2004-09-18 23:27:31+02:00, laforge@netfilter.org
  [NETFILTER]: add sysctl to read out the number of current connections
 
  Apparently a lot of scripts use a construct like
          "cat /proc/net/ip_conntrack | wc -l"
  which has a negative impact on system performance due to all the locking
  required.
 
  Signed-off-by: Harald Welte <laforge@netfilter.org>
  Signed-off-by: Patrick McHardy <kaber@trash.net>


[-- Attachment #2: 02.diff --]
[-- Type: text/x-patch, Size: 2560 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/09/18 23:27:31+02:00 laforge@netfilter.org 
#   [NETFILTER]: add sysctl to read out the number of current connections
#   
#   Apparently a lot of scripts use a construct like
#           "cat /proc/net/ip_conntrack | wc -l"
#   which has a negative impact on system performance due to all the locking
#   required.
#   
#   Signed-off-by: Harald Welte <laforge@netfilter.org>
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ip_conntrack_standalone.c
#   2004/09/18 23:27:03+02:00 laforge@netfilter.org +8 -0
#   [NETFILTER]: add sysctl to read out the number of current connections
#   
#   Apparently a lot of scripts use a construct like
#           "cat /proc/net/ip_conntrack | wc -l"
#   which has a negative impact on system performance due to all the locking
#   required.
#   
#   Signed-off-by: Harald Welte <laforge@netfilter.org>
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# include/linux/sysctl.h
#   2004/09/18 23:27:03+02:00 laforge@netfilter.org +1 -0
#   [NETFILTER]: add sysctl to read out the number of current connections
#   
#   Apparently a lot of scripts use a construct like
#           "cat /proc/net/ip_conntrack | wc -l"
#   which has a negative impact on system performance due to all the locking
#   required.
#   
#   Signed-off-by: Harald Welte <laforge@netfilter.org>
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/include/linux/sysctl.h b/include/linux/sysctl.h
--- a/include/linux/sysctl.h	2004-09-20 11:57:01 +02:00
+++ b/include/linux/sysctl.h	2004-09-20 11:57:01 +02:00
@@ -424,6 +424,7 @@
  	NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
  	NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
  	NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
+	NET_IPV4_NF_CONNTRACK_COUNT=27,
 };
  
 /* /proc/sys/net/ipv6 */
diff -Nru a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
--- a/net/ipv4/netfilter/ip_conntrack_standalone.c	2004-09-20 11:57:01 +02:00
+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c	2004-09-20 11:57:01 +02:00
@@ -515,6 +515,14 @@
 		.proc_handler	= &proc_dointvec,
 	},
 	{
+		.ctl_name	= NET_IPV4_NF_CONNTRACK_COUNT,
+		.procname	= "ip_conntrack_count",
+		.data		= &ip_conntrack_count,
+		.maxlen		= sizeof(int),
+		.mode		= 0444,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
 		.ctl_name	= NET_IPV4_NF_CONNTRACK_BUCKETS,
 		.procname	= "ip_conntrack_buckets",
 		.data		= &ip_conntrack_htable_size,

                 reply	other threads:[~2004-09-21  3:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=414F9E53.3090604@trash.net \
    --to=kaber@trash.net \
    --cc=davem@redhat.com \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.