[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-net
Subject: [PATCH 2.4.21-pre6] synchronize_net patch (2/2)
From: Stephen Hemminger <shemminger () osdl ! org>
Date: 2003-03-31 23:56:56
[Download RAW message or body]
Use the new synchronize_net function for all the place in netfilter that
call lock/unlock just to assure that net packets don't see old data.
--------
diff -urN -X dontdiff linux-2.4/net/ipv4/netfilter/ip_conntrack_core.c
linux-2.4-netsync/net/ipv4/netfilter/ip_conntrack_core.c
--- linux-2.4/net/ipv4/netfilter/ip_conntrack_core.c 2003-03-31
11:09:09.000000000 -0800
+++ linux-2.4-netsync/net/ipv4/netfilter/ip_conntrack_core.c 2003-03-31
14:26:41.000000000 -0800
@@ -23,7 +23,6 @@
#include <linux/skbuff.h>
#include <linux/proc_fs.h>
#include <linux/vmalloc.h>
-#include <linux/brlock.h>
#include <net/checksum.h>
#include <linux/stddef.h>
#include <linux/sysctl.h>
@@ -1161,8 +1160,7 @@
WRITE_UNLOCK(&ip_conntrack_lock);
/* Someone could be still looking at the helper in a bh. */
- br_write_lock_bh(BR_NETPROTO_LOCK);
- br_write_unlock_bh(BR_NETPROTO_LOCK);
+ synchronize_net();
MOD_DEC_USE_COUNT;
}
@@ -1384,8 +1382,7 @@
/* This makes sure all current packets have passed through
netfilter framework. Roll on, two-stage module
delete... */
- br_write_lock_bh(BR_NETPROTO_LOCK);
- br_write_unlock_bh(BR_NETPROTO_LOCK);
+ synchronize_net();
i_see_dead_people:
ip_ct_selective_cleanup(kill_all, NULL);
diff -urN -X dontdiff
linux-2.4/net/ipv4/netfilter/ip_conntrack_standalone.c
linux-2.4-netsync/net/ipv4/netfilter/ip_conntrack_standalone.c
--- linux-2.4/net/ipv4/netfilter/ip_conntrack_standalone.c 2003-03-31
11:09:09.000000000 -0800
+++
linux-2.4-netsync/net/ipv4/netfilter/ip_conntrack_standalone.c 2003-03-31 06:25:34.000000000 -0800
@@ -15,7 +15,6 @@
#include <linux/skbuff.h>
#include <linux/proc_fs.h>
#include <linux/version.h>
-#include <linux/brlock.h>
#include <net/checksum.h>
#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_conntrack_lock)
@@ -327,8 +326,7 @@
WRITE_UNLOCK(&ip_conntrack_lock);
/* Somebody could be still looking at the proto in bh. */
- br_write_lock_bh(BR_NETPROTO_LOCK);
- br_write_unlock_bh(BR_NETPROTO_LOCK);
+ synchronize_net();
/* Remove all contrack entries for this protocol */
ip_ct_selective_cleanup(kill_proto, &proto->proto);
diff -urN -X dontdiff linux-2.4/net/ipv4/netfilter/ip_nat_helper.c
linux-2.4-netsync/net/ipv4/netfilter/ip_nat_helper.c
--- linux-2.4/net/ipv4/netfilter/ip_nat_helper.c 2003-03-31
11:09:09.000000000 -0800
+++ linux-2.4-netsync/net/ipv4/netfilter/ip_nat_helper.c 2003-03-31
06:25:34.000000000 -0800
@@ -20,7 +20,6 @@
#include <linux/timer.h>
#include <linux/skbuff.h>
#include <linux/netfilter_ipv4.h>
-#include <linux/brlock.h>
#include <net/checksum.h>
#include <net/icmp.h>
#include <net/ip.h>
@@ -554,8 +553,7 @@
WRITE_UNLOCK(&ip_nat_lock);
/* Someone could be still looking at the helper in a bh. */
- br_write_lock_bh(BR_NETPROTO_LOCK);
- br_write_unlock_bh(BR_NETPROTO_LOCK);
+ synchronize_net();
/* Find anything using it, and umm, kill them. We can't turn
them into normal connections: if we've adjusted SYNs, then
diff -urN -X dontdiff linux-2.4/net/ipv4/netfilter/ip_nat_snmp_basic.c
linux-2.4-netsync/net/ipv4/netfilter/ip_nat_snmp_basic.c
--- linux-2.4/net/ipv4/netfilter/ip_nat_snmp_basic.c 2003-03-31
11:09:09.000000000 -0800
+++ linux-2.4-netsync/net/ipv4/netfilter/ip_nat_snmp_basic.c 2003-03-31
06:25:34.000000000 -0800
@@ -50,7 +50,6 @@
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv4/ip_nat.h>
#include <linux/netfilter_ipv4/ip_nat_helper.h>
-#include <linux/brlock.h>
#include <linux/types.h>
#include <linux/ip.h>
#include <net/udp.h>
@@ -1351,8 +1350,7 @@
{
ip_nat_helper_unregister(&snmp);
ip_nat_helper_unregister(&snmp_trap);
- br_write_lock_bh(BR_NETPROTO_LOCK);
- br_write_unlock_bh(BR_NETPROTO_LOCK);
+ synchronize_net();
}
module_init(init);
diff -urN -X dontdiff linux-2.4/net/ipv4/netfilter/ip_nat_standalone.c
linux-2.4-netsync/net/ipv4/netfilter/ip_nat_standalone.c
--- linux-2.4/net/ipv4/netfilter/ip_nat_standalone.c 2003-03-31
11:09:09.000000000 -0800
+++ linux-2.4-netsync/net/ipv4/netfilter/ip_nat_standalone.c 2003-03-31
14:27:04.000000000 -0800
@@ -23,7 +23,6 @@
#include <net/checksum.h>
#include <linux/spinlock.h>
#include <linux/version.h>
-#include <linux/brlock.h>
#define ASSERT_READ_LOCK(x) MUST_BE_READ_LOCKED(&ip_nat_lock)
#define ASSERT_WRITE_LOCK(x) MUST_BE_WRITE_LOCKED(&ip_nat_lock)
@@ -269,8 +268,7 @@
WRITE_UNLOCK(&ip_nat_lock);
/* Someone could be still looking at the proto in a bh. */
- br_write_lock_bh(BR_NETPROTO_LOCK);
- br_write_unlock_bh(BR_NETPROTO_LOCK);
+ synchronize_net();
MOD_DEC_USE_COUNT;
}
diff -urN -X dontdiff linux-2.4/net/ipv4/netfilter/ip_queue.c
linux-2.4-netsync/net/ipv4/netfilter/ip_queue.c
--- linux-2.4/net/ipv4/netfilter/ip_queue.c 2003-03-31
11:09:09.000000000 -0800
+++ linux-2.4-netsync/net/ipv4/netfilter/ip_queue.c 2003-03-31
06:25:34.000000000 -0800
@@ -23,7 +23,6 @@
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netlink.h>
#include <linux/spinlock.h>
-#include <linux/brlock.h>
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
#include <net/sock.h>
@@ -666,8 +665,7 @@
cleanup:
nf_unregister_queue_handler(PF_INET);
- br_write_lock_bh(BR_NETPROTO_LOCK);
- br_write_unlock_bh(BR_NETPROTO_LOCK);
+ synchronize_net();
ipq_flush(NF_DROP);
cleanup_sysctl:
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic