All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6 2/12]: add sysctl to read out the number of current connections
@ 2004-09-21  3:21 Patrick McHardy
  0 siblings, 0 replies; only message in thread
From: Patrick McHardy @ 2004-09-21  3:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: Netfilter Development Mailinglist

[-- 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,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-21  3:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-21  3:21 [PATCH 2.6 2/12]: add sysctl to read out the number of current connections Patrick McHardy

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.