Re: [PATCH 2/3] route: set iif and oif information in flowi struct
From: Ulrich Weber <hidden>
Date: 2011-11-30 17:21:56
On 29.11.2011 00:53, Julian Anastasov wrote:
May be setting flowi4_oif unconditionally here is more correct because ip_route_output_slow fills flowi4_oif with the selected oif, it can even change the provided original oif in flowi4_oif. What about this?: flp4->flowi4_oif = rth->dst.dev->ifindex; OTOH, rt_iif has some complex semantic: original oif or the selected oif. May be you prefer flowi4_oif to hold the selected oif, right?
I wasn't aware the ip_route_output_slow() might change the original oif. You know why this might happen? Shouldn't fib_lookup only return a route matching the given oif? Anyway, if thats the case your code above is more correct. The packet should always match the xfrm policy where it was originally routed.
I see one dangerous place that must be checked: icmp_route_lookup. Before now __ip_route_output_key was called after xfrm_decode_session_reverse with 0 in flowi4_oif, i.e. no oif binding was used. But now when decode_session sets flowi4_oif we will restrict the route via this interface?
Thanks for the hint! Yes the current patch will force the ICMP packet over the received interface. Will add "fl4_dec.flowi4_oif = 0;" in case the saddr is local, so the behavior will be the same. fl4_dec.flowi4_oif will then be set in _ip_route_output_key() again. Cheers Ulrich -- Ulrich Weber | ulrich.weber@sophos.com | Senior Software Engineer Astaro - a Sophos company | Amalienbadstr 41 | 76227 Karlsruhe | Germany Phone +49-721-25516-0 | Fax –200 | www.astaro.com