From e6db509d106979c71f862f78ecf4319a3ee5e1e8 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 22 Jun 2020 14:01:31 +0000 Subject: [PATCH] Move the definition of SCTP's system_base_info into sctp_crc32.c. This file is the only SCTP source file compiled into the kernel when SCTP_SUPPORT is configured. sctp_delayed_checksum() references a couple of counters defined in system_base_info, so the change allows these counters to be referenced in a kernel compiled without "options SCTP". Submitted by: tuexen MFC with: r362338 --- sys/netinet/sctp_crc32.c | 7 ++++--- sys/netinet/sctp_pcb.c | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/netinet/sctp_crc32.c b/sys/netinet/sctp_crc32.c index bff32549a221..dbc04bf941ec 100644 --- a/sys/netinet/sctp_crc32.c +++ b/sys/netinet/sctp_crc32.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef SCTP +#if defined(SCTP) || defined(SCTP_SUPPORT) #include #include #include @@ -117,6 +117,9 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset) } #if defined(SCTP) || defined(SCTP_SUPPORT) + +VNET_DEFINE(struct sctp_base_info, system_base_info); + /* * 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,10 +130,8 @@ 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)) { diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 10afa8677eee..f20e15e8c84c 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -VNET_DEFINE(struct sctp_base_info, system_base_info); - /* FIX: we don't handle multiple link local scopes */ /* "scopeless" replacement IN6_ARE_ADDR_EQUAL */ #ifdef INET6