[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ad3ee1d-32d2-c84d-ea8a-f4daf44b4fa1@gmail.com>
Date: Fri, 28 Feb 2020 09:50:45 -0700
From: David Ahern <dsahern@...il.com>
To: Hangbin Liu <liuhangbin@...il.com>, netdev@...r.kernel.org
Cc: Jianlin Shi <jishi@...hat.com>, David Miller <davem@...emloft.net>
Subject: Re: [PATCH net] net/ipv6: use configured matric when add peer route
On 2/28/20 2:18 AM, Hangbin Liu wrote:
> When we add peer address with metric configured, IPv4 could set the dest
> metric correctly, but IPv6 do not. e.g.
>
> ]# ip addr add 192.0.2.1 peer 192.0.2.2/32 dev eth1 metric 20
> ]# ip route show dev eth1
> 192.0.2.2 proto kernel scope link src 192.0.2.1 metric 20
> ]# ip addr add 2001:db8::1 peer 2001:db8::2/128 dev eth1 metric 20
> ]# ip -6 route show dev eth1
> 2001:db8::1 proto kernel metric 20 pref medium
> 2001:db8::2 proto kernel metric 256 pref medium
>
> Fix this by using configured matric instead of default one.
>
> Reported-by: Jianlin Shi <jishi@...hat.com>
> Fixes: 8308f3ff1753 ("net/ipv6: Add support for specifying metric of connected routes")
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
> net/ipv6/addrconf.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index cb493e15959c..164c71c54b5c 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -5983,9 +5983,9 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
> if (ifp->idev->cnf.forwarding)
> addrconf_join_anycast(ifp);
> if (!ipv6_addr_any(&ifp->peer_addr))
> - addrconf_prefix_route(&ifp->peer_addr, 128, 0,
> - ifp->idev->dev, 0, 0,
> - GFP_ATOMIC);
> + addrconf_prefix_route(&ifp->peer_addr, 128,
> + ifp->rt_priority, ifp->idev->dev,
> + 0, 0, GFP_ATOMIC);
> break;tools/testing/selftests/net
> case RTM_DELADDR:
> if (ifp->idev->cnf.forwarding)
>
ugh, missed that one. Thanks for the patch. Please add the tests in the
commit message to tools/testing/selftests/net/fib_tests.sh,
ipv{4,6}_addr_metric_test sections.
Reviewed-by: David Ahern <dsahern@...il.com>
(and s/matric/metric/ in a couple of places as noted by roopa)
Powered by blists - more mailing lists