From: Guillaume Nault <gnault@redhat.com>
To: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Subject: [PATCH net 1/3] ipv6: Fix datagram socket connection with DSCP.
Date: Wed, 8 Feb 2023 18:13:59 +0100 [thread overview]
Message-ID: <b827a871f8dbc204f08e7f741242ba7f7d5cb8ab.1675875519.git.gnault@redhat.com> (raw)
In-Reply-To: <cover.1675875519.git.gnault@redhat.com>
Take into account the IPV6_TCLASS socket option (DSCP) in
ip6_datagram_flow_key_init(). 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 - UDP6:[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: 2cc67cc731d9 ("[IPV6] ROUTE: Routing by Traffic Class.")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
net/ipv6/datagram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index e624497fa992..9b6818453afe 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -51,7 +51,7 @@ static void ip6_datagram_flow_key_init(struct flowi6 *fl6, struct sock *sk)
fl6->flowi6_mark = sk->sk_mark;
fl6->fl6_dport = inet->inet_dport;
fl6->fl6_sport = inet->inet_sport;
- fl6->flowlabel = np->flow_label;
+ fl6->flowlabel = ip6_make_flowinfo(np->tclass, np->flow_label);
fl6->flowi6_uid = sk->sk_uid;
if (!oif)
--
2.30.2
next prev parent reply other threads:[~2023-02-08 17:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 17:13 [PATCH net 0/3] ipv6: Fix socket connection with DSCP fib-rules Guillaume Nault
2023-02-08 17:13 ` Guillaume Nault [this message]
2023-02-09 10:55 ` [PATCH net 1/3] ipv6: Fix datagram socket connection with DSCP Eric Dumazet
2023-02-09 15:39 ` David Ahern
2023-02-08 17:14 ` [PATCH net 2/3] ipv6: Fix tcp " Guillaume Nault
2023-02-09 10:56 ` Eric Dumazet
2023-02-09 15:39 ` David Ahern
2023-02-08 17:14 ` [PATCH net 3/3] selftests: fib_rule_tests: Test UDP and TCP connections with DSCP rules Guillaume Nault
2023-02-09 15:42 ` David Ahern
2023-02-10 7:00 ` [PATCH net 0/3] ipv6: Fix socket connection with DSCP fib-rules patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b827a871f8dbc204f08e7f741242ba7f7d5cb8ab.1675875519.git.gnault@redhat.com \
--to=gnault@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).