提交 d8b968e5 编写于 作者: N Nicolas Dichtel 提交者: Zheng Zengkai

ipv6: take care of disable_policy when restoring routes

stable inclusion
from stable-v5.10.129
commit e77804158b30b5c7a0638062ab8adde625104d3b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5YNDQ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e77804158b30b5c7a0638062ab8adde625104d3b

--------------------------------

commit 3b0dc529 upstream.

When routes corresponding to addresses are restored by
fixup_permanent_addr(), the dst_nopolicy parameter was not set.
The typical use case is a user that configures an address on a down
interface and then put this interface up.

Let's take care of this flag in addrconf_f6i_alloc(), so that every callers
benefit ont it.

CC: stable@kernel.org
CC: David Forster <dforster@brocade.com>
Fixes: df789fe7 ("ipv6: Provide ipv6 version of "disable_policy" sysctl")
Reported-by: NSiwar Zitouni <siwar.zitouni@6wind.com>
Signed-off-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: NDavid Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20220623120015.32640-1-nicolas.dichtel@6wind.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 b1704a52
......@@ -1106,10 +1106,6 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,
goto out;
}
if (net->ipv6.devconf_all->disable_policy ||
idev->cnf.disable_policy)
f6i->dst_nopolicy = true;
neigh_parms_data_state_setall(idev->nd_parms);
ifa->addr = *cfg->pfx;
......
......@@ -4474,8 +4474,15 @@ struct fib6_info *addrconf_f6i_alloc(struct net *net,
}
f6i = ip6_route_info_create(&cfg, gfp_flags, NULL);
if (!IS_ERR(f6i))
if (!IS_ERR(f6i)) {
f6i->dst_nocount = true;
if (!anycast &&
(net->ipv6.devconf_all->disable_policy ||
idev->cnf.disable_policy))
f6i->dst_nopolicy = true;
}
return f6i;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册