]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: Fix tcp socket connection with DSCP.
authorGuillaume Nault <gnault@redhat.com>
Wed, 8 Feb 2023 17:14:03 +0000 (18:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:50:41 +0000 (12:50 +0100)
commitd5e27339cb14220a1f1ad56a15c48a94c77905cb
treeacb59e3cfa54d70a3c999f0014f91882de14192c
parente86effb4ba175dfb6b4494bb6dce02f70014b207
ipv6: Fix tcp socket connection with DSCP.

commit 8230680f36fd1525303d1117768c8852314c488c upstream.

Take into account the IPV6_TCLASS socket option (DSCP) in
tcp_v6_connect(). Otherwise fib6_rule_match() can't properly
match the DSCP value, resulting in invalid route lookup.

For example:

  ip route add unreachable table main 2001:db8::10/124

  ip route add table 100 2001:db8::10/124 dev eth0
  ip -6 rule add dsfield 0x04 table 100

  echo test | socat - TCP6:[2001:db8::11]:54321,ipv6-tclass=0x04

Without this patch, socat fails at connect() time ("No route to host")
because the fib-rule doesn't jump to table 100 and the lookup ends up
being done in the main table.

Fixes: effd94e60892 ("[IPV6] ROUTE: Routing by Traffic Class.")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/tcp_ipv6.c