From nobody Fri Dec 10 10:40:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0332E18D721B; Fri, 10 Dec 2021 10:40:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J9S9J0XcGz3DN8; Fri, 10 Dec 2021 10:40:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC4B418C25; Fri, 10 Dec 2021 10:40:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BAAeZBs014430; Fri, 10 Dec 2021 10:40:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BAAeZmp014428; Fri, 10 Dec 2021 10:40:35 GMT (envelope-from git) Date: Fri, 10 Dec 2021 10:40:35 GMT Message-Id: <202112101040.1BAAeZmp014428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 7a49fc843975 - stable/13 - sctp: use the correct traffic class when sending SCTP/IPv6 packets List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7a49fc843975cecb87ed36a33a85efdf12912089 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639132836; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rq9zGwK3Oz4axOyWg+jJJAq/cP6fvD9bl5QrfkxmV7c=; b=sUET+I/tajwK3wHPMKSfzUDZp8QLFFRsgN0FBIZEi4qTyEK3s3wCamOK9BhaLafUpAwc9E RzUVKdtffBnFlF61El76HULjO/iNt+XEHr+e1m6vRn3dlvGrRbCuCf795V8w19L6mAux/q 3ky5oYBZfEOBZiwAGvjeLnQ1G7z2NMo924a6yO9okw/mtT86u88F+NTHnaJa3WiwWXvChC 7UweyBqgspQpSQoojHXbKNDzWXtajLQbhTYTS8h6+kssiRseco8aO7pa8e2tRU1Vsdh992 wG1xrYcdwGeICCbO8mTt2sb83F4jDtGAut9ih/aFFxYuX1lEuqI8IFzCVklJEw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639132836; a=rsa-sha256; cv=none; b=k2tIJjArHJ8lBxjVmqTu4SYxZNLXwpwgOyWTpcWdO+8I7UU0HCf7j8yPh1HyDpBMl7A+L9 dqRZESU7GnHPT+Ly10ZQeO6UR4YXWhI6M+s9f7WM/SUlDUj2cXL1HMPpvx7CPlyt2Q1VCu 5vVnWOdhZ05JvvscRg/dZTEHAHth6VQydAW+ytmuoiWpQiHastbdAsiVACKHiXIQ5/t8vy 4NB+28VjaY3cnLAQTHo0PZrDbxvl9iudiuDImvN6KPxNSeCozbQtqJwhlWLwLLO7/+Ryp2 DiR9plViVINhQsazJfjALjgCzNoUDDzqlXr/ZNCFbuClYQ0lDWSBLyYnKPj73w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7a49fc843975cecb87ed36a33a85efdf12912089 commit 7a49fc843975cecb87ed36a33a85efdf12912089 Author: Michael Tuexen AuthorDate: 2021-12-03 20:28:47 +0000 Commit: Michael Tuexen 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(-) diff --git a/sys/netinet/sctp_os_bsd.h b/sys/netinet/sctp_os_bsd.h index 12a666b8eead..39c0a8cb5c2a 100644 --- a/sys/netinet/sctp_os_bsd.h +++ b/sys/netinet/sctp_os_bsd.h @@ -411,28 +411,30 @@ typedef struct route sctp_route_t; /* * IP output routines */ -#define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \ -{ \ - int o_flgs = IP_RAWOUTPUT; \ - struct sctp_tcb *local_stcb = stcb; \ - if (local_stcb && \ - local_stcb->sctp_ep && \ - local_stcb->sctp_ep->sctp_socket) \ - o_flgs |= local_stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE; \ - m_clrprotoflags(o_pak); \ - result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \ +#define SCTP_IP_OUTPUT(result, o_pak, ro, _inp, vrf_id) \ +{ \ + struct sctp_inpcb *local_inp = _inp; \ + int o_flgs = IP_RAWOUTPUT; \ + \ + m_clrprotoflags(o_pak); \ + if ((local_inp != NULL) && (local_inp->sctp_socket != NULL)) { \ + o_flgs |= local_inp->sctp_socket->so_options & SO_DONTROUTE; \ + } \ + result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \ } -#define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, stcb, vrf_id) \ -{ \ - struct sctp_tcb *local_stcb = stcb; \ - m_clrprotoflags(o_pak); \ - if (local_stcb && local_stcb->sctp_ep) \ - result = ip6_output(o_pak, \ - ((struct inpcb *)(local_stcb->sctp_ep))->in6p_outputopts, \ - (ro), 0, 0, ifp, NULL); \ - else \ - result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \ +#define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, _inp, vrf_id) \ +{ \ + struct sctp_inpcb *local_inp = _inp; \ + \ + m_clrprotoflags(o_pak); \ + if (local_inp != NULL) { \ + result = ip6_output(o_pak, \ + local_inp->ip_inp.inp.in6p_outputopts, \ + (ro), 0, 0, ifp, NULL); \ + } else { \ + result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \ + } \ } struct mbuf * diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 5953cf724c89..277a6625aa12 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -4220,7 +4220,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, #endif /* send it out. table id is taken from stcb */ SCTP_PROBE5(send, NULL, stcb, ip, stcb, sctphdr); - SCTP_IP_OUTPUT(ret, o_pak, ro, stcb, vrf_id); + SCTP_IP_OUTPUT(ret, o_pak, ro, inp, vrf_id); if (port) { UDPSTAT_INC(udps_opackets); } @@ -4544,7 +4544,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, sctp_packet_log(o_pak); #endif SCTP_PROBE5(send, NULL, stcb, ip6h, stcb, sctphdr); - SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id); + SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, inp, vrf_id); if (net) { /* for link local this must be done */ sin6->sin6_scope_id = prev_scope;