mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
ipv6: Stop rt6_info from using inet_peer's metrics
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: Martin KaFai Lau <kafai@fb.com> Reviewed-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Cc: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
653437d02f
commit
4b32b5ad31
2 changed files with 60 additions and 52 deletions
|
@ -124,6 +124,7 @@ struct rt6_info {
|
|||
unsigned long _rt6i_peer;
|
||||
|
||||
u32 rt6i_metric;
|
||||
u32 rt6i_pmtu;
|
||||
/* more non-fragment space at head required */
|
||||
unsigned short rt6i_nfheader_len;
|
||||
u8 rt6i_protocol;
|
||||
|
@ -189,15 +190,6 @@ static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)
|
|||
rt0->rt6i_flags |= RTF_EXPIRES;
|
||||
}
|
||||
|
||||
static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from)
|
||||
{
|
||||
struct dst_entry *new = (struct dst_entry *) from;
|
||||
|
||||
rt->rt6i_flags &= ~RTF_EXPIRES;
|
||||
dst_hold(new);
|
||||
rt->dst.from = new;
|
||||
}
|
||||
|
||||
static inline void ip6_rt_put(struct rt6_info *rt)
|
||||
{
|
||||
/* dst_release() accepts a NULL parameter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue