• Martin KaFai Lau's avatar
    ipv6: Stop rt6_info from using inet_peer's metrics · 4b32b5ad
    Martin KaFai Lau authored
    inet_peer is indexed by the dst address alone.  However, the fib6 tree
    could have multiple routing entries (rt6_info) for the same dst. For
    example,
    1. A /128 dst via multiple gateways.
    2. A RTF_CACHE route cloned from a /128 route.
    
    In the above cases, all of them will share the same metrics and
    step on each other.
    
    This patch will steer away from inet_peer's metrics and use
    dst_cow_metrics_generic() for everything.
    
    Change Highlights:
    1. Remove rt6_cow_metrics() which currently acquires metrics from
       inet_peer for DST_HOST route (i.e. /128 route).
    2. Add rt6i_pmtu to take care of the pmtu update to avoid creating a
       full size metrics just to override the RTAX_MTU.
    3. After (2), the RTF_CACHE route can also share the metrics with its
       dst.from route, by:
       dst_init_metrics(&cache_rt->dst, dst_metrics_ptr(cache_rt->dst.from), true);
    4. Stop creating RTF_CACHE route by cloning another RTF_CACHE route.  Instead,
       directly clone from rt->dst.
    
       [ Currently, cloning from another RTF_CACHE is only possible during
         rt6_do_redirect().  Also, the old clone is removed from the tree
         immediately after the new clone is added. ]
    
       In case of cloning from an older redirect RTF_CACHE, it should work as
       before.
    
       In case of cloning from an older pmtu RTF_CACHE, this patch will forget
       the pmtu and re-learn it (if there is any) from the redirected route.
    
    The _rt6i_peer and DST_METRICS_FORCE_OVERWRITE will be removed
    in the next cleanup patch.
    Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Reviewed-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
    Cc: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4b32b5ad
ip6_fib.h 7.05 KB