]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: always prefer rt6i_gateway if present
authorJulian Anastasov <ja@ssi.bg>
Sun, 20 Oct 2013 12:43:03 +0000 (15:43 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Oct 2013 22:37:00 +0000 (18:37 -0400)
commit7e67007739c99a6ec6de215d77705b79540f3a51
tree573048781c3f44e88f25cab3ff2c277aeec65316
parent2d592bdfcc7243bbe3a90ea802fbc3dc5e7fc775
ipv6: always prefer rt6i_gateway if present

In v3.9 4c7ca92b7d36cc0f ("ipv6: Do not depend on rt->n in
ip6_finish_output2()." changed the behaviour of ip6_finish_output2()
such that the recently introduced rt6_nexthop() is used
instead of an assigned neighbor.

As rt6_nexthop() prefers rt6i_gateway only for gatewayed
routes this causes a problem for users like IPVS, xt_TEE and
RAW(hdrincl) if they want to use different address for routing
compared to the destination address.

Another case is when redirect can create RTF_DYNAMIC
route without RTF_GATEWAY flag, we ignore the rt6i_gateway
in rt6_nexthop().

Fix the above problems by considering the rt6i_gateway if
present, so that traffic routed to address on local subnet is
not wrongly diverted to the destination address.

Thanks to Simon Horman and Phil Oester for spotting the
problematic commit.

Thanks to Hannes Frederic Sowa for his review and help in testing.

Reported-by: Phil Oester <kernel@linuxace.com>
Reported-by: Mark Brooks <mark@loadbalancer.org>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip6_route.h