Author: markj
Date: Mon Jul  6 14:00:20 2020
New Revision: 362961
URL: https://svnweb.freebsd.org/changeset/base/362961

Log:
  MFC r362338:
  Add the SCTP_SUPPORT kernel option.

Modified:
  stable/12/share/man/man4/sctp.4
  stable/12/sys/conf/NOTES
  stable/12/sys/conf/options
  stable/12/sys/kern/uipc_socket.c
  stable/12/sys/netinet/in_proto.c
  stable/12/sys/netinet/ip_divert.c
  stable/12/sys/netinet/ip_output.c
  stable/12/sys/netinet/sctp_crc32.c
  stable/12/sys/netinet/sctp_crc32.h
  stable/12/sys/netinet6/in6_proto.c
  stable/12/sys/netinet6/ip6_forward.c
  stable/12/sys/netinet6/ip6_output.c
  stable/12/sys/netipsec/ipsec_output.c
  stable/12/sys/netpfil/pf/pf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/sctp.4
==============================================================================
--- stable/12/share/man/man4/sctp.4     Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/share/man/man4/sctp.4     Mon Jul  6 14:00:20 2020        
(r362961)
@@ -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: stable/12/sys/conf/NOTES
==============================================================================
--- stable/12/sys/conf/NOTES    Mon Jul  6 13:54:44 2020        (r362960)
+++ stable/12/sys/conf/NOTES    Mon Jul  6 14:00:20 2020        (r362961)
@@ -692,7 +692,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
@@ -705,6 +710,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
@@ -727,7 +733,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: stable/12/sys/conf/options
==============================================================================
--- stable/12/sys/conf/options  Mon Jul  6 13:54:44 2020        (r362960)
+++ stable/12/sys/conf/options  Mon Jul  6 14:00:20 2020        (r362961)
@@ -478,6 +478,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: stable/12/sys/kern/uipc_socket.c
==============================================================================
--- stable/12/sys/kern/uipc_socket.c    Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/kern/uipc_socket.c    Mon Jul  6 14:00:20 2020        
(r362961)
@@ -689,7 +689,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: stable/12/sys/netinet/in_proto.c
==============================================================================
--- stable/12/sys/netinet/in_proto.c    Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet/in_proto.c    Mon Jul  6 14:00:20 2020        
(r362961)
@@ -97,7 +97,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");
 
@@ -327,7 +327,7 @@ SYSCTL_NODE(_net_inet, IPPROTO_IP,  ip,     CTLFLAG_RW, 0,  
 SYSCTL_NODE(_net_inet, IPPROTO_ICMP,   icmp,   CTLFLAG_RW, 0,  "ICMP");
 SYSCTL_NODE(_net_inet, IPPROTO_UDP,    udp,    CTLFLAG_RW, 0,  "UDP");
 SYSCTL_NODE(_net_inet, IPPROTO_TCP,    tcp,    CTLFLAG_RW, 0,  "TCP");
-#ifdef SCTP
+#if defined(SCTP) || defined(SCTP_SUPPORT)
 SYSCTL_NODE(_net_inet, IPPROTO_SCTP,   sctp,   CTLFLAG_RW, 0,  "SCTP");
 #endif
 SYSCTL_NODE(_net_inet, IPPROTO_IGMP,   igmp,   CTLFLAG_RW, 0,  "IGMP");

Modified: stable/12/sys/netinet/ip_divert.c
==============================================================================
--- stable/12/sys/netinet/ip_divert.c   Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet/ip_divert.c   Mon Jul  6 14:00:20 2020        
(r362961)
@@ -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
 
@@ -210,7 +210,7 @@ divert_packet(struct mbuf *m, int 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: stable/12/sys/netinet/ip_output.c
==============================================================================
--- stable/12/sys/netinet/ip_output.c   Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet/ip_output.c   Mon Jul  6 14:00:20 2020        
(r362961)
@@ -84,7 +84,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
@@ -143,7 +143,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, st
                        }
                        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
@@ -174,7 +174,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, st
                                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
@@ -603,7 +603,7 @@ sendit:
                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 & ~ifp->if_hwassist) {
                sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
                m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
@@ -786,7 +786,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) {
                sctp_delayed_cksum(m0, hlen);
                m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;

Modified: stable/12/sys/netinet/sctp_crc32.c
==============================================================================
--- stable/12/sys/netinet/sctp_crc32.c  Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet/sctp_crc32.c  Mon Jul  6 14:00:20 2020        
(r362961)
@@ -37,17 +37,16 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_sctp.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/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
@@ -116,7 +115,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.
@@ -127,8 +126,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_len)) {

Modified: stable/12/sys/netinet/sctp_crc32.h
==============================================================================
--- stable/12/sys/netinet/sctp_crc32.h  Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet/sctp_crc32.h  Mon Jul  6 14:00:20 2020        
(r362961)
@@ -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: stable/12/sys/netinet6/in6_proto.c
==============================================================================
--- stable/12/sys/netinet6/in6_proto.c  Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet6/in6_proto.c  Mon Jul  6 14:00:20 2020        
(r362961)
@@ -432,7 +432,7 @@ SYSCTL_NODE(_net_inet6,     IPPROTO_IPV6,   ip6,    
CTLFLAG_RW,
 SYSCTL_NODE(_net_inet6,        IPPROTO_ICMPV6, icmp6,  CTLFLAG_RW, 0,  
"ICMP6");
 SYSCTL_NODE(_net_inet6,        IPPROTO_UDP,    udp6,   CTLFLAG_RW, 0,  "UDP6");
 SYSCTL_NODE(_net_inet6,        IPPROTO_TCP,    tcp6,   CTLFLAG_RW, 0,  "TCP6");
-#ifdef SCTP
+#if defined(SCTP) || defined(SCTP_SUPPORT)
 SYSCTL_NODE(_net_inet6,        IPPROTO_SCTP,   sctp6,  CTLFLAG_RW, 0,  
"SCTP6");
 #endif
 #if defined(IPSEC) || defined(IPSEC_SUPPORT)

Modified: stable/12/sys/netinet6/ip6_forward.c
==============================================================================
--- stable/12/sys/netinet6/ip6_forward.c        Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet6/ip6_forward.c        Mon Jul  6 14:00:20 2020        
(r362961)
@@ -353,7 +353,7 @@ again2:
                            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: stable/12/sys/netinet6/ip6_output.c
==============================================================================
--- stable/12/sys/netinet6/ip6_output.c Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netinet6/ip6_output.c Mon Jul  6 14:00:20 2020        
(r362961)
@@ -111,7 +111,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
@@ -218,7 +218,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
            false) {
@@ -227,7 +227,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;
@@ -868,7 +868,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
@@ -898,7 +898,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: stable/12/sys/netipsec/ipsec_output.c
==============================================================================
--- stable/12/sys/netipsec/ipsec_output.c       Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netipsec/ipsec_output.c       Mon Jul  6 14:00:20 2020        
(r362961)
@@ -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: stable/12/sys/netpfil/pf/pf.c
==============================================================================
--- stable/12/sys/netpfil/pf/pf.c       Mon Jul  6 13:54:44 2020        
(r362960)
+++ stable/12/sys/netpfil/pf/pf.c       Mon Jul  6 14:00:20 2020        
(r362961)
@@ -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"
 
@@ -104,7 +104,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet6/scope6_var.h>
 #endif /* INET6 */
 
-#ifdef SCTP
+#if defined(SCTP) || defined(SCTP_SUPPORT)
 #include <netinet/sctp_crc32.h>
 #endif
 
@@ -5592,7 +5592,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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to