Skip to contentSkip to conversation

Netfilter updates for stable 3.6

PATCH In review [email protected] 2 participants 7 messages Nov 16, 2012 – Nov 20, 2012

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

cover Netfilter updates for stable 3.6

From: Pablo Neira Ayuso <[email protected]>

Hi!

Please, consider the following Netfilter patches for stable 3.6 and onwards inclusion.

The selected three patches are:

2ad5b9e netfilter: xt_TEE: don't use destination address found in header
bbb5823 netfilter: nf_conntrack: fix rt_gateway checks for H.323 helper
0153d5a netfilter: xt_CT: fix timeout setting with IPv6 [REQUIRES: 236df00 netfilter: xt_CT: refactorize xt_ct_tg_check]

More relevantly, the first patch fix the TEE target, which is broken in 3.6.

Please, cherry-pick them. Thanks!

Eric Dumazet (1):
netfilter: xt_TEE: don't use destination address found in header

Julian Anastasov (1):
netfilter: nf_conntrack: fix rt_gateway checks for H.323 helper

Pablo Neira Ayuso (1):
netfilter: xt_CT: fix timeout setting with IPv6

--
1.7.10.4

author maintainer
#1 lore raw

PATCH 1/3 netfilter: xt_TEE: don't use destination address found in header

From: Eric Dumazet <[email protected]>

Torsten Luettgert bisected TEE regression starting with commit f8126f1d5136be1 (ipv4: Adjust semantics of rt->rt_gateway.)

The problem is that it tries to ARP-lookup the original destination address of the forwarded packet, not the address of the gateway.

Fix this using FLOWI_FLAG_KNOWN_NH Julian added in commit c92b96553a80c1 (ipv4: Add FLOWI_FLAG_KNOWN_NH), so that known nexthop (info->gw.ip) has preference on resolving.

---
 net/netfilter/xt_TEE.c |    1 +
 1 file changed, 1 insertion(+)
net/netfilter/xt_TEE.c +1 -0
index ee2e5bc..bd93e51 100644
@@ -70,6 +70,7 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info)
 	fl4.daddr = info->gw.ip;
 	fl4.flowi4_tos = RT_TOS(iph->tos);
 	fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
+	fl4.flowi4_flags = FLOWI_FLAG_KNOWN_NH;
 	rt = ip_route_output_key(net, &fl4);
 	if (IS_ERR(rt))
 		return false;
Signature · 1 line
1.7.10.4
author maintainer
#2 lore raw

PATCH 2/3 netfilter: xt_CT: fix timeout setting with IPv6

In reply to [email protected]

From: Pablo Neira Ayuso <[email protected]>

This patch fixes ip6tables and the CT target if it is used to set some custom conntrack timeout policy for IPv6.

Use xt_ct_find_proto which already handles the ip6tables case for us.

[ This patch requires: 236df00 netfilter: xt_CT: refactorize xt_ct_tg_check ]

---
 net/netfilter/xt_CT.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
net/netfilter/xt_CT.c +6 -4
index 16c7125..ae7f5da 100644
@@ -180,9 +180,9 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
 	typeof(nf_ct_timeout_find_get_hook) timeout_find_get;
 	struct ctnl_timeout *timeout;
 	struct nf_conn_timeout *timeout_ext;
-	const struct ipt_entry *e = par->entryinfo;
 	struct nf_conntrack_l4proto *l4proto;
 	int ret = 0;
+	u8 proto;
 
 	rcu_read_lock();
 	timeout_find_get = rcu_dereference(nf_ct_timeout_find_get_hook);
@@ -192,9 +192,11 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
 		goto out;
 	}
 
