From owner-svn-src-head@freebsd.org Thu Jun 18 19:32:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2793C3314D6; Thu, 18 Jun 2020 19:32:38 +0000 (UTC) (envelope-from markj@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49nsXQ0Hx5z3fyQ; Thu, 18 Jun 2020 19:32:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFDA6EEB8; Thu, 18 Jun 2020 19:32:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05IJWbbc009574; Thu, 18 Jun 2020 19:32:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05IJWZYH009560; Thu, 18 Jun 2020 19:32:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006181932.05IJWZYH009560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 18 Jun 2020 19:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362338 - in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/kern sys/netinet sys/netinet6 sys/netipsec sys/netpfil/pf X-SVN-Commit-Revision: 362338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2020 19:32:38 -0000 Author: markj Date: Thu Jun 18 19:32:34 2020 New Revision: 362338 URL: https://svnweb.freebsd.org/changeset/base/362338 Log: Add the SCTP_SUPPORT kernel option. This is in preparation for enabling a loadable SCTP stack. Analogous to IPSEC/IPSEC_SUPPORT, the SCTP_SUPPORT kernel option must be configured in order to support a loadable SCTP implementation. Discussed with: tuexen MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/sctp.4 head/sys/conf/NOTES head/sys/conf/options head/sys/kern/uipc_socket.c head/sys/netinet/in_proto.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_output.c head/sys/netinet/sctp_crc32.c head/sys/netinet/sctp_crc32.h head/sys/netinet6/in6_proto.c head/sys/netinet6/ip6_forward.c head/sys/netinet6/ip6_output.c head/sys/netipsec/ipsec_output.c head/sys/netpfil/pf/pf.c Modified: head/share/man/man4/sctp.4 ============================================================================== --- head/share/man/man4/sctp.4 Thu Jun 18 19:16:03 2020 (r362337) +++ head/share/man/man4/sctp.4 Thu Jun 18 19:32:34 2020 (r362338) @@ -26,13 +26,16 @@ .\" .\" $FreeBSD$ .\" -.Dd January 4, 2020 +.Dd June 18, 2020 .Dt SCTP 4 .Os .Sh NAME .Nm sctp .Nd Internet Stream Control Transmission Protocol .Sh SYNOPSIS +.Cd "options SCTP" +.Cd "options SCTP_SUPPORT" +.Pp .In sys/types.h .In sys/socket.h .In netinet/sctp.h Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/conf/NOTES Thu Jun 18 19:32:34 2020 (r362338) @@ -697,7 +697,12 @@ options LIBALIAS # the V6 and V4.. since an association can span # both a V6 and V4 address at the SAME time :-) # +# The SCTP_SUPPORT option does not enable SCTP, but provides the necessary +# support for loading SCTP as a loadable kernel module. +# options SCTP +options SCTP_SUPPORT + # There are bunches of options: # this one turns on all sorts of # nastily printing that you can @@ -710,6 +715,7 @@ options SCTP # bits and prints.. which makes the code run # faster.. if you are not debugging don't use. options SCTP_DEBUG + # # All that options after that turn on specific types of # logging. You can monitor CWND growth, flight size @@ -732,7 +738,6 @@ options SCTP_MBCNT_LOGGING options SCTP_PACKET_LOGGING options SCTP_LTRACE_CHUNKS options SCTP_LTRACE_ERRORS - # altq(9). Enable the base part of the hooks with the ALTQ option. # Individual disciplines must be built into the base system and can not be Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/conf/options Thu Jun 18 19:32:34 2020 (r362338) @@ -476,6 +476,7 @@ XBONEHACK # SCTP # SCTP opt_sctp.h +SCTP_SUPPORT opt_sctp.h SCTP_DEBUG opt_sctp.h # Enable debug printfs SCTP_LOCK_LOGGING opt_sctp.h # Log to KTR lock activity SCTP_MBUF_LOGGING opt_sctp.h # Log to KTR general mbuf aloc/free Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/kern/uipc_socket.c Thu Jun 18 19:32:34 2020 (r362338) @@ -793,7 +793,7 @@ sonewconn(struct socket *head, int connstatus) return (so); } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) /* * Socket part of sctp_peeloff(). Detach a new socket from an * association. The new socket is returned with a reference. Modified: head/sys/netinet/in_proto.c ============================================================================== --- head/sys/netinet/in_proto.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet/in_proto.c Thu Jun 18 19:32:34 2020 (r362338) @@ -94,7 +94,7 @@ static struct pr_usrreqs nousrreqs; #include #include #include -#endif /* SCTP */ +#endif FEATURE(inet, "Internet Protocol version 4"); @@ -324,7 +324,7 @@ SYSCTL_NODE(_net_inet, IPPROTO_UDP, udp, CTLFLAG_RW | "UDP"); SYSCTL_NODE(_net_inet, IPPROTO_TCP, tcp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP"); -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) SYSCTL_NODE(_net_inet, IPPROTO_SCTP, sctp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "SCTP"); #endif Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet/ip_divert.c Thu Jun 18 19:32:34 2020 (r362338) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #endif @@ -215,7 +215,7 @@ divert_packet(struct mbuf *m, bool incoming) in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) { sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet/ip_output.c Thu Jun 18 19:32:34 2020 (r362338) @@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #include #endif @@ -154,7 +154,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, in } m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | CSUM_IP_VALID; -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif @@ -185,7 +185,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, in CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif @@ -753,7 +753,7 @@ sendit: goto bad; } } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) { m = mb_unmapped_to_ext(m); if (m == NULL) { @@ -905,7 +905,7 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int m in_delayed_cksum(m0); m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m0->m_pkthdr.csum_flags & CSUM_SCTP) { m0 = mb_unmapped_to_ext(m0); if (m0 == NULL) { Modified: head/sys/netinet/sctp_crc32.c ============================================================================== --- head/sys/netinet/sctp_crc32.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet/sctp_crc32.c Thu Jun 18 19:32:34 2020 (r362338) @@ -37,18 +37,17 @@ __FBSDID("$FreeBSD$"); #include "opt_sctp.h" -#include -#ifdef SCTP -#include -#include -#include -#include -#else #include #include +#include #include +#include #include +#ifdef SCTP +#include +#include +#include #endif static uint32_t @@ -117,7 +116,7 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) return (base); } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) /* * Compute and insert the SCTP checksum in network byte order for a given * mbuf chain m which contains an SCTP packet starting at offset. @@ -128,8 +127,10 @@ sctp_delayed_cksum(struct mbuf *m, uint32_t offset) uint32_t checksum; checksum = sctp_calculate_cksum(m, offset); +#ifdef SCTP SCTP_STAT_DECR(sctps_sendhwcrc); SCTP_STAT_INCR(sctps_sendswcrc); +#endif offset += offsetof(struct sctphdr, checksum); if (offset + sizeof(uint32_t) > (uint32_t)(m->m_pkthdr.len)) { Modified: head/sys/netinet/sctp_crc32.h ============================================================================== --- head/sys/netinet/sctp_crc32.h Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet/sctp_crc32.h Thu Jun 18 19:32:34 2020 (r362338) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) void sctp_delayed_cksum(struct mbuf *, uint32_t offset); #endif #endif /* _KERNEL */ Modified: head/sys/netinet6/in6_proto.c ============================================================================== --- head/sys/netinet6/in6_proto.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet6/in6_proto.c Thu Jun 18 19:32:34 2020 (r362338) @@ -429,7 +429,7 @@ SYSCTL_NODE(_net_inet6, IPPROTO_UDP, udp6, CTLFLAG_RW "UDP6"); SYSCTL_NODE(_net_inet6, IPPROTO_TCP, tcp6, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "TCP6"); -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) SYSCTL_NODE(_net_inet6, IPPROTO_SCTP, sctp6, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "SCTP6"); #endif Modified: head/sys/netinet6/ip6_forward.c ============================================================================== --- head/sys/netinet6/ip6_forward.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet6/ip6_forward.c Thu Jun 18 19:32:34 2020 (r362338) @@ -360,7 +360,7 @@ again: CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netinet6/ip6_output.c Thu Jun 18 19:32:34 2020 (r362338) @@ -114,7 +114,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #include #endif @@ -221,7 +221,7 @@ ip6_output_delayed_csum(struct mbuf *m, struct ifnet * __func__, __LINE__, plen, optlen, m, ifp, csum_flags, frag)); if ((csum_flags & CSUM_DELAY_DATA_IPV6) || -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) (csum_flags & CSUM_SCTP_IPV6) || #endif (!frag && (ifp->if_capenable & IFCAP_NOMAP) == 0)) { @@ -238,7 +238,7 @@ ip6_output_delayed_csum(struct mbuf *m, struct ifnet * sizeof(struct ip6_hdr) + optlen); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (csum_flags & CSUM_SCTP_IPV6) { sctp_delayed_cksum(m, sizeof(struct ip6_hdr) + optlen); m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; @@ -1041,7 +1041,7 @@ nonh6lookup: CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif @@ -1073,7 +1073,7 @@ nonh6lookup: CSUM_DATA_VALID_IPV6 | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netipsec/ipsec_output.c Thu Jun 18 19:32:34 2020 (r362338) @@ -71,7 +71,7 @@ #ifdef INET6 #include #endif -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #endif @@ -326,7 +326,7 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) { struct ip *ip = mtod(m, struct ip *); @@ -621,7 +621,7 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Thu Jun 18 19:16:03 2020 (r362337) +++ head/sys/netpfil/pf/pf.c Thu Jun 18 19:32:34 2020 (r362338) @@ -40,9 +40,9 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_bpf.h" #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_bpf.h" #include "opt_pf.h" #include "opt_sctp.h" @@ -103,7 +103,7 @@ __FBSDID("$FreeBSD$"); #include #endif /* INET6 */ -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #endif @@ -5474,7 +5474,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, in_delayed_cksum(m0); m0->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) if (m0->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) { sctp_delayed_cksum(m0, (uint32_t)(ip->ip_hl << 2)); m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;