]> git.baikalelectronics.ru Git - kernel.git/commit
net/ipv6: use configured metric when add peer route
authorHangbin Liu <liuhangbin@gmail.com>
Sat, 29 Feb 2020 09:27:13 +0000 (17:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Mar 2020 05:55:55 +0000 (21:55 -0800)
commitb5d95a048159e0f465fbd5dc43a48707a71aeffe
treedabdc1dc47dcb38e29441d61a8ce038d8babcf57
parent0daef1dbb1a29708fe9d2010127beb7da8cd7066
net/ipv6: use configured metric when add peer route

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 metric instead of default one.

Reported-by: Jianlin Shi <jishi@redhat.com>
Fixes: c8897dd908a8 ("net/ipv6: Add support for specifying metric of connected routes")
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/addrconf.c