1 From foo@baz Wed Mar 11 11:44:33 CET 2015
2 From: Martin KaFai Lau <kafai@fb.com>
3 Date: Thu, 12 Feb 2015 16:14:08 -0800
4 Subject: ipv6: fix ipv6_cow_metrics for non DST_HOST case
6 From: Martin KaFai Lau <kafai@fb.com>
8 [ Upstream commit 3b4711757d7903ab6fa88a9e7ab8901b8227da60 ]
10 ipv6_cow_metrics() currently assumes only DST_HOST routes require
11 dynamic metrics allocation from inetpeer. The assumption breaks
12 when ndisc discovered router with RTAX_MTU and RTAX_HOPLIMIT metric.
13 Refer to ndisc_router_discovery() in ndisc.c and note that dst_metric_set()
14 is called after the route is created.
16 This patch creates the metrics array (by calling dst_cow_metrics_generic) in
26 prefix fd00:face:face:face::/64
35 [root@qemu1 ~]# ip -6 r show | egrep -v unreachable
36 fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec
37 fe80::/64 dev eth0 proto kernel metric 256
38 default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec
41 [root@qemu1 ~]# ip -6 r show | egrep -v unreachable
42 fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec mtu 1300
43 fe80::/64 dev eth0 proto kernel metric 256 mtu 1300
44 default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec mtu 1300 hoplimit 30
46 Fixes: 8e2ec639173f325 (ipv6: don't use inetpeer to store metrics for routes.)
47 Signed-off-by: Martin KaFai Lau <kafai@fb.com>
48 Signed-off-by: David S. Miller <davem@davemloft.net>
49 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
51 net/ipv6/route.c | 2 +-
52 1 file changed, 1 insertion(+), 1 deletion(-)
54 --- a/net/ipv6/route.c
55 +++ b/net/ipv6/route.c
56 @@ -141,7 +141,7 @@ static u32 *ipv6_cow_metrics(struct dst_
59 if (!(rt->dst.flags & DST_HOST))
61 + return dst_cow_metrics_generic(dst, old);
63 peer = rt6_get_peer_create(rt);