* [RFC PATCH net-next] ipv6: fix ipv6_cow_metrics for non DST_HOST case
@ 2015-02-12 20:07 Martin KaFai Lau
2015-02-12 21:32 ` Hannes Frederic Sowa
2015-02-13 0:14 ` [PATCH net-next v2] " Martin KaFai Lau
0 siblings, 2 replies; 5+ messages in thread
From: Martin KaFai Lau @ 2015-02-12 20:07 UTC (permalink / raw)
To: netdev; +Cc: Hannes Frederic Sowa, davem, Kernel Team
ipv6_cow_metrics() currently assumes only DST_HOST routes require
dynamic metrics allocation from inetpeer. The assumption breaks
when ndisc discovered router with RTAX_MTU and RTAX_HOPLIMIT metric.
Refer to ndisc_router_discovery() in ndisc.c and note that dst_metric_set()
is called after the route is created.
This patch creates the metrics array (by calling dst_cow_metrics_generic) in
ipv6_cow_metrics().
Test:
radvd.conf:
interface qemubr0
{
AdvLinkMTU 1300;
AdvCurHopLimit 30;
prefix fd00:face:face:face::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr off;
};
};
Before:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec
fe80::/64 dev eth0 proto kernel metric 256
default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec
After:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec mtu 1300
fe80::/64 dev eth0 proto kernel metric 256 mtu 1300
default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec mtu 1300 hoplimit 30
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
net/ipv6/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 98565ce..4688bd4 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -141,7 +141,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
u32 *p = NULL;
if (!(rt->dst.flags & DST_HOST))
- return NULL;
+ return dst_cow_metrics_generic(dst, old);
peer = rt6_get_peer_create(rt);
if (peer) {
--
1.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFC PATCH net-next] ipv6: fix ipv6_cow_metrics for non DST_HOST case
2015-02-12 20:07 [RFC PATCH net-next] ipv6: fix ipv6_cow_metrics for non DST_HOST case Martin KaFai Lau
@ 2015-02-12 21:32 ` Hannes Frederic Sowa
2015-02-12 21:39 ` Martin Lau
2015-02-13 0:14 ` [PATCH net-next v2] " Martin KaFai Lau
1 sibling, 1 reply; 5+ messages in thread
From: Hannes Frederic Sowa @ 2015-02-12 21:32 UTC (permalink / raw)
To: Martin KaFai Lau; +Cc: netdev, davem, Kernel Team
Hi,
On Do, 2015-02-12 at 12:07 -0800, Martin KaFai Lau wrote:
> ipv6_cow_metrics() currently assumes only DST_HOST routes require
> dynamic metrics allocation from inetpeer. The assumption breaks
> when ndisc discovered router with RTAX_MTU and RTAX_HOPLIMIT metric.
> Refer to ndisc_router_discovery() in ndisc.c and note that dst_metric_set()
> is called after the route is created.
>
> This patch creates the metrics array (by calling dst_cow_metrics_generic) in
> ipv6_cow_metrics().
>
> Test:
> radvd.conf:
> interface qemubr0
> {
> AdvLinkMTU 1300;
> AdvCurHopLimit 30;
>
> prefix fd00:face:face:face::/64
> {
> AdvOnLink on;
> AdvAutonomous on;
> AdvRouterAddr off;
> };
> };
>
> Before:
> [root@qemu1 ~]# ip -6 r show | egrep -v unreachable
> fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec
> fe80::/64 dev eth0 proto kernel metric 256
> default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec
>
> After:
> [root@qemu1 ~]# ip -6 r show | egrep -v unreachable
> fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec mtu 1300
> fe80::/64 dev eth0 proto kernel metric 256 mtu 1300
> default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec mtu 1300 hoplimit 30
>
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Looks good to me.
This fixes 8e2ec639173f325 ("ipv6: don't use inetpeer to store metrics
for routes.")?
Thanks,
Hannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH net-next] ipv6: fix ipv6_cow_metrics for non DST_HOST case
2015-02-12 21:32 ` Hannes Frederic Sowa
@ 2015-02-12 21:39 ` Martin Lau
0 siblings, 0 replies; 5+ messages in thread
From: Martin Lau @ 2015-02-12 21:39 UTC (permalink / raw)
To: Hannes Frederic Sowa; +Cc: netdev, davem, Kernel Team
On Thu, Feb 12, 2015 at 04:32:39PM -0500, Hannes Frederic Sowa wrote:
> This fixes 8e2ec639173f325 ("ipv6: don't use inetpeer to store metrics
> for routes.")?
Correct. I will add the 'Fixes' tag and repost.
Thanks!
--Martin
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2] ipv6: fix ipv6_cow_metrics for non DST_HOST case
2015-02-12 20:07 [RFC PATCH net-next] ipv6: fix ipv6_cow_metrics for non DST_HOST case Martin KaFai Lau
2015-02-12 21:32 ` Hannes Frederic Sowa
@ 2015-02-13 0:14 ` Martin KaFai Lau
2015-02-15 4:28 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Martin KaFai Lau @ 2015-02-13 0:14 UTC (permalink / raw)
To: netdev, Hannes Frederic Sowa; +Cc: davem, Kernel Team
ipv6_cow_metrics() currently assumes only DST_HOST routes require
dynamic metrics allocation from inetpeer. The assumption breaks
when ndisc discovered router with RTAX_MTU and RTAX_HOPLIMIT metric.
Refer to ndisc_router_discovery() in ndisc.c and note that dst_metric_set()
is called after the route is created.
This patch creates the metrics array (by calling dst_cow_metrics_generic) in
ipv6_cow_metrics().
Test:
radvd.conf:
interface qemubr0
{
AdvLinkMTU 1300;
AdvCurHopLimit 30;
prefix fd00:face:face:face::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr off;
};
};
Before:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec
fe80::/64 dev eth0 proto kernel metric 256
default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec
After:
[root@qemu1 ~]# ip -6 r show | egrep -v unreachable
fd00:face:face:face::/64 dev eth0 proto kernel metric 256 expires 27sec mtu 1300
fe80::/64 dev eth0 proto kernel metric 256 mtu 1300
default via fe80::74df:d0ff:fe23:8ef2 dev eth0 proto ra metric 1024 expires 27sec mtu 1300 hoplimit 30
Fixes: 8e2ec639173f325 (ipv6: don't use inetpeer to store metrics for routes.)
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
---
net/ipv6/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 98565ce..4688bd4 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -141,7 +141,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old)
u32 *p = NULL;
if (!(rt->dst.flags & DST_HOST))
- return NULL;
+ return dst_cow_metrics_generic(dst, old);
peer = rt6_get_peer_create(rt);
if (peer) {
--
1.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v2] ipv6: fix ipv6_cow_metrics for non DST_HOST case
2015-02-13 0:14 ` [PATCH net-next v2] " Martin KaFai Lau
@ 2015-02-15 4:28 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-02-15 4:28 UTC (permalink / raw)
To: kafai; +Cc: netdev, hannes, kernel-team
From: Martin KaFai Lau <kafai@fb.com>
Date: Thu, 12 Feb 2015 16:14:08 -0800
> ipv6_cow_metrics() currently assumes only DST_HOST routes require
> dynamic metrics allocation from inetpeer. The assumption breaks
> when ndisc discovered router with RTAX_MTU and RTAX_HOPLIMIT metric.
> Refer to ndisc_router_discovery() in ndisc.c and note that dst_metric_set()
> is called after the route is created.
>
> This patch creates the metrics array (by calling dst_cow_metrics_generic) in
> ipv6_cow_metrics().
...
> Fixes: 8e2ec639173f325 (ipv6: don't use inetpeer to store metrics for routes.)
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-02-15 4:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12 20:07 [RFC PATCH net-next] ipv6: fix ipv6_cow_metrics for non DST_HOST case Martin KaFai Lau
2015-02-12 21:32 ` Hannes Frederic Sowa
2015-02-12 21:39 ` Martin Lau
2015-02-13 0:14 ` [PATCH net-next v2] " Martin KaFai Lau
2015-02-15 4:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).