Skip to contentSkip to conversation

account match seq_file update [RESEND of RESEND]

PATCH Applied Piotr Gasidło 2 participants 3 messages Sep 26, 2004 – Sep 27, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 account match seq_file update [RESEND of RESEND]

Hello,

This is fourth try to send this patch. Last three mails were not noticed on group :/

Changes (0.1.16 to 0.1.17):
- use of seq_file API in /proc/net/ipt_account/*
- code cleanup

Patch includes updates for both 2.4 and 2.6.

Please apply.

Signature · 4 lines
Piotr 'QuakeR' Gasidło, BOFH @ pandora.barbara.eu.org
############## sending lusers to /dev/null since 1998
##### Waiting for tomorrow, for a little ray of light
### Waiting for tomorrow just to see your smile again
account/linux/Documentation/Configure.help.ladd +44 -0
diff -uNr patch-o-matic-ng.orig/account/linux/Documentation/Configure.help.ladd patch-o-matic-ng/account/linux/Documentation/Configure.help.ladd
@@ -0,0 +1,44 @@
+CONFIG_IP_NF_MATCH_TOS
+account match support
+CONFIG_IP_NF_MATCH_ACCOUNT
+  This match is used for accounting traffic for all hosts in
+  defined network/netmask. 
+  
+  Features:
+  - long (one counter per protocol TCP/UDP/IMCP/Other) and short statistics
+  - one iptables rule for all hosts in network/netmask
+  - loading/saving counters (by reading/writting to procfs entries)
+  
+  Example usage:
+  
+  account traffic for/to 192.168.0.0/24 network into table mynetwork:
+  
+  # iptables -A FORWARD -m account --aname mynetwork --aaddr 192.168.0.0/24
+  
+  account traffic for/to WWW serwer for 192.168.0.0/24 network into table 
+  mywwwserver:
+  
+  # iptables -A INPUT -p tcp --dport 80 
+    -m account --aname mywwwserver --aaddr 192.168.0.0/24 --ashort
+  # iptables -A OUTPUT -p tcp --sport 80
+    -m account --aname mywwwserver --aaddr 192.168.0.0/24 --ashort    
+  
+  read counters:
+  
+  # cat /proc/net/ipt_account/mynetwork
+  # cat /proc/net/ipt_account/mywwwserver
+  
+  set counters:
+  
+  # echo "ip = 192.168.0.1 packets_src = 0" > /proc/net/ipt_account/mywwserver
+  
+  Webpage: 
+    http://www.barbara.eu.org/~quaker/ipt_account/    
+ 
+  If you want to compile it as a module, say M here and read
+  Documentation/modules.txt.  If unsure, say `N'.
+
+account debugging output
+CONFIG_IP_NF_MATCH_ACCOUNT_DEBUG
+  Say Y to get lots of debugging output.
+
account/linux/include/linux/netfilter_ipv4/ipt_account.h +2 -2
diff -uNr patch-o-matic-ng.orig/account/linux/include/linux/netfilter_ipv4/ipt_account.h patch-o-matic-ng/account/linux/include/linux/netfilter_ipv4/ipt_account.h
@@ -2,7 +2,7 @@
  * accounting match (ipt_account.c)
  * (C) 2003,2004 by Piotr Gasidlo ([email protected])
  *
- * Version: 0.1.6
+ * Version: 0.1.7
  *
  * This software is distributed under the terms of GNU GPL
  */
@@ -13,7 +13,7 @@
 #define IPT_ACCOUNT_NAME_LEN 64
 
 #define IPT_ACCOUNT_NAME "ipt_account"
-#define IPT_ACCOUNT_VERSION  "0.1.6"
+#define IPT_ACCOUNT_VERSION  "0.1.7"
 
 struct t_ipt_account_info {
 	char name[IPT_ACCOUNT_NAME_LEN];
account/linux/net/ipv4/netfilter/ipt_account.c +163 -159

531 lines not on this page · raw message

account/linux-2.6/include/linux/netfilter_ipv4/ipt_account.h +26 -0
diff -uNr patch-o-matic-ng.orig/account/linux-2.6/include/linux/netfilter_ipv4/ipt_account.h patch-o-matic-ng/account/linux-2.6/include/linux/netfilter_ipv4/ipt_account.h
@@ -0,0 +1,26 @@
+/* 
+ * accounting match (ipt_account.c)
+ * (C) 2003,2004 by Piotr Gasidlo ([email protected])
+ *
+ * Version: 0.1.7
+ *
+ * This software is distributed under the terms of GNU GPL
+ */
+
+#ifndef _IPT_ACCOUNT_H_
+#define _IPT_ACCOUNT_H_
+
+#define IPT_ACCOUNT_NAME_LEN 64
+
+#define IPT_ACCOUNT_NAME "ipt_account"
+#define IPT_ACCOUNT_VERSION  "0.1.7"
+
+struct t_ipt_account_info {
+	char name[IPT_ACCOUNT_NAME_LEN];
+	u_int32_t network;
+	u_int32_t netmask;
+	int shortlisting:1;
+};
+
+#endif
+
account/linux-2.6/net/ipv4/netfilter/Kconfig.ladd +45 -0

45 lines not on this page · raw message

account/linux-2.6/net/ipv4/netfilter/Makefile.ladd +2 -0
diff -uNr patch-o-matic-ng.orig/account/linux-2.6/net/ipv4/netfilter/Makefile.ladd patch-o-matic-ng/account/linux-2.6/net/ipv4/netfilter/Makefile.ladd
@@ -0,0 +1,2 @@
+obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o
+obj-$(CONFIG_IP_NF_MATCH_ACCOUNT) += ipt_account.o
account/linux-2.6/net/ipv4/netfilter/ipt_account.c +923 -0

923 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Piotr Gasid³o

Hello,

This is fourth try to send this patch. Last three mails were not noticed on group :/

Just CC me on patches.

Quoted 9 lines

Changes (0.1.16 to 0.1.17):
- use of seq_file API in /proc/net/ipt_account/*
- code cleanup

Patch includes updates for both 2.4 and 2.6.

Please apply.

Applied. iptables-based accounting is deprecated, so I expect we will remove the account/ACCOUNT match from pom-ng at some point.

Regards
Patrick

#2 lore raw
Quoted 3 lines · Patrick McHardy

iptables-based accounting is deprecated, so I expect we will remove the account/ACCOUNT match from pom-ng at some point.

Yes. I've read Harald Welte announce. I think, that module should stay till some userspace accounting tool based on /proc/net/ip_conntrack fields will be created.

My module is mostly used by small ISP (lets say "home" ISP, 100-200 users) as source for rrdtool to create traffic graphs for each IP. It was developed to replace 200-400 traffic accounting rules with single one.

Signature · 4 lines
Piotr 'QuakeR' Gasidło, BOFH @ pandora.barbara.eu.org
############## sending lusers to /dev/null since 1998
##### Waiting for tomorrow, for a little ray of light
### Waiting for tomorrow just to see your smile again