netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [081/136] netfilter: nf_nat: fix inverted logic for persistent NAT mappings
       [not found] ` <20091002012911.GA18542@kroah.com>
@ 2009-10-02  1:17   ` Greg KH
  2009-10-02  1:17   ` [082/136] netfilter: nf_conntrack: netns fix re reliable conntrack event delivery Greg KH
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-10-02  1:17 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: stable-review, torvalds, akpm, alan, netdev, netfilter-devel,
	Patrick McHardy, davem, Maximilian Engelhardt

[-- Attachment #1: netfilter-nf_nat-fix-inverted-logic-for-persistent-nat-mappings.patch --]
[-- Type: text/plain, Size: 1554 bytes --]


2.6.31-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Patrick McHardy <kaber@trash.net>

netfilter: nf_nat: fix inverted logic for persistent NAT mappings

Upstream commit cce5a5c3:

Kernel 2.6.30 introduced a patch [1] for the persistent option in the
netfilter SNAT target. This is exactly what we need here so I had a quick look
at the code and noticed that the patch is wrong. The logic is simply inverted.
The patch below fixes this.

Also note that because of this the default behavior of the SNAT target has
changed since kernel 2.6.30 as it now ignores the destination IP in choosing
the source IP for nating (which should only be the case if the persistent
option is set).

[1] http://git.eu.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=98d500d66cb7940747b424b245fc6a51ecfbf005

Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/ipv4/netfilter/nf_nat_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -212,7 +212,7 @@ find_best_ips_proto(struct nf_conntrack_
 	maxip = ntohl(range->max_ip);
 	j = jhash_2words((__force u32)tuple->src.u3.ip,
 			 range->flags & IP_NAT_RANGE_PERSISTENT ?
-				(__force u32)tuple->dst.u3.ip : 0, 0);
+				0 : (__force u32)tuple->dst.u3.ip, 0);
 	j = ((u64)j * (maxip - minip + 1)) >> 32;
 	*var_ipp = htonl(minip + j);
 }



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [082/136] netfilter: nf_conntrack: netns fix re reliable conntrack event delivery
       [not found] ` <20091002012911.GA18542@kroah.com>
  2009-10-02  1:17   ` [081/136] netfilter: nf_nat: fix inverted logic for persistent NAT mappings Greg KH
@ 2009-10-02  1:17   ` Greg KH
  2009-10-02  1:17   ` [083/136] netfilter: bridge: refcount fix Greg KH
  2009-10-02  1:17   ` [084/136] netfilter: ebt_ulog: fix checkentry return value Greg KH
  3 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-10-02  1:17 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: stable-review, torvalds, akpm, alan, netdev, netfilter-devel,
	Patrick McHardy, davem, Alexey Dobriyan, Pablo Neira Ayuso

