From: Nick Jones <hidden> Date: 2012-03-15 15:42:00
The generation of an icmp6 packet, targeted to a specific desination
address, will cause the shared metrics of the ip6_dst and inetpeer
of that address to be tainted with the hoplimit value 255.
All subsequent packets to the dst, will have this hoplimit value, and
if the destination is a router, not even advertisements specifying a
new hoplimit value will have any effect reverting this due to the way
ip6_dst_hoplimit works.
By allocating a unique metrics array for the icmp6 packet, the shared
metrics will not be tainted. A ip6_dst flag is added to indicate that
the metrics for the dst don't belong to the peer, thus are not unique
and should be freed when the dst is destroyed.
Signed-off-by: Nick Jones <redacted>
---
v2: Take care of destroy side, that was neglected in the previous
version, by setting a flag on the dst to indicate its metrics are
unique, thus should be destroyed along with the dst.
include/net/dst.h | 1 +
net/ipv6/route.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
From: Nick Jones <hidden> Date: 2012-03-17 15:47:18
The generation of an icmp6 packet, targeted to a specific desination
address, will cause the shared metrics of the ip6_dst and inetpeer
of that address to be tainted with the hoplimit value 255.
All packets, icmp6 or otherwise, will have this hoplimit value, and
if the destination is a router, not even advertisements specifying a
new hoplimit value will have any effect due to the way
ip6_dst_hoplimit works.
By allocating a unique metrics array for the icmp6 packet, the shared
metrics will not be tainted. A ip6_dst flag is added to indicate that
the metrics for the dst don't belong to the peer, thus are not unique
and should be freed when the dst is freed.
Signed-off-by: Nick Jones <redacted>
---
v2: Take care of destroy side, that was neglected in the previous
version, by setting a flag on the dst to indicate its metrics are
unique, thus should be destroyed along with the dst.
v3: declare metrics pointer variable at function top
include/net/dst.h | 1 +
net/ipv6/route.c | 13 +++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
From: Eric Dumazet <hidden> Date: 2012-03-17 16:36:45
On Sat, 2012-03-17 at 23:47 +0800, Nick Jones wrote:
The generation of an icmp6 packet, targeted to a specific desination
address, will cause the shared metrics of the ip6_dst and inetpeer
of that address to be tainted with the hoplimit value 255.
All packets, icmp6 or otherwise, will have this hoplimit value, and
if the destination is a router, not even advertisements specifying a
new hoplimit value will have any effect due to the way
ip6_dst_hoplimit works.
By allocating a unique metrics array for the icmp6 packet, the shared
metrics will not be tainted. A ip6_dst flag is added to indicate that
the metrics for the dst don't belong to the peer, thus are not unique
and should be freed when the dst is freed.
Signed-off-by: Nick Jones <redacted>
---
+ }
+ dst_init_metrics(&rt->dst, metrics, 0);
Dont be fooled by 8e2ec639 precedent, third argument is a bool, so
please use 'false' instead of 0
From: Nick Jones <hidden> Date: 2012-03-17 17:43:42
The generation of an icmp6 packet, targeted to a specific desination
address, will cause the shared metrics of the ip6_dst and inetpeer
of that address to be tainted with the hoplimit value 255.
All packets, icmp6 or otherwise, will have this hoplimit value, and
if the destination is a router, not even advertisements specifying a
new hoplimit value will have any effect due to the way
ip6_dst_hoplimit works.
By allocating a unique metrics array for the icmp6 packet, the shared
metrics will not be tainted. A ip6_dst flag is added to indicate that
the metrics for the dst don't belong to the peer, thus are not unique
and should be freed when the dst is freed.
Signed-off-by: Nick Jones <redacted>
---
v2: Forgot to handle destroy side, as pointed out by David Miller.
Achieved by setting a flag on the dst to indicate its metrics are
unique, thus should be destroyed along with the dst.
v3: David Miller reminds that metrics pointer should be declared at
function top.
v4: Eric Dumazet suggest argument of dst_init_metrics change to from
literal 0 to keyword 'false'.
include/net/dst.h | 1 +
net/ipv6/route.c | 13 +++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2012-03-19 22:04:24
From: Nick Jones <redacted>
Date: Sun, 18 Mar 2012 01:43:39 +0800
+ return ERR_CAST(-ENOMEM);
Really, please, stop wasting my time. There is no way your compiler
didn't emit a warning for that garbage.
Furthermore, callers are only ready to handle NULL vs. non-NULL as
return values from this function. So this return value you are adding
will result in crashes.
From: Nick Jones <hidden> Date: 2012-03-20 05:54:22
On Mon, 2012-03-19 at 18:04 -0400, David Miller wrote:
From: Nick Jones <redacted>
Date: Sun, 18 Mar 2012 01:43:39 +0800
quoted
+ return ERR_CAST(-ENOMEM);
Really, please, stop wasting my time. There is no way your compiler
didn't emit a warning for that garbage.
This is really sloppy, I apologise. I'll work on tightening up my
workflow for build testing, runtime testing and patch submission before
I bother you again.
Furthermore, callers are only ready to handle NULL vs. non-NULL as
return values from this function. So this return value you are adding
will result in crashes.
This one I did check. icmp6_dst_alloc returns error encoded pointers
and all call sites test the return value with IS_ERR, I simply didn't
understand the correct formatting macro, nor check the build properly.
I think you got it mixed up with ip6_dst_alloc
The 'return NULL' at the bottom of the second fragment was a bug, but
this again exposes my newness to kernel patch submission workflow: that
bug was fixed recently and this patch wouldn't have applied, further
wasting your time... wonderful.
I'll let the merge window close to let things settle down for you before
bringing this fix up again.
From: David Miller <davem@davemloft.net> Date: 2012-03-20 07:10:49
From: Nick Jones <redacted>
Date: Tue, 20 Mar 2012 13:48:01 +0800
On Mon, 2012-03-19 at 18:04 -0400, David Miller wrote:
quoted
Furthermore, callers are only ready to handle NULL vs. non-NULL as
return values from this function. So this return value you are adding
will result in crashes.
This one I did check. icmp6_dst_alloc returns error encoded pointers
and all call sites test the return value with IS_ERR, I simply didn't
understand the correct formatting macro, nor check the build properly.
I think you got it mixed up with ip6_dst_alloc
Indeed you're right on this one. We changed this recently, in fact.