Created attachment 229796 [details] Pcaps for different DSCP/TOS scenarios It seems like the DSCP/TOS field isn't getting set for INIT_ACK (but is for COOKIE_ACK) when establishing an SCTP association (IPv6). This works for IPv4 however. I have made a summary here: FreeBSD 12.2: IPv4 TCP: Working IPv6 TCP: Not working IPv4 SCTP: Working IPv6 SCTP: Not working FreeBSD 13.0: IPv4 TCP: Working IPv6 TCP: Working IPv4 SCTP: Working IPv6 SCTP: Not working Linux: IPv4 TCP: Working IPv6 TCP: Working IPv4 SCTP: Working IPv6 SCTP: Working I haven't tested this for the FIN/SHUTDOWN phase.
Created attachment 229797 [details] Test files for reproducing the bug I added some tests if it helps. They can be compiled using: g++ -o client client.cpp utils.cpp g++ -o server server.cpp utils.cpp I have tested it in VMs with the SCTP module enabled. I have also added alias addresses to the loopback interface so that I could run both the server and client over the loopback interface. These alias addresess were added: 127.0.0.2 127.0.0.3 127.0.0.4 127.0.0.5 127.0.0.6 127.0.0.7 ::2 ::3 ::4 ::5 ::6 ::7 The test can be started using: ./server --poll --ipv6 --sctp --test-dscp ./client --poll --ipv6 --sctp --test-dscp IPv4 as well as TCP can be tested as well to compare the behavior.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f32357be53d07622603049f9855be2d66ca6dc2b commit f32357be53d07622603049f9855be2d66ca6dc2b Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-12-03 20:28:47 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2021-12-03 20:36:44 +0000 sctp: use the correct traffic class when sending SCTP/IPv6 packets When sending packets the stcb was used to access the inp and then access the endpoint specific IPv6 level options. This fails when there exists an inp, but no stcb yet. This is the case for sending an INIT-ACK in response to an INIT when no association already exists. Fix this by just providing the inp instead of the stcb. PR: 260120 MFC after: 1 week sys/netinet/sctp_os_bsd.h | 42 ++++++++++++++++++++++-------------------- sys/netinet/sctp_output.c | 4 ++-- 2 files changed, 24 insertions(+), 22 deletions(-)
Created attachment 229924 [details] Pcaps for DSCP/TOS after fixes I have tested this with your fixes and it works great. Thank you for the help!
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=7a49fc843975cecb87ed36a33a85efdf12912089 commit 7a49fc843975cecb87ed36a33a85efdf12912089 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2021-12-03 20:28:47 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2021-12-10 10:39:44 +0000 sctp: use the correct traffic class when sending SCTP/IPv6 packets When sending packets the stcb was used to access the inp and then access the endpoint specific IPv6 level options. This fails when there exists an inp, but no stcb yet. This is the case for sending an INIT-ACK in response to an INIT when no association already exists. Fix this by just providing the inp instead of the stcb. PR: 260120 MFC after: 1 week (cherry picked from commit f32357be53d07622603049f9855be2d66ca6dc2b) sys/netinet/sctp_os_bsd.h | 42 ++++++++++++++++++++++-------------------- sys/netinet/sctp_output.c | 4 ++-- 2 files changed, 24 insertions(+), 22 deletions(-)