Skip to content

Commit 8230680

Browse files
Guillaume Naultkuba-moo
authored andcommitted
ipv6: Fix tcp socket connection with DSCP.
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: 2cc67cc ("[IPV6] ROUTE: Routing by Traffic Class.") Signed-off-by: Guillaume Nault <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e010ae0 commit 8230680

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ipv6/tcp_ipv6.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
272272
fl6.flowi6_proto = IPPROTO_TCP;
273273
fl6.daddr = sk->sk_v6_daddr;
274274
fl6.saddr = saddr ? *saddr : np->saddr;
275+
fl6.flowlabel = ip6_make_flowinfo(np->tclass, np->flow_label);
275276
fl6.flowi6_oif = sk->sk_bound_dev_if;
276277
fl6.flowi6_mark = sk->sk_mark;
277278
fl6.fl6_dport = usin->sin6_port;

0 commit comments

Comments
 (0)