ipt_account match update
Hello,
I've rewritten my ipt_account match. Main changes:
- big code cleanup,
- removed code that parsed input from user while writing to proc entry - I've used sscanf (in kernel) instead,
- match()ing is faster (speeded up code finding the right table to update)
- code is fully compatible with latest 2.6.16/2.4.32 kernels.
Including diff against patch-o-matic-ng SVN. No iptables (userspace) patches are needed.
There is one problem. While rewriting I broke binary compatiblity (I've added new variable to t_ipt_account_info structure, which is used by iptables userspace program).
And I've question. Do I have to write this "update" like ipt_MARK was rewriten in kernel? Or should I leave it like it is (ipt_account is not in stock kernel, it will never be, and after applying patches from patch-o-matic-ng user *have* to recompile iptables, so problem I think disapears).
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
patchlets/account/linux/include/linux/netfilter_ipv4/ipt_account.h +10 -12
@@ -1,10 +1,8 @@ -/* -* accounting match (ipt_account.c) -* (C) 2003,2004 by Piotr Gasidlo ([email protected]) +/* Copyright (c) 2004-2006 Piotr 'QuakeR' Gasidło <[email protected]> * -* Version: 0.1.7 -* -* This software is distributed under the terms of GNU GPL +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #ifndef _IPT_ACCOUNT_H_
@@ -12,15 +10,15 @@#define IPT_ACCOUNT_NAME_LEN 64 -#define IPT_ACCOUNT_NAME "ipt_account" -#define IPT_ACCOUNT_VERSION "0.1.7" +struct t_ipt_account_table ;struct t_ipt_account_info { -char name[IPT_ACCOUNT_NAME_LEN ]; -u_int32_t network; -u_int32_t netmask; +char name[IPT_ACCOUNT_NAME_LEN +1 ]; +u_int32_t network, netmask;int shortlisting:1 ; +/* pointer to the table for fast matching */ +struct t_ipt_account_table *table; }; -#endif +#endif /* _IPT_ACCOUNT_H */
patchlets/account/linux/net/ipv4/netfilter/ipt_account.c +604 -776
1,528 lines not on this page · raw message
patchlets/account/linux-2.6/include/linux/netfilter_ipv4/ipt_account.h +10 -12
@@ -1,10 +1,8 @@ -/* -* accounting match (ipt_account.c) -* (C) 2003,2004 by Piotr Gasidlo ([email protected]) +/* Copyright (c) 2004-2006 Piotr 'QuakeR' Gasidło <[email protected]> * -* Version: 0.1.7 -* -* This software is distributed under the terms of GNU GPL +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #ifndef _IPT_ACCOUNT_H_
@@ -12,15 +10,15 @@#define IPT_ACCOUNT_NAME_LEN 64 -#define IPT_ACCOUNT_NAME "ipt_account" -#define IPT_ACCOUNT_VERSION "0.1.7" +struct t_ipt_account_table ;struct t_ipt_account_info { -char name[IPT_ACCOUNT_NAME_LEN ]; -u_int32_t network; -u_int32_t netmask; +char name[IPT_ACCOUNT_NAME_LEN +1 ]; +u_int32_t network, netmask;int shortlisting:1 ; +/* pointer to the table for fast matching */ +struct t_ipt_account_table *table; }; -#endif +#endif /* _IPT_ACCOUNT_H */
patchlets/account/linux-2.6/net/ipv4/netfilter/ipt_account.c +599 -772
1,402 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.