Date: Thu, 18 Jun 2020 19:32:35 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> 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 Message-ID: <202006181932.05IJWZYH009560@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <netinet/sctp_pcb.h> #include <netinet/sctp.h> #include <netinet/sctp_var.h> -#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 <netinet/ip6.h> #include <netinet6/ip6_var.h> #endif -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include <netinet/sctp_crc32.h> #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 <netinet/udp.h> #include <netinet/udp_var.h> -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include <netinet/sctp.h> #include <netinet/sctp_crc32.h> #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 <sys/gsb_crc32.h> -#ifdef SCTP -#include <netinet/sctp_os.h> -#include <netinet/sctp.h> -#include <netinet/sctp_crc32.h> -#include <netinet/sctp_pcb.h> -#else #include <sys/param.h> #include <sys/systm.h> +#include <sys/gsb_crc32.h> #include <sys/mbuf.h> +#include <netinet/sctp.h> #include <netinet/sctp_crc32.h> +#ifdef SCTP +#include <netinet/sctp_os.h> +#include <netinet/sctp_crc32.h> +#include <netinet/sctp_pcb.h> #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 <netinet6/in6_rss.h> #include <netipsec/ipsec_support.h> -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include <netinet/sctp.h> #include <netinet/sctp_crc32.h> #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 <netinet/icmp6.h> #endif -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include <netinet/sctp_crc32.h> #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 <sys/cdefs.h> __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 <netinet6/scope6_var.h> #endif /* INET6 */ -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include <netinet/sctp_crc32.h> #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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006181932.05IJWZYH009560>