: Netfilter update part II
Subsystems (3)
cover : Netfilter update part II
Hi Dave,
these patches for 2.6.22 contain mostly cleanups: some nfnetlink_log cleanup and micro-optimizations, removal of changelogs in C files, conversion to use setup_timer in netfilter code and a size-reduction of struct nf_conntrack and struct sk_buff when connection tracking is disabled-
Please apply, thanks.
include/linux/netfilter.h | 12 ++- include/linux/skbuff.h | 28 ++----- net/bridge/netfilter/ebt_ulog.c | 4 - net/core/skbuff.c | 4 - net/ipv4/netfilter/ip_queue.c | 12 --- net/ipv4/netfilter/ip_tables.c | 6 - net/ipv4/netfilter/ipt_ECN.c | 2 net/ipv4/netfilter/ipt_REJECT.c | 2 net/ipv4/netfilter/ipt_SAME.c | 15 ---- net/ipv4/netfilter/ipt_ULOG.c | 23 ------ net/ipv4/netfilter/ipt_ecn.c | 2 net/ipv4/netfilter/ipt_ttl.c | 2 net/ipv4/netfilter/iptable_mangle.c | 2 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 8 -- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 5 - net/ipv4/netfilter/nf_nat_snmp_basic.c | 4 - net/ipv6/netfilter/ip6_queue.c | 12 --- net/ipv6/netfilter/ip6_tables.c | 9 -- net/ipv6/netfilter/ip6table_mangle.c | 2 net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 11 -- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 7 - net/ipv6/netfilter/nf_conntrack_reasm.c | 7 - net/netfilter/core.c | 23 ++++-- net/netfilter/nf_conntrack_core.c | 27 +------ net/netfilter/nf_conntrack_expect.c | 4 - net/netfilter/nf_conntrack_ftp.c | 6 - net/netfilter/nf_conntrack_netlink.c | 5 - net/netfilter/nf_conntrack_proto_generic.c | 5 - net/netfilter/nf_conntrack_proto_sctp.c | 9 -- net/netfilter/nf_conntrack_proto_tcp.c | 18 ---- net/netfilter/nf_conntrack_proto_udp.c | 5 - net/netfilter/nf_conntrack_standalone.c | 11 -- net/netfilter/nfnetlink.c | 4 - net/netfilter/nfnetlink_log.c | 92 +++++++------------------ net/netfilter/xt_DSCP.c | 2 net/netfilter/xt_connbytes.c | 9 -- net/netfilter/xt_dscp.c | 2 net/netfilter/xt_hashlimit.c | 4 - net/netfilter/xt_helper.c | 3 net/netfilter/xt_limit.c | 7 - net/netfilter/xt_realm.c | 2 41 files changed, 75 insertions(+), 342 deletions(-)
Michal Miroslaw (6):
[NETFILTER]: nfnetlink_log: don't count max(a,b) twice
[NETFILTER]: nfnetlink_log: kill duplicate code
[NETFILTER]: nfnetlink_log: micro-optimization for inst==NULL in nfulnl_recv_config() [NETFILTER]: nfnetlink_log: micro-optimization: don't modify destroyed instance [NETFILTER]: nfnetlink_log: iterator functions need iter_state * only [NETFILTER]: nfnetlink_log: micro-optimization: inst->skb != NULL in __nfulnl_send()
Patrick McHardy (3):
[NETFILTER]: Remove changelogs and CVS IDs [NETFILTER]: nfnetlink_log: remove conditional locking [NETFILTER]: Use setup_timer
Thomas Graf (1):
[NETFILTER] nfnetlink: netlink_run_queue() already checks for NLM_F_REQUEST
Yasuyuki Kozakai (2):
[NETFILTER]: nf_conntrack: don't use nfct in skb if conntrack is disabled [NETFILTER]: nf_conntrack: kill destroy() in struct nf_conntrack for diet
PATCH 1/12 : Remove changelogs and CVS IDs
[NETFILTER]: Remove changelogs and CVS IDs
---
commit 7d6eb2567f5694088bda13109f45b6b16ef1e21d
tree d91c09da8ceaad7571568c8969c3c4b38e7587c3
parent 3231f075945001667eafaf325abab8c992b3d1e4
author Patrick McHardy <[email protected]> Thu, 22 Mar 2007 23:00:33 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:20 +0100
net/ipv4/netfilter/ip_queue.c | 12 ------------ net/ipv4/netfilter/ip_tables.c | 6 ------ net/ipv4/netfilter/ipt_ECN.c | 2 -- net/ipv4/netfilter/ipt_REJECT.c | 2 -- net/ipv4/netfilter/ipt_SAME.c | 15 --------------- net/ipv4/netfilter/ipt_ULOG.c | 16 ---------------- net/ipv4/netfilter/ipt_ecn.c | 2 -- net/ipv4/netfilter/ipt_ttl.c | 2 -- net/ipv4/netfilter/iptable_mangle.c | 2 -- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 8 -------- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 5 ----- net/ipv4/netfilter/nf_nat_snmp_basic.c | 4 ---- net/ipv6/netfilter/ip6_queue.c | 12 ------------ net/ipv6/netfilter/ip6_tables.c | 9 --------- net/ipv6/netfilter/ip6table_mangle.c | 2 -- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 11 ----------- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 7 ------- net/netfilter/core.c | 4 ---- net/netfilter/nf_conntrack_core.c | 18 ------------------ net/netfilter/nf_conntrack_ftp.c | 6 ------ net/netfilter/nf_conntrack_netlink.c | 5 ----- net/netfilter/nf_conntrack_proto_generic.c | 5 ----- net/netfilter/nf_conntrack_proto_sctp.c | 9 --------- net/netfilter/nf_conntrack_proto_tcp.c | 18 ------------------ net/netfilter/nf_conntrack_proto_udp.c | 5 ----- net/netfilter/nf_conntrack_standalone.c | 11 ----------- net/netfilter/nfnetlink_log.c | 5 ----- net/netfilter/xt_DSCP.c | 2 -- net/netfilter/xt_connbytes.c | 9 --------- net/netfilter/xt_dscp.c | 2 -- net/netfilter/xt_helper.c | 3 --- net/netfilter/xt_limit.c | 7 ------- net/netfilter/xt_realm.c | 2 -- 33 files changed, 0 insertions(+), 228 deletions(-)
net/ipv4/netfilter/ip_queue.c +0 -12
@@ -8,18 +8,6 @@* 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. -* -* 2000-03-27: Simplified code (thanks to Andi Kleen for clues). -* 2000-05-20: Fixed notifier problems (following Miguel Freitas' report). -* 2000-06-19: Fixed so nfmark is copied to metadata (reported by Sebastian -* Zander). -* 2000-08-01: Added Nick Williams' MAC support. -* 2002-06-25: Code cleanup. -* 2005-01-10: Added /proc counter for dropped packets; fixed so -* packets aren't delivered to user space if they're going -* to be dropped. -* 2005-05-26: local_bh_{disable,enable} around nf_reinject (Harald Welte) -* */ #include <linux/module.h> #include <linux/skbuff.h>
net/ipv4/netfilter/ip_tables.c +0 -6
@@ -7,12 +7,6 @@* 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. -* -* 19 Jan 2002 Harald Welte <[email protected]> -* - increase module usage count as soon as we have rules inside -* a table -* 08 Oct 2005 Harald Welte <[email protected]> -* - Generalize into "x_tables" layer and "{ip,ip6,arp}_tables" */ #include <linux/cache.h> #include <linux/capability.h>
net/ipv4/netfilter/ipt_ECN.c +0 -2
@@ -5,8 +5,6 @@* 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. -* -* ipt_ECN.c,v 1.5 2002/08/18 19:36:51 laforge Exp */ #include <linux/in.h>
net/ipv4/netfilter/ipt_REJECT.c +0 -2
@@ -1,7 +1,5 @@/* * This is a module which is used for rejecting packets. -* Added support for customized reject packets (Jozsef Kadlecsik). -* Added support for ICMP type-3-code-13 (Maciej Soltysiak). [RFC 1812] */ /* (C) 1999-2001 Paul `Rusty' Russell
net/ipv4/netfilter/ipt_SAME.c +0 -15
@@ -7,21 +7,6 @@* 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. -* -* 010320 Martin Josefsson <[email protected]> -* * copied ipt_BALANCE.c to ipt_SAME.c and changed a few things. -* 010728 Martin Josefsson <[email protected]> -* * added --nodst to not include destination-ip in new source -* calculations. -* * added some more sanity-checks. -* 010729 Martin Josefsson <[email protected]> -* * fixed a buggy if-statement in same_check(), should have -* used ntohl() but didn't. -* * added support for multiple ranges. IPT_SAME_MAX_RANGE is -* defined in linux/include/linux/netfilter_ipv4/ipt_SAME.h -* and is currently set to 10. -* * added support for 1-address range, nice to have now that -* we have multiple ranges. */ #include <linux/types.h> #include <linux/ip.h>
net/ipv4/netfilter/ipt_ULOG.c +0 -16
@@ -2,20 +2,6 @@* netfilter module for userspace packet logging daemons * * (C) 2000-2004 by Harald Welte <[email protected]> -* -* 2000/09/22 ulog-cprange feature added -* 2001/01/04 in-kernel queue as proposed by Sebastian Zander -* <[email protected]> -* 2001/01/30 per-rule nlgroup conflicts with global queue. -* nlgroup now global (sysctl) -* 2001/04/19 ulog-queue reworked, now fixed buffer size specified at -* module loadtime -HW -* 2002/07/07 remove broken nflog_rcv() function -HW -* 2002/08/29 fix shifted/unshifted nlgroup bug -HW -* 2002/10/30 fix uninitialized mac_len field - <Anders K. Pedersen> -* 2004/10/25 fix erroneous calculation of 'len' parameter to NLMSG_PUT -* resulting in bogus 'error during NLMSG_PUT' messages. -* * (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2004 Netfilter Core Team <[email protected]> *
@@ -42,8 +28,6 @@* flushtimeout: * Specify, after how many hundredths of a second the queue should be * flushed even if it is not full yet. -* -* ipt_ULOG.c,v 1.22 2002/10/30 09:07:31 laforge Exp */ #include <linux/module.h>
net/ipv4/netfilter/ipt_ecn.c +0 -2
@@ -1,7 +1,5 @@/* IP tables module for matching the value of the IPv4 and TCP ECN bits * -* ipt_ecn.c,v 1.3 2002/05/29 15:09:00 laforge Exp -* * (C) 2002 by Harald Welte <[email protected]> * * This program is free software; you can redistribute it and/or modify
net/ipv4/netfilter/ipt_ttl.c +0 -2
@@ -1,7 +1,5 @@/* IP tables module for matching the value of the TTL * -* ipt_ttl.c,v 1.5 2000/11/13 11:16:08 laforge Exp -* * (C) 2000,2001 by Harald Welte <[email protected]> * * This program is free software; you can redistribute it and/or modify
net/ipv4/netfilter/iptable_mangle.c +0 -2
@@ -7,8 +7,6 @@* 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. -* -* Extended to all five netfilter hooks by Brad Chapman & Harald Welte */ #include <linux/module.h> #include <linux/netfilter_ipv4/ip_tables.h>
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +0 -8
@@ -4,14 +4,6 @@* 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. -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - move L3 protocol dependent part to this file. -* 23 Mar 2004: Yasuyuki Kozakai @USAGI <[email protected]> -* - add get_features() to support various size of conntrack -* structures. -* -* Derived from net/ipv4/netfilter/ip_conntrack_standalone.c */ #include <linux/types.h>
net/ipv4/netfilter/nf_conntrack_proto_icmp.c +0 -5
@@ -4,11 +4,6 @@* 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. -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - enable working with Layer 3 protocol independent connection tracking. -* -* Derived from net/ipv4/netfilter/ip_conntrack_proto_icmp.c */ #include <linux/types.h>
net/ipv4/netfilter/nf_nat_snmp_basic.c +0 -4
@@ -38,10 +38,6 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: James Morris <[email protected]> -* -* Updates: -* 2000-08-06: Convert to new helper API (Harald Welte). -* */ #include <linux/module.h> #include <linux/moduleparam.h>
net/ipv6/netfilter/ip6_queue.c +0 -12
@@ -11,18 +11,6 @@* 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. -* -* 2001-11-06: First try. Working with ip_queue.c for IPv4 and trying -* to adapt it to IPv6 -* HEAVILY based in ipqueue.c by James Morris. It's just -* a little modified version of it, so he's nearly the -* real coder of this. -* Few changes needed, mainly the hard_routing code and -* the netlink socket protocol (we're NETLINK_IP6_FW). -* 2002-06-25: Code cleanup. [JM: ported cleanup over from ip_queue.c] -* 2005-02-04: Added /proc counter for dropped packets; fixed so -* packets aren't delivered to user space if they're going -* to be dropped. */ #include <linux/module.h> #include <linux/skbuff.h>
net/ipv6/netfilter/ip6_tables.c +0 -9
@@ -7,15 +7,6 @@* 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. -* -* 19 Jan 2002 Harald Welte <[email protected]> -* - increase module usage count as soon as we have rules inside -* a table -* 06 Jun 2002 Andras Kis-Szabo <[email protected]> -* - new extension header parser code -* 15 Oct 2005 Harald Welte <[email protected]> -* - Unification of {ip,ip6}_tables into x_tables -* - Removed tcp and udp code, since it's not ipv6 specific */ #include <linux/capability.h>
net/ipv6/netfilter/ip6table_mangle.c +0 -2
@@ -7,8 +7,6 @@* 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. -* -* Extended to all five netfilter hooks by Brad Chapman & Harald Welte */ #include <linux/module.h> #include <linux/netfilter_ipv6/ip6_tables.h>
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +0 -11
@@ -7,17 +7,6 @@* * Author: * Yasuyuki Kozakai @USAGI <[email protected]> -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - support Layer 3 protocol independent connection tracking. -* Based on the original ip_conntrack code which had the following -* copyright information: -* (C) 1999-2001 Paul `Rusty' Russell -* (C) 2002-2004 Netfilter Core Team <[email protected]> -* -* 23 Mar 2004: Yasuyuki Kozakai @USAGI <[email protected]> -* - add get_features() to support various size of conntrack -* structures. */ #include <linux/types.h>
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +0 -7
@@ -7,13 +7,6 @@* * Author: * Yasuyuki Kozakai @USAGI <[email protected]> -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - ICMPv6 tracking support. Derived from the original ip_conntrack code -* net/ipv4/netfilter/ip_conntrack_proto_icmp.c which had the following -* copyright information: -* (C) 1999-2001 Paul `Rusty' Russell -* (C) 2002-2004 Netfilter Core Team <[email protected]> */ #include <linux/types.h>
net/netfilter/core.c +0 -4
@@ -5,10 +5,6 @@* way. * * Rusty Russell (C)2000 -- This code is GPL. -* -* February 2000: Modified by James Morris to have 1 queue per protocol. -* 15-Mar-2000: Added NF_REPEAT --RR. -* 08-May-2003: Internal logging interface added by Jozsef Kadlecsik. */ #include <linux/kernel.h> #include <linux/netfilter.h>
net/netfilter/nf_conntrack_core.c +0 -18
@@ -9,24 +9,6 @@* 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. -* -* 23 Apr 2001: Harald Welte <[email protected]> -* - new API and handling of conntrack/nat helpers -* - now capable of multiple expectations for one master -* 16 Jul 2002: Harald Welte <[email protected]> -* - add usage/reference counts to ip_conntrack_expect -* - export ip_conntrack[_expect]_{find_get,put} functions -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - generalize L3 protocol denendent part. -* 23 Mar 2004: Yasuyuki Kozakai @USAGI <[email protected]> -* - add support various size of conntrack structures. -* 26 Jan 2006: Harald Welte <[email protected]> -* - restructure nf_conn (introduce nf_conn_help) -* - redesign 'features' how they were originally intended -* 26 Feb 2006: Pablo Neira Ayuso <[email protected]> -* - add support for L3 protocol module load on demand. -* -* Derived from net/ipv4/netfilter/ip_conntrack_core.c */ #include <linux/types.h>
net/netfilter/nf_conntrack_ftp.c +0 -6
@@ -7,12 +7,6 @@* 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. -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - enable working with Layer 3 protocol independent connection tracking. -* - track EPRT and EPSV commands with IPv6 address. -* -* Derived from net/ipv4/netfilter/ip_conntrack_ftp.c */ #include <linux/module.h>
net/netfilter/nf_conntrack_netlink.c +0 -5
@@ -6,9 +6,6 @@* (C) 2003 by Patrick Mchardy <[email protected]> * (C) 2005-2006 by Pablo Neira Ayuso <[email protected]> * -* I've reworked this stuff to use attributes instead of conntrack -* structures. 5.44 am. I need more tea. --pablo 05/07/11. -* * Initial connection tracking via netlink development funded and * generally made possible by Network Robots, Inc. (www.networkrobots.com) *
@@ -16,8 +13,6 @@* * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. -* -* Derived from ip_conntrack_netlink.c: Port by Pablo Neira Ayuso (05/11/14) */ #include <linux/init.h>
net/netfilter/nf_conntrack_proto_generic.c +0 -5
@@ -4,11 +4,6 @@* 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. -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - enable working with L3 protocol independent connection tracking. -* -* Derived from net/ipv4/netfilter/ip_conntrack_proto_generic.c */ #include <linux/types.h>
net/netfilter/nf_conntrack_proto_sctp.c +0 -9
@@ -7,15 +7,6 @@* 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. -* -* 17 Oct 2004: Yasuyuki Kozakai @USAGI <[email protected]> -* - enable working with L3 protocol independent connection tracking. -* -* Derived from net/ipv4/ip_conntrack_sctp.c -*/ - -/* -* Added support for proc manipulation of timeouts. */ #include <linux/types.h>
net/netfilter/nf_conntrack_proto_tcp.c +0 -18
@@ -4,24 +4,6 @@* 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. -* -* Jozsef Kadlecsik <[email protected]>: -* - Real stateful connection tracking -* - Modified state transitions table -* - Window scaling support added -* - SACK support added -* -* Willy Tarreau: -* - State table bugfixes -* - More robust state changes -* - Tuning timer parameters -* -* 27 Oct 2004: Yasuyuki Kozakai @USAGI <[email protected]> -* - genelized Layer 3 protocol part. -* -* Derived from net/ipv4/netfilter/ip_conntrack_proto_tcp.c -* -* version 2.2 */ #include <linux/types.h>
net/netfilter/nf_conntrack_proto_udp.c +0 -5
@@ -4,11 +4,6 @@* 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. -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - enable working with Layer 3 protocol independent connection tracking. -* -* Derived from net/ipv4/netfilter/ip_conntrack_proto_udp.c */ #include <linux/types.h>
net/netfilter/nf_conntrack_standalone.c +0 -11
@@ -1,20 +1,9 @@ -/* This file contains all the functions required for the standalone -nf_conntrack module. - -These are not required by the compatibility layer. -*/ -/* (C) 1999-2001 Paul `Rusty' Russell * (C) 2002-2004 Netfilter Core Team <[email protected]> * * 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. -* -* 16 Dec 2003: Yasuyuki Kozakai @USAGI <[email protected]> -* - generalize L3 protocol dependent part. -* -* Derived from net/ipv4/netfilter/ip_conntrack_standalone.c */ #include <linux/types.h>
net/netfilter/nfnetlink_log.c +0 -5
@@ -10,11 +10,6 @@* 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. -* -* 2006-01-26 Harald Welte <[email protected]> -* - Add optional local and global sequence number to detect lost -* events from userspace -* */ #include <linux/module.h> #include <linux/skbuff.h>
net/netfilter/xt_DSCP.c +0 -2
@@ -8,8 +8,6 @@* published by the Free Software Foundation. * * See RFC2474 for a description of the DSCP field within the IP Header. -* -* xt_DSCP.c,v 1.8 2002/08/06 18:41:57 laforge Exp */ #include <linux/module.h>
net/netfilter/xt_connbytes.c +0 -9
@@ -1,14 +1,5 @@/* Kernel module to match connection tracking byte counter. * GPL (C) 2002 Martin Devera ([email protected]). -* -* 2004-07-20 Harald Welte <[email protected]> -* - reimplemented to use per-connection accounting counters -* - add functionality to match number of packets -* - add functionality to match average packet size -* - add support to match directions seperately -* 2005-10-16 Harald Welte <[email protected]> -* - Port to x_tables -* */ #include <linux/module.h> #include <linux/skbuff.h>
net/netfilter/xt_dscp.c +0 -2
@@ -1,7 +1,5 @@/* IP tables module for matching the value of the IPv4/IPv6 DSCP field * -* xt_dscp.c,v 1.3 2002/08/05 19:00:21 laforge Exp -* * (C) 2002 by Harald Welte <[email protected]> * * This program is free software; you can redistribute it and/or modify
net/netfilter/xt_helper.c +0 -3
@@ -5,9 +5,6 @@* 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. -* -* 19 Mar 2002 Harald Welte <[email protected]>: -* - Port to newnat infrastructure */ #include <linux/module.h>
net/netfilter/xt_limit.c +0 -7
@@ -1,10 +1,3 @@ -/* Kernel module to control the rate -* -* 2 September 1999: Changed from the target RATE to the match -* `limit', removed logging. Did I mention that -* Alexey is a fucking genius? -* Rusty Russell ([email protected]). */ -/* (C) 1999 J�r�me de Vivie <[email protected]> * (C) 1999 Herv� Eychenne <[email protected]> *
net/netfilter/xt_realm.c +0 -2
@@ -1,7 +1,5 @@/* IP tables module for matching the routing realm * -* $Id: ipt_realm.c,v 1.3 2004/03/05 13:25:40 laforge Exp $ -* * (C) 2003 by Sampsa Ranta <[email protected]> * * This program is free software; you can redistribute it and/or modify
PATCH 2/12 : nfnetlink_log: don't count max(a,b) twice
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: don't count max(a,b) twice
We don't need local nlbufsiz (skb size) as nfulnl_alloc_skb() takes the maximum anyway.
---
commit 9bff4aef16228a63f2fd5515dcec087574019a75
tree 9c9b3d253ee3a49a401d24b3befe69ce941ab43c
parent 7d6eb2567f5694088bda13109f45b6b16ef1e21d
author Michal Miroslaw <[email protected]> Thu, 22 Mar 2007 23:01:00 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:20 +0100
net/netfilter/nfnetlink_log.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-)
net/netfilter/nfnetlink_log.c +2 -8
@@ -590,7 +590,6 @@ nfulnl_log_packet(unsigned int pf,struct nfulnl_instance *inst;const struct nf_loginfo *li;unsigned int qthreshold; -unsigned int nlbufsiz;unsigned int plen;if (li_user && li_user->type ==NF_LOG_TYPE_ULOG )
@@ -666,13 +665,8 @@ nfulnl_log_packet(unsigned int pf,return ; } -if (size > inst->nlbufsiz) - nlbufsiz = size; -else - nlbufsiz = inst->nlbufsiz; -if (!inst->skb) { -if (!(inst->skb =nfulnl_alloc_skb (nlbufsiz, size))) { +if (!(inst->skb =nfulnl_alloc_skb (inst->nlbufsiz, size))) {UDEBUG ("error in nfulnl_alloc_skb(%u, %u)\n" , inst->nlbufsiz, size); goto alloc_failure;
@@ -688,7 +682,7 @@ nfulnl_log_packet(unsigned int pf,instance_put (inst);__nfulnl_send (inst); -if (!(inst->skb =nfulnl_alloc_skb (nlbufsiz, size))) { +if (!(inst->skb =nfulnl_alloc_skb (inst->nlbufsiz, size))) {UDEBUG ("error in nfulnl_alloc_skb(%u, %u)\n" , inst->nlbufsiz, size); goto alloc_failure;
PATCH 3/12 : nfnetlink_log: kill duplicate code
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: kill duplicate code
Kill some duplicate code in nfulnl_log_packet().
---
commit 797c0ab0be222b58be043f42eee79f2503b4ab08
tree 4877b09381dd4c284fa8d31be665b268be67463d
parent 9bff4aef16228a63f2fd5515dcec087574019a75
author Michal Miroslaw <[email protected]> Thu, 22 Mar 2007 23:01:22 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:21 +0100
net/netfilter/nfnetlink_log.c | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-)
net/netfilter/nfnetlink_log.c +7 -15
@@ -660,19 +660,11 @@ nfulnl_log_packet(unsigned int pf,break ;default : -spin_unlock_bh (&inst->lock); -instance_put (inst); -return ; + goto unlock_and_release; } -if (!inst->skb) { -if (!(inst->skb =nfulnl_alloc_skb (inst->nlbufsiz, size))) { -UDEBUG ("error in nfulnl_alloc_skb(%u, %u)\n" , - inst->nlbufsiz, size); - goto alloc_failure; - } - }else if (inst->qlen >= qthreshold || - size >skb_tailroom (inst->skb)) { +if (inst->qlen >= qthreshold || + (inst->skb && size >skb_tailroom (inst->skb))) {/* either the queue len is too high or we don't have * enough room in the skb left. flush to userspace. */ UDEBUG ("flushing old skb\n" );
@@ -681,12 +673,12 @@ nfulnl_log_packet(unsigned int pf,if (del_timer (&inst->timer))instance_put (inst);__nfulnl_send (inst); + } -if (!(inst->skb =nfulnl_alloc_skb (inst->nlbufsiz, size))) { -UDEBUG ("error in nfulnl_alloc_skb(%u, %u)\n" , - inst->nlbufsiz, size); +if (!inst->skb) { + inst->skb =nfulnl_alloc_skb (inst->nlbufsiz, size); +if (!inst->skb) goto alloc_failure; - } }UDEBUG ("qlen %d, qthreshold %d\n" , inst->qlen, qthreshold);
PATCH 4/12 : nfnetlink_log: micro-optimization for inst==NULL in nfulnl_recv_config()
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: micro-optimization for inst==NULL in nfulnl_recv_config()
Simple micro-optimization: don't call instance_put() on known NULL pointers.
---
commit 7e6bd92e1cdbb5bd83285d2a2f7dc151c853511d
tree 829f4920a6df42202656aeaa7d9871fbf0ce8a48
parent 797c0ab0be222b58be043f42eee79f2503b4ab08
author Michal Miroslaw <[email protected]> Thu, 22 Mar 2007 23:01:33 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:21 +0100
net/netfilter/nfnetlink_log.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nfnetlink_log.c +3 -3
@@ -810,13 +810,13 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, NETLINK_CB(skb).pid);if (!inst) { ret = -EINVAL ; - goto out_put; + goto out; }break ;case NFULNL_CFG_CMD_UNBIND :if (!inst) { ret = -ENODEV ; - goto out_put; + goto out; }if (inst->peer_pid !=NETLINK_CB (skb).pid) {
@@ -849,7 +849,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,"group=%u pid=%u =>ENOENT\n" , group_num, NETLINK_CB(skb).pid); ret = -ENOENT ; - goto out_put; + goto out; }if (inst->peer_pid !=NETLINK_CB (skb).pid) {
PATCH 5/12 : nfnetlink_log: micro-optimization: don't modify destroyed instance
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: micro-optimization: don't modify destroyed instance
Simple micro-optimization: Don't change any options if the instance is being destroyed.
---
commit 76fd1fbb4efe0c85596590b0a56ffaf4fc467c61
tree c09b5c3dc82ea09e5960cfc95d562722b7d6ddce
parent 7e6bd92e1cdbb5bd83285d2a2f7dc151c853511d
author Michal Miroslaw <[email protected]> Thu, 22 Mar 2007 23:01:59 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:21 +0100
net/netfilter/nfnetlink_log.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/nfnetlink_log.c +1 -1
@@ -825,7 +825,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb, }instance_destroy (inst); -break ; + goto out;case NFULNL_CFG_CMD_PF_BIND :UDEBUG ("registering log handler for pf=%u\n" , pf); ret =nf_log_register (pf, &nfulnl_logger);
PATCH 6/12 : nfnetlink_log: iterator functions need iter_state * only
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: iterator functions need iter_state * only
get_*() don't need access to seq_file - iter_state is enough for them.
---
commit 711273c65e2da4bd148f9c72d30970859d4255ad
tree 0f2964dda9df25ad6e7819dbf042a39d99a84f8b
parent 76fd1fbb4efe0c85596590b0a56ffaf4fc467c61
author Michal Miroslaw <[email protected]> Thu, 22 Mar 2007 23:02:29 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:22 +0100
net/netfilter/nfnetlink_log.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-)
net/netfilter/nfnetlink_log.c +7 -11
@@ -919,10 +919,8 @@ struct iter_state {unsigned int bucket; }; -static struct hlist_node *get_first (struct seq_file *seq) +static struct hlist_node *get_first (struct iter_state *st) { -struct iter_state *st = seq->private; -if (!st)return NULL ;
@@ -933,10 +931,8 @@ static struct hlist_node *get_first(struct seq_file *seq)return NULL ; } -static struct hlist_node *get_next (struct seq_file *seq,struct hlist_node *h) +static struct hlist_node *get_next (struct iter_state *st,struct hlist_node *h) { -struct iter_state *st = seq->private; - h = h->next;while (!h) {if (++st->bucket >=INSTANCE_BUCKETS )
@@ -947,13 +943,13 @@ static struct hlist_node *get_next(struct seq_file *seq, struct hlist_node *h)return h; } -static struct hlist_node *get_idx (struct seq_file *seq,loff_t pos) +static struct hlist_node *get_idx (struct iter_state *st,loff_t pos) {struct hlist_node *head; - head =get_first (seq); + head =get_first (st);if (head) -while (pos && (head =get_next (seq, head))) +while (pos && (head =get_next (st, head))) pos--;return pos ?NULL : head; }
@@ -961,13 +957,13 @@ static struct hlist_node *get_idx(struct seq_file *seq, loff_t pos)static void *seq_start (struct seq_file *seq,loff_t *pos) {read_lock_bh (&instances_lock); -return get_idx (seq, *pos); +return get_idx (seq->private, *pos); }static void *seq_next (struct seq_file *s,void *v,loff_t *pos) { (*pos)++; -return get_next (s, v); +return get_next (s->private, v); }static void seq_stop (struct seq_file *s,void *v)
PATCH 7/12 : nfnetlink_log: micro-optimization: inst->skb != NULL in __nfulnl_send()
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: micro-optimization: inst->skb != NULL in __nfulnl_send()
No other function calls __nfulnl_send() with inst->skb == NULL than nfulnl_timer().
---
commit d5e28a22dfd6b5a6b2d80565cb0347b093a1a85b
tree 2b6d8bddacbbc95a379d3a7b9e9db7e8a7b73166
parent 711273c65e2da4bd148f9c72d30970859d4255ad
author Michal Miroslaw <[email protected]> Thu, 22 Mar 2007 23:02:40 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:22 +0100
net/netfilter/nfnetlink_log.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
net/netfilter/nfnetlink_log.c +2 -4
@@ -360,9 +360,6 @@ __nfulnl_send(struct nfulnl_instance *inst) {int status; -if (!inst->skb) -return 0 ; -if (inst->qlen >1 ) inst->lastnlh->nlmsg_type =NLMSG_DONE ;
@@ -386,7 +383,8 @@ static void nfulnl_timer(unsigned long data)UDEBUG ("timer function called, flushing buffer\n" );spin_lock_bh (&inst->lock); -__nfulnl_send (inst); +if (inst->skb) +__nfulnl_send (inst);spin_unlock_bh (&inst->lock);instance_put (inst); }
PATCH 8/12 : nfnetlink_log: remove conditional locking
In reply to Patrick McHardy[NETFILTER]: nfnetlink_log: remove conditional locking
This is gross, have the wrapper function take the lock.
---
commit 6f67806947ea58fd8bdf2b44dd748bb3fb8752d7
tree bc21f4b37cc3170aaf5b8130af193c643d367c7b
parent d5e28a22dfd6b5a6b2d80565cb0347b093a1a85b
author Patrick McHardy <[email protected]> Thu, 22 Mar 2007 23:02:52 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:22 +0100
net/netfilter/nfnetlink_log.c | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-)
net/netfilter/nfnetlink_log.c +4 -14
@@ -195,20 +195,14 @@ out_unlock:static int __nfulnl_send (struct nfulnl_instance *inst);static void -_instance_destroy2 (struct nfulnl_instance *inst,int lock) +__instance_destroy (struct nfulnl_instance *inst) {/* first pull it out of the global list */ -if (lock) -write_lock_bh (&instances_lock); -UDEBUG ("removing instance %p (queuenum=%u) from hash\n" , inst, inst->group_num);hlist_del (&inst->hlist); -if (lock) -write_unlock_bh (&instances_lock); -/* then flush all pending packets from skb */ spin_lock_bh (&inst->lock);
@@ -230,15 +224,11 @@ _instance_destroy2(struct nfulnl_instance *inst, int lock) }static inline void -__instance_destroy (struct nfulnl_instance *inst) -{ -_instance_destroy2 (inst,0 ); -} - -static inline void instance_destroy (struct nfulnl_instance *inst) { -_instance_destroy2 (inst,1 ); +write_lock_bh (&instances_lock); +__instance_destroy (inst); +write_unlock_bh (&instances_lock); } static int
PATCH 9/12 : Use setup_timer
In reply to Patrick McHardy[NETFILTER]: Use setup_timer
---
commit c003010c98cdb0867aa4a5d188063a70af356f01
tree fb21e7a5a104f13e9d19732ae2bbbd9e9952a822
parent 6f67806947ea58fd8bdf2b44dd748bb3fb8752d7
author Patrick McHardy <[email protected]> Thu, 22 Mar 2007 23:03:06 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:23 +0100
net/bridge/netfilter/ebt_ulog.c | 4 +--- net/ipv4/netfilter/ipt_ULOG.c | 7 ++----- net/ipv6/netfilter/nf_conntrack_reasm.c | 7 ++----- net/netfilter/nf_conntrack_core.c | 5 ++--- net/netfilter/nf_conntrack_expect.c | 4 +--- net/netfilter/nfnetlink_log.c | 5 +---- net/netfilter/xt_hashlimit.c | 4 +--- 7 files changed, 10 insertions(+), 26 deletions(-)
net/bridge/netfilter/ebt_ulog.c +1 -3
@@ -297,9 +297,7 @@ static int __init ebt_ulog_init(void)/* initialize ulog_buffers */ for (i =0 ; i <EBT_ULOG_MAXNLGROUPS ; i++) { -init_timer (&ulog_buffers[i].timer); - ulog_buffers[i].timer.function = ulog_timer; - ulog_buffers[i].timer.data = i; +setup_timer (&ulog_buffers[i].timer, ulog_timer, i);spin_lock_init (&ulog_buffers[i].lock); }
net/ipv4/netfilter/ipt_ULOG.c +2 -5
@@ -375,11 +375,8 @@ static int __init ipt_ulog_init(void) }/* initialize ulog_buffers */ -for (i =0 ; i <ULOG_MAXNLGROUPS ; i++) { -init_timer (&ulog_buffers[i].timer); - ulog_buffers[i].timer.function = ulog_timer; - ulog_buffers[i].timer.data = i; - } +for (i =0 ; i <ULOG_MAXNLGROUPS ; i++) +setup_timer (&ulog_buffers[i].timer, ulog_timer, i); nflognl =netlink_kernel_create (NETLINK_NFLOG ,ULOG_MAXNLGROUPS ,NULL ,THIS_MODULE );
net/ipv6/netfilter/nf_conntrack_reasm.c +2 -5
@@ -353,9 +353,7 @@ nf_ct_frag6_create(unsigned int hash, __be32 id, struct in6_addr *src, stripv6_addr_copy (&fq->saddr, src);ipv6_addr_copy (&fq->daddr, dst); -init_timer (&fq->timer); - fq->timer.function = nf_ct_frag6_expire; - fq->timer.data = (long ) fq; +setup_timer (&fq->timer, nf_ct_frag6_expire, (unsigned long )fq);spin_lock_init (&fq->lock);atomic_set (&fq->refcnt,1 );
@@ -870,8 +868,7 @@ int nf_ct_frag6_init(void) nf_ct_frag6_hash_rnd = (u32) ((num_physpages ^ (num_physpages>>7 )) ^ (jiffies ^ (jiffies >>6 ))); -init_timer (&nf_ct_frag6_secret_timer); - nf_ct_frag6_secret_timer.function = nf_ct_frag6_secret_rebuild; +setup_timer (&nf_ct_frag6_secret_timer, nf_ct_frag6_secret_rebuild,0 ); nf_ct_frag6_secret_timer.expires = jiffies + nf_ct_frag6_secret_interval;add_timer (&nf_ct_frag6_secret_timer);
net/netfilter/nf_conntrack_core.c +2 -3
@@ -620,9 +620,8 @@ __nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, conntrack->tuplehash[IP_CT_DIR_ORIGINAL ].tuple = *orig; conntrack->tuplehash[IP_CT_DIR_REPLY ].tuple = *repl;/* Don't set timer yet: wait for confirmation */ -init_timer (&conntrack->timeout); - conntrack->timeout.data = (unsigned long )conntrack; - conntrack->timeout.function = death_by_timeout; +setup_timer (&conntrack->timeout, death_by_timeout, + (unsigned long )conntrack);read_unlock_bh (&nf_ct_cache_lock);return conntrack;
net/netfilter/nf_conntrack_expect.c +1 -3
@@ -290,9 +290,7 @@ static void nf_conntrack_expect_insert(struct nf_conntrack_expect *exp) master_help->expecting++;list_add (&exp->list, &nf_conntrack_expect_list); -init_timer (&exp->timeout); - exp->timeout.data = (unsigned long )exp; - exp->timeout.function = expectation_timed_out; +setup_timer (&exp->timeout, expectation_timed_out, (unsigned long )exp); exp->timeout.expires = jiffies + master_help->helper->timeout *HZ ;add_timer (&exp->timeout);
net/netfilter/nfnetlink_log.c +1 -4
@@ -158,10 +158,7 @@ instance_create(u_int16_t group_num, int pid)/* needs to be two, since we _put() after creation */ atomic_set (&inst->use,2 ); -init_timer (&inst->timer); - inst->timer.function = nfulnl_timer; - inst->timer.data = (unsigned long )inst; -/* don't start timer yet. (re)start it with every packet */ +setup_timer (&inst->timer, nfulnl_timer, (unsigned long )inst); inst->peer_pid = pid; inst->group_num = group_num;
net/netfilter/xt_hashlimit.c +1 -3
@@ -216,10 +216,8 @@ static int htable_create(struct xt_hashlimit_info *minfo, int family) hinfo->pde->proc_fops = &dl_file_ops; hinfo->pde->data = hinfo; -init_timer (&hinfo->timer); +setup_timer (&hinfo->timer, htable_gc, (unsigned long )hinfo); hinfo->timer.expires = jiffies +msecs_to_jiffies (hinfo->cfg.gc_interval); - hinfo->timer.data = (unsigned long )hinfo; - hinfo->timer.function = htable_gc;add_timer (&hinfo->timer);spin_lock_bh (&hashlimit_lock);
PATCH 10/12 : nf_conntrack: don't use nfct in skb if conntrack is disabled
In reply to Patrick McHardy[NETFILTER]: nf_conntrack: don't use nfct in skb if conntrack is disabled
---
commit 91dab4ecb495f0988cc36adee4674d7ea087fbc4
tree 37ba343399c13c637d7460afac16510546c8ddf2
parent c003010c98cdb0867aa4a5d188063a70af356f01
author Yasuyuki Kozakai <[email protected]> Thu, 22 Mar 2007 23:03:17 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 11:00:23 +0100
include/linux/netfilter.h | 11 +++++++---- include/linux/skbuff.h | 24 +++++++----------------- net/core/skbuff.c | 4 +--- net/netfilter/core.c | 2 ++ 4 files changed, 17 insertions(+), 24 deletions(-)
include/linux/netfilter.h +7 -4
@@ -281,9 +281,6 @@ extern void nf_reinject(struct sk_buff *skb,struct nf_info *info, unsigned int verdict); -extern void (*ip_ct_attach)(struct sk_buff *,struct sk_buff *); -extern void nf_ct_attach (struct sk_buff *,struct sk_buff *); -/* FIXME: Before cache is ever used, this must be implemented for real. */ extern void nf_invalidate_cache (int pf);
@@ -388,11 +385,17 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb, {return 1 ; } -static inline void nf_ct_attach (struct sk_buff *new,struct sk_buff *skb) {}struct flowi ;static inline void nf_nat_decode_session (struct sk_buff *skb,struct flowi *fl,int family) {}#endif /*CONFIG_NETFILTER*/ +#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) +extern void (*ip_ct_attach)(struct sk_buff *,struct sk_buff *); +extern void nf_ct_attach (struct sk_buff *,struct sk_buff *); +#else +static inline void nf_ct_attach (struct sk_buff *new,struct sk_buff *skb) {} +#endif +#endif /*__KERNEL__*/ #endif /*__LINUX_NETFILTER_H*/
include/linux/skbuff.h +7 -17
@@ -88,11 +88,12 @@struct net_device ; -#ifdef CONFIG_NETFILTER +#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )struct nf_conntrack {atomic_t use;void (*destroy)(struct nf_conntrack *); }; +#endif #ifdef CONFIG_BRIDGE_NETFILTER struct nf_bridge_info {
@@ -107,8 +108,6 @@ struct nf_bridge_info { };#endif -#endif -struct sk_buff_head {/* These two members must be first. */ struct sk_buff *next;
@@ -278,15 +277,13 @@ struct sk_buff {__be16 protocol;void (*destructor)(struct sk_buff *skb); -#ifdef CONFIG_NETFILTER -struct nf_conntrack *nfct;#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) +struct nf_conntrack *nfct;struct sk_buff *nfct_reasm;#endif #ifdef CONFIG_BRIDGE_NETFILTER struct nf_bridge_info *nf_bridge;#endif -#endif /* CONFIG_NETFILTER */ #ifdef CONFIG_NET_SCHED __u16 tc_index;/* traffic control index */ #ifdef CONFIG_NET_CLS_ACT
@@ -1556,7 +1553,7 @@ static inline unsigned int skb_checksum_complete(struct sk_buff *skb)__skb_checksum_complete (skb); } -#ifdef CONFIG_NETFILTER +#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )static inline void nf_conntrack_put (struct nf_conntrack *nfct) {if (nfct &&atomic_dec_and_test (&nfct->use))
@@ -1567,7 +1564,6 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)if (nfct)atomic_inc (&nfct->use); } -#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )static inline void nf_conntrack_get_reasm (struct sk_buff *skb) {if (skb)
@@ -1593,9 +1589,9 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)#endif /* CONFIG_BRIDGE_NETFILTER */ static inline void nf_reset (struct sk_buff *skb) { +#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )nf_conntrack_put (skb->nfct); skb->nfct =NULL ; -#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )nf_conntrack_put_reasm (skb->nfct_reasm); skb->nfct_reasm =NULL ;#endif
@@ -1608,10 +1604,10 @@ static inline void nf_reset(struct sk_buff *skb)/* Note: This doesn't put any conntrack and bridge info in dst. */ static inline void __nf_copy (struct sk_buff *dst,const struct sk_buff *src) { +#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) dst->nfct = src->nfct;nf_conntrack_get (src->nfct); dst->nfctinfo = src->nfctinfo; -#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) dst->nfct_reasm = src->nfct_reasm;nf_conntrack_get_reasm (src->nfct_reasm);#endif
@@ -1623,8 +1619,8 @@ static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)static inline void nf_copy (struct sk_buff *dst,const struct sk_buff *src) { -nf_conntrack_put (dst->nfct);#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) +nf_conntrack_put (dst->nfct);nf_conntrack_put_reasm (dst->nfct_reasm);#endif #ifdef CONFIG_BRIDGE_NETFILTER
@@ -1633,12 +1629,6 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)__nf_copy (dst, src); } -#else /* CONFIG_NETFILTER */ -static inline void nf_reset (struct sk_buff *skb) {} -static inline void __nf_copy (struct sk_buff *dst,const struct sk_buff *src) {} -static inline void nf_copy (struct sk_buff *dst,const struct sk_buff *src) {} -#endif /* CONFIG_NETFILTER */ -#ifdef CONFIG_NETWORK_SECMARK static inline void skb_copy_secmark (struct sk_buff *to,const struct sk_buff *from) {
net/core/skbuff.c +1 -3
@@ -382,15 +382,13 @@ void __kfree_skb(struct sk_buff *skb)WARN_ON (in_irq ()); skb->destructor (skb); } -#ifdef CONFIG_NETFILTER -nf_conntrack_put (skb->nfct);#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) +nf_conntrack_put (skb->nfct);nf_conntrack_put_reasm (skb->nfct_reasm);#endif #ifdef CONFIG_BRIDGE_NETFILTER nf_bridge_put (skb->nf_bridge);#endif -#endif /* XXX: IS this still necessary? - JHS */ #ifdef CONFIG_NET_SCHED skb->tc_index =0 ;
net/netfilter/core.c +2 -0
@@ -240,6 +240,7 @@ void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, }EXPORT_SYMBOL (nf_proto_csum_replace4); +#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )/* This does not belong here, but locally generated errors need it if connection tracking in use: without this, connection may not be in hash table, and hence manufactured ICMP or RST packets will not be associated with it. */
@@ -259,6 +260,7 @@ void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) } }EXPORT_SYMBOL (nf_ct_attach); +#endif #ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_net_netfilter;
PATCH 11/12 : nf_conntrack: kill destroy() in struct nf_conntrack for diet
In reply to Patrick McHardy[NETFILTER]: nf_conntrack: kill destroy() in struct nf_conntrack for diet
The destructor per conntrack is unnecessary, then this replaces it with system wide destructor.
---
commit 3435a23f0ddf1b795860e4cf03ce50a9092d34e7
tree 1246d9a480c0e15884fd43a664fe478afb5ee5f1
parent 91dab4ecb495f0988cc36adee4674d7ea087fbc4
author Yasuyuki Kozakai <[email protected]> Thu, 22 Mar 2007 23:03:28 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 14:57:19 +0100
include/linux/netfilter.h | 1 + include/linux/skbuff.h | 4 ++-- net/netfilter/core.c | 17 ++++++++++++++++- net/netfilter/nf_conntrack_core.c | 4 +++- 4 files changed, 22 insertions(+), 4 deletions(-)
include/linux/netfilter.h +1 -0
@@ -393,6 +393,7 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )extern void (*ip_ct_attach)(struct sk_buff *,struct sk_buff *);extern void nf_ct_attach (struct sk_buff *,struct sk_buff *); +extern void (*nf_ct_destroy)(struct nf_conntrack *);#else static inline void nf_ct_attach (struct sk_buff *new,struct sk_buff *skb) {}#endif
include/linux/skbuff.h +2 -2
@@ -91,7 +91,6 @@ struct net_device;#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE )struct nf_conntrack {atomic_t use; -void (*destroy)(struct nf_conntrack *); };#endif
@@ -1554,10 +1553,11 @@ static inline unsigned int skb_checksum_complete(struct sk_buff *skb) }#if defined(CONFIG_NF_CONNTRACK ) || defined(CONFIG_NF_CONNTRACK_MODULE ) +extern void nf_conntrack_destroy (struct nf_conntrack *nfct);static inline void nf_conntrack_put (struct nf_conntrack *nfct) {if (nfct &&atomic_dec_and_test (&nfct->use)) - nfct->destroy (nfct); +nf_conntrack_destroy (nfct); }static inline void nf_conntrack_get (struct nf_conntrack *nfct) {
net/netfilter/core.c +16 -1
@@ -260,7 +260,22 @@ void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) } }EXPORT_SYMBOL (nf_ct_attach); -#endif + +void (*nf_ct_destroy)(struct nf_conntrack *); +EXPORT_SYMBOL (nf_ct_destroy); + +void nf_conntrack_destroy (struct nf_conntrack *nfct) +{ +void (*destroy)(struct nf_conntrack *); + +rcu_read_lock (); + destroy =rcu_dereference (nf_ct_destroy); +BUG_ON (destroy ==NULL ); +destroy (nfct); +rcu_read_unlock (); +} +EXPORT_SYMBOL (nf_conntrack_destroy); +#endif /* CONFIG_NF_CONNTRACK */ #ifdef CONFIG_PROC_FS struct proc_dir_entry *proc_net_netfilter;
net/netfilter/nf_conntrack_core.c +3 -1
@@ -616,7 +616,6 @@ __nf_conntrack_alloc(const struct nf_conntrack_tuple *orig,memset (conntrack,0 , nf_ct_cache[features].size); conntrack->features = features;atomic_set (&conntrack->ct_general.use,1 ); - conntrack->ct_general.destroy = destroy_conntrack; conntrack->tuplehash[IP_CT_DIR_ORIGINAL ].tuple = *orig; conntrack->tuplehash[IP_CT_DIR_REPLY ].tuple = *repl;/* Don't set timer yet: wait for confirmation */
@@ -1122,6 +1121,8 @@ void nf_conntrack_cleanup(void)while (atomic_read (&nf_conntrack_untracked.ct_general.use) >1 )schedule (); +rcu_assign_pointer (nf_ct_destroy,NULL ); +for (i =0 ; i <NF_CT_F_NUM ; i++) {if (nf_ct_cache[i].use ==0 )continue ;
@@ -1259,6 +1260,7 @@ int __init nf_conntrack_init(void)/* For use by REJECT target */ rcu_assign_pointer (ip_ct_attach, __nf_conntrack_attach); +rcu_assign_pointer (nf_ct_destroy, destroy_conntrack);/* Set up fake conntrack: - to never be deleted, not in any hashes */
[NETFILTER] nfnetlink: netlink_run_queue() already checks for NLM_F_REQUEST
In reply to Patrick McHardy[NETFILTER] nfnetlink: netlink_run_queue() already checks for NLM_F_REQUEST
Patrick has made use of netlink_run_queue() in nfnetlink while my patches have been waiting for net-2.6.22 to open. So this check for NLM_F_REQUEST can go as well.
---
commit 65374601f87e77135967ccd508669b3a92775720
tree 1ad354f932d676c23d734114a1c94dfc6849bfc7
parent 3435a23f0ddf1b795860e4cf03ce50a9092d34e7
author Thomas Graf <[email protected]> Thu, 22 Mar 2007 23:03:39 +0100 committer Patrick McHardy <[email protected]> Fri, 23 Mar 2007 14:59:14 +0100
net/netfilter/nfnetlink.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
net/netfilter/nfnetlink.c +0 -4
@@ -204,10 +204,6 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)if (security_netlink_recv (skb,CAP_NET_ADMIN ))return -EPERM ; -/* Only requests are handled by kernel now. */ -if (!(nlh->nlmsg_flags &NLM_F_REQUEST )) -return 0 ; -/* All the messages must at least contain nfgenmsg */ if (nlh->nlmsg_len <NLMSG_SPACE (sizeof (struct nfgenmsg )))return 0 ;
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Fri, 23 Mar 2007 15:04:58 +0100 (MET)
Quoted 8 lines
Hi Dave,
these patches for 2.6.22 contain mostly cleanups: some
nfnetlink_logcleanup and micro-optimizations, removal of changelogs in C files, conversion to usesetup_timerin netfilter code and a size-reduction of structnf_conntrackand structsk_buffwhen connection tracking is disabled-Please apply, thanks.
All applied, thanks a lot Patrick.