-	if (e->ip.invflags & IPT_INV_PROTO) {
+	proto = xt_ct_find_proto(par);
+	if (!proto) {
 		ret = -EINVAL;
-		pr_info("You cannot use inversion on L4 protocol\n");
+		pr_info("You must specify a L4 protocol, and not use "
+			"inversions on it.\n");
 		goto out;
 	}
 
@@ -214,7 +216,7 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
 	/* Make sure the timeout policy matches any existing protocol tracker,
 	 * otherwise default to generic.
 	 */
-	l4proto = __nf_ct_l4proto_find(par->family, e->ip.proto);
+	l4proto = __nf_ct_l4proto_find(par->family, proto);
 	if (timeout->l4proto->l4proto != l4proto->l4proto) {
 		ret = -EINVAL;
 		pr_info("Timeout policy `%s' can only be used by L4 protocol "
Signature · 1 line
1.7.10.4
#3 lore raw

Re: [PATCH 2/3] [-stable] netfilter: xt_CT: fix timeout setting with IPv6

Quoted 5 lines · On Fri, Nov 16, 2012 at 03:02:29PM +0100, [email protected] wrote:

From: Pablo Neira Ayuso <[email protected]>

This patch fixes ip6tables and the CT target if it is used to set some custom conntrack timeout policy for IPv6.

Quoted 8 lines

Use xt_ct_find_proto which already handles the ip6tables case for us.

[ This patch requires: 236df00 netfilter: xt_CT: refactorize xt_ct_tg_check ]

---
 net/netfilter/xt_CT.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

This one doesn't apply to the 3.6-stable tree, care to provide a backport that works properly?

thanks,

greg k-h

author maintainer
#4 lore raw

PATCH 3/3 netfilter: nf_conntrack: fix rt_gateway checks for H.323 helper

In reply to [email protected]

From: Julian Anastasov <[email protected]>

After the change "Adjust semantics of rt->rt_gateway" (commit f8126f1d51) we should properly match the nexthop when destinations are directly connected because rt_gateway can be 0.

The rt_gateway checks in H.323 helper try to avoid the creation of an unnecessary expectation in this call-forwarding case:

http://people.netfilter.org/zhaojingmin/h323_conntrack_nat_helper/#_Toc133598073

However, the existing code fails to avoid that in many cases, see this thread:

http://marc.info/?l=linux-netdev&m=135043175028620&w=2

It seems it is not trivial to know from the kernel if two hosts have to go through the firewall to communicate each other, which is the main point of the call-forwarding filter code to avoid creating unnecessary expectations.

So this patch just gets things the way they were as before commit f8126f1d51.

---
 net/netfilter/nf_conntrack_h323_main.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_h323_main.c +2 -1
index 4283b20..02f65bc 100644
@@ -733,7 +733,8 @@ static int callforward_do_filter(const union nf_inet_addr *src,
 				   flowi4_to_flowi(&fl1), false)) {
 			if (!afinfo->route(&init_net, (struct dst_entry **)&rt2,
 					   flowi4_to_flowi(&fl2), false)) {
-				if (rt1->rt_gateway == rt2->rt_gateway &&
+				if (rt_nexthop(rt1, fl1.daddr) ==
+				    rt_nexthop(rt2, fl2.daddr) &&
 				    rt1->dst.dev  == rt2->dst.dev)
 					ret = 1;
 				dst_release(&rt2->dst);
Signature · 1 line
1.7.10.4
author maintainer
#5 lore raw
In reply to [email protected]
Quoted 6 lines · On Fri, Nov 16, 2012 at 03:02:27PM +0100, [email protected] wrote:

From: Pablo Neira Ayuso <[email protected]>

Hi!

Please, consider the following Netfilter patches for stable 3.6 and onwards inclusion.

The "onwards" is obviously a typo from the template I've used, these are already in 3.7-rc :-)

Quoted 26 lines

The selected three patches are:

2ad5b9e netfilter: xt_TEE: don't use destination address found in header
bbb5823 netfilter: nf_conntrack: fix rt_gateway checks for H.323 helper
0153d5a netfilter: xt_CT: fix timeout setting with IPv6 [REQUIRES: 236df00 netfilter: xt_CT: refactorize xt_ct_tg_check]

More relevantly, the first patch fix the TEE target, which is broken in 3.6.

Please, cherry-pick them. Thanks!

Eric Dumazet (1):
netfilter: xt_TEE: don't use destination address found in header

Julian Anastasov (1):
netfilter: nf_conntrack: fix rt_gateway checks for H.323 helper

Pablo Neira Ayuso (1):
netfilter: xt_CT: fix timeout setting with IPv6

--
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to [email protected]
Quoted 11 lines · On Fri, Nov 16, 2012 at 03:02:27PM +0100, [email protected] wrote:

From: Pablo Neira Ayuso <[email protected]>

Hi!

Please, consider the following Netfilter patches for stable 3.6 and onwards inclusion.

The selected three patches are:

2ad5b9e netfilter: xt_TEE: don't use destination address found in header bbb5823 netfilter: nf_conntrack: fix rt_gateway checks for H.323 helper

These two now applied to the 3.6-stable tree.

Quoted 1 line

0153d5a netfilter: xt_CT: fix timeout setting with IPv6 [REQUIRES: 236df00 netfilter: xt_CT: refactorize xt_ct_tg_check]

This one didn't apply :(

thanks,

greg k-h