diff options
author | David Ahern <dsahern@gmail.com> | 2018-10-04 23:07:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-10-05 00:54:19 -0400 |
commit | e1255ed4b6dafd9966c99cde5105891cc1ac70df (patch) | |
tree | a8118d6d76a79bc59220ce115663b9567365ce1a /net/ipv4 | |
parent | cc5f0eb2164f9aa11fe631f8d905192e0233e262 (diff) |
net: common metrics init helper for dst_entry
ipv4 and ipv6 both use refcounted metrics if FIB entries have metrics set.
Move the common initialization code to a helper and use for both protocols.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/route.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 048919713f4e..8ccbc8f2c2cc 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1528,11 +1528,8 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr, | |||
1528 | rt->rt_gateway = nh->nh_gw; | 1528 | rt->rt_gateway = nh->nh_gw; |
1529 | rt->rt_uses_gateway = 1; | 1529 | rt->rt_uses_gateway = 1; |
1530 | } | 1530 | } |
1531 | dst_init_metrics(&rt->dst, fi->fib_metrics->metrics, true); | 1531 | ip_dst_init_metrics(&rt->dst, fi->fib_metrics); |
1532 | if (fi->fib_metrics != &dst_default_metrics) { | 1532 | |
1533 | rt->dst._metrics |= DST_METRICS_REFCOUNTED; | ||
1534 | refcount_inc(&fi->fib_metrics->refcnt); | ||
1535 | } | ||
1536 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1533 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1537 | rt->dst.tclassid = nh->nh_tclassid; | 1534 | rt->dst.tclassid = nh->nh_tclassid; |
1538 | #endif | 1535 | #endif |