diff mbox

[tproxy,regression] tproxy broken in 2.6.32

Message ID 1259589577.873.30.camel@bigi
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

jamal Nov. 30, 2009, 1:59 p.m. UTC
On Mon, 2009-11-30 at 13:45 +0100, KOVACS Krisztian wrote:
> Hi,
> 

> No, because by narrowing the rule to specific ingress interfaces the
> lookup done in fib_validate_source() won't match the rule(s) (because
> the flow used will have iif set to the loopback device), and thus it
> will look up the main table and select a unicast route.

ok, nice;->

> I don't think it would be unreasonable to add a sysctl but disable the
> feature by default. It's up to you, of course.

The problem is it is hard to decide where the proper exception is to be
made. I can make it only worry about the scenario you are faced with
something like attached (incomplete, uncompiled, untested) patch. Will
that do it or can you think of other scenarios where source validation
is done and this is needed (example forwarding path)? Patrick?
[I could move the check into fib_validate, but that would punish other
users with a few extra cycles]. 

cheers,
jamal
diff mbox

Patch

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 5b1050a..f509f7b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2139,9 +2139,12 @@  static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 
 	if (res.type == RTN_LOCAL) {
 		int result;
+		int mark = 0;
+		if (sysctl_mark_validate_source)
+			mark = skb->mark;
 		result = fib_validate_source(saddr, daddr, tos,
 					     net->loopback_dev->ifindex,
-					     dev, &spec_dst, &itag, skb->mark);
+					     dev, &spec_dst, &itag, mark);
 		if (result < 0)
 			goto martian_source;
 		if (result)