[-- Attachment #1: netfilter-nf_conntrack-netns-fix-re-reliable-conntrack-event-delivery.patch --]
[-- Type: text/plain, Size: 1572 bytes --]


2.6.31-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Patrick McHardy <kaber@trash.net>

netfilter: nf_conntrack: netns fix re reliable conntrack event delivery

Upstream commit ee254fa4:

Conntracks in netns other than init_net dying list were never killed.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/netfilter/nf_conntrack_core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1089,14 +1089,14 @@ void nf_conntrack_flush_report(struct ne
 }
 EXPORT_SYMBOL_GPL(nf_conntrack_flush_report);
 
-static void nf_ct_release_dying_list(void)
+static void nf_ct_release_dying_list(struct net *net)
 {
 	struct nf_conntrack_tuple_hash *h;
 	struct nf_conn *ct;
 	struct hlist_nulls_node *n;
 
 	spin_lock_bh(&nf_conntrack_lock);
-	hlist_nulls_for_each_entry(h, n, &init_net.ct.dying, hnnode) {
+	hlist_nulls_for_each_entry(h, n, &net->ct.dying, hnnode) {
 		ct = nf_ct_tuplehash_to_ctrack(h);
 		/* never fails to remove them, no listeners at this point */
 		nf_ct_kill(ct);
@@ -1115,7 +1115,7 @@ static void nf_conntrack_cleanup_net(str
 {
  i_see_dead_people:
 	nf_ct_iterate_cleanup(net, kill_all, NULL);
-	nf_ct_release_dying_list();
+	nf_ct_release_dying_list(net);
 	if (atomic_read(&net->ct.count) != 0) {
 		schedule();
 		goto i_see_dead_people;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [083/136] netfilter: bridge: refcount fix
       [not found] ` <20091002012911.GA18542@kroah.com>
  2009-10-02  1:17   ` [081/136] netfilter: nf_nat: fix inverted logic for persistent NAT mappings Greg KH
  2009-10-02  1:17   ` [082/136] netfilter: nf_conntrack: netns fix re reliable conntrack event delivery Greg KH
@ 2009-10-02  1:17   ` Greg KH
  2009-10-02  1:17   ` [084/136] netfilter: ebt_ulog: fix checkentry return value Greg KH
  3 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-10-02  1:17 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: stable-review, torvalds, akpm, alan, netdev, netfilter-devel,
	Patrick McHardy, davem, Eric Dumazet

[-- Attachment #1: netfilter-bridge-refcount-fix.patch --]
[-- Type: text/plain, Size: 1097 bytes --]


2.6.31-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Patrick McHardy <kaber@trash.net>

netfilter: bridge: refcount fix

Upstream commit f3abc9b9:

commit f216f082b2b37c4943f1e7c393e2786648d48f6f
([NETFILTER]: bridge netfilter: deal with martians correctly)
added a refcount leak on in_dev.

Instead of using in_dev_get(), we can use __in_dev_get_rcu(),
as netfilter hooks are running under rcu_read_lock(), as pointed
by Patrick.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/bridge/br_netfilter.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -359,7 +359,7 @@ static int br_nf_pre_routing_finish(stru
 				},
 				.proto = 0,
 			};
-			struct in_device *in_dev = in_dev_get(dev);
+			struct in_device *in_dev = __in_dev_get_rcu(dev);
 
 			/* If err equals -EHOSTUNREACH the error is due to a
 			 * martian destination or due to the fact that

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [084/136] netfilter: ebt_ulog: fix checkentry return value
       [not found] ` <20091002012911.GA18542@kroah.com>
                     ` (2 preceding siblings ...)
  2009-10-02  1:17   ` [083/136] netfilter: bridge: refcount fix Greg KH
@ 2009-10-02  1:17   ` Greg KH
  3 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-10-02  1:17 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: stable-review, torvalds, akpm, alan, netdev, netfilter-devel,
	Patrick McHardy, davem

[-- Attachment #1: netfilter-ebt_ulog-fix-checkentry-return-value.patch --]
[-- Type: text/plain, Size: 900 bytes --]


2.6.31-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Patrick McHardy <kaber@trash.net>

netfilter: ebt_ulog: fix checkentry return value

Upstream commit 8a56df0a:

Commit 19eda87 (netfilter: change return types of check functions for
Ebtables extensions) broke the ebtables ulog module by missing a return
value conversion.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/bridge/netfilter/ebt_ulog.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -266,7 +266,7 @@ static bool ebt_ulog_tg_check(const stru
 	if (uloginfo->qthreshold > EBT_ULOG_MAX_QLEN)
 		uloginfo->qthreshold = EBT_ULOG_MAX_QLEN;
 
-	return 0;
+	return true;
 }
 
 static struct xt_target ebt_ulog_tg_reg __read_mostly = {



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-02  1:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20091002011548.335611824@mini.kroah.org>
     [not found] ` <20091002012911.GA18542@kroah.com>
2009-10-02  1:17   ` [081/136] netfilter: nf_nat: fix inverted logic for persistent NAT mappings Greg KH
2009-10-02  1:17   ` [082/136] netfilter: nf_conntrack: netns fix re reliable conntrack event delivery Greg KH
2009-10-02  1:17   ` [083/136] netfilter: bridge: refcount fix Greg KH
2009-10-02  1:17   ` [084/136] netfilter: ebt_ulog: fix checkentry return value Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).