提交 67f69513 编写于 作者: D David Ahern 提交者: David S. Miller

ipv6: Move setting default metric for routes

ip6_route_info_create is a low level function for ensuring fc_metric is
set. Move the check and default setting to the 2 locations that do not
already set fc_metric before calling ip6_route_info_create. This is
required for the next patch which moves addrconf allocations to
ip6_route_info_create and want the metric for host routes to be 0.
Signed-off-by: NDavid Ahern <dsahern@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a88c26f6
...@@ -2951,9 +2951,6 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, ...@@ -2951,9 +2951,6 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
goto out; goto out;
} }
if (cfg->fc_metric == 0)
cfg->fc_metric = IP6_RT_PRIO_USER;
if (cfg->fc_flags & RTNH_F_ONLINK) { if (cfg->fc_flags & RTNH_F_ONLINK) {
if (!dev) { if (!dev) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG(extack,
...@@ -3604,7 +3601,7 @@ static void rtmsg_to_fib6_config(struct net *net, ...@@ -3604,7 +3601,7 @@ static void rtmsg_to_fib6_config(struct net *net,
.fc_table = l3mdev_fib_table_by_index(net, rtmsg->rtmsg_ifindex) ? .fc_table = l3mdev_fib_table_by_index(net, rtmsg->rtmsg_ifindex) ?
: RT6_TABLE_MAIN, : RT6_TABLE_MAIN,
.fc_ifindex = rtmsg->rtmsg_ifindex, .fc_ifindex = rtmsg->rtmsg_ifindex,
.fc_metric = rtmsg->rtmsg_metric, .fc_metric = rtmsg->rtmsg_metric ? : IP6_RT_PRIO_USER,
.fc_expires = rtmsg->rtmsg_info, .fc_expires = rtmsg->rtmsg_info,
.fc_dst_len = rtmsg->rtmsg_dst_len, .fc_dst_len = rtmsg->rtmsg_dst_len,
.fc_src_len = rtmsg->rtmsg_src_len, .fc_src_len = rtmsg->rtmsg_src_len,
...@@ -4524,6 +4521,9 @@ static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -4524,6 +4521,9 @@ static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
if (err < 0) if (err < 0)
return err; return err;
if (cfg.fc_metric == 0)
cfg.fc_metric = IP6_RT_PRIO_USER;
if (cfg.fc_mp) if (cfg.fc_mp)
return ip6_route_multipath_add(&cfg, extack); return ip6_route_multipath_add(&cfg, extack);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册