Skip to content
  • Julian Anastasov's avatar
    ipv6: always prefer rt6i_gateway if present · 96dc8095
    Julian Anastasov authored
    In v3.9 6fd6ce20
    
     ("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: default avatarPhil Oester <kernel@linuxace.com>
    Reported-by: default avatarMark Brooks <mark@loadbalancer.org>
    Signed-off-by: default avatarJulian Anastasov <ja@ssi.bg>
    Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    96dc8095