* netfilter 01/03: nf_log regression fix
2009-04-16 17:16 netfilter 00/03: netfilter fixes Patrick McHardy
@ 2009-04-16 17:16 ` Patrick McHardy
2009-04-16 17:16 ` netfilter 02/03: nf_conntrack: fix crash when unloading helpers Patrick McHardy
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2009-04-16 17:16 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
commit b6f0a3652ea9d2296fdc98c3b2c96603be611c4d
Author: Eric Dumazet <dada1@cosmosbay.com>
Date: Wed Apr 15 12:16:19 2009 +0200
netfilter: nf_log regression fix
commit ca735b3aaa945626ba65a3e51145bfe4ecd9e222
'netfilter: use a linked list of loggers'
introduced an array of list_head in "struct nf_logger", but
forgot to initialize it in nf_log_register(). This resulted
in oops when calling nf_log_unregister() at module unload time.
Reported-and-tested-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Acked-by: Eric Leblond <eric@inl.fr>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 8bb998f..beb3731 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -36,10 +36,14 @@ static struct nf_logger *__find_logger(int pf, const char *str_logger)
int nf_log_register(u_int8_t pf, struct nf_logger *logger)
{
const struct nf_logger *llog;
+ int i;
if (pf >= ARRAY_SIZE(nf_loggers))
return -EINVAL;
+ for (i = 0; i < ARRAY_SIZE(logger->list); i++)
+ INIT_LIST_HEAD(&logger->list[i]);
+
mutex_lock(&nf_log_mutex);
if (pf == NFPROTO_UNSPEC) {
^ permalink raw reply related [flat|nested] 5+ messages in thread
* netfilter 02/03: nf_conntrack: fix crash when unloading helpers
2009-04-16 17:16 netfilter 00/03: netfilter fixes Patrick McHardy
2009-04-16 17:16 ` netfilter 01/03: nf_log regression fix Patrick McHardy
@ 2009-04-16 17:16 ` Patrick McHardy
2009-04-16 17:16 ` netfilter 03/03: nf_nat: add support for persistent mappings Patrick McHardy
2009-04-16 23:33 ` netfilter 00/03: netfilter fixes David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2009-04-16 17:16 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
commit 38fb0afcd8761f8858e27135ed89a65117e2019c
Author: Patrick McHardy <kaber@trash.net>
Date: Wed Apr 15 12:45:08 2009 +0200
netfilter: nf_conntrack: fix crash when unloading helpers
Commit ea781f197d (netfilter: nf_conntrack: use SLAB_DESTROY_BY_RCU and)
get rid of call_rcu() was missing one conversion to the hlist_nulls
functions, causing a crash when unloading conntrack helper modules.
Reported-and-tested-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 30b8e90..0fa5a42 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -176,7 +176,7 @@ static void __nf_conntrack_helper_unregister(struct nf_conntrack_helper *me,
}
/* Get rid of expecteds, set helpers to NULL. */
- hlist_for_each_entry(h, nn, &net->ct.unconfirmed, hnnode)
+ hlist_nulls_for_each_entry(h, nn, &net->ct.unconfirmed, hnnode)
unhelp(h, me);
for (i = 0; i < nf_conntrack_htable_size; i++) {
hlist_nulls_for_each_entry(h, nn, &net->ct.hash[i], hnnode)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* netfilter 03/03: nf_nat: add support for persistent mappings
2009-04-16 17:16 netfilter 00/03: netfilter fixes Patrick McHardy
2009-04-16 17:16 ` netfilter 01/03: nf_log regression fix Patrick McHardy
2009-04-16 17:16 ` netfilter 02/03: nf_conntrack: fix crash when unloading helpers Patrick McHardy
@ 2009-04-16 17:16 ` Patrick McHardy
2009-04-16 23:33 ` netfilter 00/03: netfilter fixes David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2009-04-16 17:16 UTC (permalink / raw)
To: davem; +Cc: netdev, Patrick McHardy, netfilter-devel
commit 98d500d66cb7940747b424b245fc6a51ecfbf005
Author: Patrick McHardy <kaber@trash.net>
Date: Thu Apr 16 18:33:01 2009 +0200
netfilter: nf_nat: add support for persistent mappings
The removal of the SAME target accidentally removed one feature that is
not available from the normal NAT targets so far, having multi-range
mappings that use the same mapping for each connection from a single
client. The current behaviour is to choose the address from the range
based on source and destination IP, which breaks when communicating
with sites having multiple addresses that require all connections to
originate from the same IP address.
Introduce a IP_NAT_RANGE_PERSISTENT option that controls whether the
destination address is taken into account for selecting addresses.
http://bugzilla.kernel.org/show_bug.cgi?id=12954
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 9dc1039..8df0b7f 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -18,6 +18,7 @@ enum nf_nat_manip_type
#define IP_NAT_RANGE_MAP_IPS 1
#define IP_NAT_RANGE_PROTO_SPECIFIED 2
#define IP_NAT_RANGE_PROTO_RANDOM 4
+#define IP_NAT_RANGE_PERSISTENT 8
/* NAT sequence number modifications */
struct nf_nat_seq {
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index fe65187..3229e0a 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -211,7 +211,8 @@ find_best_ips_proto(struct nf_conntrack_tuple *tuple,
minip = ntohl(range->min_ip);
maxip = ntohl(range->max_ip);
j = jhash_2words((__force u32)tuple->src.u3.ip,
- (__force u32)tuple->dst.u3.ip, 0);
+ range->flags & IP_NAT_RANGE_PERSISTENT ?
+ (__force u32)tuple->dst.u3.ip : 0, 0);
j = ((u64)j * (maxip - minip + 1)) >> 32;
*var_ipp = htonl(minip + j);
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: netfilter 00/03: netfilter fixes
2009-04-16 17:16 netfilter 00/03: netfilter fixes Patrick McHardy
` (2 preceding siblings ...)
2009-04-16 17:16 ` netfilter 03/03: nf_nat: add support for persistent mappings Patrick McHardy
@ 2009-04-16 23:33 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2009-04-16 23:33 UTC (permalink / raw)
To: kaber; +Cc: netdev, netfilter-devel
From: Patrick McHardy <kaber@trash.net>
Date: Thu, 16 Apr 2009 19:16:22 +0200 (MEST)
> the following three patches fix two netfilter bugs introduced during the merge
> window and re-add support for a feature that accidentally got dropped with the
> SAME target removal:
>
> - a missing list initialization of the nf_log logger lists
>
> - a missing conversion to use the hlist_nulls list function in connection tracking
> helper unregistration
>
> - support for persistent multi-range NAT mappings
>
> Please apply or pull from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.git
Pulled, thanks a lot!
^ permalink raw reply [flat|nested] 5+ messages in thread