From: Michal Kubecek <hidden> Date: 2018-06-01 11:30:06
Some of the code paths calculating flow hash for IPv6 use flowlabel member
of struct flowi6 which, despite its name, encodes both flow label and
traffic class. If traffic class changes within a TCP connection (as e.g.
ssh does), ECMP route can switch between path. It's also incosistent with
other code paths where ip6_flowlabel() (returning only flow label) is used
to feed the key.
Use only flow label everywhere, including one place where hash key is set
using ip6_flowinfo().
Fixes: 51ebd3181572 ("ipv6: add support of equal cost multipath (ECMP)")
Fixes: f70ea018da06 ("net: Add functions to get skb->hash based on flow structures")
Signed-off-by: Michal Kubecek <redacted>
---
net/core/flow_dissector.c | 3 ++-
net/ipv6/route.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
From: Nicolas Dichtel <hidden> Date: 2018-06-01 12:25:29
Le 01/06/2018 à 12:34, Michal Kubecek a écrit :
Some of the code paths calculating flow hash for IPv6 use flowlabel member
of struct flowi6 which, despite its name, encodes both flow label and
traffic class. If traffic class changes within a TCP connection (as e.g.
ssh does), ECMP route can switch between path. It's also incosistent with
nit: s/incosistent/inconsistent
other code paths where ip6_flowlabel() (returning only flow label) is used
to feed the key.
Use only flow label everywhere, including one place where hash key is set
using ip6_flowinfo().
Fixes: 51ebd3181572 ("ipv6: add support of equal cost multipath (ECMP)")
Fixes: f70ea018da06 ("net: Add functions to get skb->hash based on flow structures")
Signed-off-by: Michal Kubecek <redacted>
From: David Ahern <hidden> Date: 2018-06-01 16:42:16
On 6/1/18 4:34 AM, Michal Kubecek wrote:
quoted hunk
Some of the code paths calculating flow hash for IPv6 use flowlabel member
of struct flowi6 which, despite its name, encodes both flow label and
traffic class. If traffic class changes within a TCP connection (as e.g.
ssh does), ECMP route can switch between path. It's also incosistent with
other code paths where ip6_flowlabel() (returning only flow label) is used
to feed the key.
Use only flow label everywhere, including one place where hash key is set
using ip6_flowinfo().
Fixes: 51ebd3181572 ("ipv6: add support of equal cost multipath (ECMP)")
Fixes: f70ea018da06 ("net: Add functions to get skb->hash based on flow structures")
Signed-off-by: Michal Kubecek <redacted>
---
net/core/flow_dissector.c | 3 ++-
net/ipv6/route.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
From there we can fix the flow struct to have flowinfo instead of
flowlabel and use the macro to hide the conversion.
I'll send v2 with inline helper. I'm just not sure about including the
cast as this way the helper would be useful for hash key which is not
clear from the name. So it seems more appropriate to either introduce a
helper which just does the masking or helper which does also the copying
into struct flow_keys.
Michal Kubecek
From there we can fix the flow struct to have flowinfo instead of
flowlabel and use the macro to hide the conversion.
I'll send v2 with inline helper. I'm just not sure about including the
cast as this way the helper would be useful for hash key which is not
clear from the name. So it seems more appropriate to either introduce a
helper which just does the masking or helper which does also the copying
into struct flow_keys.
I think the cast should stay in the helper. See the RFC patch flipping
the name from flowlabel to flowinfo. Makes the code the more readable IMHO.
On Fri, Jun 01, 2018 at 12:34:41PM +0200, Michal Kubecek wrote:
Some of the code paths calculating flow hash for IPv6 use flowlabel member
of struct flowi6 which, despite its name, encodes both flow label and
traffic class. If traffic class changes within a TCP connection (as e.g.
ssh does), ECMP route can switch between path. It's also incosistent with
other code paths where ip6_flowlabel() (returning only flow label) is used
to feed the key.
Use only flow label everywhere, including one place where hash key is set
using ip6_flowinfo().
Fixes: 51ebd3181572 ("ipv6: add support of equal cost multipath (ECMP)")
Fixes: f70ea018da06 ("net: Add functions to get skb->hash based on flow structures")
Signed-off-by: Michal Kubecek <redacted>
Hi Michal,
Please consider adding a test case to
tools/testing/selftests/net/fib_tests.sh
Personally, I tested the patch by looping over different values of 'tos'
for 'ip route get' and confirmed that the same nexthop is selected.
Thanks!
From: Michal Kubecek <hidden> Date: 2018-06-02 07:54:20
On Fri, Jun 01, 2018 at 09:19:29PM +0300, Ido Schimmel wrote:
On Fri, Jun 01, 2018 at 12:34:41PM +0200, Michal Kubecek wrote:
quoted
Some of the code paths calculating flow hash for IPv6 use flowlabel member
of struct flowi6 which, despite its name, encodes both flow label and
traffic class. If traffic class changes within a TCP connection (as e.g.
ssh does), ECMP route can switch between path. It's also incosistent with
other code paths where ip6_flowlabel() (returning only flow label) is used
to feed the key.
Use only flow label everywhere, including one place where hash key is set
using ip6_flowinfo().
Fixes: 51ebd3181572 ("ipv6: add support of equal cost multipath (ECMP)")
Fixes: f70ea018da06 ("net: Add functions to get skb->hash based on flow structures")
Signed-off-by: Michal Kubecek <redacted>
Please consider adding a test case to
tools/testing/selftests/net/fib_tests.sh
Personally, I tested the patch by looping over different values of 'tos'
for 'ip route get' and confirmed that the same nexthop is selected.
Thanks for the tip, I'll look into it next week.
Michal Kubecek