patch-2.4.21 linux-2.4.21/net/ipv4/netfilter/ip_tables.c

Next file: linux-2.4.21/net/ipv4/netfilter/ipchains_core.c
Previous file: linux-2.4.21/net/ipv4/netfilter/ip_queue.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.20/net/ipv4/netfilter/ip_tables.c linux-2.4.21/net/ipv4/netfilter/ip_tables.c
@@ -68,13 +68,12 @@
 #define inline
 #endif
 
-/* Locking is simple: we assume at worst case there will be one packet
-   in user context and one from bottom halves (or soft irq if Alexey's
-   softnet patch was applied).
-
+/*
    We keep a set of rules for each CPU, so we can avoid write-locking
-   them; doing a readlock_bh() stops packets coming through if we're
-   in user context.
+   them in the softirq when updating the counters and therefore
+   only need to read-lock in the softirq; doing a write_lock_bh() in user
+   context stops packets coming through and allows user context to read
+   the counters or update the rules.
 
    To be cache friendly on SMP, we arrange them like so:
    [ n-entries ]
@@ -1630,7 +1629,7 @@
 		     u_int8_t type, u_int8_t code,
 		     int invert)
 {
-	return (type == test_type && code >= min_code && code <= max_code)
+	return ((test_type == 0xFF) || (type == test_type && code >= min_code && code <= max_code))
 		^ invert;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)