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

net/ipv6: Fix updates to prefix route

Sowmini reported that a recent commit broke prefix routes for linklocal
addresses. The newly added modify_prefix_route is attempting to add a
new prefix route when the ifp priority does not match the route metric
however the check needs to account for the default priority. In addition,
the route add fails because the route already exists, and then the delete
removes the one that exists. Flip the order to do the delete first.

Fixes: 8308f3ff ("net/ipv6: Add support for specifying metric of connected routes")
Reported-by: NSowmini Varadhan <sowmini.varadhan@oracle.com>
Tested-by: NSowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: NDavid Ahern <dsahern@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d14b56f5
...@@ -4528,6 +4528,7 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp, ...@@ -4528,6 +4528,7 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp,
unsigned long expires, u32 flags) unsigned long expires, u32 flags)
{ {
struct fib6_info *f6i; struct fib6_info *f6i;
u32 prio;
f6i = addrconf_get_prefix_route(&ifp->addr, f6i = addrconf_get_prefix_route(&ifp->addr,
ifp->prefix_len, ifp->prefix_len,
...@@ -4536,13 +4537,15 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp, ...@@ -4536,13 +4537,15 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp,
if (!f6i) if (!f6i)
return -ENOENT; return -ENOENT;
if (f6i->fib6_metric != ifp->rt_priority) { prio = ifp->rt_priority ? : IP6_RT_PRIO_ADDRCONF;
if (f6i->fib6_metric != prio) {
/* delete old one */
ip6_del_rt(dev_net(ifp->idev->dev), f6i);
/* add new one */ /* add new one */
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, addrconf_prefix_route(&ifp->addr, ifp->prefix_len,
ifp->rt_priority, ifp->idev->dev, ifp->rt_priority, ifp->idev->dev,
expires, flags, GFP_KERNEL); expires, flags, GFP_KERNEL);
/* delete old one */
ip6_del_rt(dev_net(ifp->idev->dev), f6i);
} else { } else {
if (!expires) if (!expires)
fib6_clean_expires(f6i); fib6_clean_expires(f6i);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册