]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.19.2/ipv6-fix-ipv6_cow_metrics-for-non-dst_host-case.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.2 / ipv6-fix-ipv6_cow_metrics-for-non-dst_host-case.patch
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
5
6 From: Martin KaFai Lau <kafai@fb.com>
7
8 [ Upstream commit 3b4711757d7903ab6fa88a9e7ab8901b8227da60 ]
9
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.
15
16 This patch creates the metrics array (by calling dst_cow_metrics_generic) in
17 ipv6_cow_metrics().
18
19 Test:
20 radvd.conf:
21 interface qemubr0
22 {
23 AdvLinkMTU 1300;
24 AdvCurHopLimit 30;
25
26 prefix fd00:face:face:face::/64
27 {
28 AdvOnLink on;
29 AdvAutonomous on;
30 AdvRouterAddr off;
31 };
32 };
33
34 Before:
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
39
40 After:
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
45
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>
50 ---
51 net/ipv6/route.c | 2 +-
52 1 file changed, 1 insertion(+), 1 deletion(-)
53
54 --- a/net/ipv6/route.c
55 +++ b/net/ipv6/route.c
56 @@ -141,7 +141,7 @@ static u32 *ipv6_cow_metrics(struct dst_
57 u32 *p = NULL;
58
59 if (!(rt->dst.flags & DST_HOST))
60 - return NULL;
61 + return dst_cow_metrics_generic(dst, old);
62
63 peer = rt6_get_peer_create(rt);
64 if (peer) {